From patchwork Thu Jan 5 15:17:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 39645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp353324wrt; Thu, 5 Jan 2023 07:23:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXv79JQt4pRij7gAbthnQa+EQmvLZEGy1M/KoCo8zIBwzwc9ttZIaVEenpKqEvcn1Wjpf/30 X-Received: by 2002:a05:6a20:94ca:b0:af:f77c:39d0 with SMTP id ht10-20020a056a2094ca00b000aff77c39d0mr62014508pzb.11.1672932212395; Thu, 05 Jan 2023 07:23:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672932212; cv=pass; d=google.com; s=arc-20160816; b=QgBaSwsv3RAcIT/EvXwrBUej6A4M2Levu0LyXd5URSs+JmVi8ROYWi1HkvQqVAWXMg pxggwC9+oZbyIJJphlgZtMy9KwRcHadn9etaWkcFtXwR31Lt5kQhzzzqUlgu0XrDm9Rl dq13vpqO02MQG259wEwuJVktv3/T7BqeA6H31u9nfzztxZ8ziYUTKoLsUmKib+/+zdQP enqQnZ+nWEIOzavMXNogAUbvv+B6D+jyBu8wplsS17prRQAEgckIDIVxR2tSc3U1zjcI 25vlS+jrvCwl6srFrMj5nOwuiXS9K3gGgrywC6Rc+squoSAcvZvP0Eq3+libJbveNGF5 YkoQ== 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=0WkScAuPCL2nzHWWGz3/rW0nPs4YZo8Ffn35KwPDCqk=; b=MonOHoU3vou3LiJJN4MdIesgqUfKfuRRTD3Tka9R9PMhbZ6VYWXYc/RanqDbJhELDD arlV1gTyX2j+W4JJ4CCy/izmz+1+nctwnwgEqpFxaBOYry3C7MyTKdgR7QjZKGGaw9vQ anYJbe1GHqHpNmHRlg1SVDaIoVNhbpN/MDxxob6DSpvzAiGtaZsDQBc9nE2r1qPbG7ol kHErGLYvvfpVA7Eh0OolMViIt2aRj6TJtKVWC71w00jG2pLkPkDvXr9v8XxE8V8Wmn4q UjpGtS5693BkC7IDsBgyJAgHR0zpG93woJka9+5clGEgCqr1cmeB5d2+3ETOICFinnZw 4inw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=M+vPBAGF; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wqfTFTTi; 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 i70-20020a638749000000b004a8375e8edbsi868243pge.451.2023.01.05.07.23.20; Thu, 05 Jan 2023 07:23:32 -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=M+vPBAGF; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wqfTFTTi; 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 S234332AbjAEPSJ (ORCPT + 99 others); Thu, 5 Jan 2023 10:18:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233893AbjAEPRx (ORCPT ); Thu, 5 Jan 2023 10:17:53 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D2A050E4F for ; Thu, 5 Jan 2023 07:17:51 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 305E448b021184; Thu, 5 Jan 2023 15:17:31 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=0WkScAuPCL2nzHWWGz3/rW0nPs4YZo8Ffn35KwPDCqk=; b=M+vPBAGFO0gfz5w9In+zm/XrnxS6yFVhCcDLsgUM5t+yyM+xTHIhI3ViJOFb3egRk3tu 2EgsGxKey1wHQXV5QklQnjN0AqnfYVz04R77q5W3MRXmM2HU+WkY3JvqnOgiIdRaTZ/D oGwbNM3/Ub5IvF+3UDG5QTuUdbCWzNrjsh3WTPnbOVzbBr/T/zbKn62kWCEeZpsnw0AY iS+NpmUZU41LO2FXs5rOtN332I2lkl6LxosjxhrW52B4w7USlidAQm9ocxdcCUyxOJi1 YaMXiS604TEdGNvRKnFvRFOQYnsUBEIykeCv0RLEaMu9EQBV6b6nlgquMYHJ+rkHgXdz Eg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtcya901j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 05 Jan 2023 15:17:30 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 305EPKOc040149; Thu, 5 Jan 2023 15:17:30 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mwevjmsp5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 05 Jan 2023 15:17:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JlVk330YNk5lLIwIYEhJpTQ9L0K1hXWjFP+mOk87NpS7kAP881ZI+JPzL36FxXKWIaNcV99mPm2HY6eqvoZhdoDY02A/OH4HjlND1D8lTJ41Sfpi9wRu5X6rGzwCUwJk9TypidEQkfkOfHcg2fl5KCt2B5Nk97F/ShutKzSmDYmW8XIXWmSwMiv+t5C8a4SSYOf6jo4WHh4yEB1oxbG7gVYEiRbJsTDn0LF1zgtzqn/5L2+2h1FF9cqaeYHyGLifJdxHiGNJrcKKtivrO/jCr8ffZ3n4jCQxlAt1P5nspNBqBgL/xrdpyQyWLpJym92aj5ppUC4JX1DaV6Vf+kWzOQ== 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=0WkScAuPCL2nzHWWGz3/rW0nPs4YZo8Ffn35KwPDCqk=; b=agG0MDX6s6Zbir2ZkaZV1sQHVUPHm+3tY5DKZioA5YbIwmSlQToJ2CYKZ6tmfUeh0Zaq8HnxByf9V88nh1mor5jCmx3m1u8aBu5uwgcFVWEUA21PUN1Dn96VgQb8b+tpIm+Nfs78V4bsrft/9DpFaUk5nP/Gtm5IrwzRz6djxVPWQETiV3UPsxKsV6qLoW2NvOK9KKuMwxi+4Uec8AyFW1smnFRyx/hPPB8nWruD+WV2LtRy8SZpSw5BV34vT8wuG+4Mnf1p/Ius8zCND7L6YW1rtHLT/15ohM9dyr1goTfBlg9D/f7YPgZ1Olza+hCKEhiPZDR1HB3PalJiNdRhgg== 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=0WkScAuPCL2nzHWWGz3/rW0nPs4YZo8Ffn35KwPDCqk=; b=wqfTFTTi8lnwGOycQ0V/f+iz0nn5U1nh937UImxNm6ayXVY8c1fpNgqibilIKVbpddmqWWDWG5vExXSY3edTXVJA2OR4aLebxM1u7vQtSHXb5maB5Ez75DJSEL8c4tZxBbYAosBTJaMgYHyZvZaftEA52ySzHb1uxzZ9elKU2dU= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by DS0PR10MB7406.namprd10.prod.outlook.com (2603:10b6:8:158::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 15:17:27 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e301:fde6:85e5:b45a]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::e301:fde6:85e5:b45a%5]) with mapi id 15.20.5944.019; Thu, 5 Jan 2023 15:17:27 +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 v16 3/7] crash: add generic infrastructure for crash hotplug support Date: Thu, 5 Jan 2023 10:17:05 -0500 Message-Id: <20230105151709.1845-4-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230105151709.1845-1-eric.devolder@oracle.com> References: <20230105151709.1845-1-eric.devolder@oracle.com> X-ClientProxiedBy: DM6PR05CA0042.namprd05.prod.outlook.com (2603:10b6:5:335::11) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|DS0PR10MB7406:EE_ X-MS-Office365-Filtering-Correlation-Id: 803ff4cc-2e58-461b-8b30-08daef2ff47c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ihzza8dsOXIEe31ef7xWOn8lvYaD/5835ZoffgHUsdXyV98NzZ+jKAlrdSPPTr2+oW1sKSsRquPbHF5pogPK7QM/wAO5HQsFPvH9AvnQOthqkOM4YXsyfUOi7/p4INBNbmWiT7b2UuGixf2uKbAWsef/lxFrVrzd4vef/LWfwQHLQigUAUjwDJ9fYMjQrwqODOeD9rwTK5L59wknWHE+ipP8QS/GpPQMHdgYm2QpI/ZSnJeNpEyvL3GmrjHMtIsXYb7jKnG5MVD5rpO3rgqtze3HZAzSPhOgVjUIsaz1Wek2x1CvMFzkQ/2sSpvKQxCgb2MGQUx/3u+OaxyiKT63rS6GbYJiZVRT3mjtzGTKtMamUHCseiBR7+T4C3bf5rzDJi4JNoG80/hTDRNXSgr9HcGaIIj7Sp0P8qLsOT489z7bskhAHncADMg6G2+yJ9xF/1cAOmpCuQ0oKRk0IY/JNlyIkM6Y56EDewqot3xyqElbOhPYrODt8T6Xyl8u6ucxVECDbJ0xS6JQtJvYkTBMzaYIbiTZ6HZK5zdyzS3dCzhh6XeXOk6QtQ5URhjU2IaD1X7k5laIrol5ajqjmMUF8Lyq5mO6bPiZ+7WGwUwK5SurfhQ4NEVREiz48WTDGWnCbjBUhe2A1XMmPRsPXTMO2AJt9bBSE1zp5kf3zptjpkH5/DVpTbNFWUQE8/3yMiyW 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)(376002)(396003)(366004)(39860400002)(136003)(451199015)(4326008)(8676002)(107886003)(5660300002)(66476007)(66556008)(6666004)(66946007)(8936002)(41300700001)(316002)(7416002)(6486002)(2906002)(478600001)(6506007)(38100700002)(26005)(186003)(2616005)(1076003)(6512007)(36756003)(83380400001)(86362001)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B10G+YLHkQ9JOeHXDwuCiBCgFlSK9sRJlCK1qZPiHAncP2mJ03qmyxC6foM2J5sAgBDz31gvas+QwTTC8Xx3ct/+YjK0JpdNWVRhateiz2vfmNnxuRH5SkJL3jxP5n2CNH0xR/uft46UQCXDoFLjemSgsaJGfrWXKmX6siSH/sIYtAoeumaVK5KJtrs3kcQUPK9jzjiXq5HyyhUv9eAUjDQcjmUyeWmP1nNmACGnaN/34D1fvNXvRum5MPO6pgRRQ2bspHMJ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VMh0TGMKO1aKFFj5S+Co3rTBZME9kuFVaNMrU7QGs2jeWj9CXfl2Yxr3a56/N80pdxCScK+gGEGjSP5LvNWrFYpUrTbXS5eFxxAECSSW9eETujKauKknfo944mUeF3yog2rW99BfdX6cG7gY+Xo4h7WR2mxLjxoVtBsjGj+poW6eYdSEk341iSKuBQSOMV8tW6+0ih3O54vZI31Q1a3u/5nwiL2ACJ9K3YZ5ugypqnIx+FdnJHKsqUUOJYqx5XVGz+p96HODBPDDyFVC9QULcSSFwhPQ/iTX9IYxVrI+dIO/Y1//h1bsCOckaTFrHVG+ILyknt/pkxpdlBsHJZazuUAydY0ud4QiFfjt3MhzV94Ysn0AMxKEQOPUwg4G/ynvRhZkt2GKJO5bl3oayCVu7x4OWoOWAEleZgN7aehwy4GHepMOV1sG0CNSUxd7rdEXih93BgUUGHxYlf4KNB+IuJ/TsXuKe8kosTDHQQeqjeLJPek+LMqIXaZ3POeydG36BHL1i1WJqeb9p/ufFmSYk6b1eeBSFsKj8ChbUUeuKpiJtUgECwXe9CFR80UBqwbvtekpOkBqSizM73678rAGOMRKkGrB0iBCD/sx3TIZ6a6GQbMCWDx5fn23VEIw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 803ff4cc-2e58-461b-8b30-08daef2ff47c X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 15:17:27.3317 (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: QO+HMfERiY8yhhishXFZe+xy7ysOC9X18djv29JOhgLznlL2NAD7z7594PWY3pr/2E03kggFuYqYr3QpiQd1lychzAG1aFEnr2xbiwPSbJ8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB7406 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-05_06,2023-01-05_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301050119 X-Proofpoint-ORIG-GUID: p2-1S-9nRDJP5GABQxkm0mADFtpuZNMJ X-Proofpoint-GUID: p2-1S-9nRDJP5GABQxkm0mADFtpuZNMJ 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?1754196567899696865?= X-GMAIL-MSGID: =?utf-8?q?1754196567899696865?= CPU and memory change notifications are received in order to regenerate the elfcorehdr. To support cpu hotplug, a callback is registered to capture the CPUHP_AP_ONLINE_DYN online and offline events via cpuhp_setup_state_nocalls(). To support memory hotplug, a notifier is registered to capture the MEM_ONLINE and MEM_OFFLINE events via register_memory_notifier(). The cpu callback and memory notifiers call handle_hotplug_event() which performs needed tasks and then dispatches the event to the architecture specific arch_crash_handle_hotplug_event(). During the process, the kexec_lock is held. Signed-off-by: Eric DeVolder Acked-by: Baoquan He --- include/linux/crash_core.h | 8 +++ include/linux/kexec.h | 12 ++++ kernel/crash_core.c | 138 +++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index de62a722431e..a270f8660538 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -84,4 +84,12 @@ int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, int parse_crashkernel_low(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base); +#define KEXEC_CRASH_HP_REMOVE_CPU 0 +#define KEXEC_CRASH_HP_ADD_CPU 1 +#define KEXEC_CRASH_HP_REMOVE_MEMORY 2 +#define KEXEC_CRASH_HP_ADD_MEMORY 3 +#define KEXEC_CRASH_HP_INVALID_CPU -1U + +struct kimage; + #endif /* LINUX_CRASH_CORE_H */ diff --git a/include/linux/kexec.h b/include/linux/kexec.h index c8662a48d455..a1838699d7b2 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -33,6 +33,7 @@ extern note_buf_t __percpu *crash_notes; #include #include #include +#include #include /* Verify architecture specific macros are defined */ @@ -371,6 +372,13 @@ struct kimage { struct purgatory_info purgatory_info; #endif +#ifdef CONFIG_CRASH_HOTPLUG + bool hotplug_event; + unsigned int offlinecpu; + bool elfcorehdr_index_valid; + int elfcorehdr_index; +#endif + #ifdef CONFIG_IMA_KEXEC /* Virtual address of IMA measurement buffer for kexec syscall */ void *ima_buffer; @@ -500,6 +508,10 @@ static inline int arch_kexec_post_alloc_pages(void *vaddr, unsigned int pages, g static inline void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) { } #endif +#ifndef arch_crash_handle_hotplug_event +static inline void arch_crash_handle_hotplug_event(struct kimage *image) { } +#endif + #else /* !CONFIG_KEXEC_CORE */ struct pt_regs; struct task_struct; diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 92eb7dc05457..973d7ddff1cf 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include @@ -18,6 +20,7 @@ #include #include "kallsyms_internal.h" +#include "kexec_internal.h" /* vmcoreinfo stuff */ unsigned char *vmcoreinfo_data; @@ -615,3 +618,138 @@ static int __init crash_save_vmcoreinfo_init(void) } subsys_initcall(crash_save_vmcoreinfo_init); + +#ifdef CONFIG_CRASH_HOTPLUG +#undef pr_fmt +#define pr_fmt(fmt) "crash hp: " fmt +/* + * To accurately reflect hot un/plug changes, the elfcorehdr (which + * is passed to the crash kernel via the elfcorehdr= parameter) + * must be updated with the new list of CPUs and memories. + * + * In order to make changes to elfcorehdr, two conditions are needed: + * First, the segment containing the elfcorehdr must be large enough + * to permit a growing number of resources; the elfcorehdr memory size + * is based on NR_CPUS_DEFAULT and CRASH_MAX_MEMORY_RANGES. + * Second, purgatory must explicitly exclude the elfcorehdr from the + * list of segments it checks (since the elfcorehdr changes and thus + * would require an update to purgatory itself to update the digest). + */ +static void handle_hotplug_event(unsigned int hp_action, unsigned int cpu) +{ + /* Obtain lock while changing crash information */ + if (kexec_trylock()) { + + /* Check kdump is loaded */ + if (kexec_crash_image) { + struct kimage *image = kexec_crash_image; + + if (hp_action == KEXEC_CRASH_HP_ADD_CPU || + hp_action == KEXEC_CRASH_HP_REMOVE_CPU) + pr_debug("hp_action %u, cpu %u\n", hp_action, cpu); + else + pr_debug("hp_action %u\n", hp_action); + + /* + * When the struct kimage is allocated, it is wiped to zero, so + * the elfcorehdr_index_valid defaults to false. Find the + * segment containing the elfcorehdr, if not already found. + * This works for both the kexec_load and kexec_file_load paths. + */ + if (!image->elfcorehdr_index_valid) { + unsigned long mem; + unsigned char *ptr; + unsigned int n; + + for (n = 0; n < image->nr_segments; n++) { + mem = image->segment[n].mem; + ptr = kmap_local_page(pfn_to_page(mem >> PAGE_SHIFT)); + if (ptr) { + /* The segment containing elfcorehdr */ + if (memcmp(ptr, ELFMAG, SELFMAG) == 0) { + image->elfcorehdr_index = (int)n; + image->elfcorehdr_index_valid = true; + } + kunmap_local(ptr); + } + } + } + + if (!image->elfcorehdr_index_valid) { + pr_err("unable to locate elfcorehdr segment"); + goto out; + } + + /* Needed in order for the segments to be updated */ + arch_kexec_unprotect_crashkres(); + + /* Flag to differentiate between normal load and hotplug */ + image->hotplug_event = true; + + /* Now invoke arch-specific update handler */ + arch_crash_handle_hotplug_event(image); + + /* No longer handling a hotplug event */ + image->hotplug_event = false; + + /* Change back to read-only */ + arch_kexec_protect_crashkres(); + } + +out: + /* Release lock now that update complete */ + kexec_unlock(); + } +} + +static int crash_memhp_notifier(struct notifier_block *nb, unsigned long val, void *v) +{ + switch (val) { + case MEM_ONLINE: + handle_hotplug_event(KEXEC_CRASH_HP_ADD_MEMORY, + KEXEC_CRASH_HP_INVALID_CPU); + break; + + case MEM_OFFLINE: + handle_hotplug_event(KEXEC_CRASH_HP_REMOVE_MEMORY, + KEXEC_CRASH_HP_INVALID_CPU); + break; + } + return NOTIFY_OK; +} + +static struct notifier_block crash_memhp_nb = { + .notifier_call = crash_memhp_notifier, + .priority = 0 +}; + +static int crash_cpuhp_online(unsigned int cpu) +{ + handle_hotplug_event(KEXEC_CRASH_HP_ADD_CPU, cpu); + return 0; +} + +static int crash_cpuhp_offline(unsigned int cpu) +{ + handle_hotplug_event(KEXEC_CRASH_HP_REMOVE_CPU, cpu); + return 0; +} + +static int __init crash_hotplug_init(void) +{ + int result = 0; + + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) + register_memory_notifier(&crash_memhp_nb); + + if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) + result = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, + "crash/cpuhp", + crash_cpuhp_online, + crash_cpuhp_offline); + + return result; +} + +subsys_initcall(crash_hotplug_init); +#endif