Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3562167pxf; Mon, 22 Mar 2021 09:15:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVxDT1cPOYrX0gwdXkVFd6XdcxKCvxw4bgJxMHqVtwobgCWUp/5yDY2LOxqg3ILvitaBnL X-Received: by 2002:a17:906:d787:: with SMTP id pj7mr518796ejb.257.1616429716042; Mon, 22 Mar 2021 09:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616429716; cv=none; d=google.com; s=arc-20160816; b=UyBFN25wHFuS0LcjBzClgXE8bJ25VEGpcAzUuTNotbexpauVfhVvs+KwgmAjPrn5+O yVA2x4HSUmVPHFfWD5lYpVFLo9kHdcf3kGj0jSHY0+ftPsUtH7d2ibOPRsUlQUnRFCAh ke9MFhNgKw6A9G/9wjlBuMDn9gTZIKNKFYrzMVEK59Ya+2bUN+w4fqJ4CQcU+sLff2JM OR+uQXUnGb3uQSUk+QYU381ft8KVmvYFY3maEG0NT60g9hk+rO7FTHs90uymrus6KjQc 6SKTqmESxWoj2PRFkXTOTUwysVENY06KlsbZnTCu+Kj6lcpfqsXOEE9oU0TDd3tNZm1U ElTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0RjSQM4DgkK7m/ekOUT02sK+WqopVxraVt2b40+KaBU=; b=AicdlX6OTqwdmqmkpNiWZgNZ+W1qmykX0bevqYOZXgGdxeishuwJOdu3icRkfEf63L C5OhBQ2IjEeaH3UCjEcGNw/6sf4pDXZSZquJ5zZEbZbCqH9L3cxO5s/lBu+sNeezxWyE 8mRPPoP7Z8HleUQrzvcQk5Ct3OWv5lYW6WCBnS5q7vwV0FPL0E7wp0BjCxKwmRhztuZD 3z6EOGBrBA85E831uQ6PvTdaPNYPhY3yZdm+pLDvyER8aTIYaLq/bwxlQDV4nRhJnc4V Otd6ki5vap7HG2ZJcpg0r5Sth9tn1BrfH20qZLAvvY/zmQq0lNsUO6FUagd8RdSyyS5b uf4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=xlR34CXl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fx8si11744681ejb.481.2021.03.22.09.14.52; Mon, 22 Mar 2021 09:15:16 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=xlR34CXl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbhCVQLf (ORCPT + 99 others); Mon, 22 Mar 2021 12:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbhCVQLA (ORCPT ); Mon, 22 Mar 2021 12:11:00 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C4EC061574 for ; Mon, 22 Mar 2021 09:10:58 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id r12so22215315ejr.5 for ; Mon, 22 Mar 2021 09:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0RjSQM4DgkK7m/ekOUT02sK+WqopVxraVt2b40+KaBU=; b=xlR34CXli2xQbahXQ3WiajunYFVNHrhO61oNhpR4/BYX6TPJtgYJmbdPpdF/A31M4B 66ycQ1WNrd8yikq99kH9YnVaeub+aRLakcZm8YWnKtJEeLTzvKIu1Q6UP9LpOuwd6Kbf 8raqj1HQG/Fba/NR16M++LWd4Am3B75WUTIrp9MCif8o7dY04WWvBWkxG19AHnJnnuND NkxL6drrSy20vU5G1f5clhkItXup1oA4BMEKFzO5oSK3LHoAIRBcBBW3DvFW70AoTOv9 i6dx6E1lKit1YwP+2xfk8Q4ThhFXZFhd6KWgJK+7q9iefjxr0QR9WupVABR7Hy0gFNxN CUOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0RjSQM4DgkK7m/ekOUT02sK+WqopVxraVt2b40+KaBU=; b=EiAUljcoQGxa19GCbrEnewcQlZjxCoju08g2xZp26EwIRvKcUmpmB8VrRDdMTOQ9UQ pS72QPum1cNWqQKoIX4my+SjO+HRI6tvQ76VWOC1kgru3tVDfMF+4vZvO/QkxBpp/Dqa vXi+jqU6FstRTcNDP4YZB4hjLBzCwth0rLfBt2L5VzHiHe+NGweJW4QHmr7M0qr7D8s7 yd1zjru7+2i+umEeJKnlLHR737qo9O+9efXO2PHFQ3DX27b8O/YISuEnPimWgzhErUyk t0+WLKWYEr0A/MSXmRpk9+8ny8kejP5YYmZ6/IlI7h+ViZG/mYy2TFfYMyaDyPXJPsuw USMA== X-Gm-Message-State: AOAM533RytNTolMIDKOc6oAExJHTGwUz43gQ/9p1LdIgVjCyDPWX+wYD 1NdceF1sYCKkOde+GYl9aSTHv13i3uGOgxNGx8Y+NA== X-Received: by 2002:a17:906:2ac1:: with SMTP id m1mr539193eje.472.1616429457645; Mon, 22 Mar 2021 09:10:57 -0700 (PDT) MIME-Version: 1.0 References: <20210322160200.19633-1-david@redhat.com> <20210322160200.19633-2-david@redhat.com> In-Reply-To: <20210322160200.19633-2-david@redhat.com> From: Dan Williams Date: Mon, 22 Mar 2021 09:10:48 -0700 Message-ID: Subject: Re: [PATCH v1 1/3] kernel/resource: make walk_system_ram_res() find all busy IORESOURCE_SYSTEM_RAM resources To: David Hildenbrand Cc: Linux Kernel Mailing List , Linux MM , Andrew Morton , Greg Kroah-Hartman , Daniel Vetter , Andy Shevchenko , 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 ML , Kexec Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 9:02 AM 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 > 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); Looks good, Reviewed-by: Dan Williams