From patchwork Wed Mar 6 10:28:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13583816 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03B4AC54E49 for ; Wed, 6 Mar 2024 10:29:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F88D6B0081; Wed, 6 Mar 2024 05:29:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 85DFB6B0088; Wed, 6 Mar 2024 05:29:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AD1E6B0089; Wed, 6 Mar 2024 05:29:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 54D656B0081 for ; Wed, 6 Mar 2024 05:29:19 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D1AAA120862 for ; Wed, 6 Mar 2024 10:29:18 +0000 (UTC) X-FDA: 81866241996.27.66D9623 Received: from esa9.hc1455-7.c3s2.iphmx.com (esa9.hc1455-7.c3s2.iphmx.com [139.138.36.223]) by imf01.hostedemail.com (Postfix) with ESMTP id 8161B4000F for ; Wed, 6 Mar 2024 10:29:16 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=uNCHmnhd; dmarc=pass (policy=quarantine) header.from=fujitsu.com; spf=pass (imf01.hostedemail.com: domain of lizhijian@fujitsu.com designates 139.138.36.223 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709720956; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bmWUdbMXm6xto0M0EQsTATXArvbNpLtVOFoS8B10h8Y=; b=MfVoHV+fS5CMZDEX6AHlXuLk6FNXtZxlEmf5g6AuKPKPs0KSgpuKWVasSy9Ta4I/RzdLtQ zA+yKskNoVATXUxx5Mf1G8cVk4bdvTYX7Tnqyc22dEy76Aloi7blt+x/Q1xLW4DwxfIgFr Z89bULJ8fiz/p/uUZ+7I+SBLr/koilg= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=fujitsu.com header.s=fj2 header.b=uNCHmnhd; dmarc=pass (policy=quarantine) header.from=fujitsu.com; spf=pass (imf01.hostedemail.com: domain of lizhijian@fujitsu.com designates 139.138.36.223 as permitted sender) smtp.mailfrom=lizhijian@fujitsu.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709720956; a=rsa-sha256; cv=none; b=0FjKYM6l5tfi7PfrYpTZYN2m9ZeVAJp6ygVHet2nTYG7ZIQUBuJl8ai3gNkC8wlVHLCXt1 3iSNitCKamtQHytTG5v69tIDJi0Sd33GOtHjgSqBqFh31IrZg+rij8x8YRKRQYYVcefz5k XwvZIyvLJ5nByKbDwzKpb5RCpQQA0kg= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1709720956; x=1741256956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Nq7SMqNBqa42A9Gw9it0V4iEBEk255GCXGK0EU8r0Nc=; b=uNCHmnhdUAbDeCX6uXUHBxJ9jl5/EvEooVcAJpjiSMdKY4SK82W1D4fy OoGLD9OKYhFeVb5yhERQ/Y9mH3KkE5IBbGfG5CFnYmmGlH+6Ys5MmsaaE +gATHIpXVMmjrdAKO5raxHdtlcg/0JHOe1f2HmE20Hhfdt0YLYGe3te2q Dke5OLWnjtoR2sngbEJsfDdxQItEIvBa4NA2xOXN5REPYpTQVXSwW2sRe WQ/AMSPyDdVWdp1XAc0zXHiY3sE2k2Y5RVEH456WQ/11LhXfLTe/GVOVd 1rMWWRuQwwKFCt5igWT//NBmfb6YMNzU93mq98OjwpXYh8Oc9bjOQhb78 A==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="139869811" X-IronPort-AV: E=Sophos;i="6.06,208,1705330800"; d="scan'208";a="139869811" Received: from unknown (HELO yto-r2.gw.nic.fujitsu.com) ([218.44.52.218]) by esa9.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 19:29:15 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id C723BC6909 for ; Wed, 6 Mar 2024 19:29:12 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 047B2D5EBC for ; Wed, 6 Mar 2024 19:29:12 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 39F0B2008FF9A for ; Wed, 6 Mar 2024 19:29:11 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 4A1AE1A006A; Wed, 6 Mar 2024 18:29:10 +0800 (CST) From: Li Zhijian To: linux-kernel@vger.kernel.org Cc: y-goto@fujitsu.com, Alison Schofield , Andrew Morton , Baoquan He , Borislav Petkov , Dan Williams , Dave Hansen , Dave Jiang , Greg Kroah-Hartman , hpa@zytor.com, Ingo Molnar , Ira Weiny , Thomas Gleixner , Vishal Verma , linux-cxl@vger.kernel.org, linux-mm@kvack.org, nvdimm@lists.linux.dev, x86@kernel.org, kexec@lists.infradead.org, Li Zhijian Subject: [PATCH v3 6/7] x86/crash: make device backed vmemmap dumpable for kexec_file_load Date: Wed, 6 Mar 2024 18:28:45 +0800 Message-Id: <20240306102846.1020868-7-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240306102846.1020868-1-lizhijian@fujitsu.com> References: <20240306102846.1020868-1-lizhijian@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28234.006 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28234.006 X-TMASE-Result: 10--8.255800-10.000000 X-TMASE-MatchedRID: Eprm7pA/VZ5ZxhI5bGrNsjiEPRj9j9rvSdIdCi8Ba4AiqRodPpseIRwE EIVsM/kp/lneBjailE5V00+whwxVQy/7QU2czuUNA9lly13c/gH4uJ1REX4MHbs3Yh2IOCYzJti zbkLGoS92PULLZTziuytFAV6Sdl32oFf+7ciBzQpYKMMlFh4BncnlJe2gk8vIMzT8XBPSpdajxY yRBa/qJXcsDK2xBHh7jaPj0W1qn0Q7AFczfjr/7LEnb/1qBW++QLtrZDNFv46p+VAyfOE7vP5i9 RGEpFvIT2g+olvABKw= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Rspamd-Queue-Id: 8161B4000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: gphc9etofyt9n5wjtw73br16qprb7fhq X-HE-Tag: 1709720956-119671 X-HE-Meta: U2FsdGVkX1/dKznsp56pSnMooxwD7FqCjBPgBbERtztUz5KuCmHYQCx5w5t2UqNrkQs1Lhff+JPKUooyUPL3l9LU2qrdgHwCohV7YTbtGeEZvYxO0aMd/TU2Vv/sco1FWavKpPefN18D3eT9srcCfh4rjrDHBDlJqfpfOycI04gPfAYxi7NuQ9QIk4hSVx47KqPDnoxmKLSYWyzIrfviij25mgpRkkiBimoyL/BS43LgaZN0ZBd9e5lq8JEatMSA5Ixo56TBAUb0Uj2vnqRRE78xzZyoKw4/yWmbltgxzhLr+uHX+i65VQW7m3HIsS99aJt1A8tSmqeFIMjo4N8CJIqFB4acVl0BhBrLW+7KAj3mLtmEAa6GoHTyiTYu965IAHU+QMMPe8Y+9npLf3OaSxoCS1/GSI5NE8rNdmZy+W9lQeJys3CwFumjt+dNcvzetDK2L8ANy/POHVge/S+7zT4bSD5wmZJIGNkw3uXjOR8FGKXDqkOm61fItejDOIcAwVvEPrJzLFVpq4U2ElHtmT94ssXWnO8RNH0qoZH4sjcDFOLMx74pfS9aWYxVPDMcrUsYqcTQA4+2d6yONeGuBGrPugoalLX/EUTDDiutaHJuQUmV/qgPmWiGkOnkzAUO7kZAquRQmcxWG39GEt3pwD9/d2DJTAeeijrs8rIYUILRZwfHDf6xD8G8qWjJg/rR8PEuvfAnklTfEgxLSSAmzmf0Mot1mtae8WAtUvv8OKzzKiip+LT7k4UULKFepjd/Ke+WsUy7oAmH+eAW/7h8tAYdsabQBE+Jnitdgpa7YUt158sPkisXux4ZFofDXpw7a+NTYm2eYEqyBsTC8VWSCICoWspAc1rm5OjuWicGN6qrijW8dxra9Rx3DKdM3TMtgHZXIAjOBKy5WDEtFD93ctXU+lJ1RqeXuUlNWQF+az7JzouS32LELeMsu7Uf9g1zUxscl8PWOQmKpGtImg7 48CPHb4m svIW+H4E7txgtDUvPzFJa5G5yr/6MfqY0HFRO 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: List-Subscribe: List-Unsubscribe: Add resources with specific flags to PT_LOADs of the elfcorehdr so that these resources can be dumpable. This change is for kexec_file_load(2) while kexec_load(2) setups the PT_LOADs according to its parameters by the callers which usually rely on resources' name from /proc/iomem CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: Dave Hansen CC: Baoquan He CC: Andrew Morton CC: "H. Peter Anvin" CC: x86@kernel.org Signed-off-by: Li Zhijian --- arch/x86/kernel/crash.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index b6b044356f1b..b8426fedd2cd 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -146,6 +146,8 @@ static struct crash_mem *fill_up_crash_elf_data(void) if (!nr_ranges) return NULL; + walk_device_backed_vmemmap_res(0, -1, &nr_ranges, + get_nr_ram_ranges_callback); /* * Exclusion of crash region and/or crashk_low_res may cause * another range split. So add extra two slots here. @@ -212,6 +214,9 @@ static int prepare_elf_headers(void **addr, unsigned long *sz, if (ret) goto out; + walk_device_backed_vmemmap_res(0, -1, cmem, + prepare_elf64_ram_headers_callback); + /* Exclude unwanted mem ranges */ ret = elf_header_exclude_ranges(cmem); if (ret)