From: "Erik Bosman" Subject: Re: [Patch] Allow bitmasks with the badpage bootoption Date: Wed, 5 Apr 2006 13:10:36 +0200 Message-ID: References: <49a267fe3eb03564486d6e7dbb21de83@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_5665_14248722.1144235436628" Return-path: In-Reply-To: <49a267fe3eb03564486d6e7dbb21de83@cl.cam.ac.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org ------=_Part_5665_14248722.1144235436628 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/5/06, Keir Fraser wrote: > > The masking scheme is unnecessarily restrictive. Why not just allow > specification of inclusive ranges of pages? For example: > badpage=3D0xa2000-0xa2fff,0x100-0x1ff,0x123-0x456 > > -- Keir > This was how I first implemented it for my machine, since it only requires two ranges: badpage=3D0x2a000-0x2afff,0x3a000-0x3afff But I thought a mask would be better since it resembles the way memory usually breaks (not that I have much experience with this.) On the other hand, ranges are much easier to understand. I've attached my original patch. Erik Bosman ------=_Part_5665_14248722.1144235436628 Content-Type: text/x-patch; name=badpage-range.patch; charset=us-ascii Content-Transfer-Encoding: 7bit X-Attachment-Id: f_elnjx2wo Content-Disposition: attachment; filename="badpage-range.patch" diff -ru xen-3.0.1-orig/xen/common/page_alloc.c xen-3.0.1-range/xen/common/page_alloc.c --- xen-3.0.1-orig/xen/common/page_alloc.c 2006-03-14 12:17:06.000000000 +0100 +++ xen-3.0.1-range/xen/common/page_alloc.c 2006-04-03 00:29:35.000000000 +0200 @@ -155,7 +155,7 @@ void init_boot_pages(physaddr_t ps, physaddr_t pe) { - unsigned long bad_pfn; + unsigned long bad_psfn, bad_pefn, i; char *p; ps = round_pgup(ps); @@ -169,18 +169,31 @@ p = opt_badpage; while ( *p != '\0' ) { - bad_pfn = simple_strtoul(p, &p, 0); + bad_psfn = simple_strtoul(p, &p, 0); + bad_pefn = bad_psfn; + + if ( *p == '-' ) + { + p++; + bad_pefn = simple_strtoul(p, &p, 0); + if ( bad_pefn < bad_psfn ) + bad_pefn = bad_psfn; + } if ( *p == ',' ) p++; else if ( *p != '\0' ) break; - if ( (bad_pfn < max_page) && !allocated_in_map(bad_pfn) ) - { - printk("Marking page %lx as bad\n", bad_pfn); - map_alloc(bad_pfn, 1); - } + if (bad_pefn == bad_psfn) + printk("Marking page %lx as bad\n", bad_psfn); + else + printk("Marking pages %lx through %lx as bad\n", + bad_psfn, bad_pefn); + + for ( i = bad_psfn; i <= bad_pefn; i++ ) + if ( (i < max_page) && !allocated_in_map(i) ) + map_alloc(i, 1); } } ------=_Part_5665_14248722.1144235436628 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ------=_Part_5665_14248722.1144235436628--