From patchwork Wed Jan 18 21:35:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 45510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2576367wrn; Wed, 18 Jan 2023 13:40:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYAjGTZ68QjuZVIXLbaV39y3kSA7CDCAK0hs6Ux8uD8d9Kpud3lfspc4+bOTc7Fp7/V3ty X-Received: by 2002:a17:907:d089:b0:7ad:aed7:a5da with SMTP id vc9-20020a170907d08900b007adaed7a5damr9170002ejc.28.1674078052777; Wed, 18 Jan 2023 13:40:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674078052; cv=pass; d=google.com; s=arc-20160816; b=MdROaubTIq4KHQ9h0HUHeUMdxNsHP0/or7NEKxOj7G2ZbHCjmn2O4UKOhixT17u0mL TPbDSP1GPgUAYNd9Yf7Uqo9vBHW18eYjODNI9/xM1h/elmxEHTdUmEHtcpfEgbY56zm+ 4vgBxKEf9aNiHN/zSL0BDgYczMcTcKrXfNULsVcoOq5l71R00yT8x6T8Sl/7FrZqnq4C smzE0ar3oyrZ/A9CC97lgG0zZH27vaZ+D7BXRqxNQ23Yzp+RRX7DxtZMTJCNGx4PBbvm Dl7/n02kGd9cmVQUxlHyYmr1nIi+Kt6QC/iXt3/El/sE7chu69nMMY0tBYPO/4br9+Vf GHcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=f6UdExf1TKM8GUOVAAnj9buuvcJy94WdoCzKS2kMVAo=; b=AjYa5+wOrUeIOMeKRnl5vZP+FBbN/fQepMiAZrxUnP5lZt7opIXFyN5aPJDhlmp9TF EhQHqAEUGrmTOLrBt1seLJ1B/FEgBZIzb+FMhUbPUPw4W2crL4QCRsgzEm/HrbhAHgJf EmBkIAWXHpZ7+1A4q58AZ4yxyh+TJ6MCbTOksGJ78hY/EtTXma42q4Nm7D6cQ94neETu dIjPATVZHM9gT+L+TiPRXIryE/BOzMuk0b3xrfyGps5HD/QCxoTbQAR2oOtdIzKtyMkz P2Ha//FTKMQpRGD/7DZqvkGST2XUy02C4atLwoSPQzpa0Ny5zrSa9mKVuHpvTQv/F9Du YupQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=rGAnPudw; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="moy/RY3R"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be7-20020a1709070a4700b007c11e5ad98csi15915110ejc.352.2023.01.18.13.40.29; Wed, 18 Jan 2023 13:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=rGAnPudw; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="moy/RY3R"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbjARVgn (ORCPT + 99 others); Wed, 18 Jan 2023 16:36:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjARVgc (ORCPT ); Wed, 18 Jan 2023 16:36:32 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A03AF63E17 for ; Wed, 18 Jan 2023 13:36:31 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30IKnDFa002415; Wed, 18 Jan 2023 21:36:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=f6UdExf1TKM8GUOVAAnj9buuvcJy94WdoCzKS2kMVAo=; b=rGAnPudw36n0GN0wiWEHkCR96+OXh2ZzsW6fNX0dWHfa4M06Y4pSBVU23lcUelF9JHII 3O2Yl7fe8gptAxndVwO9etOA0hON9Kt8ZI85kv6wS+/mqSkyb99GuGMAULkXtMY2Rev7 DNrAI9THNtLVgcUCHPj+XM/UM3Wtrh9V5Tj6PGkOt31GQsEI0Dj/sfJlTjNfPymvgGBQ dYAdRc/2eLA6Nqb7ce3wc1SYEi6NuIFa54AlzktQF8RtZgTHWhLkT++CTV0LX7r/eCF3 PAD7BBDVem5gEHgHBUcVLGtUlu+2rgfkdQO3r9muVeZUhkByxt2V5MYO6pN5owbnHEHM Qw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3k010t89-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jan 2023 21:36:12 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30ILDROl033460; Wed, 18 Jan 2023 21:36:12 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2045.outbound.protection.outlook.com [104.47.51.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n6rgc8tb7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jan 2023 21:36:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1MODJtXnMXH7aHVTcjqpq/pmu9y5wyDQ/sADLmpyMdstL2gDVrgI7OkrLV/ewBWTRcmDVGhLaN3n7a2I0hjm4qgdjkSp+14qEqm1RChMTv0RleHOsetqMP4XoAIfV/LW2FafO76eEZTz1+KLQW8cI+aN0hfHKWHbz7RMu10n153YFkzB7Vi1/MG/Fa2Pa2m9Yp8h1l41gQcZdEoSYEIBft+pHr21ljuUBlgNuYpPu2pDmvLqvGikET6H325cb0a1dVbyjyWKQIjXWYYF+JCNWSnmvcI32Eip54QPnPRcTgQ+BYfvYDvFgwBs/5o/30V74ULdUelLvA9I9MgKIICfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f6UdExf1TKM8GUOVAAnj9buuvcJy94WdoCzKS2kMVAo=; b=gy9pNNUqwQN+Xru7V8UE1MLRwTXI4Z9xnzTwk/d3qXAJ8i3CI+iWQA93rdGPSTEggg92i3MFtu0oN989dyFOYQvGo29jNSYj330PiUl8XdERoKZRPYPDgBGKvtQw3816AoFZ1AcVmwzFLFEu1lk2qrFO1VMvg1dKoeDgUbtod7UnOfJ+BYVgkA3T1Ehq6d3rc00O5Gjy6gVc5Mc5BQANxBIdYOrsicTsPomhEGTTr3CBsgFzCNB7vH/wVwib7ktlebdwtwFFE7JP5UldYsEQITm3CktM9jl8TJOS8aTRb01PFSvrRpyUdLlewgjQUEtvvyhlrymmu1MzAv7XZ8OTVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f6UdExf1TKM8GUOVAAnj9buuvcJy94WdoCzKS2kMVAo=; b=moy/RY3RF1ZN1B7xol6Y2gsRwsAD2kzoDgx/OLtD9MOj36Q2+/Bk9jSeQ4KMnxPwbS0L4z4PSgXLfj+7ojUz+1FxUFM7NG8J5PVGBudhafgclCNsGFQ6B3HJYjISGG5Ug0VSwWB14+yNpX2p+SgeVBxj0htdykZ7VSaq1CmNQZw= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by DS7PR10MB5056.namprd10.prod.outlook.com (2603:10b6:5:3aa::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Wed, 18 Jan 2023 21:36:09 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e301:fde6:85e5:b45a]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e301:fde6:85e5:b45a%4]) with mapi id 15.20.6002.024; Wed, 18 Jan 2023 21:36:09 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, ebiederm@xmission.com, dyoung@redhat.com, bhe@redhat.com, vgoyal@redhat.com Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, nramas@linux.microsoft.com, thomas.lendacky@amd.com, robh@kernel.org, efault@gmx.de, rppt@kernel.org, david@redhat.com, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v17 6/6] x86/crash: add x86 crash hotplug support Date: Wed, 18 Jan 2023 16:35:44 -0500 Message-Id: <20230118213544.2128-7-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230118213544.2128-1-eric.devolder@oracle.com> References: <20230118213544.2128-1-eric.devolder@oracle.com> X-ClientProxiedBy: BY3PR04CA0030.namprd04.prod.outlook.com (2603:10b6:a03:217::35) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|DS7PR10MB5056:EE_ X-MS-Office365-Filtering-Correlation-Id: a477b4c6-a27d-49bd-998b-08daf99c030f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qn5KgznBrTdchz6IpNuNBVJiv/466ys0F4bs0YAtfmgEXdi4VUUc6zp6ieBfw9ePFfIU4vubjTJflXSfdD8JmjSwwsONOfMtN78A1AVinkIC73M7HGM2EtLU1eE7sUmJlgIS2esPnNHk4Arf71Q9PEiB/2dDX3KAjSjT/rOqqsUrZoScHA9a7Uz4gDF6SnMib7MNuEoEdj3bv8QlQdPEp7NNqZ54X0xLy7PPd/0LVCvv2FTXfJOKmgI+0st+BQCgwSpT22BLio1mW38QBDv3sYNkcpRK+5PaqqIkhThS5z+/lEXd62EWzHUB8AiL43vqSlmdOXLY2yDhJyb/OH2DrALX3zHTMBHljhoo1i9mDsGfthqNwcfjCvKhsHavdRsizKYEWlTCa1SRKUE0HRpDER/62Hj2VoWtkbouQATRi8opCE2SbfACB61wMpzWy1UMPJCqrlYzA8N2bBUkizJMXNvpeBIeZbbLJ5R+FYsJ6GygMAsHXFgKkpose6WArQUNdr4ebraGpjUXBtAG0nF6tC576JNMRcAQ0uT2W675hqlslPl9633xml/EKjs4Yw8uhcm7yF7tscuUJG3MrizrX0kvgbL6vWYH63BVKsEYYd94kq2XgPWpD/Jh0NYR75Crqb9YjW/K0oePpKXsA+PLUw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR10MB4531.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(136003)(396003)(376002)(366004)(39860400002)(451199015)(38100700002)(36756003)(86362001)(316002)(66476007)(66946007)(186003)(26005)(4326008)(66556008)(8676002)(6486002)(6512007)(478600001)(2616005)(1076003)(2906002)(6506007)(8936002)(83380400001)(41300700001)(107886003)(6666004)(7416002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /to+1Kk5oc8DtTn0xl0gQO35O3GQPdv+JyzWe9rRFUoxvevkoihxcW6VGFpUuZAAREzyI/b3/l9qrCtVPc4eRql3yvy7srlfeyBuot+LUElJN6wEf2Y19STatnuuDJ4DbTyugTL5Z6hij5dgD1PRs4gUOcZNlnDAJugOIxojrBfe8EUxw+wT2FfdSOQ6otXXdJfRoNYdsREQSyJTqtQV0kiOV4WYYkh9GcYwLmYEcyx5F4VCDB4JjtCBoo6/1BM6MIjzLa1/9FaMxu0fBer7trEFPR5nP4NzjBMbOPybh6UacPYlSX/UzyJYjaX/aKg7L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Wm9uxl4Z+keUhf+F1jWT4HdYq93KINvvK/BBEbJiX9wzT/RirPr6Qu5o+Lk/1EsIBqZbk221T8OdaL+IsTpZsPsc5o37nwUoFlMCtQvzaMY18/hmmNtESsp4wOk/ynFHo9VAnagkP6nRQTl0hnxkG0E7MLsxz/pQiY3rhRpYuGONUH/S8aki4iM3U3MHg0ozmsAksz4fL/WyZltz9mEsRL2O+W6W0eOd09WZI4XNeMCkye8sqJfu2CJDXQ6EtflN1/EelvX0vvwNOB8Acmo378uddNUMmGNEXNFyav03tt9KwQSu5btA98sLATmBS+MUmTxLbez7VzQDvroU11mFBCWzPoJRUsgVhkwR+aGobOvT2y8kpB3YXfDnPu6wwef5EPdpMzzrsnnPaIcAwfN0ghgJ/Wej3iwXVlM436gecI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a477b4c6-a27d-49bd-998b-08daf99c030f X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2023 21:36:09.1114 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S8nyeIOTH6hHAd+LTwEacU7qXmdX6D8KRbxIYEw1Ls0IQigSGjsQf3UmsxbvzIfIHxaC+UV45qhp8fhqPDWoxhCCBveBqM2bEYJQTOOvBuY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5056 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-18_05,2023-01-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301180180 X-Proofpoint-GUID: Dys_SDOHcN9352GpjbvQwddgzo8jdTl- X-Proofpoint-ORIG-GUID: Dys_SDOHcN9352GpjbvQwddgzo8jdTl- X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755398067940091817?= X-GMAIL-MSGID: =?utf-8?q?1755398067940091817?= When CPU or memory is hot un/plugged, the crash elfcorehdr, which describes the CPUs and memory in the system, must also be updated. A new elfcorehdr is generated from the available CPUs and memory into a buffer, and then installed over the top of the existing elfcorehdr. The segment containing the elfcorehdr is identified at run time in crash_core:handle_hotplug_event(), which works for both the kexec_load() and kexec_file_load() syscalls. In the patch 'kexec: exclude elfcorehdr from the segment digest' the need to update purgatory due to the change in elfcorehdr was eliminated. As a result, no changes to purgatory or boot_params (as the elfcorehdr= kernel command line parameter pointer remains unchanged and correct) are needed, just elfcorehdr. To accommodate a growing number of resources via hotplug, the elfcorehdr segment must be sufficiently large enough to accommodate changes, see the CRASH_MAX_MEMORY_RANGES description. Signed-off-by: Eric DeVolder --- arch/x86/Kconfig | 12 ++++ arch/x86/include/asm/kexec.h | 15 +++++ arch/x86/kernel/crash.c | 123 +++++++++++++++++++++++++++++++++-- 3 files changed, 143 insertions(+), 7 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 3604074a878b..09e9b7a091ed 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2119,6 +2119,18 @@ config CRASH_DUMP (CONFIG_RELOCATABLE=y). For more details see Documentation/admin-guide/kdump/kdump.rst +config CRASH_HOTPLUG + bool "Update the crash elfcorehdr on system configuration changes" + default n + depends on CRASH_DUMP && (HOTPLUG_CPU || MEMORY_HOTPLUG) + help + Enable direct update to the crash elfcorehdr (which contains + the list of CPUs and memory regions to be dumped upon a crash) + in response to hot plug/unplug of CPUs or memory. This is a much + more advanced approach than userspace attempting that. + + If unsure, say Y. + config KEXEC_JUMP bool "kexec jump" depends on KEXEC && HIBERNATION diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index a3760ca796aa..1bc852ce347d 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -212,6 +212,21 @@ typedef void crash_vmclear_fn(void); extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss; extern void kdump_nmi_shootdown_cpus(void); +#ifdef CONFIG_CRASH_HOTPLUG +void arch_crash_handle_hotplug_event(struct kimage *image); +#define arch_crash_handle_hotplug_event arch_crash_handle_hotplug_event + +#ifdef CONFIG_HOTPLUG_CPU +static inline int crash_hotplug_cpu_support(void) { return 1; } +#define crash_hotplug_cpu_support crash_hotplug_cpu_support +#endif + +#ifdef CONFIG_MEMORY_HOTPLUG +static inline int crash_hotplug_memory_support(void) { return 1; } +#define crash_hotplug_memory_support crash_hotplug_memory_support +#endif +#endif + #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_KEXEC_H */ diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 8a9bc9807813..ba11c7e70edb 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -42,6 +42,21 @@ #include #include +/* + * For the kexec_file_load() syscall path, specify the maximum number of + * memory regions that the elfcorehdr buffer/segment can accommodate. + * These regions are obtained via walk_system_ram_res(); eg. the + * 'System RAM' entries in /proc/iomem. + * This value is combined with NR_CPUS_DEFAULT and multiplied by + * sizeof(Elf64_Phdr) to determine the final elfcorehdr memory buffer/ + * segment size. + * The value 8192, for example, covers a (sparsely populated) 1TiB system + * consisting of 128MiB memblocks, while resulting in an elfcorehdr + * memory buffer/segment size under 1MiB. This represents a sane choice + * to accommodate both baremetal and virtual machine configurations. + */ +#define CRASH_MAX_MEMORY_RANGES 8192 + /* Used while preparing memory map entries for second kernel */ struct crash_memmap_data { struct boot_params *params; @@ -173,8 +188,6 @@ void native_machine_crash_shutdown(struct pt_regs *regs) crash_save_cpu(regs, safe_smp_processor_id()); } -#ifdef CONFIG_KEXEC_FILE - static int get_nr_ram_ranges_callback(struct resource *res, void *arg) { unsigned int *nr_ranges = arg; @@ -246,7 +259,7 @@ static int prepare_elf64_ram_headers_callback(struct resource *res, void *arg) /* Prepare elf headers. Return addr and size */ static int prepare_elf_headers(struct kimage *image, void **addr, - unsigned long *sz) + unsigned long *sz, unsigned long *nr_mem_ranges) { struct crash_mem *cmem; int ret; @@ -264,6 +277,9 @@ static int prepare_elf_headers(struct kimage *image, void **addr, if (ret) goto out; + /* Return the computed number of memory ranges, for hotplug usage */ + *nr_mem_ranges = cmem->nr_ranges; + /* By default prepare 64bit headers */ ret = crash_prepare_elf64_headers(image, cmem, IS_ENABLED(CONFIG_X86_64), addr, sz); @@ -272,6 +288,7 @@ static int prepare_elf_headers(struct kimage *image, void **addr, return ret; } +#ifdef CONFIG_KEXEC_FILE static int add_e820_entry(struct boot_params *params, struct e820_entry *entry) { unsigned int nr_e820_entries; @@ -386,18 +403,45 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) int crash_load_segments(struct kimage *image) { int ret; + unsigned long nr_mem_ranges; struct kexec_buf kbuf = { .image = image, .buf_min = 0, .buf_max = ULONG_MAX, .top_down = false }; /* Prepare elf headers and add a segment */ - ret = prepare_elf_headers(image, &kbuf.buffer, &kbuf.bufsz); + ret = prepare_elf_headers(image, &kbuf.buffer, &kbuf.bufsz, &nr_mem_ranges); if (ret) return ret; - image->elf_headers = kbuf.buffer; - image->elf_headers_sz = kbuf.bufsz; + image->elf_headers = kbuf.buffer; + image->elf_headers_sz = kbuf.bufsz; + kbuf.memsz = kbuf.bufsz; + + if (IS_ENABLED(CONFIG_CRASH_HOTPLUG)) { + /* + * Ensure the elfcorehdr segment large enough for hotplug changes. + * Start with VMCOREINFO and kernel_map and maximum CPUs. + */ + unsigned long pnum = 2 + CONFIG_NR_CPUS_DEFAULT; + + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) + pnum += CRASH_MAX_MEMORY_RANGES; + else + pnum += nr_mem_ranges; + + if (pnum < (unsigned long)PN_XNUM) { + kbuf.memsz = pnum * sizeof(Elf64_Phdr); + kbuf.memsz += sizeof(Elf64_Ehdr); + + image->elfcorehdr_index = image->nr_segments; + image->elfcorehdr_index_valid = true; + + /* Mark as usable to crash kernel, else crash kernel fails on boot */ + image->elf_headers_sz = kbuf.memsz; + } else { + pr_err("number of Phdrs %lu exceeds max\n", pnum); + } + } - kbuf.memsz = kbuf.bufsz; kbuf.buf_align = ELF_CORE_HEADER_ALIGN; kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; ret = kexec_add_buffer(&kbuf); @@ -410,3 +454,68 @@ int crash_load_segments(struct kimage *image) return ret; } #endif /* CONFIG_KEXEC_FILE */ + +#ifdef CONFIG_CRASH_HOTPLUG + +#undef pr_fmt +#define pr_fmt(fmt) "crash hp: " fmt + +/** + * arch_crash_handle_hotplug_event() - Handle hotplug elfcorehdr changes + * @image: the active struct kimage + * + * To accurately reflect hot un/plug changes, the new elfcorehdr + * is prepared in a kernel buffer, and then it is written on top + * of the existing/old elfcorehdr. + */ +void arch_crash_handle_hotplug_event(struct kimage *image) +{ + void *elfbuf = NULL, *old_elfcorehdr; + unsigned long nr_mem_ranges; + unsigned long mem, memsz; + unsigned long elfsz = 0; + + /* + * Create the new elfcorehdr reflecting the changes to CPU and/or + * memory resources. + */ + if (prepare_elf_headers(image, &elfbuf, &elfsz, &nr_mem_ranges)) { + pr_err("unable to prepare elfcore headers"); + goto out; + } + + /* + * Obtain address and size of the elfcorehdr segment, and + * check it against the new elfcorehdr buffer. + */ + mem = image->segment[image->elfcorehdr_index].mem; + memsz = image->segment[image->elfcorehdr_index].memsz; + if (elfsz > memsz) { + pr_err("update elfcorehdr elfsz %lu > memsz %lu", + elfsz, memsz); + goto out; + } + + /* + * Copy new elfcorehdr over the old elfcorehdr at destination. + */ + old_elfcorehdr = kmap_local_page(pfn_to_page(mem >> PAGE_SHIFT)); + if (!old_elfcorehdr) { + pr_err("updating elfcorehdr failed\n"); + goto out; + } + + /* + * Temporarily invalidate the crash image while the + * elfcorehdr is updated. + */ + xchg(&kexec_crash_image, NULL); + memcpy_flushcache(old_elfcorehdr, elfbuf, elfsz); + xchg(&kexec_crash_image, image); + kunmap_local(old_elfcorehdr); + pr_debug("updated elfcorehdr\n"); + +out: + vfree(elfbuf); +} +#endif