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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00DEAC43219 for ; Thu, 30 Sep 2021 21:22:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF16F61A60 for ; Thu, 30 Sep 2021 21:21:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AF16F61A60 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4EDE29400CF; Thu, 30 Sep 2021 17:21:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 476F294003A; Thu, 30 Sep 2021 17:21:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3184A9400CF; Thu, 30 Sep 2021 17:21:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 1D60F94003A for ; Thu, 30 Sep 2021 17:21:59 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C34AF18464CFE for ; Thu, 30 Sep 2021 21:21:58 +0000 (UTC) X-FDA: 78645512316.26.6EF80B1 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf12.hostedemail.com (Postfix) with ESMTP id 5F2F410003EE for ; Thu, 30 Sep 2021 21:21:58 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5030061A38; Thu, 30 Sep 2021 21:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633036917; bh=5ZljzaXbR3xYsQvJRNVhxdM1OvKapm+v1Ojej4R63xE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GqbQwG1DyM3InnuIHi9HKra4huPMkQuVPLqsznYbmXGWNX1Sdw8gTbP6jGRu67Wul eoDKkWvnRYBvinlJhcLuN3McvlBEGXoLDVJOCyt14fdqSjivb5EKQxejPVLL8eXafC MY/HA2LZsZgy3JkzEsFlK1JVlqHt1tX09qhJ/n9N7x/mlOc4rZ7oOxwoL19LYdu/Kw 2xkVxOLhAK/gzBynTVb8ZNDYyL0LZ9PqvNK9J20Bh6TKV7Y7STMqJkhXwhhX+SBY4x GpSiJ68+2RhjkQqGWoWssyxzMBDlC17Nfmg7tpWOtxUQH1r6sgJQACVFGLWnj1quYn KaUBJs+ZAnYMA== Date: Thu, 30 Sep 2021 14:21:56 -0700 From: Mike Rapoport To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, Andrew Morton , Michal Hocko , Oscar Salvador , Jianyong Wu , "Aneesh Kumar K . V" , Vineet Gupta , Geert Uytterhoeven , Huacai Chen , Jiaxun Yang , Thomas Bogendoerfer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Eric Biederman , Arnd Bergmann , linux-snps-arc@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, linux-mm@kvack.org, kexec@lists.infradead.org Subject: Re: [PATCH v1 3/4] memblock: add MEMBLOCK_DRIVER_MANAGED to mimic IORESOURCE_SYSRAM_DRIVER_MANAGED Message-ID: References: <20210927150518.8607-1-david@redhat.com> <20210927150518.8607-4-david@redhat.com> <830c1670-378b-0fb6-bd5e-208e545fa126@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <830c1670-378b-0fb6-bd5e-208e545fa126@redhat.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5F2F410003EE X-Stat-Signature: scwr3qqzme1nrdt9mcziz3wrub3rmhup Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GqbQwG1D; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=rppt@kernel.org X-HE-Tag: 1633036918-563207 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 Wed, Sep 29, 2021 at 06:54:01PM +0200, David Hildenbrand wrote: > On 29.09.21 18:39, Mike Rapoport wrote: > > Hi, > > > > On Mon, Sep 27, 2021 at 05:05:17PM +0200, David Hildenbrand wrote: > > > Let's add a flag that corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED. > > > Similar to MEMBLOCK_HOTPLUG, most infrastructure has to treat such memory > > > like ordinary MEMBLOCK_NONE memory -- for example, when selecting memory > > > regions to add to the vmcore for dumping in the crashkernel via > > > for_each_mem_range(). > > Can you please elaborate on the difference in semantics of MEMBLOCK_HOTPLUG > > and MEMBLOCK_DRIVER_MANAGED? > > Unless I'm missing something they both mark memory that can be unplugged > > anytime and so it should not be used in certain cases. Why is there a need > > for a new flag? > > In the cover letter I have "Alternative B: Reuse MEMBLOCK_HOTPLUG. > MEMBLOCK_HOTPLUG serves a different purpose, though.", but looking into the > details it won't work as is. > > MEMBLOCK_HOTPLUG is used to mark memory early during boot that can later get > hotunplugged again and should be placed into ZONE_MOVABLE if the > "movable_node" kernel parameter is set. > > The confusing part is that we talk about "hotpluggable" but really mean > "hotunpluggable": the reason is that HW flags DIMM slots that can later be > hotplugged as "hotpluggable" even though there is already something > hotplugged. MEMBLOCK_HOTPLUG name is indeed somewhat confusing, but still it's core meaning "this memory may be removed" which does not differ from what IORESOURCE_SYSRAM_DRIVER_MANAGED means. MEMBLOCK_HOTPLUG regions are indeed placed into ZONE_MOVABLE, but more importantly, they are avoided when we allocate memory from memblock. So, in my view, both flags mean that the memory may be removed and it should not be used for certain types of allocations. > For example, ranges in the ACPI SRAT that are marked as > ACPI_SRAT_MEM_HOT_PLUGGABLE will be marked MEMBLOCK_HOTPLUG early during > boot (drivers/acpi/numa/srat.c:acpi_numa_memory_affinity_init()). Later, we > use that information to size ZONE_MOVABLE > (mm/page_alloc.c:find_zone_movable_pfns_for_nodes()). This will make sure > that these "hotpluggable" DIMMs can later get hotunplugged. > > Also, see should_skip_region() how this relates to the "movable_node" kernel > parameter: > > /* skip hotpluggable memory regions if needed */ > if (movable_node_is_enabled() && memblock_is_hotpluggable(m) && > (flags & MEMBLOCK_HOTPLUG)) > return true; Hmm, I think that the movable_node_is_enabled() check here is excessive, but I suspect we cannot simply remove it without breaking anything. I'll take a deeper look on the potential consequences. BTW, is there anything that prevents putting kexec to hot-unplugable memory that was cold-plugged on boot? -- Sincerely yours, Mike.