From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83248C43461 for ; Thu, 10 Sep 2020 12:01:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1EA97207EA for ; Thu, 10 Sep 2020 12:01:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1EA97207EA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8ED07900002; Thu, 10 Sep 2020 08:01:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89D6C6B007D; Thu, 10 Sep 2020 08:01:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DA89900002; Thu, 10 Sep 2020 08:01:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 68E936B007B for ; Thu, 10 Sep 2020 08:01:28 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2BBCB181AEF1E for ; Thu, 10 Sep 2020 12:01:28 +0000 (UTC) X-FDA: 77247011856.08.floor15_4610a49270e5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 62FCF1819E624 for ; Thu, 10 Sep 2020 12:01:26 +0000 (UTC) X-HE-Tag: floor15_4610a49270e5 X-Filterd-Recvd-Size: 4253 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Sep 2020 12:01:25 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 31B87AD36; Thu, 10 Sep 2020 12:01:40 +0000 (UTC) Date: Thu, 10 Sep 2020 14:01:23 +0200 From: Michal Hocko To: Laurent Dufour Cc: akpm@linux-foundation.org, David Hildenbrand , Oscar Salvador , rafael@kernel.org, nathanl@linux.ibm.com, cheloha@linux.ibm.com, stable@vger.kernel.org, Greg Kroah-Hartman , linux-mm@kvack.org, LKML Subject: Re: [PATCH] mm: don't rely on system state to detect hot-plug operations Message-ID: <20200910120123.GF28354@dhcp22.suse.cz> References: <20200909074011.GD7348@dhcp22.suse.cz> <9faac1ce-c02d-7dbc-f79a-4aaaa5a73d28@linux.ibm.com> <20200909090953.GE7348@dhcp22.suse.cz> <4cdb54be-1a92-4ba4-6fee-3b415f3468a9@linux.ibm.com> <20200909105914.GF7348@dhcp22.suse.cz> <74a62b00-235e-7deb-2814-f3b240fea25e@linux.ibm.com> <20200910072331.GB28354@dhcp22.suse.cz> <31cfdf35-618f-6f56-ef16-0d999682ad02@linux.ibm.com> <20200910111246.GE28354@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 62FCF1819E624 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 10-09-20 13:35:32, Laurent Dufour wrote: > Le 10/09/2020 =E0 13:12, Michal Hocko a =E9crit=A0: > > On Thu 10-09-20 09:51:39, Laurent Dufour wrote: > > > Le 10/09/2020 =E0 09:23, Michal Hocko a =E9crit=A0: > > > > On Wed 09-09-20 18:07:15, Laurent Dufour wrote: > > > > > Le 09/09/2020 =E0 12:59, Michal Hocko a =E9crit=A0: > > > > > > 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. > > > > > >=20 > > > > > > Yes, but let me repeat. We have a mess here and different pat= hs check > > > > > > for the very same condition by different ways. We need to uni= fy those. > > > > >=20 > > > > > What are you suggesting to unify these checks (using a MP_* enu= m as > > > > > suggested by David, something else)? > > > >=20 > > > > 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? > > >=20 > > > 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 regis= tered at > > > that system state too. So system state is not enough to discriminat= e between > > > the both. > >=20 > > 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 boo= t? > > How that happens? I am only aware of https://lkml.kernel.org/r/202008= 18110046.6664-1-osalvador@suse.de > > and that doesn't happen as early as SYSTEM_SCHEDULING. >=20 > That points has been raised by David, quoting him here: >=20 > > IIRC, ACPI can hotadd memory while SCHEDULING, this patch would break= that. > >=20 > > Ccing Oscar, I think he mentioned recently that this is the case with= ACPI. : Please, note that upstream has fixed that differently (and unintentiona= lly) by : adding another boot state (SYSTEM_SCHEDULING), which is set before smp_= init(). : That should happen before memory hotplug events even with memhp_default= _state=3Donline. : Backporting that would be too intrusive. Either I am confused or the above says that no hotplug should happen during SYSTEM_SCHEDULING even in the above case. I really have hard time to imagine how an early boot hotplug should even work. We start with a memory layout provided by a BIOS/FW and intiailize it statically. How would a hotplug even actually trigger that early? --=20 Michal Hocko SUSE Labs