All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xishi Qiu <qiuxishi@huawei.com>
To: Andrea Reale <ar@linux.vnet.ibm.com>
Cc: Maciej Bielski <m.bielski@virtualopensystems.com>,
	<scott.branden@broadcom.com>, <will.deacon@arm.com>,
	<tech@virtualopensystems.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] Memory hotplug support for arm64 platform
Date: Fri, 16 Dec 2016 09:31:47 +0800	[thread overview]
Message-ID: <58534403.1040800@huawei.com> (raw)
In-Reply-To: <20161215183154.GC4806@samekh>

On 2016/12/16 2:31, Andrea Reale wrote:

> Hi Xishi Qiu,
> 
> thanks for your comments. 
> 
> The short anwser to your question is the following.  As you hinted,
> it is related to the way pfn_valid() is implemented in arm64 when
> CONFIG_HAVE_ARCH_PFN_VALID is true (default), i.e., just a check for
> the NOMAP flags on the corresponding memblocks.
> 
> Since arch_add_memory->__add_pages() expects pfn_valid() to return false
> when it is first called, we mark corresponding memory blocks with NOMAP;
> however, arch_add_memory->__add_pages()->__add_section()->__add_zone()
> expects pfn_valid() to return true when, at the end of its body,
> it cycles through pages to call SetPageReserved(). Since blocks are
> marked with NOMAP, pages will not be reserved there, henceforth we
> need to reserve them after we clear the NOMAP flag inside the body of
> arch_add_memory. Having pages reserved at the end of arch_add_memory
> is a preconditions for the upcoming onlining of memory blocks (see
> memory_block_change_state()).
> 
>> It's because that in memmap_init_zone() -> early_pfn_valid(), the new page is still
>> invalid, so we need to init it after memblock_clear_nomap()
>>
>> So why not use __init_single_page() and set_pageblock_migratetype()?
> 
> About your comment on memmap_init_zone()->early_pfn_valid(), I think
> that that particular check is never executed in the context of memory
> hotplug; in fact, just before the call to early_pfn_valid(), the code
> will jump to the `not_early` label, because the context == MEMMAP_HOPTLUG.
> 

Hi Andrea,

Thanks for your answer, I notice it now. I thought SetPageReserved() was
done in memmap_init_zone(), but the new kernel change this logic now, so
sorry for the noise.

Thanks,
Xishi Qiu

WARNING: multiple messages have this Message-ID (diff)
From: qiuxishi@huawei.com (Xishi Qiu)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] Memory hotplug support for arm64 platform
Date: Fri, 16 Dec 2016 09:31:47 +0800	[thread overview]
Message-ID: <58534403.1040800@huawei.com> (raw)
In-Reply-To: <20161215183154.GC4806@samekh>

On 2016/12/16 2:31, Andrea Reale wrote:

> Hi Xishi Qiu,
> 
> thanks for your comments. 
> 
> The short anwser to your question is the following.  As you hinted,
> it is related to the way pfn_valid() is implemented in arm64 when
> CONFIG_HAVE_ARCH_PFN_VALID is true (default), i.e., just a check for
> the NOMAP flags on the corresponding memblocks.
> 
> Since arch_add_memory->__add_pages() expects pfn_valid() to return false
> when it is first called, we mark corresponding memory blocks with NOMAP;
> however, arch_add_memory->__add_pages()->__add_section()->__add_zone()
> expects pfn_valid() to return true when, at the end of its body,
> it cycles through pages to call SetPageReserved(). Since blocks are
> marked with NOMAP, pages will not be reserved there, henceforth we
> need to reserve them after we clear the NOMAP flag inside the body of
> arch_add_memory. Having pages reserved at the end of arch_add_memory
> is a preconditions for the upcoming onlining of memory blocks (see
> memory_block_change_state()).
> 
>> It's because that in memmap_init_zone() -> early_pfn_valid(), the new page is still
>> invalid, so we need to init it after memblock_clear_nomap()
>>
>> So why not use __init_single_page() and set_pageblock_migratetype()?
> 
> About your comment on memmap_init_zone()->early_pfn_valid(), I think
> that that particular check is never executed in the context of memory
> hotplug; in fact, just before the call to early_pfn_valid(), the code
> will jump to the `not_early` label, because the context == MEMMAP_HOPTLUG.
> 

Hi Andrea,

Thanks for your answer, I notice it now. I thought SetPageReserved() was
done in memmap_init_zone(), but the new kernel change this logic now, so
sorry for the noise.

Thanks,
Xishi Qiu

  reply	other threads:[~2016-12-16  1:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 12:16 [RFC PATCH] Memory hotplug support for arm64 platform Maciej Bielski
2016-12-14 12:16 ` Maciej Bielski
2016-12-15  6:18 ` Xishi Qiu
2016-12-15  6:18   ` Xishi Qiu
2016-12-15  6:40   ` Xishi Qiu
2016-12-15  6:40     ` Xishi Qiu
2016-12-15 18:31     ` Andrea Reale
2016-12-15 18:31       ` Andrea Reale
2016-12-16  1:31       ` Xishi Qiu [this message]
2016-12-16  1:31         ` Xishi Qiu
2016-12-20 19:12 ` Scott Branden
2016-12-20 19:12   ` Scott Branden
2016-12-21  9:44   ` Maciej Bielski
2016-12-21  9:44     ` Maciej Bielski
2016-12-22  1:20     ` Scott Branden
2016-12-22  1:20       ` Scott Branden
2017-02-06 11:17       ` Andrea Reale
2017-02-06 11:17         ` Andrea Reale
2017-02-08 20:08         ` Scott Branden
2017-02-08 20:08           ` Scott Branden
2017-03-30  0:40         ` Florian Fainelli
2017-03-30  0:40           ` Florian Fainelli
2017-03-31 14:16           ` Andrea Reale
2017-03-31 14:16             ` Andrea Reale

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=58534403.1040800@huawei.com \
    --to=qiuxishi@huawei.com \
    --cc=ar@linux.vnet.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.bielski@virtualopensystems.com \
    --cc=scott.branden@broadcom.com \
    --cc=tech@virtualopensystems.com \
    --cc=will.deacon@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.