From: Laurent Dufour <ldufour@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>, Michal Hocko <mhocko@suse.com>
Cc: akpm@linux-foundation.org, Oscar Salvador <osalvador@suse.de>,
rafael@kernel.org, nathanl@linux.ibm.com, cheloha@linux.ibm.com,
stable@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: don't rely on system state to detect hot-plug operations
Date: Thu, 10 Sep 2020 14:36:13 +0200 [thread overview]
Message-ID: <ac9d3ea9-3735-8d38-e2d3-4eb69d5471b1@linux.ibm.com> (raw)
In-Reply-To: <65b2680d-b02e-16c9-66a4-e38b9d3fa52b@redhat.com>
Le 10/09/2020 à 14:00, David Hildenbrand a écrit :
> On 10.09.20 13:35, Laurent Dufour wrote:
>> Le 10/09/2020 à 13:12, Michal Hocko a écrit :
>>> On Thu 10-09-20 09:51:39, Laurent Dufour wrote:
>>>> Le 10/09/2020 à 09:23, Michal Hocko a écrit :
>>>>> On Wed 09-09-20 18:07:15, Laurent Dufour wrote:
>>>>>> Le 09/09/2020 à 12:59, Michal Hocko a écrit :
>>>>>>> On Wed 09-09-20 11:21:58, Laurent Dufour wrote:
>>>>> [...]
>>>>>>>> For the point a, using the enum allows to know in
>>>>>>>> register_mem_sect_under_node() if the link operation is due to a hotplug
>>>>>>>> operation or done at boot time.
>>>>>>>
>>>>>>> Yes, but let me repeat. We have a mess here and different paths check
>>>>>>> for the very same condition by different ways. We need to unify those.
>>>>>>
>>>>>> What are you suggesting to unify these checks (using a MP_* enum as
>>>>>> suggested by David, something else)?
>>>>>
>>>>> We do have system_state check spread at different places. I would use
>>>>> this one and wrap it behind a helper. Or have I missed any reason why
>>>>> that wouldn't work for this case?
>>>>
>>>> That would not work in that case because memory can be hot-added at the
>>>> SYSTEM_SCHEDULING system state and the regular memory is also registered at
>>>> that system state too. So system state is not enough to discriminate between
>>>> the both.
>>>
>>> If that is really the case all other places need a fix as well.
>>> Btw. could you be more specific about memory hotplug during early boot?
>>> How that happens? I am only aware of https://lkml.kernel.org/r/20200818110046.6664-1-osalvador@suse.de
>>> and that doesn't happen as early as SYSTEM_SCHEDULING.
>>
>> That points has been raised by David, quoting him here:
>>
>>> IIRC, ACPI can hotadd memory while SCHEDULING, this patch would break that.
>>>
>>> Ccing Oscar, I think he mentioned recently that this is the case with ACPI.
>>
>> Oscar told that he need to investigate further on that.
>>
>> On my side I can't get these ACPI "early" hot-plug operations to happen so I
>> can't check that.
>>
>> If this is clear that ACPI memory hotplug doesn't happen at SYSTEM_SCHEDULING,
>> the patch I proposed at first is enough to fix the issue.
>>
>
> Booting a qemu guest with 4 coldplugged DIMMs gives me:
>
> :/root# dmesg | grep link_mem
> [ 0.302247] link_mem_sections() during 1
> [ 0.445086] link_mem_sections() during 1
> [ 0.445766] link_mem_sections() during 1
> [ 0.446749] link_mem_sections() during 1
> [ 0.447746] link_mem_sections() during 1
>
> So AFAICs everything happens during SYSTEM_SCHEDULING - boot memory and
> ACPI (cold)plug.
>
> To make forward progress with this, relying on the system_state is
> obviously not sufficient.
>
> 1. We have to fix this instance and the instance directly in
> get_nid_for_pfn() by passing in the context (I once had a patch to clean
> that up, to not have two state checks, but it got lost somewhere).
>
> 2. The "system_state < SYSTEM_RUNNING" check in
> register_memory_resource() is correct. Actual memory hotplug after boot
> is not impacted. (I remember we discussed this exact behavior back then)
>
> 3. build_all_zonelists() should work as expected, called from
> start_kernel() before sched_init().
I'm bit confused now.
Since hotplug operation is happening at SYSTEM_SCHEDULING like the regular
memory registration, would it be enough to add a parameter to
register_mem_sect_under_node() (reworking the memmap_context enum)?
That way the check is not based on the system state but on the calling path.
next prev parent reply other threads:[~2020-09-10 12:36 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5cbd92e1-c00a-4253-0119-c872bfa0f2bc@redhat.com>
[not found] ` <20200908170835.85440-1-ldufour@linux.ibm.com>
[not found] ` <20200908173113.GB218801@kroah.com>
2020-09-09 6:56 ` [PATCH] mm: don't rely on system state to detect hot-plug operations Laurent Dufour
[not found] ` <cb05da3d-334b-4b72-88c1-f8ed6cfc91b7@redhat.com>
2020-09-09 8:26 ` Laurent Dufour
2020-09-09 8:31 ` David Hildenbrand
2020-09-09 9:35 ` Laurent Dufour
2020-09-09 7:40 ` Michal Hocko
2020-09-09 7:48 ` Laurent Dufour
2020-09-09 9:09 ` Michal Hocko
2020-09-09 9:21 ` Laurent Dufour
2020-09-09 9:24 ` David Hildenbrand
2020-09-09 9:32 ` Laurent Dufour
2020-09-09 12:30 ` Greg Kroah-Hartman
2020-09-09 12:32 ` David Hildenbrand
2020-09-09 12:36 ` Greg Kroah-Hartman
2020-09-09 12:45 ` Michal Hocko
2020-09-09 10:59 ` Michal Hocko
2020-09-09 16:07 ` Laurent Dufour
2020-09-10 7:23 ` Michal Hocko
2020-09-10 7:51 ` Laurent Dufour
2020-09-10 11:12 ` Michal Hocko
2020-09-10 11:35 ` Laurent Dufour
2020-09-10 12:00 ` David Hildenbrand
2020-09-10 12:36 ` Laurent Dufour [this message]
2020-09-10 12:38 ` David Hildenbrand
2020-09-10 12:01 ` Michal Hocko
2020-09-10 12:03 ` Oscar Salvador
2020-09-10 12:32 ` Laurent Dufour
2020-09-10 12:47 ` Michal Hocko
2020-09-10 12:48 ` Michal Hocko
2020-09-10 13:39 ` Oscar Salvador
2020-09-10 13:51 ` Michal Hocko
2020-09-10 14:40 ` Michal Hocko
2020-09-10 12:49 ` David Hildenbrand
2020-09-10 13:54 ` Michal Hocko
2020-09-10 13:57 ` David Hildenbrand
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=ac9d3ea9-3735-8d38-e2d3-4eb69d5471b1@linux.ibm.com \
--to=ldufour@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=cheloha@linux.ibm.com \
--cc=david@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=nathanl@linux.ibm.com \
--cc=osalvador@suse.de \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
/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