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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED autolearn=unavailable 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 01386C433C1 for ; Tue, 23 Mar 2021 11:07:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDE45619BB for ; Tue, 23 Mar 2021 11:07:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230376AbhCWLHQ (ORCPT ); Tue, 23 Mar 2021 07:07:16 -0400 Received: from mga14.intel.com ([192.55.52.115]:31764 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbhCWLHE (ORCPT ); Tue, 23 Mar 2021 07:07:04 -0400 IronPort-SDR: buNFVQCzrq7BlKMhvhjw4ka9jlaG7YNpvnKe+Q0maOPr0o2dGnIzwh5n77akr9TDqd6EbIcG99 6+kYjLms1RyA== X-IronPort-AV: E=McAfee;i="6000,8403,9931"; a="189854540" X-IronPort-AV: E=Sophos;i="5.81,271,1610438400"; d="scan'208";a="189854540" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 04:06:58 -0700 IronPort-SDR: 304IViLktmB5zaz+KAlxvL9xxLnyisMiMXHxnNWIiNXPid/uKsBA+gPKmU0XGStD/ykneHpXXO 7/DpAWjhEH/A== X-IronPort-AV: E=Sophos;i="5.81,271,1610438400"; d="scan'208";a="414939300" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 04:06:52 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lOes4-00EziS-Of; Tue, 23 Mar 2021 13:06:48 +0200 Date: Tue, 23 Mar 2021 13:06:48 +0200 From: Andy Shevchenko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Greg Kroah-Hartman , Dan Williams , Daniel Vetter , Mauro Carvalho Chehab , Dave Young , Baoquan He , Vivek Goyal , Dave Hansen , Keith Busch , Michal Hocko , Qian Cai , Oscar Salvador , 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: 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> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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. > > 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 "...fixes..." effectively means to me that Fixes tag should be provided. > 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 > -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mga17.intel.com ([192.55.52.151]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOesM-00Egba-05 for kexec@lists.infradead.org; Tue, 23 Mar 2021 11:07:08 +0000 Date: Tue, 23 Mar 2021 13:06:48 +0200 From: Andy Shevchenko Subject: Re: [PATCH v1 1/3] kernel/resource: make walk_system_ram_res() find all busy IORESOURCE_SYSTEM_RAM resources Message-ID: References: <20210322160200.19633-1-david@redhat.com> <20210322160200.19633-2-david@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210322160200.19633-2-david@redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Greg Kroah-Hartman , Dan Williams , Daniel Vetter , Mauro Carvalho Chehab , Dave Young , Baoquan He , Vivek Goyal , Dave Hansen , Keith Busch , Michal Hocko , Qian Cai , Oscar Salvador , Eric Biederman , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Tom Lendacky , Brijesh Singh , x86@kernel.org, kexec@lists.infradead.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. > > 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 "...fixes..." effectively means to me that Fixes tag should be provided. > 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 > -- With Best Regards, Andy Shevchenko _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec