From patchwork Tue Apr 4 18:03:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 79322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp76780vqo; Tue, 4 Apr 2023 11:22:11 -0700 (PDT) X-Google-Smtp-Source: AKy350bFPj+cU/qEyf/cmSIk99xDL8Cg/R48gnM9w6eYFTzkSfONNKO1CfnYo2LOXC2xToOoUzXh X-Received: by 2002:a17:90a:4146:b0:23c:6713:45b3 with SMTP id m6-20020a17090a414600b0023c671345b3mr4187217pjg.7.1680632531082; Tue, 04 Apr 2023 11:22:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680632531; cv=pass; d=google.com; s=arc-20160816; b=GbbSpLk7+TJPjenlS1r2ZVCYmxuEcGslijRkew14muhV5f/k3pH4Qqe9wi97Q6iYvk UJl72v9O7qvKqLiPctL3ZGq7zIFcxe3jm4eOlvHWLwYXazz7bRtchM950bbHpZbAOHRQ x6FIkqYn+aqPeZ8vhCAkGtpiaVvl0K67lekE2/ofddv5uPG2O4ywQ6rn1a5+GLWZmTRW QQOf8jhPerhGLWmvSN9JHCDIgpWoBTdOzxZjFfjJR1cYzuHrxig9HkKH8zFAk6KetguF uTBDmOFD318QKNkzKCI/l6RCpEw0Or1NTi+aGMO4pPHR8DvUFM62gBCUj8LomWfdAX6+ yKhQ== 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=Z39c7i32oLUZ4ubge8eBGitLtIahF77IQjSiLkcr4yY=; b=BdLGEhdvwxRX7HJSrvjrhxFXaazgrjTOu9ZLN3uXviiiHqAIksfbevlR8amys2waRt 1JZQXFxrgMoFQBWBF/+1POjgXuNjnVB0JWtMPpbd9jIS38/35XORDeWRBRvLgDaLTR0V j9qnmYF0LnPxyqT5czhGRXRJHIZTO0DycGx1/VJuezw1Mm1K8kUzGob5/Ij+v78jb1EL Wb+Ohs9c91SumGS1iSPx7hVKKaWpmr68FYIAmKPH72QIMUpfyHvKD9aiuZ0cCusWsERj X8x250qUlgsYrOcDFqjceRgGGu+Wc7angm/SxQQB79u0RsvRnp4DewdVKYXumNA5HdHW XFJA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=nBojjIkI; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=KmEvMF+n; 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 a21-20020a63e855000000b00513af1fa0b5si10819120pgk.797.2023.04.04.11.21.59; Tue, 04 Apr 2023 11:22:11 -0700 (PDT) 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=nBojjIkI; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=KmEvMF+n; 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 S236339AbjDDSFQ (ORCPT + 99 others); Tue, 4 Apr 2023 14:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236183AbjDDSEw (ORCPT ); Tue, 4 Apr 2023 14:04:52 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D723255AD for ; Tue, 4 Apr 2023 11:04:37 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 334Dx1S8026157; Tue, 4 Apr 2023 18:04:12 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=Z39c7i32oLUZ4ubge8eBGitLtIahF77IQjSiLkcr4yY=; b=nBojjIkI5e3rTpVf2pOigLhsjo0ye0nuox2CBT2U/Mp3pUu6bc6nJrk0qwIdgbhYp4Ne uWr3RLYR9oAMtAeCaGeTlFFYTkkfBkcV0TBAY2QFK2d4Fg3VHrgrO70jU0vR2L/WOsnE vpo6KJMBfR1SahWaB9Dhql271I+45C0scsSVO+rkWrYzhMMKVDoNI2RENT3WFFdICsFw E0FsJTJw3Psjxinofcnzi7H1U1AsJlepAkFCcILewbdxporLMldDn4sK4j+Mi39ssZH4 NeMLGqt7b8c5XeZBdANDOW5BRGPyO8DO5sKazQjZBS4uemPyJDWYmccIsWruUDFcjRpY QQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ppbd3xj2b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Apr 2023 18:04:12 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 334GUh8N027788; Tue, 4 Apr 2023 18:04:11 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2044.outbound.protection.outlook.com [104.47.73.44]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3pptuq7tbv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Apr 2023 18:04:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b12+mN5GQ6eZ9bVZZXqKtGhjkYEjnK1YlXWdjLVIJ1NHr3kiO9IIUG1bMb9YcIO7PSYRB+6yOOxWuGNpMeiCvL+c0PhZSqy+qkXqqb+qLpXuDj8pztcfljd7xQspKac+0aEYyJlofp+aqKJLAVnHJ3xf8MORPnJgieIpxi5ygd+WDbcvdg7OHDFVcvFxHeM0OXvKWaVfznLc6g3ApaQ0WPd2TuE0k2YF1pjBJLd1iDASr9S6MK7QjiZeqybVn8gTdd/apsOLVd/SuSZd7N8olixI+39Fe7NlPyp4DKl7Lt5qEwyzHnObq070KBBVGzDSd5cq5FqxYgA4IS40jeOLYQ== 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=Z39c7i32oLUZ4ubge8eBGitLtIahF77IQjSiLkcr4yY=; b=CwXsZNcGlcmClwHDXkcINPlzwTNT4C3WRc1IXqQr1fT0wgZhmf5UeNJgizwkC/L2ZqHzM7eZFgkacFfYOEf/rfgXLLoXEh5SVmPC1+0oUEsKjcnMGXi1dh+pDrfbaTTPktsFX3A/+6+MprlZWwLmZTvAruu0DGAtQSdrpJDLHlMrQK3hwpD6m9WjwXwGiIbcUkZS8aEEfrI9fktNDjp+TmatGKz0imT/iH8I8ri+lg3NHD9UXu3PWsgyRa6cstUCs8mxa8pGiQZ8iEC4dJZmTbTPvsRDi0Q6ipPNQ5ZKKA+UTE4SbEZXKWieqH7GxY+MQMrPcy/3Cdyh1hMAdNBjPw== 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=Z39c7i32oLUZ4ubge8eBGitLtIahF77IQjSiLkcr4yY=; b=KmEvMF+nbl7UkUptPzc6ibThTDoXpDx/+E2ABiYcSWgDh1pqu4qy6aP1QKJ9Th3tlOMcaP6Sv41ixYMI/9hvWrw78KISrl59sn0uuY1N7tbIvU4vlLyq+VbBSXE60ctsZx/lgH/q5HeAEewAYWpmOnN1PxZUQ7BP3zG7CclYZpM= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by MN0PR10MB5909.namprd10.prod.outlook.com (2603:10b6:208:3cf::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Tue, 4 Apr 2023 18:04:08 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e9ed:8782:64cb:cfc3]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e9ed:8782:64cb:cfc3%9]) with mapi id 15.20.6254.028; Tue, 4 Apr 2023 18:04:08 +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 v21 5/7] x86/crash: add x86 crash hotplug support Date: Tue, 4 Apr 2023 14:03:24 -0400 Message-Id: <20230404180326.6890-6-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230404180326.6890-1-eric.devolder@oracle.com> References: <20230404180326.6890-1-eric.devolder@oracle.com> X-ClientProxiedBy: DU2PR04CA0025.eurprd04.prod.outlook.com (2603:10a6:10:3b::30) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|MN0PR10MB5909:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f1f1b92-efc6-4e75-b3da-08db3536fc68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gq2cyFsODIccuTYLlq8V5z1F8SIkjTTCNrM98Vu5CFIGPxVpErzunAIBZo2ipmpuesTXCNgyRIOJwjKYaLpsAX6T9OqqDkutRiBpUTDlPpz31hMPSPYTdijoIPqwRY3czs3mp2xDcal+0vWfTaouhMUT+AvjgVfWOoOzuptIiuak14g2bm/bGADPCEuPSzQP9O3TXJRpOtoWptZx6hY8GBU3JqT4u8MSmkzTCObUUIUIOIqOiUXzVLia9Ue7UNEehNx1IvRxHpql0WoTNaohHVZ5aMiFoX51DbdqWVNjrTsy14YbbjUnpAymyrn8b5UGjCVXfNPaZLLgQDQmenS5hIaToBsO5roNLUb1qvE83D69fdU6/GmhjsIRHCkixLG5lTPemmcNVydLUXfIewDDn4kanXDvZ8D9hryGu3McnlUbVMMMd23RMoRfzNaFZVoBabVAvIIxLx+n8fYYcRxYIm8a2Zghtib55CT28Vmbra2867NIXdWK4uKrotln+02tJ3tWzvJ6PH79IFi5xLsB8kkgz7g2i9YlAPyB0me0tYyXN9H/9scHjOQU93v7FA8C 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:(13230028)(376002)(346002)(39860400002)(396003)(136003)(366004)(451199021)(83380400001)(4326008)(8676002)(66946007)(316002)(66556008)(66476007)(86362001)(2906002)(41300700001)(478600001)(36756003)(38100700002)(2616005)(8936002)(6486002)(5660300002)(6512007)(7416002)(186003)(107886003)(6666004)(26005)(6506007)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9zhThoEzX50mrXAAYYPt1mMD0AYhzGTY0A15y2tgoNDOxPvFKgO/jBtLzqGB7k5dbZPyw2STcXgmhB2dhAd2nOk3bUBcASuEesm3P+00HLOzIHfA8BBfmawSj2orENq5MEtHRZDNWFmupMCkV2kHX9VOhXfe5P2GAn8vyCalSzeishOcmc3xRdgASGd/1d0Y4k4LvryNnI4tLr6wmtl0h2weJLNNKzPX5xDqu6TmDCrmIEatp/e7svgOUpZNFvHueZJzMCTp3GKunP3VHd0cRTWedL8cOlrvTj3J7RqraQ1gcC8luJBCh4oJINOQvBulYTMIBack6QTky6kqc/eMwUhb3h1VkFqxSwbvWpMP+oE9cXowiil7+qln5xHjyRDFZx6q3h64WCvXyKV8VCZC/mZPPDcKlMq6Q5n43ua/z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vr+bBS70kTcc0DKr2oAU4nKzv1DbQBooRZhUzSKYgPyTB//jQHWPz+2vmIV8HwvOED4qUhZ1s0IORMeStCFgge7W4VZkNNl/uE8jbFPTawMp9tWU+T/ER7inEBFodx8R/eZSsSBwVrZvq8+F4mqfmd27t1H2+qBr+Y/RvX+cv9XAfRl/Iwg/CQXIh5/ySLdfNY4zGy1QJVMuWGwc3wRasVw4dUEnMuqHFOgm+Vj6F8bAEAmVz8bZ+5PlSxUZO3aCgasmM3ugzZkkG1Qj0pY7ytA1W2RpF0ni6eUpSP7228JX8Mp3Ob9yEc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f1f1b92-efc6-4e75-b3da-08db3536fc68 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 18:04:08.5714 (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: gF4zbMo4VkX03I9b55motIjGwWGcVVgiUwYQfrMdRc1AiT+C9fmcb5M8a0wtsowsJxGB+18Wf3PPNw3izBfVvmn2HVqPOTm2SYv10gfOoMQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR10MB5909 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-04_09,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304040165 X-Proofpoint-ORIG-GUID: zO5C3TGrhbp9RWu0k5n4UYtXb1oeXA4e X-Proofpoint-GUID: zO5C3TGrhbp9RWu0k5n4UYtXb1oeXA4e X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1762270937166821505?= X-GMAIL-MSGID: =?utf-8?q?1762270937166821505?= When CPU or memory is hot un/plugged, or off/onlined, the crash elfcorehdr, which describes the CPUs and memory in the system, must also be updated. The segment containing the elfcorehdr is identified at run-time in crash_core:crash_handle_hotplug_event(), which works for both the kexec_load() and kexec_file_load() syscalls. A new elfcorehdr is generated from the available CPUs and memory into a buffer, and then installed over the top of the existing elfcorehdr. 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. This is used only on the kexec_file_load() syscall; for kexec_load() userspace will need to size the segment similarly. To accommodate kexec_load() syscall in the absence of kexec_file_load() syscall support, and with CONFIG_CRASH_HOTPLUG enabled, it is necessary to move prepare_elf_headers() and dependents outside of CONFIG_KEXEC_FILE. Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain --- arch/x86/Kconfig | 13 ++++ arch/x86/include/asm/kexec.h | 15 +++++ arch/x86/kernel/crash.c | 119 ++++++++++++++++++++++++++++++++--- 3 files changed, 140 insertions(+), 7 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index a825bf031f49..316fdaa9a68e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2119,6 +2119,19 @@ 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 y + 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 or online/offline 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 cdd92ab43cda..0c9d496cf7ce 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -41,6 +41,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; @@ -158,8 +173,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; @@ -231,7 +244,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; @@ -249,6 +262,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(cmem, IS_ENABLED(CONFIG_X86_64), addr, sz); @@ -257,6 +273,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; @@ -371,18 +388,42 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) int crash_load_segments(struct kimage *image) { int ret; + unsigned long pnum = 0; 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, &pnum); 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; + +#ifdef CONFIG_CRASH_HOTPLUG + /* + * Ensure the elfcorehdr segment large enough for hotplug changes. + * Account for VMCOREINFO and kernel_map and maximum CPUs. + */ + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) + pnum = 2 + CONFIG_NR_CPUS_DEFAULT + CRASH_MAX_MEMORY_RANGES; + else + pnum += 2 + CONFIG_NR_CPUS_DEFAULT; + + if (pnum < (unsigned long)PN_XNUM) { + kbuf.memsz = pnum * sizeof(Elf64_Phdr); + kbuf.memsz += sizeof(Elf64_Ehdr); + + image->elfcorehdr_index = image->nr_segments; + + /* 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); + } +#endif - kbuf.memsz = kbuf.bufsz; kbuf.buf_align = ELF_CORE_HEADER_ALIGN; kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; ret = kexec_add_buffer(&kbuf); @@ -395,3 +436,67 @@ 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 + * + * 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