public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Christoph Lameter <clameter@sgi.com>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2 of 4] hotplug-memory: adding non-section-aligned memory is bad
Date: Thu, 27 Mar 2008 19:51:26 -0700	[thread overview]
Message-ID: <47EC5D2E.8060001@goop.org> (raw)
In-Reply-To: <20080328113312.65cca8b5.kamezawa.hiroyu@jp.fujitsu.com>

KAMEZAWA Hiroyuki wrote:
> On Thu, 27 Mar 2008 19:13:20 -0700
> Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>   
>>>> Because, firmware may occupy some area in the section.
>>>> Firmware must exclude those area to notify kernel. So, E820, EFI,
>>>> or _CRS of ACPI may return not aligned address and size.
>>>> register_memory_resource() and walk_memory_resource() are to skip
>>>> them silently. This is intended.
>>>>
>>>>     
>>>>         
>>> Ah, ok. sorry.
>>>
>>> Jeremy, I think you can check whether you have 'struct page' or not by
>>> pfn_valid(). 
>>>
>>> If pfn_valid() == false, you should call add_memory() and create
>>> a section/mem_map. If pfn_valid() == true, you should just remove
>>> PG_reserved bit in mem_map by online_page().
>>>       
>> OK.  Would that ever be necessary if I explicitly align my start and size?
>>
>>     
> Maybe no. but be carefull not to register resource in overlapped manner.
>   

Yes.  That's why I added add_memory_resource(), so I could use 
allocate_resource() to find a non-overlapping range to put the new memory.

> (I wrote online_page() in above, but online_pages() is maybe better.
>  It does all what you want.)
>   

No, for my use-case the pages must be onlined one by one as they get 
some physical memory assigned to them.  At the time I do add_memory(), 
I'm just allocating page structures, but there's no memory backing that 
range.

That's why I need to disable the sysfs onlining interface, because it 
bulk onlines the pages before there's anything behind them.

> Start/Size are automatically alined to section in __add_pages().
>
> See below.
> ==
> 110 int __add_pages(struct zone *zone, unsigned long phys_start_pfn,
>  111                  unsigned long nr_pages)
>  112 {
>  113         unsigned long i;
>  114         int err = 0;
>  115         int start_sec, end_sec;
>  116         /* during initialize mem_map, align hot-added range to section */
>  117         start_sec = pfn_to_section_nr(phys_start_pfn);
>  118         end_sec = pfn_to_section_nr(phys_start_pfn + nr_pages - 1);
> ==
>
> And online_pages(), which onlines pages in [pfn, pfn + size), will see
> registerred resources within [pfn, pfn + size).
> ==
> 184 int online_pages(unsigned long pfn, unsigned long nr_pages)
> <snip>
> 227         walk_memory_resource(pfn, nr_pages, &onlined_pages,
> 228                 online_pages_range);
> ==
>
> One of my concern is how-to-handle sysfs status in this case.
>
> Another concerns is, currently, I think no one tried to online a section twice
> to online reserved pages in a section. so, you may see bug.
> For example, mem_notify() in online_pages() will be called several times against
> a section.
>   

I'd really rather prevent online_pages from happening at all, since it 
can only cause havoc.

Thanks,
    J

  reply	other threads:[~2008-03-28  2:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-28  0:28 [PATCH 0 of 4] [RFC] hotplug memory: minor updates Jeremy Fitzhardinge
2008-03-28  0:28 ` [PATCH 1 of 4] hotplug-memory: add add_memory_resource Jeremy Fitzhardinge
2008-03-28  0:28 ` [PATCH 2 of 4] hotplug-memory: adding non-section-aligned memory is bad Jeremy Fitzhardinge
2008-03-28  1:27   ` KAMEZAWA Hiroyuki
2008-03-28  1:34     ` Yasunori Goto
2008-03-28  1:54       ` KAMEZAWA Hiroyuki
2008-03-28  2:13         ` Jeremy Fitzhardinge
2008-03-28  2:33           ` KAMEZAWA Hiroyuki
2008-03-28  2:51             ` Jeremy Fitzhardinge [this message]
2008-03-28  3:17               ` KAMEZAWA Hiroyuki
2008-03-28  4:20                 ` Jeremy Fitzhardinge
2008-03-28  4:39                   ` KAMEZAWA Hiroyuki
2008-03-28 18:19                     ` Jeremy Fitzhardinge
2008-03-28 18:27                       ` Dave Hansen
2008-03-28  3:21               ` Yasunori Goto
2008-03-28  4:07                 ` Jeremy Fitzhardinge
2008-03-28 21:30             ` Jeremy Fitzhardinge
2008-03-28  0:28 ` [PATCH 3 of 4] sparsemem: reduce i386 PAE section size Jeremy Fitzhardinge
2008-03-28  0:35   ` Christoph Lameter
2008-03-28  2:26     ` Jeremy Fitzhardinge
2008-03-28  2:27       ` Christoph Lameter
2008-03-28  6:18         ` Jeremy Fitzhardinge
2008-03-28 16:43           ` Dave Hansen
2008-03-28 18:05             ` Jeremy Fitzhardinge
2008-03-28 16:45   ` Dave Hansen
2008-03-28  0:28 ` [PATCH 4 of 4] paravirt_ops: don't steal memory resources in paravirt_disable_iospace Jeremy Fitzhardinge
2008-03-28  2:41   ` Rusty Russell
2008-03-28  9:12 ` [PATCH 0 of 4] [RFC] hotplug memory: minor updates Ingo Molnar
2008-03-28 16:07   ` Jeremy Fitzhardinge
2008-03-28 22:04     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47EC5D2E.8060001@goop.org \
    --to=jeremy@goop.org \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --cc=y-goto@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox