Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp976746lqs; Wed, 6 Mar 2024 02:32:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW4jNjNKDwsLdE+raVfAEAL4oC9nRgX79XfyoEdE6Z7JFXfX3H/1nWy4W1q0TS+SzQIdjMEFr0pGXExniT7INHzzw3FimaqJsl2DBaCPQ== X-Google-Smtp-Source: AGHT+IEESo7maWBan0EnD0UeroFJbtEqn2+avKBqfBm0Yvb3OS6q5VDKspiQUISTNccso9KSbt0F X-Received: by 2002:a05:6a21:8cca:b0:1a0:ce31:128b with SMTP id ta10-20020a056a218cca00b001a0ce31128bmr6179005pzb.34.1709721140139; Wed, 06 Mar 2024 02:32:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709721140; cv=pass; d=google.com; s=arc-20160816; b=Sc12OAi8q5WjMMW7FmSPG8ykuTvdbUi844eR2xsHgz4SENOx4ogbpz+gshgv3GICmS HuKux0v4RG2c8kPp97Oj7EpG8vYniHWXCvqXxEh7NaiKZmBxPR568A4k85Sdj8/anpH9 +25GJ1p458tx2u5cz8t877ehB/bMt2ijvI9LnlBBL9BhN3UYdHmTifPJvsjz6+lFScKJ //YyBN5rul9zix92SFEA102ZuhwbgEtdSlpg673BDCybi0WU58WuyMwZlbUwIk1eyGYN TOm1QrckxCV32T+Ew6TvAveYGEcao0zdrH7zOgIitFD3yTjAmi6X4NN3F193mhDxjgza qP2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bmWUdbMXm6xto0M0EQsTATXArvbNpLtVOFoS8B10h8Y=; fh=Esoboxpj5S375eVgzl7RcLquV3oq0qjVFAxEnZXMv8o=; b=YieWGcGF81Yng4T/KNtSYD0mIyH1pFmutnAzdJVKmQDfhFwh7YT8yl3Prn4fDXrXkI ZF7BGtbikE6xG8fQ27hHFJvD8BbSZetHWRUS8dO32t8VADelVmg8mUdcX4tMpabGoLln G2v7KYYCZ1NAqRWWjw/cUDHOetv+oaMWFY4b1QAzhfpJ9AdwTdKRxQPicZapGO3BnWED GWWmSvEAFV41/EVUGw/DTU1nTH6rugZkJYh5DlHyFxXW2X4lQx6DazCgGoh/5JaKmgkz BU8WoR7hHH65qjBuOYDFQAq/SpIWiNIOEnUX9u4xI7zXJP28tdXNvX+0yoyN7LnMV90i ddjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@fujitsu.com header.s=fj2 header.b="X++/zVCQ"; arc=pass (i=1 spf=pass spfdomain=fujitsu.com dkim=pass dkdomain=fujitsu.com dmarc=pass fromdomain=fujitsu.com); spf=pass (google.com: domain of linux-kernel+bounces-93765-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g23-20020a635217000000b005ce021f4418si11693819pgb.524.2024.03.06.02.32.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:32:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93765-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@fujitsu.com header.s=fj2 header.b="X++/zVCQ"; arc=pass (i=1 spf=pass spfdomain=fujitsu.com dkim=pass dkdomain=fujitsu.com dmarc=pass fromdomain=fujitsu.com); spf=pass (google.com: domain of linux-kernel+bounces-93765-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=fujitsu.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BDD9C286DA5 for ; Wed, 6 Mar 2024 10:31:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADEDF60B9C; Wed, 6 Mar 2024 10:30:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b="X++/zVCQ" Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0BE06089F; Wed, 6 Mar 2024 10:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.138.37.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721030; cv=none; b=AY5Pzk5Vc9Yg1Qk7kGLt7h/Ii5A9ub9+XAy4K3ESNXqS/Y/bSIzQTi7Li+W7Aayj8EI2n30wWF8dsjieklQ1/eW9Zo8egbmU51GPlpHt7C7v4aLQBlAo1mjyUFR3Pp+dDhio6Dg8wJAGfGOgmmvFUXnFcx2lq/G/327YGTmuTEI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721030; c=relaxed/simple; bh=Nq7SMqNBqa42A9Gw9it0V4iEBEk255GCXGK0EU8r0Nc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l1vVJHVNM5LNn/5XND9Y0gZbLMBdbifNrsN7ivC8YFxgR8sljqpeZtIsluCNROY6kR2rreXpwdr4O7wFiiQZmRpdIzcaviDQVvBTx3DCIafpyjVLXNWHFwFw4/MNRyJYlFmbAUSKNJRwylUAJzxe0ydnZ+B7igXzjKeOH0F5yEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fujitsu.com; spf=pass smtp.mailfrom=fujitsu.com; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b=X++/zVCQ; arc=none smtp.client-ip=139.138.37.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1709721029; x=1741257029; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Nq7SMqNBqa42A9Gw9it0V4iEBEk255GCXGK0EU8r0Nc=; b=X++/zVCQWbD3RwO4sV0R5jBoWm59aunLFlpz3wvSj7tUIUr1+QIcfxcw rUs51YTB9zQ4GsEFyK7E9vjQzv0Au7y/DHG9M/IIFiCx7tL2jEhH7HUXZ chdvdHYTFqV6pzIBWj11H5sAtkQ/5VztBHXXiORyfbehxUOTV2ZPhDbbo 0/vGrLBods4ZHkPHoHSMHz4JikXFb9z6EalEfAX2XZhSG7SsF8+yNrddq j3yL4Pimm6h3PUI9+zXPNs6wxWMi1QvXj5go7YYDTGpjexIN++Vqqfss8 zIrxwjNOuKfwNc4iyucLrPUjbkzprpGv7peddPfybMqsSH0zoBMZYiYI5 A==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="130699036" X-IronPort-AV: E=Sophos;i="6.06,208,1705330800"; d="scan'208";a="130699036" Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 19:29:16 +0900 Received: from yto-m1.gw.nic.fujitsu.com (yto-nat-yto-m1.gw.nic.fujitsu.com [192.168.83.64]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id C7383E5EA4; 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-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 06543D21CB; 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 3D7B22030C7E0; 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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) -- 2.29.2