Message ID | 20221031193604.28779-6-eric.devolder@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2507663wru; Mon, 31 Oct 2022 12:42:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WmctV4miC4tIgVwTYTJ3+lqdqK6C5zw08fJVbbM7RBwl9SztjlqeAh78L5MdFNGN1mGr0 X-Received: by 2002:a17:907:aa1:b0:7ad:cd92:a48f with SMTP id bz1-20020a1709070aa100b007adcd92a48fmr7750675ejc.369.1667245365709; Mon, 31 Oct 2022 12:42:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667245365; cv=pass; d=google.com; s=arc-20160816; b=LE+vkkrVszkYpxhF64pbqFXLtroq0ilPiLomlkrXwN6kbjZCtrQcdWS4NCKU7bG5xO S+hrQg/OWkNl1sPzbbvehHGV2RtN9PNtY5qrSuN0sk1DKJO0LWtebNIOUOC9fYInYLII XWKyU7Ptn2JzSsZaEVW5nYnybMg1gienaGdFc+jP4XHjhOFR/sqgdaM8Iyc+yXJ/Gyd3 mbzuR/iJ6XQoy9NhjWdTQk7705Fx+MufhQTRKiTKosPJH4hrCc31ehN85hq/oociz18o muCXGLD97+007p5bW0FFYo9QIIDzv5/VbNGfNkTyhiIVJV9hyRqCCxCvZ+xsMCZqPz6Y FP+Q== 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=4FuJFOdktghNoyHGaLWoA78CkTP8gKQRefEyDrRVWis=; b=noyHsw7cyl+a3CMRFtrRblcQgK4I0oT6f9msatiuvczSd8OqsLAat62OrPBzJD3i6u b7t6vtJYMyotgVmG8YD6BIUCUS1VE7qGGFdTvaQadaqnzaFMbYs+ZoQEPxX1GfUUxOZo h4hSMp+JK2GlhAGRxRb0MW7nxi4AMITmh+tkKXRXTmuSODWOMLPTbn9xmKkdeM/TnA0U 3uyDWNJDao8AGrwAGQ2+pQ/KQRDEt1+r/UO+6r/7dn4nFN1BLroKh2Hd4YQtZlfMDM7u hvIa2LqqH09TumEk6eKrz67BawyS8v/yfj12W+i/k6os2XyTgytqOZvwuLAK2o0EPNYp YtPA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="k+1Id/uN"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rvdiCCSY; 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 h15-20020a056402280f00b004635f094565si5519969ede.535.2022.10.31.12.42.20; Mon, 31 Oct 2022 12:42:45 -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="k+1Id/uN"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rvdiCCSY; 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 S230111AbiJaThP (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Mon, 31 Oct 2022 15:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbiJaTgz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Oct 2022 15:36:55 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A74C613DFC for <linux-kernel@vger.kernel.org>; Mon, 31 Oct 2022 12:36:54 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29VGxI8G001214; Mon, 31 Oct 2022 19:36:29 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=4FuJFOdktghNoyHGaLWoA78CkTP8gKQRefEyDrRVWis=; b=k+1Id/uNZf92wKS+yrcxDa3Ro8rN9jq5NtMVkB1Ywc/Y6KIdKUMo2pSU4INW2qF9EW9K 3UAoLzhC5Ej4OqBNLMa10wKacnaOWA8WvTLF1kMWP44jyn9dhkNTkyoC6y55KlsNAcTM Qfva0I4DtvgnAn1Ss+OqnevK8C+k0cPGBbCh38L6HosJ6nDtz9dGuIGfSBdN3NJ3lzp/ 6bhGcNCf71QXUoaPeiOYBry1zKXUXq6u6scNxiaf+OnIX0tTUlyBdYYSnRq43uIftE93 InYhrKBnWlfRxVwX6nNpy8bb5hmuk2hnzBO5B8WMTL2Z2fNklhSvMG3+jsz0htu8B5Rw Ig== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgvqtcqum-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Oct 2022 19:36:28 +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 29VJXEkd033125; Mon, 31 Oct 2022 19:36:28 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm3nkfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Oct 2022 19:36:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jHxglbmK+mTVOZnUxaXIzgAIwZQqMVDEDL1HVKXC5viy0hupd/ATY+Gt2vIo6uBVAsnMYx1jG12dJFaDs0uWfYsiOmwE1XzZig0XQwnR5eFrZ1fs9mBEZULKyxjbrtxEglsw3dAZ2dnFIBP2KIxuguM7g6ieTL0lW/oXiwCqHj89TSCo83GweIG/H0R6CQqjDpalXR4DlTi1avGNJVlnTSSOMGADUbL482e/MpRwblSJp6ybqZITjLpMf7F8ShbPvCs5rwdBK4rhf0omu63FzQpEeD/YySMC6Y+MB11770mfmsPgZLwJ4mgTf+cDLc+LjnIDtR/6zWfzYwx0811SSA== 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=4FuJFOdktghNoyHGaLWoA78CkTP8gKQRefEyDrRVWis=; b=SBtHW0kkJZF41D1sHr/AGcKQbFJXxzIpZ91U0E2sRdN+NffkmfYbuBJusu3L/muTIB/3D1gec3dOFO4boSPDLicLdxH3L50m+1Y1MbNAAKFv7rodIRkRCEuiI5nF/IOtHxbJHQDcI2pDRbSiR392f0GbDP/D58CgM2jibQDEBmNkc57xR80exJKK0Csjbe++SuOFeOUDqA4pAci2jtzvyI4b6Dq9NX8kly4/d1luVKbUKlAGTlR1RdC5Gbu6DE5OE0r2XGwIso6JToYjL7G4FJYsMvLSiMpj3CkqW4IhGpUhruvE+y0z13pFhnHkZNkzmAxtBAZMXdGdRWgHyj85YQ== 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=4FuJFOdktghNoyHGaLWoA78CkTP8gKQRefEyDrRVWis=; b=rvdiCCSYdsYG31eNkg7KXKlDbgl4cGiVNOFaWEHhRAX7KdtM5Au7bc70f8zYdaxLZBsCFOx9yolUCzUyNPUT8zvWwdL95cwiFFMKTO72mxyRaC9RVHJl5t6pDd8frgAlZchWzgay8E6pu1JTQaBNSLCVuZRB57we1kFi6esyLW8= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by IA0PR10MB6793.namprd10.prod.outlook.com (2603:10b6:208:43b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Mon, 31 Oct 2022 19:36:26 +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.5769.021; Mon, 31 Oct 2022 19:36:25 +0000 From: Eric DeVolder <eric.devolder@oracle.com> 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 v13 5/7] kexec: exclude hot remove cpu from elfcorehdr notes Date: Mon, 31 Oct 2022 15:36:02 -0400 Message-Id: <20221031193604.28779-6-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221031193604.28779-1-eric.devolder@oracle.com> References: <20221031193604.28779-1-eric.devolder@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA0PR11CA0194.namprd11.prod.outlook.com (2603:10b6:806:1bc::19) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|IA0PR10MB6793:EE_ X-MS-Office365-Filtering-Correlation-Id: 29e334e2-2239-44f6-91fb-08dabb7732e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Uy8IZSt817Bk+cOHtitjaY+BH0c9+h2diw0+aGHLwkPdmJ6tEDP9qZpvkqRTnoT8WlWmjm+6it8rSxcgGqkiX7IEvpLyO0vW4ZqCEJfl7+MHkdyGPNQwlpJSUWnTTe5BfnvPw6dl2MZ3sE9whn+eOcpLxL94pbrKC3pcRmfJi009kah/oSnWNfNPZEd1rh5sQLTNnNsG7Il4/Wd1Hqc6+/0FK4QgDl1SloMSaAvUVwMf/8ixIEYLVMRb9XlEaRYnWlWArisZawzBG8P2622Ccqmh9RBPdDgUZqzhYx2W0qoraeKL30EscHNAJKxIYHC4RTzhD0SPdP/fSmg+x0B8KnNkwjE2cGJM+bD7D32Ne4G32viOhOxi3YTQEQBqDIW7PvsgoEJYNF+1ssr4M7mFeruHAV22QB3SgNlBjIfIWolQUyOtgPR+aRd4lNj+YuhnH4Cfv45/TNpwc2lVmPROMYkz+tm3wShCrkGR4NVOJh+DgnozWhV73xyRCsgK/gobGZaCHf+eyxppnIpoQO7J7hrBrQ8jtOa9cqyg76aMqI1fscMM+RH5vQWO3f91hjYuAQamqSqrEpNcl2GFQOMHP+bsp9JLddZ6p8OKpmVnZPocu6w6X2i2p2kMMfPaXjoTTdiZyqAZkFGlpRYAU4W9IaAXL7gVM72DiJndTl8sKqo7X8v/LfuDPo3YVtUX5VAfXGQ2NtiKaLkG0ePWo/lew== 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)(376002)(346002)(39860400002)(396003)(366004)(136003)(451199015)(186003)(2906002)(1076003)(6512007)(6506007)(2616005)(6666004)(83380400001)(26005)(107886003)(7416002)(66556008)(66946007)(41300700001)(6486002)(38100700002)(5660300002)(478600001)(86362001)(4326008)(316002)(66476007)(8676002)(8936002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jrHVU+0zayFPw5PodpnqM2TMLnUTS14P5ecG4XMBzxiJ2Qtc+lPtnmFTJgiBhsU+/E4vfnzOmY72aaAS04nBBMjjuKPGL8jLBFLaFFE0veYkS0aCQIHg8i7pJX5rzP9c2Sz8zp0hl1rt0481lIN3iBitctjrUr83DHFJbwap5ko0bJJruLX1IOjRA+CinY3tTmq+Dkv8InXYwYs3jt98PUYDwKjEZVm0ssarAMudJW+hcNLZnbVx0uEf6vYv/w+di2Q7LKcbu58X2bI6I/9lO0OgmplBionEbDHBY4vnuqMemo8iw6yTk5ZjZb79Ag1e22o0di7mIJ3dHF6TB8iAyzg9DBIEMY3QQSWuLVzNtYZn0NcaYaTyHzJRjjJBzpPzVZPtXoPAHjvFvkZjzxX03bGdHco50zx16tJRkDlcpk0hRj1Fa76ANjuHnym+AVi8zMBJGilvO4MjlOzpqCXQwDocMp2sTnssFfmyfAwaipF2iLCopmiBRlieXCLbfIJTrqn3DdROM7yCUYLwcrsAFbPYGk9d6StaFZeNCXSN6aCK9vsaD7SfTEgiOdnGZTUkWRaCeiX0CkbFPALPyc3a9uVNkwywhvYrGrTWl4fbI7ZgSE3eyanhIEILAhld4Yzu9wQR1SgOOszybuaxBOSmpPvgpk6CtjKrdEDp9f5vCkIBGMVZuuxmQKKyCakAJHh+5Fnq71Ez3x4vC40WNGFREFA1+XvzNdWaY+MEDNSitBWVQRcNS/oBDGOXoCScYOvy14MSJBjKuTqFTQAGEmDdmYCqzkb6jXT6uEOkBTJKNyFOsYxZjH0XD1NNKAV8kLpuJyBfVWxvBu4k3AZ5SqNmnNlsK5+HjWTQ39yFMMpB2BOi20Hs1sCWSUn/3jqJc4VUENHGmW9EX39Fs+HCzb6Hzw2M6lNinXgw2t9yuR7JJpGMozF+TeJC8OkJ3nSWi60ZdU3pg0nMf2OeNb88NrvxEVCRzIL3UF7VZM9tl3DsunI3Rmpc/LdulqaNpCW/zEDFNz+Pc+pyv8KwALZj7tuW00S8mV/nt+hM2LjALbLSRLEblp4eFSeBOjc51T2lfYBS0PwS9F11b6O5AsKzHNQcwT38CeaIRex1jKAgQ6d/BJiF0SMzklRLen9OlEyBPpTlG3+Vm15VGPvLXTNLEAw5iN3dAchdmCSC8lgiOMwmOp+7cH3t3yAufCCbhq3cxvf+2fDIs0cXP4s4I7mHeSfzApIztHA1diBi10E4VE6r3o9MfO9WROXAjVgy8JEaDm3tWs47MmPI5CY9WqyA99rRy9uFLUycUNEJPaxdFW/0D6rrR5NZhdXUZE+FpdVhCz6D/qv4o9YMTWAR69RhGBnvOddS3t1e6+rM95e+4swLAXvxfDwnFTWAWKQ21aolz6QQHB+QEkZLdKxojsiJ3kn/d7yw5wAVN6lzdXAbTVF/SqwX3hdRigMTdVcC8lKL0YC47Tn3Tr6uM4dY/tiK78Hw+2ozWOetXzwEGD1cAlmiwjYp9rfzBt0qiKn4jimNqSSBLm3lpUu0/dXL9eqXHae96mp6lxfYzaJkELwvSq0KGf1nsv1VRWySiQOv3EsMQmScDtNwYKpQcj5/dgJe747ylg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29e334e2-2239-44f6-91fb-08dabb7732e7 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2022 19:36:25.7916 (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: 80CKNwEbECAYYIzBT/A0AOtconFurazWrzzfmblwjTlZ3pmqCLWYqDn7c+fArXOcdaHZvrc7z36lftn7I8LdVtjlYGUZemxtGlVP2vnqWwg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6793 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-31_20,2022-10-31_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210310121 X-Proofpoint-GUID: 1wypTOrUMJNi4lIKITGoEIEEdk2rWfwY X-Proofpoint-ORIG-GUID: 1wypTOrUMJNi4lIKITGoEIEEdk2rWfwY 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748233476541607166?= X-GMAIL-MSGID: =?utf-8?q?1748233476541607166?= |
Series |
crash: Kernel handling of CPU and memory hot un/plug
|
|
Commit Message
Eric DeVolder
Oct. 31, 2022, 7:36 p.m. UTC
Due to use of CPUHP_AP_ONLINE_DYN, upon CPU unplug, the CPU is still in the for_each_present_cpu() list when within the handle_hotplug_event(). Thus the CPU must be explicitly excluded when building the new list of CPUs. This change identifies in handle_hotplug_event() the CPU to be excluded, and the check for excluding the CPU in crash_prepare_elf64_headers(). Signed-off-by: Eric DeVolder <eric.devolder@oracle.com> Acked-by: Baoquan He <bhe@redhat.com> --- kernel/crash_core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 3a0ed4168fcd..bca1b198d9e5 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -366,6 +366,12 @@ int crash_prepare_elf64_headers(struct kimage *image, struct crash_mem *mem, /* Prepare one phdr of type PT_NOTE for each present CPU */ for_each_present_cpu(cpu) { + if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) { + /* Skip the soon-to-be offlined cpu */ + if (image->hotplug_event && (cpu == image->offlinecpu)) + continue; + } + phdr->p_type = PT_NOTE; notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu)); phdr->p_offset = phdr->p_paddr = notes_addr; @@ -684,6 +690,16 @@ static void handle_hotplug_event(unsigned int hp_action, unsigned int cpu) /* Flag to differentiate between normal load and hotplug */ image->hotplug_event = true; + /* + * Due to use of CPUHP_AP_ONLINE_DYN, upon unplug and during + * this callback, the CPU is still in the for_each_present_cpu() + * list. Must explicitly look to exclude this CPU when building + * new list. + */ + image->offlinecpu = + (hp_action == KEXEC_CRASH_HP_REMOVE_CPU) ? + cpu : KEXEC_CRASH_HP_INVALID_CPU; + /* Now invoke arch-specific update handler */ arch_crash_handle_hotplug_event(image, hp_action);