Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp270554pxf; Wed, 24 Mar 2021 04:57:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2NHG+x5fgU/GeNZhSs1tZ1LOf3229HpKZuu05RriPhtb6SjxrqPU7OEQsbeIkDhYqz857 X-Received: by 2002:a17:906:9509:: with SMTP id u9mr3250640ejx.225.1616587027666; Wed, 24 Mar 2021 04:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616587027; cv=none; d=google.com; s=arc-20160816; b=aGrRfNAozKb8eaNVNe7Q0544u2RSUEi5U+MSLyyEcExe76zAxYLz7tUOpigXFmFIv/ VozFRGFFzwvLCKjOVvXp60ic6XjkvuwfoyAidrXNRu1st8OlThCIyU+7k5mIJTWUHnqn sOUWYY4ZQyHUFb8srlUuqA3JFcblP0GFdyt8+UgotUsUGjtbx+jp1nY7f4dNnKRA+DpI Hsqk0SoaVDKKm6d5mZaw1105RKU5fRhhsfsrWYOMjNMtEA1psgrV4l6Opqa2mserwBPC wOcHRbRiRG99Nq1LTPFNq4OoMQIT7nZ9yMivIsO6KaIRduTpGqPdINkpqC7AVkZnwte7 PbiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=IVQK635w+Qxcg+l0qArq6fccu1Vzb08FBsw+5qszc6I=; b=Agplm+bwnlTYrE9nBHS7OZ2eAbCv3h4VeycA5bNytB3LrDck1kaZJgdYStcP8PajfJ nV5qhNqWEGI2ZM/1LzdpO5OHl6ZOXvtKxpkqEkAbaN6/W4ZT1Rw+skuhNZGvRGGWqNb4 vbl96b6i0hlTaEF68p2q2ywTj13DdyFMPO3D7fBl1q83WeA/oqt2tnWUn/U0kPAJ9iD+ c6Q5nFkwG0m7Yw8sTMCafo5bpLENdsby3F/5wm9+WPXiO3XXVactFyXUXF0vwqneU/yC XbhfMgrYNczj8VUIDPOjhKft3obBRwqxPJg5ezlW+KlY6RZdNIoAHbjVNJENsO+XDhfq 4/Hw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m2si1457818edr.104.2021.03.24.04.56.44; Wed, 24 Mar 2021 04:57:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234620AbhCXLTH (ORCPT + 99 others); Wed, 24 Mar 2021 07:19:07 -0400 Received: from mx2.suse.de ([195.135.220.15]:60746 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231455AbhCXLSr (ORCPT ); Wed, 24 Mar 2021 07:18:47 -0400 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 95105AE37; Wed, 24 Mar 2021 11:18:45 +0000 (UTC) Date: Wed, 24 Mar 2021 12:18:40 +0100 From: Oscar Salvador To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Greg Kroah-Hartman , Dan Williams , Daniel Vetter , Andy Shevchenko , Mauro Carvalho Chehab , Dave Young , Baoquan He , Vivek Goyal , Dave Hansen , Keith Busch , Michal Hocko , Qian Cai , Eric Biederman , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Tom Lendacky , Brijesh Singh , x86@kernel.org, kexec@lists.infradead.org Subject: Re: [PATCH v1 1/3] kernel/resource: make walk_system_ram_res() find all busy IORESOURCE_SYSTEM_RAM resources Message-ID: <20210324111835.GA18855@linux> References: <20210322160200.19633-1-david@redhat.com> <20210322160200.19633-2-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322160200.19633-2-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 05:01:58PM +0100, David Hildenbrand wrote: > It used to be true that we can have busy system RAM only on the first level > in the resourc tree. However, this is no longer holds for driver-managed > system RAM (i.e., added via dax/kmem and virtio-mem), which gets added on > lower levels. Let me ask some rookie questions: What does "busy" term stand for here? Why resources coming from virtio-mem are added at a lower levels? > > We have two users of walk_system_ram_res(), which currently only > consideres the first level: > a) kernel/kexec_file.c:kexec_walk_resources() -- We properly skip > IORESOURCE_SYSRAM_DRIVER_MANAGED resources via > locate_mem_hole_callback(), so even after this change, we won't be > placing kexec images onto dax/kmem and virtio-mem added memory. No > change. > b) arch/x86/kernel/crash.c:fill_up_crash_elf_data() -- we're currently > not adding relevant ranges to the crash elf info, resulting in them > not getting dumped via kdump. > > This change fixes loading a crashkernel via kexec_file_load() and including > dax/kmem and virtio-mem added System RAM in the crashdump on x86-64. Note > that e.g,, arm64 relies on memblock data and, therefore, always considers > all added System RAM already. > > Let's find all busy IORESOURCE_SYSTEM_RAM resources, making the function > behave like walk_system_ram_range(). > > Cc: Andrew Morton > Cc: Greg Kroah-Hartman > Cc: Dan Williams > Cc: Daniel Vetter > Cc: Andy Shevchenko > Cc: Mauro Carvalho Chehab > Cc: Signed-off-by: David Hildenbrand > Cc: Dave Young > Cc: Baoquan He > Cc: Vivek Goyal > Cc: Dave Hansen > Cc: Keith Busch > Cc: Michal Hocko > Cc: Qian Cai > Cc: Oscar Salvador > Cc: Eric Biederman > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: "H. Peter Anvin" > Cc: Tom Lendacky > Cc: Brijesh Singh > Cc: x86@kernel.org > Cc: kexec@lists.infradead.org > Signed-off-by: David Hildenbrand > --- > kernel/resource.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/resource.c b/kernel/resource.c > index 627e61b0c124..4efd6e912279 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -457,7 +457,7 @@ int walk_system_ram_res(u64 start, u64 end, void *arg, > { > unsigned long flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; > > - return __walk_iomem_res_desc(start, end, flags, IORES_DESC_NONE, true, > + return __walk_iomem_res_desc(start, end, flags, IORES_DESC_NONE, false, > arg, func); > } > > -- > 2.29.2 > > -- Oscar Salvador SUSE L3