Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3553139pxf; Mon, 22 Mar 2021 09:04:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw12vc4cJVsSSAg/9sOR+OobZ19oH5XUZeFO9Oe5sP0jyW8Zgb0/tNeU92nvUFsdMaDryXd X-Received: by 2002:a17:906:489b:: with SMTP id v27mr491533ejq.1.1616429077256; Mon, 22 Mar 2021 09:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616429077; cv=none; d=google.com; s=arc-20160816; b=fkLPnGja+cLEB6vO0mtS0oteoFlm2RsRhGOOo8BaFu5CvaCSD8kXM9YO1yCBySgmqw +q6MBJtsHFPqXO/g7RTt+X/USgvCAoiY8PWeKvVvhVgk3YFGSGY+ETLT/VXXnsphkDWA PKxiEuQnDqQBLznikgXDGS8wmtJ7fg/VaZ8CEm2Qe6tyBgldFWSYgQSfrZ9QvBM4Ddob zYN8hkc/JyN39rCtNSvvVFQwyE0AI4As11IVfvZSwkSreq5/B19s8p/1JBrOcw04lGRx DQFl8SMtw1aCIVJu4m219UKsapu9kvfWU67eRKp24r5hQQmIzjYGFntk9ejIPBMI9prd jfHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3TuVemh/cjU85M5ax1Qb4mUdW++TvKop8mZhQ52bvsY=; b=ZL9t7zNtxN9MswZV9aOwX1Oy5sWaxVvz6naUNNXVvsX5iwmgwhh9llElp7WPjZQWJc UOhReAHi1h9jvZ5RzjspQxfs/Ql7upVf2mHrV8Y08kEL9VmJzeNlKioJrvkf7ht8Tikk rTe9pYxsxqkw6eNtMfUrZQaO3uSFPvIvqYMRhwkKkSDS1YHYJi+VZJ0IPI/xXw7AsVKV 7p+aX3UTO6i5RMRXzaZMIdkhHLzJwEnT1oknW+jQD9cRvK7GM/Zzmoa8py/CrRZ0Js/8 aNW6Yi4u/CN8eslYw814KrJZIQEA4JMINnQ9ZWwONGH99FbIwxqTEeBcRU77jGlq3tDW FnZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UZvosLdr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si11193893ejv.399.2021.03.22.09.04.13; Mon, 22 Mar 2021 09:04:37 -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=@redhat.com header.s=mimecast20190719 header.b=UZvosLdr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231403AbhCVQC5 (ORCPT + 99 others); Mon, 22 Mar 2021 12:02:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46663 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbhCVQC1 (ORCPT ); Mon, 22 Mar 2021 12:02:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616428946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3TuVemh/cjU85M5ax1Qb4mUdW++TvKop8mZhQ52bvsY=; b=UZvosLdrJOoVKpumUt2tMylO6WjXbZnjqrGD9TD9m6DY7lV3zLAH/cDzJlQ8DlEMSBml5f b1vnM7U8D0Hdy5tCQyP/6MQrddDilAcTP5dCmSc4Rm7tSHQp5QvctrbgLJ+6dT4iIjcWn/ iCZB5VJYTxgNSma63vyk68zsV1H8VRo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-90hf-u34MTWNAw8OoPT0Lw-1; Mon, 22 Mar 2021 12:02:24 -0400 X-MC-Unique: 90hf-u34MTWNAw8OoPT0Lw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2595218C89CC; Mon, 22 Mar 2021 16:02:22 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-54.ams2.redhat.com [10.36.115.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCE505B4A1; Mon, 22 Mar 2021 16:02:16 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , 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 , 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: [PATCH v1 1/3] kernel/resource: make walk_system_ram_res() find all busy IORESOURCE_SYSTEM_RAM resources Date: Mon, 22 Mar 2021 17:01:58 +0100 Message-Id: <20210322160200.19633-2-david@redhat.com> In-Reply-To: <20210322160200.19633-1-david@redhat.com> References: <20210322160200.19633-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.29.2