From patchwork Wed Nov 16 21:46:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 21295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp77926wrr; Wed, 16 Nov 2022 13:50:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Rht0nrWeEbgwiOYut8AQpYKnwdJvvOwjh4QM1gbL33+UyBlhRlSAIDujY7tVBmzfXjqBV X-Received: by 2002:a17:90a:7bc1:b0:20d:23ee:c041 with SMTP id d1-20020a17090a7bc100b0020d23eec041mr5564267pjl.140.1668635405679; Wed, 16 Nov 2022 13:50:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668635405; cv=pass; d=google.com; s=arc-20160816; b=JDWcWA56D0SgJtc7VRSzpbcAoIPqUZ8N3jTltWv72H1q+xlMWRby/G9QGWEoHxYRaa GnGUIajuSYfNKyI1p3nheH/i1DQ1HqMWdW80s8t7Pzz75Pa5YAE0txMKNJBgS+uRYLF/ koCua2Ti5pKzVmWSZ52o6kdOrtSKChj++xsC+gHsQQkc28RpTYv+w3ys0HVVHLmcl6uA CA9CfkdWEK4TfUlluK3lEBXzCHmrosACpEoo6Dw3x5dxjC0PfQN1PjpoXK8ZwA53HSM6 88tExnNEiZRCOBQ9pIxMvxqKQa0hhrBTtVJse21Vi/DyHA0b46XwmU0f07CeO0KJaS8R uSBw== 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=Hj6QP3AF4aXAFQOvMDiGMeqsass/ASyHJ9oGGdbl6H8=; b=kGf2doR20QEy4ZzuHNlLSTeiXv6SsHssDHsJ4lwUIgNGZ3F59V1q8D1Mjr/NINgKU6 lYA+CoWFG0ycOrvTowJqg0gXq8eTE9/znxeZbkNvzD57AFPJ7BDT84f27RQsboaNpKCj 82l4ztVj0VZbaLnItSHIutMfwQ3YQWneSzHvEDOIg0WwbHK8yj7EDnpywEeNmAeewVpB qT1Xkpl8UmMjiy/9KN9B+nPRWL1Wzd24rn42k6XHzWyLpBXwIbp55ar5RgfQOM7Ax+OV 5LXOlzShL9OGrQZPtC1eWVSbZogQQ6T62lifnmH6aB9kWkRAb9Taf93nPd7CLKaUV4kz +Izg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="q/o6WyCg"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RemdNfOx; 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 l2-20020a056a00140200b00572dc2ed220si1152613pfu.231.2022.11.16.13.49.51; Wed, 16 Nov 2022 13:50:05 -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="q/o6WyCg"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RemdNfOx; 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 S234020AbiKPVrf (ORCPT + 99 others); Wed, 16 Nov 2022 16:47:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233262AbiKPVrc (ORCPT ); Wed, 16 Nov 2022 16:47:32 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D1613DDD for ; Wed, 16 Nov 2022 13:47:29 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AGLdKiQ016874; Wed, 16 Nov 2022 21:47:02 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=Hj6QP3AF4aXAFQOvMDiGMeqsass/ASyHJ9oGGdbl6H8=; b=q/o6WyCgmaz1Woru8KgqLCXFIXwpM4JeB3Ot2RiORKmhI+h9yPcqvxmD7qy5KEpJCXw8 Bi/rJDOOKL6tsP6PACOL0f6vjCBNe4RhOZ4+euSpvO8jf8R9GW8ZbL1sQHt6xEe1pdvQ jGSZUPkZFdC2A3xFptGJqfKA4Sgst4nvZkhLwCHPumx71OouJf587kuYW9N1Q72C/+R1 uy6bWOU3QWKVUaUcQkkzAw7yUEM7RInUzF8pm3st5Gjb8OOSoLIIAGkDCm1XBa/TixXi ro/3RZagpJW+nJOgatMI9a0VHUtZW5ncw6M96oTuTb5k8I65bSvSAjvxh+Uk7ia+qEwf hg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kv3htxthf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 21:47:01 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AGL1Ye1000301; Wed, 16 Nov 2022 21:47:01 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2040.outbound.protection.outlook.com [104.47.73.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ku3k8y3q5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 21:47:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N3rI4Or7TLDa4rgJ4qhYMnVX5Z9he8kuEzTAeu+mAPJ56Fs+bODVMDZfA1VzaL4IdXpnQPR4u5jr6v+WT5UgjiC7vjU8sLbAFrwbH6U0W1GqHcJi5wyfTvsMmX2d06AYLTKi1865+2zX3qE9PDxs38noLjFahbg4Qc214yjTO+PfnDEWb5+Q/aYUgUB7ZxGQGN1VC2J3uR5ymefDQGaUSwhBwVrDUHmJePCNliBKqTp1EvFK6rDW07GCN+uGTYhACQeH5O1b/JDi8m2p+aNOaQk2uKcu6AM67zypbqhsbl3vXycEhs+yC8oZDMD7k+KBD0QQSAF3ubrzUtJ7ZtoZBg== 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=Hj6QP3AF4aXAFQOvMDiGMeqsass/ASyHJ9oGGdbl6H8=; b=cKsujr4YlWzeLNel+5YvZGKVVC7kY0jHS0n6k+Kr38vmfSd8oIW2FrRqU1/duB6NqMcxg84Kbi+Z+E2naN0DNAzPSyOv7+ryJ3AZUGgZc4X2kh0Zjw9teAZPDf5izoGfTbvu8I69webQHg9iNwwNPZOk+RSv/o0lAP9QBYh7DWrpLFmjToc5YtEY8alwd+u5fFx2fA0wNT29xeJTAMRFhos8kW9ti+ep6dlIAVO+DjSGgkbuyIUZxKE8scENcFJqECV4RM9mcI8wnrMY0/ndYi2bz3+XXdoLsovfCVfCLz/Lk+Wgz/dyhcZT4mWTRAZVUc6oAxiMLa/8IBzfwUdBQg== 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=Hj6QP3AF4aXAFQOvMDiGMeqsass/ASyHJ9oGGdbl6H8=; b=RemdNfOxjzYZI/YtNq7T0lnR/qQHWb4HJ2zf9ci+4Sy/EM5MBpW6LGh9Efa2lbEP0SDNmW7VWlmE2ho4Tje0o2SNKXhG/Co1Sh4jrzsRBs6sharMoRY3np1ynchFGDaTWgKROHlsBJQEUYIebu0eXoCa8FzTbZyH/kWimPVSV9k= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by SJ0PR10MB4637.namprd10.prod.outlook.com (2603:10b6:a03:2d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.18; Wed, 16 Nov 2022 21:46:58 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::f7b2:af85:fe37:31a7]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::f7b2:af85:fe37:31a7%9]) with mapi id 15.20.5813.019; Wed, 16 Nov 2022 21:46:58 +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 v14 3/7] crash: add generic infrastructure for crash hotplug support Date: Wed, 16 Nov 2022 16:46:39 -0500 Message-Id: <20221116214643.6384-4-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221116214643.6384-1-eric.devolder@oracle.com> References: <20221116214643.6384-1-eric.devolder@oracle.com> X-ClientProxiedBy: SA0PR11CA0206.namprd11.prod.outlook.com (2603:10b6:806:1bc::31) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|SJ0PR10MB4637:EE_ X-MS-Office365-Filtering-Correlation-Id: 41b885ac-0fdd-466c-0b3f-08dac81c1638 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NZ6hMcNovM5RjaW4AR2rAuCGjHUG5P6nk1pUw43Mhj6PwHj5Gp+kUHz62l5NR3unxMMbErD60nHD5oDKofBLcZFYIsuJQQBHsY9rdCvQUhlOtAQyWPRN82fU443Spwpvq1Sku5yGVLIXP7mcN3BnOdiEMmYOIrB9ZcrPuJbdtQf4Eq/68Ot0egge2drf9N20v/diVapV5HjG/Gtj0wNKs8ayVrU2XebquUVWg9SkAzURk1UnLqezCt6wLCRv8JtKzjKCmiLl6XGh8AbDqHQZjeREztUFnY5mCMDyCtaIqmgZb8cZ3kpUcYlrkRY8bCqR9FDX1Y1fdJ4xQ3DQY21BX5WMUOe5skWa/PwrhocZn+XEIJadok/nheELur0lXoZKAiz2IO6WAebS5jHu9ypddXTF0sTVcStZ9k4rqcHFZudSpx2tTPN9e9IlivFwJZlt4IBW3YHnot9QOrucEOl9MIcukfUMC/W6bGbn6oAWF6n8FDyWJq7nUakQiLBxyeyi8uQTCmbPSVSXPO+xJiVDK7mI9omT/5XEjpCt2pkAuA6O7CSg+SdxStAkb4WIyDRFF6EamhR+fMFhQVbGh3YDEaM5K7k+EPWf5T9HTVxb/x2FraPt61uCBMnv+2MVlv+APpbX4iJoswoJncvsOvvgHs+TeFvjYH4B48GC0vBClSEtyhascm/LKf1nEw2rLmMdPk1obj1LXs4u6fQmUXftkij6NvqnaLV8pXA1ceK+kXE3eF6ieDzBMretxPJysjEl 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)(39860400002)(376002)(136003)(346002)(396003)(366004)(451199015)(83380400001)(26005)(478600001)(1076003)(6512007)(186003)(2616005)(6666004)(107886003)(86362001)(6506007)(38100700002)(36756003)(8936002)(41300700001)(2906002)(5660300002)(7416002)(4326008)(66476007)(6486002)(66946007)(8676002)(316002)(66556008)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EpCiMizW8oUP3Tjc87UfSxqdpd7mvvzEAXpIrSkbT6odY9Qv7hlALNvGKhZTKJP880F47ahQZC59cOHDcyOvInAt+bbCIyJ1pSy9gOVOPs5zwxIb+VwvpPQlx+Ox+uQYixoqghgCLr2d8+jBMa5eWZVK/y2WIljsM3xQulWhaGQ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CXd4S0/zoEX9sQELvSz8M3hOyVj+LB6vFE3DIUTQGc0zX/S5XVAkOykgExyvqMmGKtGpmesom0JaLEUXqEqJMok1E2N3ponFgILWfCp2Zkvzpq5FtjIlOrtC4SNFbAi7jJ2HlBscm99dPMjmYw2jDL14e8bsJKqj0OtGVX/5Bw3aMP0OgXO5rjfoAkeioFOUHB1fES6u6Bcwfh/8DOK7spm1cTkcPW/U8mbYAFVRLNWChOwzo0VFcdLMxGR4mQs0NpeHrtxT/Hl8VaEP3amecm9O+wyzmC/uBRYTkRhRKA06gQwNQzXkFeIzkJKgPEH0LQzPebtL11pbmV554lrRXkfMbasr/SNbjBDfvc5iMkp/Bq29Vjr8QbmnOf0jrKViTwR0DDwvVf8llpH4/6XUXLeWl4YiqQSy45fLm2af5xiAm5S586RL2CkKwKuzznWYYgqAdmkSTLhTuPc7b83DiX0uzYZ+6/15xiUTGdIo0qGDK4BDPMiSChrGwegCtTeuBJcOXLtVbx1hdZhybjTFkByKE4u0u8pTGKL+BvX2me00m4JkBC8g0Rtx6jop8EgItxwIUjdGKCpZZOYlksjDZNtr68UvjV/BL0H/xO4yt6DsKo7QtMZwVFGxhQweHlytkrnlSKS00Wp+apnbMTxhqcjRmrxcM2dtBe8FoFWo4IMzNPhAO/B5DzY+ohNRHO7Q5mzB6b9viCYPKnSglDr+3W73oajLiIIt3HA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41b885ac-0fdd-466c-0b3f-08dac81c1638 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2022 21:46:58.5944 (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: shp8Bh7bySZQc1M8plGPnUADZbl6MRTHjgjSz+SgsPSd8dmO5lH/FhjHp46pzd//wFitGlymzCuDjzmbj7k/GxOJ7wwddSUO0ewwbJGhrBU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4637 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160148 X-Proofpoint-GUID: RAA66WreBW7AneB-7fbPsZNVP48XsRbH X-Proofpoint-ORIG-GUID: RAA66WreBW7AneB-7fbPsZNVP48XsRbH 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?1749691038883296911?= X-GMAIL-MSGID: =?utf-8?q?1749691038883296911?= 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 --- include/linux/crash_core.h | 8 +++ include/linux/kexec.h | 36 ++++++++++ kernel/crash_core.c | 139 +++++++++++++++++++++++++++++++++++++ 3 files changed, 183 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 ebf46c3b8f8b..b4dbc21f9081 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -32,6 +32,7 @@ extern note_buf_t __percpu *crash_notes; #include #include #include +#include #include /* Verify architecture specific macros are defined */ @@ -374,6 +375,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; @@ -503,6 +511,34 @@ 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_map_crash_pages +/* + * NOTE: The addresses and sizes passed to this routine have + * already been fully aligned on page boundaries. There is no + * need for massaging the address or size. + */ +static inline void *arch_map_crash_pages(unsigned long paddr, + unsigned long size) +{ + if (size > 0) + return kmap_local_page(pfn_to_page(paddr >> PAGE_SHIFT)); + else + return NULL; +} +#endif + +#ifndef arch_unmap_crash_pages +static inline void arch_unmap_crash_pages(void *ptr) +{ + if (ptr) + kunmap_local(ptr); +} +#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 8c648fd5897a..4e7221226976 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; @@ -612,3 +615,139 @@ 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, memsz; + unsigned char *ptr; + unsigned int n; + + for (n = 0; n < image->nr_segments; n++) { + mem = image->segment[n].mem; + memsz = image->segment[n].memsz; + ptr = arch_map_crash_pages(mem, memsz); + if (ptr) { + /* The segment containing elfcorehdr */ + if (memcmp(ptr, ELFMAG, SELFMAG) == 0) { + image->elfcorehdr_index = (int)n; + image->elfcorehdr_index_valid = true; + } + } + arch_unmap_crash_pages((void *)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