From patchwork Wed May 3 22:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 89861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1654677vqo; Wed, 3 May 2023 15:44:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CMVhf1tkUTwbcQprNe/9PVd7QsbESAoy/Jjh31IUJwzwexA4lukjqV/iC8KDihYIbUoBX X-Received: by 2002:a17:902:e810:b0:19d:297:f30b with SMTP id u16-20020a170902e81000b0019d0297f30bmr1998189plg.19.1683153846706; Wed, 03 May 2023 15:44:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683153846; cv=pass; d=google.com; s=arc-20160816; b=xa4aWiYZ4V6Dp9zRb1jADMP9PoSQOXMv7HW3N5x6ZAXt9CbHLkvwfILu2rMFwP+ps9 0excJ4MFN9gXMuMFHcYt5X1AuqCwn1W6pyUFgF2H5xa4L+IiPpjawKOvvpyiJAh/UQV8 97Z9rBIYYEXqzeKAyOrgPIksLmEquyNXLxztQQOuPLRfFizaR0DuGW1Xh4fO+RkbifMI PRPJmSewX5+ncHcdEY/gmCgyDA70qPbfPhfRSBahJk903hVbwMoJvVkahl6orckPt1VB Ttyir/RP9AP70/cH81L36f65gp1uPXxgGOIokBcF6JA4sB8o8HcIAsQDap9d7faKKIMJ /Qng== 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=3oNs7VjZoRQtLk6+NTns46Uuyq7OZDe54A7/naaX6YQ=; b=qQIrSq2eRFxFBKpB4AyzvlhfwfoeinjGDktS75eDt1epmShGPL1FVvavnmD0LbHoNs xopM4oDFUI01CNn5XHhWgBLvgK/UJO2R6YmBlFkt1dAsfsGDpdXZA8tuh4XKAxQIkcFe ut8CWpuh0zweEwddwNPzYBlJ285jOosCKdKrFbkxzFa/+0nvyFTkRKXl9MsKXiDAuuww rrhv7ET+ZrAGgAKIUgvWsTC3k0mWYGBCSzWaNc3MJST6tAnwO7Ibz7S8iYM9iKv83TGc K8bAB9KXV+Nrr1p7kZLslPBNu04t0M1TCKTUVpO7MtczWJPDopK5XlgVyEaw1uCd1RV9 CB9g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=N94HDfEY; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cwjxsb34; 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 b1-20020a1709027e0100b001a956801791si28654438plm.119.2023.05.03.15.43.52; Wed, 03 May 2023 15:44:06 -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-2023-03-30 header.b=N94HDfEY; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cwjxsb34; 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 S229656AbjECWmf (ORCPT + 99 others); Wed, 3 May 2023 18:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjECWmb (ORCPT ); Wed, 3 May 2023 18:42:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49445268C for ; Wed, 3 May 2023 15:42:29 -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 343Hoq2v014461; Wed, 3 May 2023 22:42:01 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-2023-03-30; bh=3oNs7VjZoRQtLk6+NTns46Uuyq7OZDe54A7/naaX6YQ=; b=N94HDfEYBfh8QfZiGYgOzO+PKG7uvUnlTQjGmq/DPfuW1d/ySHn8V1lyO8bk6uZgh1Ej M/gc9xaZtvlH4ssXcyowqCFVwM4AL44T6sM5ADMTfe9f5e7TrGHM4uh+1Ok5b8nSMkk7 Y0Bp+ciVKiMTf7JSfkX6I1m9eSIioFBPQlr3mSbzrYYIAmAJsKvzrmIypkc48NaOuJNq wbMj0fynulk9zi5d/mEWwofeWO06Hu1UGC78qvvbXMhVgAbTzHBHg20kS53CC+ioBZxo 9JNJi10Lxe/tUPsoqQHakh1vpDLXNLacHzN9PAVmn69zWUrXnJCpVLFD2ovi1pZ8TeP5 8A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t140mm5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 May 2023 22:42:00 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 343MDhMG040507; Wed, 3 May 2023 22:42:00 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8sp7rs86-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 May 2023 22:42:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TZiW6Gjx00Js76fqIKGKRUsPq60fZUWFpwJzrV6c37f7HEsF2ZZuq2OMmzI0Vh+P9hxLVeOJApIA+vf+vNIfo7ULGAHY7kZlrkEt3xhSM+aGEIf9EiPNo+W58zZ4I/0L8ZCP9gQXMNpGqRlrBZBeyJf6LuLTo2w8SNrz6Ae/Pvf5FAbT0z4/VySBPeeGL1CYsZfQjE5riWDYg+tA9M6psx+GcOgkXPmDyi6m2ErhQptEo4SUWPK1T9UXkyOLJqRasUl7lwamhqXbmc3vD5khBPsBhdTps2QeZIQW+lRbtyvPu70m5SHDGJvkghF4M64U+683ldld5o2Lm2bNGlzzng== 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=3oNs7VjZoRQtLk6+NTns46Uuyq7OZDe54A7/naaX6YQ=; b=RQgj0Ca6gctJ/QLrDXsp1s5H1sZdcoTQxVPTVqevbJaccr/Rwg4DU8NBgcoSb7PZ28teMSSkNxbsk50937/APXqpswvAzQpCNZ1jJNsk76l0wl430AUmgeSVHfl2RsnvrjwhLiarupOjOfNPKuty0YPRwBYUpIhR4bm3GRBXLXKlB3P9Qyv03MXnZ/ICQzCvobzqrglICuLXlO9CG3O811M3eiBnAdURL0GGorPOjN1NGyRS6v6d6KgluNkbminPxgMo0GjVDdxTGmh1VuX6RjqfUDYKntOcrHarhp+bnU8xWx1Wy1xzw5zRorepW/gsk5exbdqCSjFoQ+0Gba1mkQ== 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=3oNs7VjZoRQtLk6+NTns46Uuyq7OZDe54A7/naaX6YQ=; b=Cwjxsb340AriqPU7MhFnveqbOza6SYkJSR6Y1IkruMF+k2oAAgaSfAxgUFxC7h3ekdI+WxyBAxZY+rvg6fGS0M2ygA/6I7/2PHlNiKl18KBdCtyiRW2RtLI3g4rDQBLc4oa3ceST4P7KaIZ7g9C3OkbIvtAMOq6VSCqeqoS2k8U= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by IA0PR10MB6890.namprd10.prod.outlook.com (2603:10b6:208:432::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Wed, 3 May 2023 22:41:57 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::ac1a:bf88:bdbf:2573]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::ac1a:bf88:bdbf:2573%5]) with mapi id 15.20.6363.022; Wed, 3 May 2023 22:41:57 +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 v22 2/8] crash: add generic infrastructure for crash hotplug support Date: Wed, 3 May 2023 18:41:39 -0400 Message-Id: <20230503224145.7405-3-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230503224145.7405-1-eric.devolder@oracle.com> References: <20230503224145.7405-1-eric.devolder@oracle.com> X-ClientProxiedBy: SN7PR04CA0231.namprd04.prod.outlook.com (2603:10b6:806:127::26) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|IA0PR10MB6890:EE_ X-MS-Office365-Filtering-Correlation-Id: 22761ec0-fecb-41ee-2397-08db4c2799e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lLquuHKGCqPIPuLJUyuZ0CFod26e8TZA/FspGrTLqpnwFuidrYS2UaA1hJSFNpWjuR1+Uq+S8C0Wi8rCxlRCygK6wUZcC0sP5lxHpNKk/8wpRw/XlP/n2Rfkfi4HoYsgPIKaWsxKcKx76dA66A2JV6uIv0j5PROuBVaPUB7d5g3wkF/23gaQwmJ0/7cHAvMvhyZGM3D075LaWoIzz0CPe052lSR31POsqNHuNvGziVb4KaHURfs7gHkb8APM9cgbsodwnuWqEM1kfvc4iuykEGyra0xeGoJJo+HB/pYCz08BcQC/K9c6t97/yVbNjgB9R4fYN+hNAuuSvfSgvM+6YeORojR6aPBzh5EUJf1HMZmNZxEMtZecvFj4VfsJiVMFEUAoG6hrRvZ4LzLxEhXuPmnIpoD78eJ52kr62M81yLHxDd7QEN6dz4GPciRcTxq5//tf79d/50upcryhzgJ9wwiXaGuDUaESo0SfopQVtYTaamh1sN6WfOVzjLnq2r7cEVHxoFk+N9Sz6tMLg3CzItBAzrPsQLRQU/3MYTo30Xwp/FNOWMCBOlxQKcANhA5C/uf0Rkvk1/KqfqhtvHIZadTUoIfks3oVxd3qh7mRG34= 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)(39860400002)(396003)(136003)(376002)(366004)(346002)(451199021)(2906002)(107886003)(38100700002)(83380400001)(2616005)(6512007)(26005)(1076003)(6506007)(186003)(36756003)(8676002)(8936002)(66476007)(5660300002)(7416002)(316002)(478600001)(4326008)(6666004)(6486002)(86362001)(41300700001)(66556008)(66946007)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xTZCul1d+BvB4+Q0bo5kzGCIMyOKXAk4OZ7UtH6EZzGbT640buZi069nc4bfpqG7ioJxYwykDD0uUWb2nt6lsA5MR0/H8GC7n6cbqzv0Q4hIPmPuHj/yUw3r3WKInpVupPGeWyQ10T6ds+hHZ2Ohn7jxzDZGs5ia3kpgbhmWNbBcog7cxMYdp1tluAbK/7On7QLq9oTo0jh4LBCc6a+gLAGGTk80KFHpRviOigpyCkf1uVmCzU7gwuH4G2TQAMb+1BdnS+zBMInngQs3+Dg333c7O4vrvT+b2Kioi5QKRBfPbx/qg5aoN8S9A/AFh1NLx8zoR5tCFRGGesleWdD+uv7SzbcLwOKJlSYi6M7hYRjgDfiIJAi63A1LXVmCGbAtkwz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ySjTfP4NKWozlpDJAwE0x8AMcqS5T5u8dmWc4TRuFiONFZWrzdxIULJ43M2XPuBxFQIASnxtMTYYJsWfy0G8IxuffQiT/YJYAwKDKO/J5kBfQAU5rPkYYh4lC1gZszz7JA0iHpYGqMMO0aOOK8RYkOTk6GG6LRRh9DW1Cd3L3gYE0PHiq+KLd58yVhK3K19pyoc5B/aacU3zwQzgde6w1Y/TSlKQS4qA1VpMxr+fcarLMrrrThjoTGdRz0mwJrjdpsDhvPMymNz7+kcmFY1nKuub/IUzTTeXzzTw/0lg+0kADcbiOiUk3y4LiQgxe63R15CfouW/DvjNp+1g= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22761ec0-fecb-41ee-2397-08db4c2799e4 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2023 22:41:57.4436 (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: zzJ58J4332SaWfPO7OrQyUX4BBgMSLNxgwzHCXlGC5t5ISEg1wXvXasFMEqIqNz37phhCj+IGpjAge4NeitMJLvQKARgFUPW4wmnRscZ74I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6890 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-05-03_14,2023-05-03_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305030195 X-Proofpoint-GUID: mxBkNIOZ2XcNnRSJYm8mZRSXL2k5NIH3 X-Proofpoint-ORIG-GUID: mxBkNIOZ2XcNnRSJYm8mZRSXL2k5NIH3 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,T_SCC_BODY_TEXT_LINE 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?1764914728008285507?= X-GMAIL-MSGID: =?utf-8?q?1764914728008285507?= To support crash hotplug, a mechanism is needed to update the crash elfcorehdr upon CPU or memory changes (eg. hot un/plug or off/ onlining). The crash elfcorehdr describes the CPUs and memory to be written into the vmcore. To track CPU changes, callbacks are registered with the cpuhp mechanism via cpuhp_setup_state_nocalls(CPUHP_BP_PREPARE_DYN). The crash hotplug elfcorehdr update has no explicit ordering requirement (relative to other cpuhp states), so meets the criteria for utilizing CPUHP_BP_PREPARE_DYN. CPUHP_BP_PREPARE_DYN is a dynamic state and avoids the need to introduce a new state for crash hotplug. Also, this is the last state in the PREPARE group, just prior to the STARTING group, which is very close to the CPU starting up in a plug/online situation, or stopping in a unplug/ offline situation. This minimizes the window of time during an actual plug/online or unplug/offline situation in which the elfcorehdr would be inaccurate. Note that for a CPU being unplugged or offlined, the CPU will still be present in the list of CPUs generated by crash_prepare_elf64_headers(). However, there is no need to explicitly omit the CPU, see the discussion in the patch 'crash: change crash_prepare_elf64_headers() to for_each_possible_cpu()'. To track memory changes, a notifier is registered to capture the memblock MEM_ONLINE and MEM_OFFLINE events via register_memory_notifier(). The CPU callbacks and memory notifiers invoke crash_handle_hotplug_event() which performs needed tasks and then dispatches the event to the architecture specific arch_crash_handle_hotplug_event() to update the elfcorehdr with the current state of CPUs and memory. During the process, the kexec_lock is held. Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain Acked-by: Baoquan He --- include/linux/crash_core.h | 9 +++ include/linux/kexec.h | 11 +++ kernel/crash_core.c | 142 +++++++++++++++++++++++++++++++++++++ kernel/kexec_core.c | 6 ++ 4 files changed, 168 insertions(+) diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index de62a722431e..e14345cc7a22 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -84,4 +84,13 @@ 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_NONE 0 +#define KEXEC_CRASH_HP_ADD_CPU 1 +#define KEXEC_CRASH_HP_REMOVE_CPU 2 +#define KEXEC_CRASH_HP_ADD_MEMORY 3 +#define KEXEC_CRASH_HP_REMOVE_MEMORY 4 +#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 811a90e09698..b9903dd48e24 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 */ @@ -360,6 +361,12 @@ struct kimage { struct purgatory_info purgatory_info; #endif +#ifdef CONFIG_CRASH_HOTPLUG + int hp_action; + int elfcorehdr_index; + bool elfcorehdr_updated; +#endif + #ifdef CONFIG_IMA_KEXEC /* Virtual address of IMA measurement buffer for kexec syscall */ void *ima_buffer; @@ -490,6 +497,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 b7c30b748a16..ef6e91daad56 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; @@ -697,3 +700,142 @@ 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 of cpu and memory resources + * (including onling and offlining of those resources), 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 crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu) +{ + struct kimage *image; + + /* Obtain lock while changing crash information */ + if (!kexec_trylock()) { + pr_info("kexec_trylock() failed, elfcorehdr may be inaccurate\n"); + return; + } + + /* Check kdump is not loaded */ + if (!kexec_crash_image) + goto out; + + 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, the elfcorehdr_index + * is set to -1. 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 < 0) { + 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; + kunmap_local(ptr); + } + } + } + + if (image->elfcorehdr_index < 0) { + pr_err("unable to locate elfcorehdr segment"); + goto out; + } + + /* Needed in order for the segments to be updated */ + arch_kexec_unprotect_crashkres(); + + /* Differentiate between normal load and hotplug update */ + image->hp_action = hp_action; + + /* Now invoke arch-specific update handler */ + arch_crash_handle_hotplug_event(image); + + /* No longer handling a hotplug event */ + image->hp_action = KEXEC_CRASH_HP_NONE; + image->elfcorehdr_updated = true; + + /* 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: + crash_handle_hotplug_event(KEXEC_CRASH_HP_ADD_MEMORY, + KEXEC_CRASH_HP_INVALID_CPU); + break; + + case MEM_OFFLINE: + crash_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) +{ + crash_handle_hotplug_event(KEXEC_CRASH_HP_ADD_CPU, cpu); + return 0; +} + +static int crash_cpuhp_offline(unsigned int cpu) +{ + crash_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_BP_PREPARE_DYN, + "crash/cpuhp", crash_cpuhp_online, crash_cpuhp_offline); + } + + return result; +} + +subsys_initcall(crash_hotplug_init); +#endif diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index 3d578c6fefee..8296d019737c 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -277,6 +277,12 @@ struct kimage *do_kimage_alloc_init(void) /* Initialize the list of unusable pages */ INIT_LIST_HEAD(&image->unusable_pages); +#ifdef CONFIG_CRASH_HOTPLUG + image->hp_action = KEXEC_CRASH_HP_NONE; + image->elfcorehdr_index = -1; + image->elfcorehdr_updated = false; +#endif + return image; }