Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754362Ab0ALXBu (ORCPT ); Tue, 12 Jan 2010 18:01:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753940Ab0ALXBt (ORCPT ); Tue, 12 Jan 2010 18:01:49 -0500 Received: from mail-px0-f174.google.com ([209.85.216.174]:61607 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753322Ab0ALXBs (ORCPT ); Tue, 12 Jan 2010 18:01:48 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=B3zRRyFkIoZkknqJzjX/9aE6AufSZhnlIY2+tizoeMDLiubsUqLJ/mGAks/1Nn3Ess tBRvRyyLEDqrAQwanGp3C3j9WynPG5pCcBz9d+JzeUiurk9F6+XGVSemn+5GTUyKSI3p P0dNUzzG/rVXp070KKBKyzllhYzzp+Qryz1oc= MIME-Version: 1.0 In-Reply-To: <20100112133556.GB7647@localhost> References: <20100108124851.GB6153@localhost> <20100111124303.GA21408@localhost> <20100112093031.0fc6877f.kamezawa.hiroyu@jp.fujitsu.com> <20100112023307.GA16661@localhost> <20100112113903.89163c46.kamezawa.hiroyu@jp.fujitsu.com> <20100112133556.GB7647@localhost> Date: Tue, 12 Jan 2010 15:01:47 -0800 X-Google-Sender-Auth: bfe3da7679297b83 Message-ID: <86802c441001121501v57b61815lc4b4c6d86dc5818d@mail.gmail.com> Subject: Re: [PATCH - resend] Memory-Hotplug: Fix the bug on interface /dev/mem for 64-bit kernel(v1) From: Yinghai Lu To: Wu Fengguang , Ingo Molnar , "H. Peter Anvin" , "akpm@linux-foundation.org" Cc: KAMEZAWA Hiroyuki , "Zheng, Shaohui" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "ak@linux.intel.com" , "y-goto@jp.fujitsu.com" , Dave Hansen , "x86@kernel.org" Content-Type: multipart/mixed; boundary=00504502b223753a4a047cffa337 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7810 Lines: 142 --00504502b223753a4a047cffa337 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, Jan 12, 2010 at 5:35 AM, Wu Fengguang wrot= e: > On Tue, Jan 12, 2010 at 10:39:03AM +0800, KAMEZAWA Hiroyuki wrote: >> On Tue, 12 Jan 2010 10:33:08 +0800 >> Wu Fengguang wrote: >> >> > Sure, here it is :) >> > --- >> > x86: use the generic page_is_ram() >> > >> > The generic resource based page_is_ram() works better with memory >> > hotplug/hotremove. So switch the x86 e820map based code to it. >> > >> > CC: Andi Kleen >> > CC: KAMEZAWA Hiroyuki >> > Signed-off-by: Wu Fengguang >> >> Ack. > > Thank you. > >> >> > +#ifdef CONFIG_X86 >> > + =A0 /* >> > + =A0 =A0* A special case is the first 4Kb of memory; >> > + =A0 =A0* This is a BIOS owned area, not kernel ram, but generally >> > + =A0 =A0* not listed as such in the E820 table. >> > + =A0 =A0*/ >> > + =A0 if (pfn =3D=3D 0) >> > + =A0 =A0 =A0 =A0 =A0 return 0; >> > + >> > + =A0 /* >> > + =A0 =A0* Second special case: Some BIOSen report the PC BIOS >> > + =A0 =A0* area (640->1Mb) as ram even though it is not. >> > + =A0 =A0*/ >> > + =A0 if (pfn >=3D (BIOS_BEGIN >> PAGE_SHIFT) && >> > + =A0 =A0 =A0 pfn < =A0(BIOS_END =A0 >> PAGE_SHIFT)) >> > + =A0 =A0 =A0 =A0 =A0 return 0; >> > +#endif >> >> I'm glad if this part is sorted out in clean way ;) > > Two possible solutions are: > > - to exclude the above two ranges directly in e820 map; > - to not add the above two ranges into iomem_resource. > > Yinghai, do you have any suggestions? > We want to get rid of the two explicit tests from page_is_ram(). please check attached patch. YH --00504502b223753a4a047cffa337 Content-Type: text/x-diff; charset=US-ASCII; name="remove_bios_begin_end.patch" Content-Disposition: attachment; filename="remove_bios_begin_end.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g4dac1ov0 W1BBVENIXSB4ODY6IHJlbW92ZSBiaW9zIGRhdGEgcmFuZ2UgZnJvbSBlODIwCgp0byBwcmVwYXJl IG1vdmUgcGFnZV9pc19yYW0gYXMgZ2VuZXJpYyBvbmUKClNpZ25lZC1vZmYtYnk6IFlpbmdoYWkg THUgPHlpbmdoYWlAa2VybmVsLm9yZy4KCi0tLQogYXJjaC94ODYva2VybmVsL2U4MjAuYyAgIHwg ICAgOCArKysrKysrKwogYXJjaC94ODYva2VybmVsL2hlYWQzMi5jIHwgICAgMiAtLQogYXJjaC94 ODYva2VybmVsL2hlYWQ2NC5jIHwgICAgMiAtLQogYXJjaC94ODYva2VybmVsL3NldHVwLmMgIHwg ICAxOSArKysrKysrKysrKysrKysrKystCiBhcmNoL3g4Ni9tbS9pb3JlbWFwLmMgICAgfCAgIDE2 IC0tLS0tLS0tLS0tLS0tLS0KIDUgZmlsZXMgY2hhbmdlZCwgMjYgaW5zZXJ0aW9ucygrKSwgMjEg ZGVsZXRpb25zKC0pCgpJbmRleDogbGludXgtMi42L2FyY2gveDg2L2tlcm5lbC9zZXR1cC5jCj09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT0KLS0tIGxpbnV4LTIuNi5vcmlnL2FyY2gveDg2L2tlcm5lbC9zZXR1cC5jCisrKyBs aW51eC0yLjYvYXJjaC94ODYva2VybmVsL3NldHVwLmMKQEAgLTY1Nyw2ICs2NTcsMjMgQEAgc3Rh dGljIHN0cnVjdCBkbWlfc3lzdGVtX2lkIF9faW5pdGRhdGEgYgogCXt9CiB9OwogCitzdGF0aWMg dm9pZCBfX2luaXQgdHJpbV9iaW9zX3JhbmdlKHZvaWQpCit7CisJLyoKKwkgKiBBIHNwZWNpYWwg Y2FzZSBpcyB0aGUgZmlyc3QgNEtiIG9mIG1lbW9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N0b3ApLCAiVEVYVCBEQVRB IEJTUyIpOwogCiAjaWZkZWYgQ09ORklHX0JMS19ERVZfSU5JVFJECg== --00504502b223753a4a047cffa337-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/