From patchwork Fri Aug 4 21:03:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131397 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp142411vqr; Fri, 4 Aug 2023 15:45:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjOhzgaq1LrFCx7W1+vR8v1DSHrJZAZcrwIrCh8PyHOA2mo6fsaJdE5AeR8G9/nmTtZ9ja X-Received: by 2002:aa7:d306:0:b0:522:2b76:1985 with SMTP id p6-20020aa7d306000000b005222b761985mr2240653edq.2.1691189104232; Fri, 04 Aug 2023 15:45:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691189104; cv=pass; d=google.com; s=arc-20160816; b=B+aTbETwLYfX9elUwOGj05l+I4+skhhjggA0+0nE6BwXrG0EJenBOADEtuXrKtC4hL ZxSS/7bAZRDI2OS2svqZgho4243s0TyS3B7eU+JBi3XWLCPy13G09qq85uMFclR3MhQo oOqYVGJnHEdc1ijWGySMYMk3azkbX01XY0TsHglGF96NPqfB40egDh8FGl6U439rPveT ur9AXCrO1c4qkku/QWa9o0VvSbp1sNyD2zoMjat+oSIpIYkm+ISJp4HqUezflSUrn01O /h/0Ox7g+fvuRzF22/7ZdWagZS4Ywx2siwr7mJeBcITXgG3k9ni8/316JE8seUJikFgG 4wnw== 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=5eYj+23ZC7VzOGJgW8YD6nEDB2+diEwDOwLRzF4YxgI=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=sRGr48s+byu1We03szYQ2q+tXijlu48Q1eZtwHz8iLxA3vxFT/17jyRkCgxrBIySlv 3jXjN0hVgt2I6L8EzuL+8AEH+eqlJluoYETd6+QacIWjS05msRAjFlxzG4v7gm8tasp3 XH5n++VlOP2+Ad1tptakixNkX6DckD6I9A4Ao9tIlR5kFvx2yEMnBNOliPE439XG35Aa b+IA9qtOtO1+mEROUFE2xTaB+BrpKuwXQDNDdbNrQO4Q8eHAbH0TbOKn4edF2FQDoC3i s+GztDx/dZjM4m3l0pNCeNYQkClsemS9ZEP9CUm+eP7zonFXFZrOfu2DATuJF6JuUrB/ R+PQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=xmWF7PHj; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=h74VH6nF; 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 e9-20020a056402104900b0052306e00649si2170083edu.413.2023.08.04.15.44.41; Fri, 04 Aug 2023 15:45:04 -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=xmWF7PHj; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=h74VH6nF; 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 S231159AbjHDVJZ (ORCPT + 99 others); Fri, 4 Aug 2023 17:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbjHDVI4 (ORCPT ); Fri, 4 Aug 2023 17:08:56 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A1A84EFF; Fri, 4 Aug 2023 14:07:55 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 374JCft4007577; Fri, 4 Aug 2023 21:04:15 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=5eYj+23ZC7VzOGJgW8YD6nEDB2+diEwDOwLRzF4YxgI=; b=xmWF7PHj+DUzrCBbXqkH/KjCf11tDxe+Wr0I4Yw+d39g+AxPaWIDy1plX14QARHd6mqD KXLfuQywH9qThdKw0e0F7Q+o3k6BxfyQkGH92cy1fJIcCmBYy8/6m4MCGf4pfWVQKnO8 0Un7c3IYska07CBzcERrMwRD5o8SgOq2Nmve/cAaQkqNW7ZAyg8wW6CH130gnt710usZ 11Uja4fZQ8YSoKEvk3fIhf+iK5Y7H9H8ciJGr4GcsG00dxgmu3NEG9F17r6fNUV+kWRZ JJedNLZfmoAWycZjYdjtMecII+H6+lrbhMVARt/pbS99JsW7W+3pLeCVaRNceOOmrflr eA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4ttdct8r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 374J4Wno029410; Fri, 4 Aug 2023 21:04:13 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s8m29nq6u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LU4fzF26BHZF1rmXc6dRdscfdB5M7IkfoS5onv8xbho6wMh2TEuwMxshEnPB0F53/ZaZlZkRd5JmZRPnJC6yXurTQIvhQGvvclQAWDfOWE6E446t7qsOFNjLe+Jkt7sTG5U5sDQgpky6tqdn039sbi0XOf++paDcHYSs9UVnmebMoPjLOFojAmeAWVAjTwZjs7amCyYMFlxulhcIIRbj0wxUHxwZCP6TeBdxEF1T8r0aAlED9WEvTNAl1uE5r/JjdBmOkmjMqxHrCY7xbW5rc9jFGKTJNCG8d4I/AaPWtNDohSQw6MleCNLam04nGSUl7W0gRopC960dsRchojKFdg== 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=5eYj+23ZC7VzOGJgW8YD6nEDB2+diEwDOwLRzF4YxgI=; b=ZQhoLGrag9A0Z2wa0jvDzTgJy0jRq6OMDrSIH67Nk/EtsLsLSy1CLezjlpYJhtxvEU1fEgFFONGZBoB9oPNUsNBZHvtdX1FROPekxx4QFy1zvp4iFqWjycOh1gWq3CPjguRycKwFDItNNKKd/fkpVBuX8pZarIV6QA4Gj8wdWhpITPGcQ+q/SkZM3QbmFfleNf1dSFfrY6794qA4izCLb7OTgd9KdbrnO73lR35pvF5C3ptodhyTiyS8LnLekBXbTfBaUO7ZVXGpwTdOAHYS+OtA+GMuw59qKZF2Hg+RP3NP5WhMFGl7hmh0Yrj0UcOeHRCf9c+8PmaN5Hpy0KrydA== 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=5eYj+23ZC7VzOGJgW8YD6nEDB2+diEwDOwLRzF4YxgI=; b=h74VH6nFQCCiBVxw9H66YGey1yUMfeDNhdZFJnB4HnkitmjXg63Gd4YrADSKfTE7DCvuMxrNDqBd0+dLN3DHn3anOfDcuo+oOd0eREtg50NF5vhh2pKOSRQCGDNTSLmcAPJ4Ci9TJfSf8yvFkqHR2/IoBv5cTbmI4hLC0M8N6gs= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by BN0PR10MB5014.namprd10.prod.outlook.com (2603:10b6:408:115::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21; Fri, 4 Aug 2023 21:04:10 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:10 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 1/8] crash: move a few code bits to setup support of crash hotplug Date: Fri, 4 Aug 2023 17:03:52 -0400 Message-Id: <20230804210359.8321-2-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: CY8PR12CA0048.namprd12.prod.outlook.com (2603:10b6:930:49::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_|BN0PR10MB5014:EE_ X-MS-Office365-Filtering-Correlation-Id: a5f09b0a-fa43-46fe-e8df-08db952e5954 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1HgXG/2jZRuskRLs+lGQ3IH32sgEZiwLHB03C98M86XQlz/NVGLSe4hAY/0QLhE7edE7kmpbWm+4dK44vovdma0MKII3HnAQKNYJFVrKJWIeIEOdQFez3sVUKPdTqTELRDnzyNM+7fiqcqiPrURGOekIhpEMRvgrMhxz+lLyvJdAcai/VwkzuWh0+5YFBJTGuqtj8DHFPKZ9fPjkV9IMw+E6Q8lSV+iLHJSAm0Fn2xFC3M32F+hyPDKQgUHhXFmG/fHVzyRwKmCtLSAyHwRPN5FAKFRR16PnAX2SyU86i/L42GTkquUdnn0o9lY02GTWfJMTtOLjT1TWwVj8frEml2tcAXpagEc/56iQ+TNo7kTmA1pS5DNfG3e5n/zVjAqpeBIPqW0SzfhBXAFc1DYMOilW4Dsd/hyacs+zboOvQuri8WTUXiW0xxPh9onaqMa4kOgzpxW7gNt6kn0wsgZu1WmhLnimq2xOCyCysCEmmwIEqKp3g5H7bE/XTwxAcxQO8jH4oU1TDwadVDpAdnla4TQF3DD4+gCLDSBED0eRdvt62JhjgT/t8rme1+S9d48MBNohU2mDMD4+khqaIsh4k82wcaBHQvILJGu70fLHw00= 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)(396003)(346002)(376002)(366004)(39860400002)(136003)(186006)(451199021)(1800799003)(5660300002)(7416002)(7406005)(4326008)(2906002)(66946007)(66476007)(66556008)(30864003)(316002)(8936002)(8676002)(41300700001)(478600001)(86362001)(6666004)(6486002)(6512007)(921005)(38100700002)(6506007)(1076003)(26005)(2616005)(36756003)(83380400001)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vN4IXoErjb8mvhwd+0E0oOrRlfwGuGRf6FLyc+tv/IaZ3B0wtg6rNlS5/S4i46J9ngJ8jlptX4o5hi9byoJe+krNV0+1JisDhnmvn0wigSXDZ7h93z5WoefGgA72S69T1KGXPODxmRukL+Vf9TeYpPL1arHYZ01pGtchcNlcU2Yvc4tk7cqV1dnQ80ByTd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D3bnEbC9Q/e1oZciYDOkT/WcHipYinptazUXE6Uw3biPebaemIZvu1pgoI2O4VpNfOuPKb4+L+nQPIQZZWUfUdOY2KNgD64olel35X1tX9PwOiedpIs4v48yS6Fnsi+tT8u81zfkY2hd8puBZjSl0LMBnR7/tF1iHWVqRgYrUX0QSxtNhhlWD1ObA8XVcqzIxWA+t1zFeaMHQRhvm34ELR7Ic6yT2hUjnhDjHyxLxA03nT4TfL50uFTJn/DdGoycrFu0yly5oW7rN/snaDdZLpv9VvmnbZgc44q+EFENLSGrpOJcbKe6nSMDkkzZj1TjK5vGu3kaVN73qai6gz/RsdqjO9URewfuQVHIQq4+Bq45Ii+FxuYf+JPrHrg2Gi2MW+xp7u39DlCcTXZ/rdAO0s0cY9kZu/tOeNdU/Mj8uleW+E6YZOttHVtSmmBgzOo3ayiDzAaVghRFWfyJclViA6LLblqCslxla2Hm2xH9J2sS3S4hF6HK0kiXmSyxVHNAXcb/MaLQGfs4ZOan1XO1cXBO1vkzOYl6PyiX2vBWTOh/63c2CvDuRZzvftSc2B0lJHU6QF6mMlM6a3gpgRu/JBGLIbaVMm0H8Udegm+1YD338YdjoStn0rCZK0HPf1Ggq5UuntxTx6HM493wFg8LadI5RLpQvzUqYyVusBKmKn0YMKrP66iazgfRUEHaG9X6WzFKx4JBAcUS6him1a+XqWNHiPBDdztmGgl9sMXQs4Hq8qz3TwWUuGSc4PifGxByk9iZRMADuuaXza0HOJ/8EjqhsH0uqE7K7TVFM8c13eojeVqrufOkrWG0hgCsvxOkFew= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5f09b0a-fa43-46fe-e8df-08db952e5954 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:10.4994 (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: O7uUjUWouaIPiAMqiLUJSpQyIcqQhgSC9EyVoon1V5i2K7GvFJH7RfD7ERhtBUVrVi22kKf/vZ7VGC+6Kbtjpopy70hPnAbfYJp+7rIJU+M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5014 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-GUID: pBZEDHZL7xB3BuozkEAhD4EHjfZXDEEt X-Proofpoint-ORIG-GUID: pBZEDHZL7xB3BuozkEAhD4EHjfZXDEEt 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773340306381164622 X-GMAIL-MSGID: 1773340306381164622 The crash hotplug support leans on the work for the kexec_file_load() syscall. To also support the kexec_load() syscall, a few bits of code need to be move outside of CONFIG_KEXEC_FILE. As such, these bits are moved out of kexec_file.c and into a common location crash_core.c. No functionality change intended. Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain Acked-by: Hari Bathini Acked-by: Baoquan He --- include/linux/kexec.h | 30 +++---- kernel/crash_core.c | 182 ++++++++++++++++++++++++++++++++++++++++++ kernel/kexec_file.c | 181 ----------------------------------------- 3 files changed, 197 insertions(+), 196 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 22b5cd24f581..811a90e09698 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -105,6 +105,21 @@ struct compat_kexec_segment { }; #endif +/* Alignment required for elf header segment */ +#define ELF_CORE_HEADER_ALIGN 4096 + +struct crash_mem { + unsigned int max_nr_ranges; + unsigned int nr_ranges; + struct range ranges[]; +}; + +extern int crash_exclude_mem_range(struct crash_mem *mem, + unsigned long long mstart, + unsigned long long mend); +extern int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, + void **addr, unsigned long *sz); + #ifdef CONFIG_KEXEC_FILE struct purgatory_info { /* @@ -230,21 +245,6 @@ static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) } #endif -/* Alignment required for elf header segment */ -#define ELF_CORE_HEADER_ALIGN 4096 - -struct crash_mem { - unsigned int max_nr_ranges; - unsigned int nr_ranges; - struct range ranges[]; -}; - -extern int crash_exclude_mem_range(struct crash_mem *mem, - unsigned long long mstart, - unsigned long long mend); -extern int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, - void **addr, unsigned long *sz); - #ifndef arch_kexec_apply_relocations_add /* * arch_kexec_apply_relocations_add - apply relocations of type RELA diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 90ce1dfd591c..b7c30b748a16 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -314,6 +315,187 @@ static int __init parse_crashkernel_dummy(char *arg) } early_param("crashkernel", parse_crashkernel_dummy); +int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, + void **addr, unsigned long *sz) +{ + Elf64_Ehdr *ehdr; + Elf64_Phdr *phdr; + unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz; + unsigned char *buf; + unsigned int cpu, i; + unsigned long long notes_addr; + unsigned long mstart, mend; + + /* extra phdr for vmcoreinfo ELF note */ + nr_phdr = nr_cpus + 1; + nr_phdr += mem->nr_ranges; + + /* + * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping + * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64). + * I think this is required by tools like gdb. So same physical + * memory will be mapped in two ELF headers. One will contain kernel + * text virtual addresses and other will have __va(physical) addresses. + */ + + nr_phdr++; + elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr); + elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN); + + buf = vzalloc(elf_sz); + if (!buf) + return -ENOMEM; + + ehdr = (Elf64_Ehdr *)buf; + phdr = (Elf64_Phdr *)(ehdr + 1); + memcpy(ehdr->e_ident, ELFMAG, SELFMAG); + ehdr->e_ident[EI_CLASS] = ELFCLASS64; + ehdr->e_ident[EI_DATA] = ELFDATA2LSB; + ehdr->e_ident[EI_VERSION] = EV_CURRENT; + ehdr->e_ident[EI_OSABI] = ELF_OSABI; + memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD); + ehdr->e_type = ET_CORE; + ehdr->e_machine = ELF_ARCH; + ehdr->e_version = EV_CURRENT; + ehdr->e_phoff = sizeof(Elf64_Ehdr); + ehdr->e_ehsize = sizeof(Elf64_Ehdr); + ehdr->e_phentsize = sizeof(Elf64_Phdr); + + /* Prepare one phdr of type PT_NOTE for each present CPU */ + for_each_present_cpu(cpu) { + 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; + phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t); + (ehdr->e_phnum)++; + phdr++; + } + + /* Prepare one PT_NOTE header for vmcoreinfo */ + phdr->p_type = PT_NOTE; + phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note(); + phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE; + (ehdr->e_phnum)++; + phdr++; + + /* Prepare PT_LOAD type program header for kernel text region */ + if (need_kernel_map) { + phdr->p_type = PT_LOAD; + phdr->p_flags = PF_R|PF_W|PF_X; + phdr->p_vaddr = (unsigned long) _text; + phdr->p_filesz = phdr->p_memsz = _end - _text; + phdr->p_offset = phdr->p_paddr = __pa_symbol(_text); + ehdr->e_phnum++; + phdr++; + } + + /* Go through all the ranges in mem->ranges[] and prepare phdr */ + for (i = 0; i < mem->nr_ranges; i++) { + mstart = mem->ranges[i].start; + mend = mem->ranges[i].end; + + phdr->p_type = PT_LOAD; + phdr->p_flags = PF_R|PF_W|PF_X; + phdr->p_offset = mstart; + + phdr->p_paddr = mstart; + phdr->p_vaddr = (unsigned long) __va(mstart); + phdr->p_filesz = phdr->p_memsz = mend - mstart + 1; + phdr->p_align = 0; + ehdr->e_phnum++; + pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n", + phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz, + ehdr->e_phnum, phdr->p_offset); + phdr++; + } + + *addr = buf; + *sz = elf_sz; + return 0; +} + +int crash_exclude_mem_range(struct crash_mem *mem, + unsigned long long mstart, unsigned long long mend) +{ + int i, j; + unsigned long long start, end, p_start, p_end; + struct range temp_range = {0, 0}; + + for (i = 0; i < mem->nr_ranges; i++) { + start = mem->ranges[i].start; + end = mem->ranges[i].end; + p_start = mstart; + p_end = mend; + + if (mstart > end || mend < start) + continue; + + /* Truncate any area outside of range */ + if (mstart < start) + p_start = start; + if (mend > end) + p_end = end; + + /* Found completely overlapping range */ + if (p_start == start && p_end == end) { + mem->ranges[i].start = 0; + mem->ranges[i].end = 0; + if (i < mem->nr_ranges - 1) { + /* Shift rest of the ranges to left */ + for (j = i; j < mem->nr_ranges - 1; j++) { + mem->ranges[j].start = + mem->ranges[j+1].start; + mem->ranges[j].end = + mem->ranges[j+1].end; + } + + /* + * Continue to check if there are another overlapping ranges + * from the current position because of shifting the above + * mem ranges. + */ + i--; + mem->nr_ranges--; + continue; + } + mem->nr_ranges--; + return 0; + } + + if (p_start > start && p_end < end) { + /* Split original range */ + mem->ranges[i].end = p_start - 1; + temp_range.start = p_end + 1; + temp_range.end = end; + } else if (p_start != start) + mem->ranges[i].end = p_start - 1; + else + mem->ranges[i].start = p_end + 1; + break; + } + + /* If a split happened, add the split to array */ + if (!temp_range.end) + return 0; + + /* Split happened */ + if (i == mem->max_nr_ranges - 1) + return -ENOMEM; + + /* Location where new range should go */ + j = i + 1; + if (j < mem->nr_ranges) { + /* Move over all ranges one slot towards the end */ + for (i = mem->nr_ranges - 1; i >= j; i--) + mem->ranges[i + 1] = mem->ranges[i]; + } + + mem->ranges[j].start = temp_range.start; + mem->ranges[j].end = temp_range.end; + mem->nr_ranges++; + return 0; +} + Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, void *data, size_t data_len) { diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index dd115571f8fc..453b7a513540 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -1151,184 +1151,3 @@ int kexec_purgatory_get_set_symbol(struct kimage *image, const char *name, return 0; } #endif /* CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY */ - -int crash_exclude_mem_range(struct crash_mem *mem, - unsigned long long mstart, unsigned long long mend) -{ - int i, j; - unsigned long long start, end, p_start, p_end; - struct range temp_range = {0, 0}; - - for (i = 0; i < mem->nr_ranges; i++) { - start = mem->ranges[i].start; - end = mem->ranges[i].end; - p_start = mstart; - p_end = mend; - - if (mstart > end || mend < start) - continue; - - /* Truncate any area outside of range */ - if (mstart < start) - p_start = start; - if (mend > end) - p_end = end; - - /* Found completely overlapping range */ - if (p_start == start && p_end == end) { - mem->ranges[i].start = 0; - mem->ranges[i].end = 0; - if (i < mem->nr_ranges - 1) { - /* Shift rest of the ranges to left */ - for (j = i; j < mem->nr_ranges - 1; j++) { - mem->ranges[j].start = - mem->ranges[j+1].start; - mem->ranges[j].end = - mem->ranges[j+1].end; - } - - /* - * Continue to check if there are another overlapping ranges - * from the current position because of shifting the above - * mem ranges. - */ - i--; - mem->nr_ranges--; - continue; - } - mem->nr_ranges--; - return 0; - } - - if (p_start > start && p_end < end) { - /* Split original range */ - mem->ranges[i].end = p_start - 1; - temp_range.start = p_end + 1; - temp_range.end = end; - } else if (p_start != start) - mem->ranges[i].end = p_start - 1; - else - mem->ranges[i].start = p_end + 1; - break; - } - - /* If a split happened, add the split to array */ - if (!temp_range.end) - return 0; - - /* Split happened */ - if (i == mem->max_nr_ranges - 1) - return -ENOMEM; - - /* Location where new range should go */ - j = i + 1; - if (j < mem->nr_ranges) { - /* Move over all ranges one slot towards the end */ - for (i = mem->nr_ranges - 1; i >= j; i--) - mem->ranges[i + 1] = mem->ranges[i]; - } - - mem->ranges[j].start = temp_range.start; - mem->ranges[j].end = temp_range.end; - mem->nr_ranges++; - return 0; -} - -int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, - void **addr, unsigned long *sz) -{ - Elf64_Ehdr *ehdr; - Elf64_Phdr *phdr; - unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz; - unsigned char *buf; - unsigned int cpu, i; - unsigned long long notes_addr; - unsigned long mstart, mend; - - /* extra phdr for vmcoreinfo ELF note */ - nr_phdr = nr_cpus + 1; - nr_phdr += mem->nr_ranges; - - /* - * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping - * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64). - * I think this is required by tools like gdb. So same physical - * memory will be mapped in two ELF headers. One will contain kernel - * text virtual addresses and other will have __va(physical) addresses. - */ - - nr_phdr++; - elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr); - elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN); - - buf = vzalloc(elf_sz); - if (!buf) - return -ENOMEM; - - ehdr = (Elf64_Ehdr *)buf; - phdr = (Elf64_Phdr *)(ehdr + 1); - memcpy(ehdr->e_ident, ELFMAG, SELFMAG); - ehdr->e_ident[EI_CLASS] = ELFCLASS64; - ehdr->e_ident[EI_DATA] = ELFDATA2LSB; - ehdr->e_ident[EI_VERSION] = EV_CURRENT; - ehdr->e_ident[EI_OSABI] = ELF_OSABI; - memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD); - ehdr->e_type = ET_CORE; - ehdr->e_machine = ELF_ARCH; - ehdr->e_version = EV_CURRENT; - ehdr->e_phoff = sizeof(Elf64_Ehdr); - ehdr->e_ehsize = sizeof(Elf64_Ehdr); - ehdr->e_phentsize = sizeof(Elf64_Phdr); - - /* Prepare one phdr of type PT_NOTE for each present CPU */ - for_each_present_cpu(cpu) { - 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; - phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t); - (ehdr->e_phnum)++; - phdr++; - } - - /* Prepare one PT_NOTE header for vmcoreinfo */ - phdr->p_type = PT_NOTE; - phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note(); - phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE; - (ehdr->e_phnum)++; - phdr++; - - /* Prepare PT_LOAD type program header for kernel text region */ - if (need_kernel_map) { - phdr->p_type = PT_LOAD; - phdr->p_flags = PF_R|PF_W|PF_X; - phdr->p_vaddr = (unsigned long) _text; - phdr->p_filesz = phdr->p_memsz = _end - _text; - phdr->p_offset = phdr->p_paddr = __pa_symbol(_text); - ehdr->e_phnum++; - phdr++; - } - - /* Go through all the ranges in mem->ranges[] and prepare phdr */ - for (i = 0; i < mem->nr_ranges; i++) { - mstart = mem->ranges[i].start; - mend = mem->ranges[i].end; - - phdr->p_type = PT_LOAD; - phdr->p_flags = PF_R|PF_W|PF_X; - phdr->p_offset = mstart; - - phdr->p_paddr = mstart; - phdr->p_vaddr = (unsigned long) __va(mstart); - phdr->p_filesz = phdr->p_memsz = mend - mstart + 1; - phdr->p_align = 0; - ehdr->e_phnum++; - pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n", - phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz, - ehdr->e_phnum, phdr->p_offset); - phdr++; - } - - *addr = buf; - *sz = elf_sz; - return 0; -} From patchwork Fri Aug 4 21:03:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131351 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp109450vqr; Fri, 4 Aug 2023 14:26:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh2DGIB/P1J24pLG2EZ5L/75Pu1zZEh+uu1+LPL6ZEaX23tEB2EDgBETKt7dsmH2MV5UdU X-Received: by 2002:a17:903:244d:b0:1b3:a928:18e7 with SMTP id l13-20020a170903244d00b001b3a92818e7mr3028643pls.59.1691184404722; Fri, 04 Aug 2023 14:26:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691184404; cv=pass; d=google.com; s=arc-20160816; b=zkac/8B3WvhubdeJU+Bdfkr4feERXm9iiUDYirpssW9Aks/aLmRF2vG519k5bzob/N WEOR3plLcnMn622E0epb5tPkI8RXpq0xLj4Yc1tMUiL1JwRzpBbeN7AE1GBJysBCpaXk pT7wwpy1S5sxEPkut6wdTk6oyoHQZs97DCL+TbSc/NtnDpMZE41atwMI6kzaa4TCG5ZS xIk7GgGzSSssLunJglMlzsDzwR7Z8yTXhE+4lfWm6O/F/Pee1m1lMYcS1gEPglKkOStr 024PYnCsAR99ZLBCZmqWfY3VHIbKYxRGgVLJMxs14erF/NjL3H/XkWXRpFYJUxTNH8zJ UHCQ== 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=neX4dgrHOHpPdCnxirrY8SJnRS3HP5J4e2JJvTSuYE0=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=zdLmNNhRIWOwfASYLrSstM9gpaDRS7+CZwtA1aWPxcqDZDhPhEBpLOwi0y2eK5xskU gtZ1BThwxkGwN6gANjHURLQlqBG02sNEK4GB65KOcUFAQK4+gnGzeJ8l60GV85k3D5ZM KieS/s8ENyzxSKpxXO/gYyjDAJGYpEBMUHJLCLpP5heAD97T+CaEuzpdmQy0VBMyPnLy JN5x3oOSAa77XFuww/xiWcfYkvl4p53Cx3/S/NjFKhZtT9iO5FXS2CMo4GTzTtBe/5I6 TxFHRqaSSnVa571uCoqfHueVQxN4xotT1lp5byO1p9wohfep9YRCFV2NR+DKzAp8K6jW T9pw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=ZrzIS4Dz; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZScOZg1z; 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 p12-20020a170902e74c00b001baff05d890si2362133plf.313.2023.08.04.14.26.28; Fri, 04 Aug 2023 14:26:44 -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=ZrzIS4Dz; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZScOZg1z; 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 S229464AbjHDVGB (ORCPT + 99 others); Fri, 4 Aug 2023 17:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbjHDVFj (ORCPT ); Fri, 4 Aug 2023 17:05:39 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0CF5599; Fri, 4 Aug 2023 14:05:12 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 374JCmDC003843; Fri, 4 Aug 2023 21:04:32 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=neX4dgrHOHpPdCnxirrY8SJnRS3HP5J4e2JJvTSuYE0=; b=ZrzIS4DzgJ+HXwJGvdd8C0VTiGamYO4V/2GbHyblaqtdrrxoYVYfAsEt8u8X6ozRvAlj FG8Ny2h2wTz9sGS6vSJhaZE3EXc3RWtn40Hl4rDsL4AsocqRiChVIKy/krCQEuWICHCn FE2/+Yx3o6Rd+FDJ+1+2mqukxM9mDYmxv6lRT82slV4z6jMIrSI4thF+qYsu3OQ3XpVQ ZAg5hJucKInTyGpmBEEzn+8rDjFS5oM8Kc7NpkfYu5ddakNin8eRGzWZiEW3XDU9JSbU 4GOw/u+H+MV1C7wSQ3jC749R31c0kq/wiBMszPvdmVbjTIup1jp4t66oK1lsRMmQAOxN pw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4sc2mqfx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:31 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 374KOGHY006661; Fri, 4 Aug 2023 21:04:16 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s8kfhy0sf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fn2mCMpRQ1FkfGz4bWap5hhOMfcyLan7nfKlHbDzi25bAJff3UZviJDwCFkQ7jEoLJ8tAbfNpC+OrtTspX+B/pLGly8/fWunZA1MxF8exzQaoDLZaYbo/AWRPmwlwJ3Hr5WISGy4vCESHpb8IsB7HAaNQUM4H2bYkkNyVQfsXYrKlwqBZFIhsb9vOFhCvT58ZMZCI9DgYJM70bFxY/hhJFWe0tYS3U8TTIFEq2qu/Xbt+U0DTnjrdaw1r2OejgISLtw7ttl9EHvlrMYEbkgKtiEu3yI/5v3TqpzOL2dHQeFYbBD4MESHos7tcVvv6Hss1nJj42KGs5LU7oOoLMOLPA== 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=neX4dgrHOHpPdCnxirrY8SJnRS3HP5J4e2JJvTSuYE0=; b=FSQVZKnLFgxs1B3uP4Xa4gjEsYOpWsVDKVXQRlR6bcl8HS/RC3xaTL2uZmxzOMnZm0uwFOOq1EsJ+hM8J2zdb8eM8pZ5mxjLGkhE0EgCjDdMKcSyNNAxGvEL0rHbmdUdKJSfyZqkMscDD6rhveDtGM/tKOCR/vb2lIs+0cqWvGUkis46N0oQSpS5c80N6YE1cs26fbRhfoQC6uWK8y0eAkOd778v6RMEdbaEHvprgWcFdeGPfdNFnSsS2TP+4XYH9sT82C6gfnqd49PekCd1LQd1bJ6h4XkbarF7x5ykrogRlYdMvVma87M+oy3OKe47U6q7UCqvMdpNRijOAeiLGQ== 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=neX4dgrHOHpPdCnxirrY8SJnRS3HP5J4e2JJvTSuYE0=; b=ZScOZg1zov56XGeOJgmFGOznxZHjEj0gr7T2vppWUlB/TqLlWSfdikICd2gunhx4lh9obfzyVuWE9JCPw50uMq2RU/GQEnMLdNppj2+x6EfFEitK+U/wYMwtLHcUpa9pWkCzhho8D+mgWqvWB/8CHzbaE3FxcwaDKfJ69x15Prg= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by BN0PR10MB5014.namprd10.prod.outlook.com (2603:10b6:408:115::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21; Fri, 4 Aug 2023 21:04:13 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:13 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 2/8] crash: add generic infrastructure for crash hotplug support Date: Fri, 4 Aug 2023 17:03:53 -0400 Message-Id: <20230804210359.8321-3-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: DS7PR03CA0288.namprd03.prod.outlook.com (2603:10b6:5:3ad::23) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|BN0PR10MB5014:EE_ X-MS-Office365-Filtering-Correlation-Id: cda28542-2064-4b68-5dd8-08db952e5b04 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HCCaz4v/jd0q3nA/3sLoKqb86xO7+LwhNxUSfBUrZ+MLA5VGFzbWTA9TgqBRGY+/hBdzDwVWGPYFxwQZvrOM++WWyc5RjUP4uoP8dGNmll8m19diApqLE3KjlTze8ocOHiFC+g3XPJIxgdZqUOeb3tNePEHJW6poDxYEEQZAkcq0HRXqJHdShWfy6RZDVHyFwCMmIqT6uvUq1o5Qa1TCbdQDqvZkXWDICKve1S/bInm3I21d5s1KCLj2P/FJWhsxTDHKBSDP3krqogsYcdgaW5FXhLAgrlyjqxqfftCA/OweD1OS1b/RDpO/BizudYLA5jAU1/vyuylmnbWVO5m+NGgoh8zvQAu+81iTIVA56rYkfgMl/fnT1n7iHFzcg44mYYKi5T7VjRkS/3DrqKMt/FNI9nPpNfQZlwuQp7R0Wwz6WtKBDKuofYnWGGBSSlhaaY09gorMU05J/fZZ7KSnc1344L91UP3wiJGTI3NwY7RKwIuj7+L/Jp4qSDDk0v7BdQ4DUfBMyD0wZE77U9lQAgwyydIhctnMlB4ddo/YHWx+aSzTAReiKSCUCkLIvxgLEUkcSnGxavE+On4YQsy20FYXsCD7zRCqsP6W4ibJrjkRN/Si8zame2VGckeNFT5i 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)(396003)(346002)(376002)(366004)(39860400002)(136003)(186006)(451199021)(1800799003)(5660300002)(7416002)(7406005)(4326008)(2906002)(66946007)(66476007)(66556008)(30864003)(316002)(8936002)(8676002)(41300700001)(478600001)(86362001)(6666004)(6486002)(6512007)(921005)(38100700002)(6506007)(1076003)(26005)(2616005)(36756003)(83380400001)(107886003)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gpKWD5eayypUovxEl1EkCwLnomjZvuSr3/RroGTDv05I1uE1NuVIfG189VFOo5eDG10lcX1lINFineRqGKQU0Faq9/29+W+0y4ADXlZ7evuqzDaeM7m8wFdMFWQsVuyxCUQ+12cxmykDddAYMvpxgDoxLgciVQMHPeutjXDMaDPBS2iry0gSQSCT5lgjU6Gea9fjMoNLmAbPCPVmQI8qZjg491JQ2FobFW3vIVXtVDx6fM5O0rvhSFa0JtXvGlbrT3gF6IVCf6MKL5LLHR4HaR8W0+APWdPKmC5g4sdR3TDIO5fQGCqQyNbGJG2UmvPOBcPO6umHMSqL9xYBM4xfetTpHTWpFLxj0oYztl9Qc5IIgsMty0rqVz1kjbKmihts5UKAMUIuu2TXA7/zId3H8HRpNNvQ9BN6886rAa76HnldgQFiIpLUcgMcIjG1JvFYFLLk9dYOXKMXkznC425u/88CFi2hgi6VwzNjN/TVQoErGjynXyoDxwEbwMWr4G7YxsZGbsLu+ZWFC57txNrxkY3Ul+afdeam0WFs4IebzIGw/IDo3hA1CWLxLsLqeqBkKpwIWnHvdx1k76iEKQqE/PF4YyZbs0TBxM8+AvSSmosQR96VdfG8AZ09nH9XYa1YIyUywJ9jH+nr6xSP0qthUyPBLt+JZxasahZ91mnXUQL1kJ0In9xMvP/0H+Rwtw/R5kRqFygakNsK3IwbbICuWByDgpBndeMUIniVJSvvVNgqV1aMIcfQKlt2T/6S1MjdenjqiS75RBrLDOz+wFfJtBzXTo/6KhYaZtvghdbJdt5Ch8rtzUI+/Os/if0HgvkSnP1+V9CtOKdyM4SLKjl+r7zs7m9OBsswdRP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d5jgbyw2kM1jNIoh6bRSKLoS8zldHpXRN7BguZzJbpKZidoiVNXv5gTON7/6h5aOBWy+mDhUxWQLCeVIb4ck0XI2SGEK8AX43L3Da72Ai4dZOp4IrIivIkTfgMRbRliv4tKT0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cda28542-2064-4b68-5dd8-08db952e5b04 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:13.3426 (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: 1D1oPjO+shdVdok5suCgIvBTIap9HhSbkrv/zIkjwiOYEmYijNB3jfNH3JN/G7C5ZyzIHnDvWpXmIxSricYT98h58KJqsuDNBXLc/GBHims= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5014 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-ORIG-GUID: 1bBX5gwz8DQOf04qH5gSUqk-ykFMEJGZ X-Proofpoint-GUID: 1bBX5gwz8DQOf04qH5gSUqk-ykFMEJGZ 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773335378331787675 X-GMAIL-MSGID: 1773335378331787675 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, CPUHP_BP_PREPARE_DYN 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 justification in '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: Hari Bathini Acked-by: Baoquan He --- include/linux/crash_core.h | 9 +++ include/linux/kexec.h | 11 +++ kernel/Kconfig.kexec | 31 ++++++++ kernel/crash_core.c | 142 +++++++++++++++++++++++++++++++++++++ kernel/kexec_core.c | 6 ++ 5 files changed, 199 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/Kconfig.kexec b/kernel/Kconfig.kexec index ff72e45cfaef..d0a9a5392035 100644 --- a/kernel/Kconfig.kexec +++ b/kernel/Kconfig.kexec @@ -113,4 +113,35 @@ config CRASH_DUMP For s390, this option also enables zfcpdump. See also +config CRASH_HOTPLUG + bool "Update the crash elfcorehdr on system configuration changes" + default y + depends on CRASH_DUMP && (HOTPLUG_CPU || MEMORY_HOTPLUG) + depends on ARCH_SUPPORTS_CRASH_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 CRASH_MAX_MEMORY_RANGES + int "Specify the maximum number of memory regions for the elfcorehdr" + default 8192 + depends on CRASH_HOTPLUG + help + 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. + endmenu diff --git a/kernel/crash_core.c b/kernel/crash_core.c index b7c30b748a16..53d211c690a1 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); + + /* + * The elfcorehdr_index is set to -1 when the struct kimage + * is allocated. Find the segment containing the elfcorehdr, + * if not already found. + */ + 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(); + + /* Errors in the callback is not a reason to rollback state */ +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 e2f2574d8b74..5d323255862a 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; } From patchwork Fri Aug 4 21:03:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp110034vqr; Fri, 4 Aug 2023 14:28:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUsiHMjOMRG28jUXGsWQjFFPGgMyoGR8NuGj1Gwrf5gUQjfdKbYu1RLEPamCloIIhQWSnF X-Received: by 2002:a05:6a00:1a0a:b0:686:4dd4:d56e with SMTP id g10-20020a056a001a0a00b006864dd4d56emr3547030pfv.2.1691184499902; Fri, 04 Aug 2023 14:28:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691184499; cv=pass; d=google.com; s=arc-20160816; b=K5mwLFHRhCrQsU1TTFRl4N9cLT7iV94n2TzV0Vk117bI8Im8bHPSbcWjGRai8hoGxC LB5roB6eA9TPkZQrFGWB+p69vB/HjlICD+yVlTClroGl6Gg7BEMnSqslii+HvBpRd3DR pv5estfzgTBQMLQZ8xW7wNAJtjWRCYM9Z+7z476kWXvLY1pkCCoADhwegHjc5cBDaenV Jo76wHBWKyS13n6A7PKks44pyKggMBk2FK55Uh909wq9/56jYMTlFC84C/iS8vLVqID0 dM8O65LPs7f1RVWRjTwL16ZOIrMizEXdREafJwiWNyyz3ROp7Uf7MZjbrvAj4XNdkQor xiTw== 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=TpE1wqVtb7MplpG9Vaelj6riR98OXh5MaMtMxiY6bCg=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=ZqRHRb0qxhTRbsJ5vKKwhRtPFHPErSb+MktVyiE2BNMV1xS8IkQEg8pr5hdqLkDnYl gwBnQ03udAGFMzyiP8+pNSvcIE0vpNPraTK4FoiwyOpA338jpttpgMBU2FfzbkZ1KjEK 9+OSiyJ+/ACSA6c4MSCAvLEqVfRvLNnj3sU1W3MKy1qSaNci9d4cklQfDKQX5j9kS6BY c+LnWP1WnbZfv7X1I/Sccuv8ElhHOHKOGWOc8aCWQ/LC4jkyEeHY/DCPO0jeRQ+N3hve AwGzATXSCyU3BhS3MPVHFJkD6ztIJacb4J+0fQK76b6TvDxhZ4/p9H2BeYjHGBNvi0cl HFdg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=wi3vl8bM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VhYLquOC; 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 g188-20020a636bc5000000b00563e87fdac9si2214560pgc.36.2023.08.04.14.28.01; Fri, 04 Aug 2023 14:28:19 -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=wi3vl8bM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VhYLquOC; 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 S230514AbjHDVLf (ORCPT + 99 others); Fri, 4 Aug 2023 17:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230498AbjHDVL3 (ORCPT ); Fri, 4 Aug 2023 17:11:29 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB106526D; Fri, 4 Aug 2023 14:10:58 -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 374JCaKp019555; Fri, 4 Aug 2023 21:04:20 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=TpE1wqVtb7MplpG9Vaelj6riR98OXh5MaMtMxiY6bCg=; b=wi3vl8bM8eBasvGR81O1W2GEtNnCz6QoTxkEkdwLlZ9bJKBvG17IHs6Uqwez5bI7wIhp 4FQWjVQ0TqccROrF2v6KlQ7JZZvpbFBWCK0TFVvBoLw2JvkPbiHxbyJLHK0R1dBO4hco qw3rBeidv+PBRdDsMILtOm+kltpQ5LBKO3zoAJ0NlyN87fCWjZkD9qMKzfWk/8j4zwXx c6kCgcVTXh4E7KNGG2UDKY5Evo+2oQWXssrFNSvhpxJoTlPzfuX+rCKJkX4Tv5gC0Ovc CaeRY9uGC8YHj8fcvDmLXtvF67vDGk/ZOQH96UEcCJUjhosxuRhDUAaj96O7ot7RgbC1 bA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s79vbxr11-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:19 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 374J3nbQ029416; Fri, 4 Aug 2023 21:04:19 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s8m29nqa9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XeiAWsFDpImDckZwXaqewtveodbQ18j3Pm+mxr5szJz/l/VL1M6Y1J6h5xQkTjrd7peOrHRRdvreqOueHDbZXVal8U4sdRJmnfA7fQY4zlcbewAwW8S+NQLfG7K7zIzHs7W6qMTzlxW1x4h8T8tIjaWrM2cVPwVfcuc2wvr7V9DxLGVI5rMG/r34W/Ew4AN6rIBJInl0PKIHyqr2g6ukVssH/oMwnAEWf1IX4W2ro4zNWJMMNefu4KFP+GY4M0bpO6W4rZa2BCGcpGJCILPDayarXt342HeJxbxTPCPypldu6B87AiQNZdKBoQM+Ad9fwNsdoo3+Eb+EljzPA/3j6g== 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=TpE1wqVtb7MplpG9Vaelj6riR98OXh5MaMtMxiY6bCg=; b=kOZrWYXVBmESkAL67R8M8WVyeRCzQydYLDAi6z0FLVWHt9Z22luzbAI+KDt3uMdytYSh5Cp+lBw7/eYh0Tsd7hBE+hyiGqa//di9uRdJQnuinoCpIMmB1Z5MzIjZkb8la5nmBz2D8BGLFuuGFWd2Mzi81KTpjnEVesxl9DLklnfP7eBVJxSyPU9Fva+nDzdipv+FnDixXQnxyv5Vea+UaAQ+Sf1kIx23HGyfN1nVZsvIjB1EPgzZdlXE5a88MHBty/swecbEGlMJLsQTveJpKDZOlfCrYNwJCIDfi4wFSS4ynQkwgyYv39nGF2w6TKUTpQRixH0IyS53QpREzalsBA== 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=TpE1wqVtb7MplpG9Vaelj6riR98OXh5MaMtMxiY6bCg=; b=VhYLquOCcJMSPrlU2oWJs5PfOOiYn3tIuaYgs9k4GsUpMJgo/AitcGcewhbOVLaT4PVgzOgIWs99ZRRaC4gR2NjRVGfZhBM+SMyRsX5HAoOlcXRucRsHdbxZmSXRxrfdr922VLVKSgs1UfeHpGI8BHLyYON4JI0usv1l9LHI0hI= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by PH7PR10MB7056.namprd10.prod.outlook.com (2603:10b6:510:275::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 21:04:16 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:16 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 3/8] kexec: exclude elfcorehdr from the segment digest Date: Fri, 4 Aug 2023 17:03:54 -0400 Message-Id: <20230804210359.8321-4-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: DS7PR05CA0050.namprd05.prod.outlook.com (2603:10b6:8:2f::9) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|PH7PR10MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: 3afe64e1-d745-4c96-9743-08db952e5cb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dsEiHiLaxKRP8JTJzuGbg6i/hNa/+iEffD6M1pyvFbYc6llajn3wG18q0t++uLTnjWZ0f4wc9gHP5fIGhHL7PoGXe/G4hZM6tZhNYYbNitKkfybBq8inft1bFK6+f7+dHEKPHD0vIf8++ppGX8dwsgjP97Me/tmC3dAtB4dqJyF9EFQ0xgO9z198HHzBNJH9NkxbXC+hTvc1p6OZSZWYNXcrRqhfqZGpLlITHDImv18Klb/N/x4HnwrmrE1TgZxwtTQc9qjs3/bRTpt7ldLpHiamge64NYEnUkZMRw4Q+bL8gT696I8z1Ut7aShJjcfTl5XeDcHH24RIHKOyadnIwnr/mHRvUO7ykZ8nXQao8K4PRGQeuTdmOUc0pJSYdt9llvvc2+s9zEdJ/6S6qRo6btWByCVQp7ioVHeamCguAPcfA9uWAwopMR/M49FAq8gIbjcJBQEeazsvN75ZY+EAc+WGIL6W5kzdHlo0WNFFMx+QHt/XXSrtO73S2Y9roMerxmDBIA4jCfGYGp8Y/g0ro3zbw5gFI3q57bk+6Iec1imBBCcgA3/ao/S8vi0T4SjU9ryeJFE8PieOrpTmnr8pv+VFBUUJ4fQeIasY/iHCufc= 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)(136003)(346002)(39860400002)(396003)(366004)(376002)(451199021)(1800799003)(186006)(1076003)(2616005)(107886003)(26005)(83380400001)(6506007)(8936002)(41300700001)(2906002)(5660300002)(66946007)(66556008)(66476007)(4326008)(316002)(8676002)(6486002)(6666004)(6512007)(7416002)(7406005)(478600001)(921005)(38100700002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gsy48CeLKVRo99kJ3vV+kYeq24FEkREoUNNrBgqLnDVEcUY/FNn3uxuTofwbl+4Oe0+WfqF3uiN9Oqq0QE9bJfcg5BBoIeYD3t77ozGJJR0Hc/fvuowtUMablzgrOpakSBdDdzLuJrs/sILCAJeG40huwIsd3tRb+w7QUSdmKnJFj4bIqgKGblp767ljyMfZgU/CDaeS57uk/QjSnpbCweRxGLPPqU40R9qmx2K7SyNaT93+KerjUE1I/REL8dKGf0OugQelq08HbE2E55iCM3d/DZluRwY9wrZh+h8fNsLC0uDYWYKSlLJs5A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lPAjEgp8/fL7aZvK4cCXjHDifvAgCZBI17ZBpWgq1purV3KcmXksTKW2rRmq5wDg2gF90jwjZ6m79wPGBwsoa0pHWrPsqTO91QERjzH5RAswsSuLON6s02tGuRmXAqzSAajB4s4pPgF8unr4bbg5zT5Xp7iFjCLCP5jMjUumuzt9+Wit3jyKKt72aNABnlWcADGhJg/ZZVejpNtYWazExSJoLvYJv+jBDby+hdYXyg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WHBQnhTImCRxwhU3szNa1OazLLTYGSeBMqTLoxBUD2Fb5aWe2s15RBozTFWDT2UlIL2SP/7sC47h3rYxB5BSFHPGK1Epb/0OUTjZdA+jAHJuGIjL80B+U0adPUY7aOLrE1EEJ6WfulknBQQphqnYVVpIV5Faj+39ydwLJuPgLcOHb3+cGxBr4MzdIhcMHaz/6HD6OJdqb3BYfbUfJ/2Ix4Ots46ArFfVWwQfQ0q/7VAIJdzBykJwYJSJZv6IuxHHxegfXxP45afCpS5q9MhunfsDk9XSVLtxuwQg1/ZzRbQmVmYVc+sO3dOZ27QylnBThQyJmcJtW4KamBmuY6Blg0kUWZyqywE5e/B8IUC62ZnEpw58KqwTr0/gvbV1V64Vac6iKTueSkgD98n+KepKG3i/qbElubohm9rP2OedItFGqUPtdmBCANSyF0HSSI+O8bM1bLObd5hsy/VkyQ9DfrmgZOorJDzNfphBOrz+anLQrDiM6aahqmv7fDobsnCDke8RYEMhbDp6/KIrJgzIFS5TmWcLDzrPnGhJuuN/x5p71+LJp5k9n5Jv9YESF+d0yik54mqdBl0vBEllyrWJGE4UP6ODeGzW175F4wM7YwZ1HwuTrvTxkL92ygWSzJCSs8Zvvcw87oE+N8sWaEgjWVqFsVronh+qtFR6KrizVwS5sNbO9uRZpAqoirnaygILikFzbKxfs2KQ8qByuLtBX4/5FLKCl8i9ygBTzmPQvfUJH71WLfIC2H+sa8FE2sg1vm/19iqzY1WDWdzii1l//eTc01bLb7FwQCUWBii5VYpBwMhBPEh6tJrh5YXj+boMrILsRRYozcI1H4pNCPIliCOlGmwvj/xxAu19CO8Z/UQ+A2N+QcXbV7A/AMKuzmwdPqAPfP2w9CvXXi7A68fflRlnjaHy2X+9paEhhkesrZDU2PFUjdP3Hnyw5I4tghJYdwl8gD2mAIQCa0kv4llY3mnSxZu6DKsqUV78dpaC5uMhHR7hJXoTx/naHh9c9OS/VMDb7MvhW6aiouVrQCYTlG+1ewCmZylzlcUpItjJSbAOrUaxH9gRycn8f3mN32SNZo8lyU3DTay8DA/rX/R1R8KQxsgDB7PNsLWr22Bs/HmY7V6Z66YIOwDnA4o5fRQ5J0g3Wqcj2Vcxsx0kMXEdEV6W83jllwfNeeZHYw+3wv53oqtz6rK2h72g2gAVvGkqvdneFq+81QOQ8xHPOxY35NCcy/PXX1YapwkXV8SFHUuJ6+JuBwn5QBJnbH5EYwLuDnGC86M/uliI8gh7ghkVtZMfSC2v8y1/jYQ5/7EqPErPx0YKCaFFftKxpuwDGCKx7Lxk8KjgEPhGfSMm/2CabuvGdpnJTvKRniRSI2k5Ceyp8B043hG0xDYenFQqLcsGJa9bK/6TkqwMWzzosESxcbITlyXr/Fj8tGPZtI5ir74= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3afe64e1-d745-4c96-9743-08db952e5cb8 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:16.1278 (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: FAURMkAUq9LFBMSpWkRq3F9Cbc/UPv5LbaPb3UZ8l6I+IBQ7pHvBbNGpBSJebJs3QthiXPtlw3cg35NIDTNgIY2aubCh8VnP2HiTWColyFw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB7056 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-GUID: JG-J_ZHkgySjrc5OI-bV73qV2ZLg3BhE X-Proofpoint-ORIG-GUID: JG-J_ZHkgySjrc5OI-bV73qV2ZLg3BhE 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773335478114572084 X-GMAIL-MSGID: 1773335478114572084 When a crash kernel is loaded via the kexec_file_load() syscall, the kernel places the various segments (ie crash kernel, crash initrd, boot_params, elfcorehdr, purgatory, etc) in memory. For those architectures that utilize purgatory, a hash digest of the segments is calculated for integrity checking. The digest is embedded into the purgatory image prior to placing in memory. Updates to the elfcorehdr in response to CPU and memory changes would cause the purgatory integrity checking to fail (at crash time, and no vmcore created). Therefore, the elfcorehdr segment is explicitly excluded from the purgatory digest, enabling updates to the elfcorehdr while also avoiding the need to recompute the hash digest and reload purgatory. Suggested-by: Baoquan He Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain Acked-by: Hari Bathini Acked-by: Baoquan He --- kernel/kexec_file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 453b7a513540..e2ec9d7b9a1f 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -726,6 +726,12 @@ static int kexec_calculate_store_digests(struct kimage *image) for (j = i = 0; i < image->nr_segments; i++) { struct kexec_segment *ksegment; +#ifdef CONFIG_CRASH_HOTPLUG + /* Exclude elfcorehdr segment to allow future changes via hotplug */ + if (j == image->elfcorehdr_index) + continue; +#endif + ksegment = &image->segment[i]; /* * Skip purgatory as it will be modified once we put digest From patchwork Fri Aug 4 21:03:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp133660vqr; Fri, 4 Aug 2023 15:24:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElNQb2Iz8rRIhPZEGn1njqMy+2XaB8v5eUMgDMId0dz80kyoY6n5mgXaAhbL7cqTThDEjE X-Received: by 2002:aa7:d0c3:0:b0:523:1436:578d with SMTP id u3-20020aa7d0c3000000b005231436578dmr2262327edo.8.1691187886496; Fri, 04 Aug 2023 15:24:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691187886; cv=pass; d=google.com; s=arc-20160816; b=Off4emmVAxZ1Ib18eF3tJs/pMapfDc/Cb3I/RppVc7QU7Fl5pXIc8FAy1lPnAX5tDf TCZGxq3IbwShGSvTvEkqoZMvtOcMP566xGV43DGcC5ZYpKC4vtcLQVLEXZHPin0VGFCd cWv03q3UknrlIq2xVNiAYxxGYYDZCtqNJ3A5MCD8UL/kvxO68ixagq08UICRU0oG3gHl SnnHaOzu5RW4pB4GLV8LeChe15WEplJW0BTPKYNizaBXZ2KaPQZ7Nrf02JUQ5bonrVJA xpMgorYsLAyhOhAPbIgZEh02dKC4D45iylJpTnUZjP7Lw7Ae1Hmx1U4kbAl20auuv9W9 t3wA== 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=sJaWF7pnSKeey37a5Z8iTxypuK002o6eMHAEnIzLK3Y=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=bsLtSHB1HLcaackj/6zDhjD/g05XiMp84XtDpGRT24iwuQF0KdQplz48f9wuhW6M2M AZ9QTVmcg9QwWt2qgQjeHJ6ShOtFsDFW0rn5uRY2mGehR9hMgueyPWvb8JdNz48WMw42 SZOBathUFqcwh13LA2AVYO2i1+Y2lZZ4m9hO/FC8FA+f/EYPSvNB+zNsHvxMQbQAoU9s cmeHkqMKnYly0dGDdaiJ/eWzOI0YXoX9xFJeWI7NgPyGBtzpjoXW56KzpJH34S5W9e/6 1gyyVaOIyWE2iC3FOlc0glIqgFa9Kfd3lFSC5FuRDlrLAuBSe4rvnEwhb97/ByawHUu0 +tYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=uAQuw1u0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=zVnTs8zq; 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 l21-20020a056402345500b005219e26dddesi2097369edc.655.2023.08.04.15.24.22; Fri, 04 Aug 2023 15:24:46 -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=uAQuw1u0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=zVnTs8zq; 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 S230473AbjHDVF4 (ORCPT + 99 others); Fri, 4 Aug 2023 17:05:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbjHDVFi (ORCPT ); Fri, 4 Aug 2023 17:05:38 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16C4F4ED0; Fri, 4 Aug 2023 14:05:11 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 374JCYd1010719; Fri, 4 Aug 2023 21:04:23 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=sJaWF7pnSKeey37a5Z8iTxypuK002o6eMHAEnIzLK3Y=; b=uAQuw1u07sC9Zsb0eiiVtcjCdCevPOskeatJIUAv/TbBsv1NW0Meij9fTajPx37z897x cn/0aExBsUz7/6tPgDpYwXsJYwSFqdSPZEv9D1XEn0+ewAmPTRB9+H0qDGe9Pt6cqinv 7nOEtu7XXsHo1RysfABHM5ucqQU5TB6s2WYvXtL7f+HxHyDUxuMbX9NGW6BM0o+4apY2 Jul6RhGiNMV3gr85IK5Ph4pSMteAoX1wCjtavS5nN/9LQb4H30jYOyQfJoHsGNW6jR6N TmU6faSTP98MtFDiX0wu4Pi5FwX9yD3HR35/jS2M5+9IQx3RoB85mI33yv11ly+DC5NE CQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4uav4p0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:23 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 374J8tUt029588; Fri, 4 Aug 2023 21:04:22 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s8m29nqbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YyehfNdlZ0Uno0dfKksBfrdZgYYYNMTotnuEK6fMuNdF/P0bUscwHnIIAirUgZSPhrIAji6tzZ6/K0nxWp6jtCpRIXIXneV+RPDfO9cpDeSjaBJWIR+Ov0BeQVb+Vp3k3pkHg92JaIsC8ueT7Ru4sTxAUTTOAM68fHjgyUi0EWuRpuHlqNHb+gi4nauYcbnAy5oxp1DcqmR5v0usqPkOtGHrR/zsvV937Qzgv1VOj+9tlT6WL0WaZwtoofk5vaJNQ9U6mxcRFoBfnJe6AjA4n7UkMZnSEqaanUMFhyNEoUBzzuUW+qypCReSAChRUQqWdktf3+FRnkU7bwwBoCs1Tg== 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=sJaWF7pnSKeey37a5Z8iTxypuK002o6eMHAEnIzLK3Y=; b=bxfyaOhJ/CW/Fusl1T2eIAilJLsRYG/1o24+Y+f0G9ddIBVLIDZs+H6GzmuMfcloxFXTJRQaRqwT+840nXcpd6FtBDvpbR5tGHFgcsXmKKeQjq4Q1sVT+brVjHMr7MwRTX2NquVOrP0y/VlpX2GsogTEZMsM6ZFGsQKvN1Y1DN8wTN82ib6AG2zxgZnSr1/vY7vnZKu+dJQOg5Hu32LwIP5/T4rK5sg1Y917YP01uqRsgB1ihlkeTh83OcUuTy3gOj2bkKYbed1jnfitTe5RHvZwfdH7bTlXQS069yfwm+i2pTZCoAhxeCsU4ud87f1PJ0aVwb551pRwmivElTHFXg== 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=sJaWF7pnSKeey37a5Z8iTxypuK002o6eMHAEnIzLK3Y=; b=zVnTs8zqgMEQDdgbnXZfLnjYPD/2+sFX7uuCzWESWmcejHVMeUQ9N4fD2DkDgaNCxFnAuL18Dm5b+N3vSuTTjWp3smZIy0lSMFZmYKCfKEhfexlrVzev4z9dOyLD7HuZR80KEY1Eq+i4tj551dRBxSj8Hn8bq+afAwFk2D4NmtA= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by PH7PR10MB7056.namprd10.prod.outlook.com (2603:10b6:510:275::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 21:04:19 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:18 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 4/8] crash: memory and CPU hotplug sysfs attributes Date: Fri, 4 Aug 2023 17:03:55 -0400 Message-Id: <20230804210359.8321-5-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: DS7PR05CA0034.namprd05.prod.outlook.com (2603:10b6:8:2f::35) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|PH7PR10MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: d9c7fafd-cac7-459b-ace2-08db952e5e46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +CHmvjDMxoP6h5yJH/Si5VT5Hg95Jy4lFjtF6t3aWOW0quO4cOQGGP0VGLGM9+lQi5SP1UKY8z67Z3AFGYsfcLMn0gtr76rn8ZmIW5c80Yo7UhQkANcAkT+CINwHQ/BFETkltD8E4l6ZUEv8ZK6V0hMIUPNu0Fp+EO2/iMefQzl7BLaiGpr5FjgYQNSqapL0BUDm+/dSMdR54UJ7J3UweI3sIGMdFJd9+brX862Ts+rtzKS9bgqrfkrDvtqQbkwXJ0uVleFUK4tZNwb2020TPUfY3o5nKA8xtOX7weVSCEqVnpcZ1tY7qTu3x8oXFzpq74wfldaI5j6ecvvLWx5IOnZiqGuYlSo9XSsillHRj36H5ZetF2ZWBeLTznQyv5q18POLOpx74qqDXCHZl11rCoxSX9dOkjBuibifUXaVVLwu1VKU7UfCnv335Som7HHedGpHeBp7prms3NQt87GEXmG0nnTOW5Th6Ptz94cqNr2ZcCmOWa4YW6YfDWqlvwvLBjAZDfTBbdKsbVWjAyXt2kE2PUKu+b0WlRqAl0ZMVCWmfWFknsOehUh4ejJ22wkyPftuDglB0msZ30SFcrEG9xCFfzUSiYsVsFp438ZA3Eg= 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)(136003)(346002)(39860400002)(396003)(366004)(376002)(451199021)(1800799003)(186006)(1076003)(2616005)(107886003)(26005)(83380400001)(6506007)(8936002)(41300700001)(2906002)(5660300002)(66946007)(66556008)(66476007)(4326008)(316002)(8676002)(6486002)(6666004)(6512007)(7416002)(7406005)(478600001)(921005)(38100700002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Lz7keIZDMmAzoKGlIXRkdxd6qKEl6g7IKrXfMyYNh4anwFfQEd+Q9AaxNSF33ey10klObFy5eNepL0qj7Pxqb1k/Oe8f0mM/ljyiUk2chGm3XapiAfGag4E6XpOji/mDhLys1pkMMFeA+8OL1CP9cTWtEjd1Fulcx+A1umQvNrm+T6O3+Hpmn07BImci6yDQziDnnDBRBQg/1eLIOCyehi/oA2PlRnUJOONTJmVDs0YPMU+k5hxve57Ur9nvCK3ibujyO2c04g2xR730YqFfH/1ZZC6V5G1HJwZPBU+3re4e11gRf2hwY+z3bTDCcP4u4j1lgJ5Vi/MGco8EjsaZ0fWE8PhjH+V/TjfhBsVWe2PxhhvjclxN6dAYbxJWLikiuGY85wxGYucE6dR/3oPUQ/2VgfIHU9zqbbUX+mL3IRN+MnAcq79vp+BgoDwsXY/sVjGOoSVm/v5XBs74Xw/KZQRJelGoNmI/JeFQfzgSnvLq8yh2ijMQAXLbdDKQL71o8HsF1vi03DC2jv0xVpYuSnA0xIrEH7JG9VC26MEUtdhpqYatVIhqbVQBaRNMrXjhRo0MgOSvF2S9RQ8uAZUWYlLvqDv5Bl5/HU8ojXpumk74QspPNRCPKqJ7eS5w9vw7my4/FMZuv39TNzzk3sAMD0fKf3tyfGEQZonBZyqQx6CI6+PO/R+LcyuJvTC5c2YCUP+t75ooNoDoC00AmfwC+B+P3zZB3voEfFm90lR6E0GNfFaB4Nd4a7zxXRPcdlaE/v5KomQfHxTJ5gHk8SWnBUZqsyiRZIyjjgvF/rlS4DtO8Z8nwEDfH4fQOK7jlL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xUBxeXgtd4wm+XwDV02/F2lpfWVS7cbeddswzzjcRshYuSkWPBNxT4huaXV5IROyd+xX12LytxYrxpXXA4/SJNQX3M5qZHb4qwn12RZrncOWb/M5VJJqoJvsUaRBZ6jlXmmjpJ3JESvwzi68FIm2WEGv0bF8AH4qFvIoy10cBvbu8H2TAog= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9c7fafd-cac7-459b-ace2-08db952e5e46 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:18.8430 (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: n7QFYy2oo6Cu35HBC7hdfCoMMqTFWXvGe8GuE0komFXuLm94cZ/2qA06hFmbHKUuQ6T0V1lGr8Naqm38T5iSTclA3IWnW6xJV0T+YQHHMt4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB7056 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-ORIG-GUID: B0tiYUOe4J4eeVa_zPkpKabg9NY4KABj X-Proofpoint-GUID: B0tiYUOe4J4eeVa_zPkpKabg9NY4KABj 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773339029068225991 X-GMAIL-MSGID: 1773339029068225991 Introduce the crash_hotplug attribute for memory and CPUs for use by userspace. These attributes directly facilitate the udev rule for managing userspace re-loading of the crash kernel upon hot un/plug changes. For memory, expose the crash_hotplug attribute to the /sys/devices/system/memory directory. For example: # udevadm info --attribute-walk /sys/devices/system/memory/memory81 looking at device '/devices/system/memory/memory81': KERNEL=="memory81" SUBSYSTEM=="memory" DRIVER=="" ATTR{online}=="1" ATTR{phys_device}=="0" ATTR{phys_index}=="00000051" ATTR{removable}=="1" ATTR{state}=="online" ATTR{valid_zones}=="Movable" looking at parent device '/devices/system/memory': KERNELS=="memory" SUBSYSTEMS=="" DRIVERS=="" ATTRS{auto_online_blocks}=="offline" ATTRS{block_size_bytes}=="8000000" ATTRS{crash_hotplug}=="1" For CPUs, expose the crash_hotplug attribute to the /sys/devices/system/cpu directory. For example: # udevadm info --attribute-walk /sys/devices/system/cpu/cpu0 looking at device '/devices/system/cpu/cpu0': KERNEL=="cpu0" SUBSYSTEM=="cpu" DRIVER=="processor" ATTR{crash_notes}=="277c38600" ATTR{crash_notes_size}=="368" ATTR{online}=="1" looking at parent device '/devices/system/cpu': KERNELS=="cpu" SUBSYSTEMS=="" DRIVERS=="" ATTRS{crash_hotplug}=="1" ATTRS{isolated}=="" ATTRS{kernel_max}=="8191" ATTRS{nohz_full}==" (null)" ATTRS{offline}=="4-7" ATTRS{online}=="0-3" ATTRS{possible}=="0-7" ATTRS{present}=="0-3" With these sysfs attributes in place, it is possible to efficiently instruct the udev rule to skip crash kernel reloading for kernels configured with crash hotplug support. For example, the following is the proposed udev rule change for RHEL system 98-kexec.rules (as the first lines of the rule file): # The kernel updates the crash elfcorehdr for CPU and memory changes SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end" SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end" When examined in the context of 98-kexec.rules, the above rules test if crash_hotplug is set, and if so, the userspace initiated unload-then-reload of the crash kernel is skipped. CPU and memory checks are separated in accordance with CONFIG_HOTPLUG_CPU and CONFIG_MEMORY_HOTPLUG kernel config options. If an architecture supports, for example, memory hotplug but not CPU hotplug, then the /sys/devices/system/memory/crash_hotplug attribute file is present, but the /sys/devices/system/cpu/crash_hotplug attribute file will NOT be present. Thus the udev rule skips userspace processing of memory hot un/plug events, but the udev rule will evaluate false for CPU events, thus allowing userspace to process CPU hot un/plug events (ie the unload-then-reload of the kdump capture kernel). Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain Acked-by: Hari Bathini Acked-by: Baoquan He --- Documentation/ABI/testing/sysfs-devices-memory | 8 ++++++++ .../ABI/testing/sysfs-devices-system-cpu | 8 ++++++++ .../admin-guide/mm/memory-hotplug.rst | 8 ++++++++ Documentation/core-api/cpu_hotplug.rst | 18 ++++++++++++++++++ drivers/base/cpu.c | 13 +++++++++++++ drivers/base/memory.c | 13 +++++++++++++ include/linux/kexec.h | 8 ++++++++ 7 files changed, 76 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-devices-memory b/Documentation/ABI/testing/sysfs-devices-memory index d8b0f80b9e33..a95e0f17c35a 100644 --- a/Documentation/ABI/testing/sysfs-devices-memory +++ b/Documentation/ABI/testing/sysfs-devices-memory @@ -110,3 +110,11 @@ Description: link is created for memory section 9 on node0. /sys/devices/system/node/node0/memory9 -> ../../memory/memory9 + +What: /sys/devices/system/memory/crash_hotplug +Date: Aug 2023 +Contact: Linux kernel mailing list +Description: + (RO) indicates whether or not the kernel directly supports + modifying the crash elfcorehdr for memory hot un/plug and/or + on/offline changes. diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu index ecd585ca2d50..31189da7ef57 100644 --- a/Documentation/ABI/testing/sysfs-devices-system-cpu +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu @@ -686,3 +686,11 @@ Description: (RO) the list of CPUs that are isolated and don't participate in load balancing. These CPUs are set by boot parameter "isolcpus=". + +What: /sys/devices/system/cpu/crash_hotplug +Date: Aug 2023 +Contact: Linux kernel mailing list +Description: + (RO) indicates whether or not the kernel directly supports + modifying the crash elfcorehdr for CPU hot un/plug and/or + on/offline changes. diff --git a/Documentation/admin-guide/mm/memory-hotplug.rst b/Documentation/admin-guide/mm/memory-hotplug.rst index 1b02fe5807cc..eb99d79223a3 100644 --- a/Documentation/admin-guide/mm/memory-hotplug.rst +++ b/Documentation/admin-guide/mm/memory-hotplug.rst @@ -291,6 +291,14 @@ The following files are currently defined: Availability depends on the CONFIG_ARCH_MEMORY_PROBE kernel configuration option. ``uevent`` read-write: generic udev file for device subsystems. +``crash_hotplug`` read-only: when changes to the system memory map + occur due to hot un/plug of memory, this file contains + '1' if the kernel updates the kdump capture kernel memory + map itself (via elfcorehdr), or '0' if userspace must update + the kdump capture kernel memory map. + + Availability depends on the CONFIG_MEMORY_HOTPLUG kernel + configuration option. ====================== ========================================================= .. note:: diff --git a/Documentation/core-api/cpu_hotplug.rst b/Documentation/core-api/cpu_hotplug.rst index e6f5bc39cf5c..d6d470d7dda0 100644 --- a/Documentation/core-api/cpu_hotplug.rst +++ b/Documentation/core-api/cpu_hotplug.rst @@ -741,6 +741,24 @@ will receive all events. A script like:: can process the event further. +When changes to the CPUs in the system occur, the sysfs file +/sys/devices/system/cpu/crash_hotplug contains '1' if the kernel +updates the kdump capture kernel list of CPUs itself (via elfcorehdr), +or '0' if userspace must update the kdump capture kernel list of CPUs. + +The availability depends on the CONFIG_HOTPLUG_CPU kernel configuration +option. + +To skip userspace processing of CPU hot un/plug events for kdump +(i.e. the unload-then-reload to obtain a current list of CPUs), this sysfs +file can be used in a udev rule as follows: + + SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end" + +For a CPU hot un/plug event, if the architecture supports kernel updates +of the elfcorehdr (which contains the list of CPUs), then the rule skips +the unload-then-reload of the kdump capture kernel. + Kernel Inline Documentations Reference ====================================== diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index c1815b9dae68..c9204d69e616 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -282,6 +282,16 @@ static ssize_t print_cpus_nohz_full(struct device *dev, static DEVICE_ATTR(nohz_full, 0444, print_cpus_nohz_full, NULL); #endif +#ifdef CONFIG_CRASH_HOTPLUG +static ssize_t crash_hotplug_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, "%d\n", crash_hotplug_cpu_support()); +} +static DEVICE_ATTR_ADMIN_RO(crash_hotplug); +#endif + static void cpu_device_release(struct device *dev) { /* @@ -469,6 +479,9 @@ static struct attribute *cpu_root_attrs[] = { #ifdef CONFIG_NO_HZ_FULL &dev_attr_nohz_full.attr, #endif +#ifdef CONFIG_CRASH_HOTPLUG + &dev_attr_crash_hotplug.attr, +#endif #ifdef CONFIG_GENERIC_CPU_AUTOPROBE &dev_attr_modalias.attr, #endif diff --git a/drivers/base/memory.c b/drivers/base/memory.c index b456ac213610..15bb416e58ce 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -490,6 +490,16 @@ static ssize_t auto_online_blocks_store(struct device *dev, static DEVICE_ATTR_RW(auto_online_blocks); +#ifdef CONFIG_CRASH_HOTPLUG +#include +static ssize_t crash_hotplug_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%d\n", crash_hotplug_memory_support()); +} +static DEVICE_ATTR_RO(crash_hotplug); +#endif + /* * Some architectures will have custom drivers to do this, and * will not need to do it from userspace. The fake hot-add code @@ -889,6 +899,9 @@ static struct attribute *memory_root_attrs[] = { &dev_attr_block_size_bytes.attr, &dev_attr_auto_online_blocks.attr, +#ifdef CONFIG_CRASH_HOTPLUG + &dev_attr_crash_hotplug.attr, +#endif NULL }; diff --git a/include/linux/kexec.h b/include/linux/kexec.h index b9903dd48e24..6a8a724ac638 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -501,6 +501,14 @@ static inline void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) { static inline void arch_crash_handle_hotplug_event(struct kimage *image) { } #endif +#ifndef crash_hotplug_cpu_support +static inline int crash_hotplug_cpu_support(void) { return 0; } +#endif + +#ifndef crash_hotplug_memory_support +static inline int crash_hotplug_memory_support(void) { return 0; } +#endif + #else /* !CONFIG_KEXEC_CORE */ struct pt_regs; struct task_struct; From patchwork Fri Aug 4 21:03:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp165241vqr; Fri, 4 Aug 2023 16:39:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQOD5+/7tXpfjXKasjBd9ZRTKHEK4tGHYmcsFYkvMbGkAiCEZNkZVPVkxNKZ7iAAGxgg9d X-Received: by 2002:a17:906:153:b0:99b:e464:bf49 with SMTP id 19-20020a170906015300b0099be464bf49mr2718478ejh.51.1691192397385; Fri, 04 Aug 2023 16:39:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691192397; cv=pass; d=google.com; s=arc-20160816; b=uijgsDHnk0FYAxpuOjmNj5H+PlLRDwr5UvtSZ81ogvw2HrxzXGQWJRfUQCkhzQL4UU 1g2jmTafPLAUxWB9OWK0TnSUvDeF/OaSTyJv/bebE8BC9ILs/kXFi9BNdY/GvmqhxEIo vV3RLasrTWC/QWE09EGJCuB7pidCzuq0JYsklQcovsfQ4fLg67RG9JhOmMyILhIG1Bx7 gKtGJAWGDQ/X1cZIz1mMq+Hka06HZ+mU1ZlI8SQFFobrcnhV3/brVTyspIFhC4EZH5Fz CW2oAkyAxSMw2+wKKNaEMl8xjGAWfmgVTzeEx8PTBK8QZsAIBuG5aVdqd9o8uJV6ZeMc YHDg== 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=YiE3bI9CczOXY+M3tBrHxgK+Wi4/BsWUxmlu48+lBQQ=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=i4W6OMFvSgOV5/WF1jRUSmbJ8hRJUj0nUBf/qhBiM/vKN5Ie1nNdxlpux1med1K/uq J39BnHDa8dKu6rwVMMzPT1thjnWMBkgVe88fYY/D7wdi2KBLsLp2dQ0w8Ik/4V+bZXWw CNcIre0gGRZCCRSV2HkF/ctS3ixLaqvWDjpV0/MP7D6D55z/PMHZHam02IG2nx5x9N2C lfzkBkeB/sIVul3onmpCDHi++k9U6zrwAlMBVjbSvopWdjxNSvtnLaoUfGvN+6ZmspJj xZ+hMII4Y0K4sZnXPPtLBJk9xPx2y9Opoi8nHfOIxs+h6RFMu25KCY2zmRoW/j3eUMCb 7UQA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=tPy25h9K; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=sFDbLxQq; 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 jt16-20020a170906ca1000b0098dfa5abc0bsi920167ejb.88.2023.08.04.16.39.33; Fri, 04 Aug 2023 16:39:57 -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=tPy25h9K; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=sFDbLxQq; 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 S230401AbjHDVFt (ORCPT + 99 others); Fri, 4 Aug 2023 17:05:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbjHDVFh (ORCPT ); Fri, 4 Aug 2023 17:05:37 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 168864EC1; Fri, 4 Aug 2023 14:05:11 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 374JCoKK014556; Fri, 4 Aug 2023 21:04:26 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=YiE3bI9CczOXY+M3tBrHxgK+Wi4/BsWUxmlu48+lBQQ=; b=tPy25h9KfkChmByvNca3MlmxpO15xnk4ls1A3h04GHHSRQ1mxgaBH/DHddKnsVXuLTqJ Qp+l22cjikpGEOZ8XOeftB9kBNDlj+uUtw+OhFYxnBRciPHRv+6XD67EinqZDEi/ZGcr Mt017xkunAqbWhWT75VTNuTIPCeN3RGvP6WtWrbFp9KntWSxonA9SQu8GP1U3nrtEEV2 uURow7/Bk2OS1q27WTYP8lUyuxseVdqMjyUe97k5JKjeJubcvp83RhfzItxDFPA4h154 BZArO+dQx5PNjZ6kbI9Y0+3XkMD4oU9BBLGawWY/dUQPKkvknxDXL/AoJ/2Nvnvo/Za7 /A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4spccr8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:26 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 374Krtms040728; Fri, 4 Aug 2023 21:04:24 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2176.outbound.protection.outlook.com [104.47.57.176]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s8kpkxn93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UVavxDtMRxh6HSqEELlC2rYhO3SMaKFSOAu0/YghrCfY9SBGGJxNGlJvrU4I8Cuh1t4ofntp7wDaXRlg1wJ/fscOwo6CHdQktAbcBwYFPHH91BGvbkAST9AkquNC0n9MQqW4nnhlyz3DH12LQIay7XHDvuHvXEG8CmyD61FBiLip2w9V9wERkWt6uRUN5f0zjLT44q1sh2HQAAs81mF6kehDEaqSMqc5aOPEFNs1cvVsXk0L5UvwUgZlaLN27g5V/epSvFJSBoG6+EzbE3UbGAdK+JZEwYdI3zkylHbcI/9Rr9L2hfVXaMI88BE+K4GFaRW2ekCQ5LUb852kcvcliw== 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=YiE3bI9CczOXY+M3tBrHxgK+Wi4/BsWUxmlu48+lBQQ=; b=WTBjytTkTUDZ79uOBhZY7VJFCdRIWyPxbgi3i5wGrk2wI1uyJHFcuCEK6a/hS1onT2uiggfX+OpdACdfMjvYrEmG8BsJNUZ16JNdK8E+HV6hzlnQiEhz67iSZsxkcZipxVn4uo6+HxM6sROE1EoMVoA+SpVA7Kjn/OJ9geai+SWImqFKoxLAuYm0aMZFqwInSj3oyjf4Z5gtbU2AZwYaaF99mcIpe98lRAklmcLtTU6LFIq5gK+XGSWYeaxRBiH/CwtKjdhSBYBndMtQmZD/XDb9kwcH/G/TavoC0cD9OvSXbyy0UX4ch2jGZnNLD12w4sH1xF0UnUCewjSJEwTZoQ== 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=YiE3bI9CczOXY+M3tBrHxgK+Wi4/BsWUxmlu48+lBQQ=; b=sFDbLxQq9uAB5PHChPAkp1q7DWddYfGyrZmDbEd5FgUhv2Fsru7tjOQrytOa/clOYUiTCrqMlWt+b5MJWEhNiLPaxV8LGil++57mJ/OtDpChuo17LKYLOMtXqgxjbVCyexm5TVI7zM2/DTuJdM/ikajcUU6JBJ/fMnNLsOsKIfo= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by PH7PR10MB7056.namprd10.prod.outlook.com (2603:10b6:510:275::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 21:04:21 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:21 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 5/8] x86/crash: add x86 crash hotplug support Date: Fri, 4 Aug 2023 17:03:56 -0400 Message-Id: <20230804210359.8321-6-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: DM6PR06CA0067.namprd06.prod.outlook.com (2603:10b6:5:54::44) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|PH7PR10MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: c5acc9e5-85c6-416a-6f59-08db952e6004 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Auab/AYjdOdGoRc7CkEbSSsExBpZU3M3hofDIt2I/DTlL2Z2mjPULop2N7/qqoh7gxBCMO88e05+VGh8KkzX/aSV9KJm1Jt4fpbfC06lwEwF59C6X0j8WZnNoJ/Gv+SX84yzEwx6d1xgJK+5vhdHiMlwCTbAV04WpYMzETaTmIGcDEeAeWwbyAWFKjGjHXhjmNKEaqAhlwTstpzmdcsTYlphLHUjEM3Z2qLsWat2UIZfypFX2C532mZKsKFgt7SEffKbIGFu5i8hIicZqcMy5PE+nwokcozy1tPkudCO3RMp3Z2oTcA67Nvo9AMYJ3UgAjjKDr0PaVcqcVRp4UvjJc6DgNEXHpsXU1YKY1r6/eBtK6kwIODnLUKub8ao+3bgSXsYVQvRTiPwtBz2bgrMmZvOjVcbfXkV0zqGPvqB8w/iJ40K67ZjGwwb27RX97CnXDtcdwYNBSxr0EhfQo2S4ll7o/KP4LkBW0KOhEHwQovT6VN4FbIEa/GBU7BRHHErZgLmYgO0izr/kNOUOaor5UldVz0VKXpfnuxLy+uppYLJIyDFegnUSzuDsEzr2a9OQBkzTocdHiBbqvE68f5Y7Bq5nBN/B3D1zzx2nZgD8w= 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)(136003)(346002)(39860400002)(396003)(366004)(376002)(451199021)(1800799003)(186006)(1076003)(2616005)(107886003)(26005)(83380400001)(6506007)(8936002)(41300700001)(2906002)(5660300002)(66946007)(66556008)(66476007)(4326008)(316002)(8676002)(6486002)(6666004)(6512007)(7416002)(7406005)(478600001)(921005)(38100700002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wGHzJj8RKi+Ek2nbKQXoOfyndOJCc7CKSiEZQe7YK3TEzfAOQ23wbYZUBQvWPzMkw8R9A42iLQGAxBMwqc1PNZfb3SGSardfmPkM9AA4JYzOh8vymnocGh0H6ML2+H+dEJtb9Ud2Kks4+NmVvcqu51XZGpleUYpGfO1AHHZClj8ss1WYWekmO6QO67MlBdf9s508E4iCcQJk0svJE5W9OUOtyqMDSH82jgn1izY2unhaM/GRcmgKf9d7cT6ZhniP/3bY8WkCAtKVFcb9kni4gyWTp2zpH47ivZ9OSduNrH7s3U4NQFv3kp/kQdLSukJCVvSgy8hUkOXzzcoGCX7K4Q6LFET8TVvSAVMSo7FdneD570Nu135MXi55UOXjzXLjRSg6OsSfzoBBbtOXjL8rG/PGzP2AQ9tDN2IsugBeXodZvPpgk3qWpPDpE0uTuxeSIXPbYmwBaL3Q3socHBAFf3kbjssiERs9dYCAijrRYIlUas+0eJe3PAlvUFtboZGxt8Sy25LLsrHAMtUd//tD9KOBXjCAlcHWGk7n9nn6/YjheZRym2MXrJrJcisPXfK2O9oaBAhkrGSYh5IJImD90DqKb+K9kI9jlflfkNDmhSIPfASQGy1YnRBR8OwEjO6lZDUJBvTo+de5AjG7symc0nncF3kUfXrNHrl90Z2Hwhru0vEAiJhVOgc4pe5gmcROWL3mILZcFEjlr6vV+8z5X1B0D6pqyShZukOBNTijodkAXFaDc5b05TdQKf4z/IykWLq5Xz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U40fUj0uVvgrwiHDVNPvjJqhU74USCzkZz693O6mBmWNg4deYju4SVsfMIOHEOyDDGV207LZuVPL2jJ15ed1P/A41NEFJ8i0I7yYiKiDyX8KulZi3Bloh4bwqcYN3BqJJX/Y4wPWL6S8s4j4ff3CE1KS2GZQc+h9hQupYiI4Cv3eX4JynqqISoV3NLAtps2TEFuxfFRx1hI36k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5acc9e5-85c6-416a-6f59-08db952e6004 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:21.6680 (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: 5DTLKg8dojH0AIACMtGh6PVQ7lykOurKALbXySRTiLmzPQpT6rVRND0tr9BsHv19/PDMFtxsCxyUSepMssDr3Znbs9sotwqbOq3dMLzFuSQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB7056 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 bulkscore=0 adultscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-ORIG-GUID: lee-4678h3AU203rQftC-TcooF9Xd6ey X-Proofpoint-GUID: lee-4678h3AU203rQftC-TcooF9Xd6ey 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773343759447671562 X-GMAIL-MSGID: 1773343759447671562 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. A new elfcorehdr is generated from the available CPUs and memory and replaces the existing elfcorehdr. The segment containing the elfcorehdr is identified at run-time in crash_core:crash_handle_hotplug_event(). No modifications to purgatory (see 'kexec: exclude elfcorehdr from the segment digest') or boot_params (as the elfcorehdr= capture kernel command line parameter pointer remains unchanged and correct) are needed, just elfcorehdr. For kexec_file_load(), the elfcorehdr segment size is based on NR_CPUS and CRASH_MAX_MEMORY_RANGES in order to accommodate a growing number of CPU and memory resources. For kexec_load(), the userspace kexec utility needs to size the elfcorehdr segment in the same/similar manner. To accommodate kexec_load() syscall in the absence of kexec_file_load() syscall support, prepare_elf_headers() and dependents are moved outside of CONFIG_KEXEC_FILE. Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain Acked-by: Hari Bathini Acked-by: Baoquan He --- arch/x86/Kconfig | 3 + arch/x86/include/asm/kexec.h | 15 +++++ arch/x86/kernel/crash.c | 103 ++++++++++++++++++++++++++++++++--- 3 files changed, 114 insertions(+), 7 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index fedc6dddd743..d9fc80b9ef84 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2069,6 +2069,9 @@ config ARCH_SUPPORTS_KEXEC_JUMP config ARCH_SUPPORTS_CRASH_DUMP def_bool X86_64 || (X86_32 && HIGHMEM) +config ARCH_SUPPORTS_CRASH_HOTPLUG + def_bool y + config PHYSICAL_START hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP) default "0x1000000" diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index 5b77bbc28f96..9143100ea3ea 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -209,6 +209,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..c70a111c44fa 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -158,8 +158,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 +229,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 +247,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 +258,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 +373,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 + /* + * The elfcorehdr segment size accounts for VMCOREINFO, kernel_map, + * maximum CPUs and maximum memory ranges. + */ + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) + pnum = 2 + CONFIG_NR_CPUS_DEFAULT + CONFIG_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 +421,66 @@ 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: a pointer to kexec_crash_image + * + * Prepare the new elfcorehdr and replace the existing 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 create new elfcorehdr"); + 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("mapping elfcorehdr segment 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 From patchwork Fri Aug 4 21:03:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp111492vqr; Fri, 4 Aug 2023 14:31:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERK/aXwIvCJCwh9IxKzBOojJ4arI83y3Uj+bxc8yB44BbmanRNkw13ZY+Ym2jtS1YlOYTm X-Received: by 2002:a17:902:7d98:b0:1b8:865d:6e1d with SMTP id a24-20020a1709027d9800b001b8865d6e1dmr2486045plm.51.1691184704058; Fri, 04 Aug 2023 14:31:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691184704; cv=pass; d=google.com; s=arc-20160816; b=Yp4uTcqRXqN8kiVUUXmaSYkCPt1hvzlCFRz3nLmpNGXk3HJjM6VH7Dra33+XeTxkPD U3NgKGNcFn2CvlvbLEa2mr4oHTsEKbbl4zYVMXo0WL3FeZIjkOr9sA9vTMLSWpeIWatl CVar/ylAlNWjM+BoFLQbWd7w4ANaywZ2d9/G9g6xY4A6eFfqLUrJ0K3ZlR+JiKK6kAyu fyxrc0gkh40ilKJNTDL8r+TrPIxvPVPkSRlI4kSVM+/EZOxw15rxo5syAJJZNLVhmnc+ 82aIOaMso6FOys0FfTRioUrEgW6gtlqaivvbXllD8iy1V2PKKfLAOgnhprL9QfC2L2yP BFhg== 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=MSKEXyVIenyIhnny+0ljW8sRLv+oqrr3PdZEtUnoGB4=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=HzRKr8UlUPkHiskBJIPEAjSfStAhKdvbGSzSLOkSno6FwvrVZY0dUtgbuGDIkJvBBH +R+9nADQ8496iEhfGa1+MMr9Jdtyb96e8mg4dK93dBVqn/I9QFv2flTbDWFnnw2I6v6e nbjZo9Jy8+9N9g9+xU8MOgdfM873GbdXZqg3lC37RrzdjzF2xclXkzP5kgfTWNFC5oFW XjREiTDH+0aivFlbh64HRePrIX+RSpd+64cakKFqSq42+vGEKM6cbuu6Dkzh2M1SaPgI o+44lKSfJpEQo249FzXnwddricc/+44CgcZLKnEuG+NGE3Wvl1ZXIvR1Jr76CHmNNXTU UCmw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=OGCTBNs0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hKB3b2HK; 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 h8-20020a170902ac8800b001b02e8d8976si2263043plr.300.2023.08.04.14.31.28; Fri, 04 Aug 2023 14:31:44 -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=OGCTBNs0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hKB3b2HK; 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 S230389AbjHDVGH (ORCPT + 99 others); Fri, 4 Aug 2023 17:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjHDVFj (ORCPT ); Fri, 4 Aug 2023 17:05:39 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B914526F; Fri, 4 Aug 2023 14:05:12 -0700 (PDT) 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 374JCk0i025344; Fri, 4 Aug 2023 21:04:30 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=MSKEXyVIenyIhnny+0ljW8sRLv+oqrr3PdZEtUnoGB4=; b=OGCTBNs0NpHD8YXJrpE1qal+dvlW5hYUnbhpN3bSiz1x8rZgxYccvqiQMN0dINQzmfMg JkM1RpSxFCPhK5grFzn4HkWtRaZFTzrUk9Q1VBUsI4P3+6ctepTraJkZGDC6XdHHpVHi pRoo4EkMCr8jNpaK1+yuFY9q2Xy7BTy0bNAr6bMXl6sR8b7x+3Pkdj7xmaNvTQIBKcLO vaB3J+xl7W88ODtZDTwJDNm3VVDqyqW85Rf7DzPYyb688CC5Pm7hHknkwxtC3fafF2+/ uJII42kdtZZH9DjbnGFP1QmOOgPICbZMvwkW14e40k5i66hxaPfMWrS7LxLG28jt4o74 Dg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4tcu4kw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:29 +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 374L0f7s035025; Fri, 4 Aug 2023 21:04:29 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2105.outbound.protection.outlook.com [104.47.55.105]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s8m09x0uu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MBvFcsWiQZwqU2puYvnR639j9Pw4njP55un9tGOWY0JuckWxJEDUmg1+ZBfHswennfYV2bTRbnCNSsrarlO/gQEebTUS8T8sWa1NuQAfmZ/TPSad5dJTKT7e+lnY8ifB5TMXabEn7lsCXHHGAwxWJukvyOzo7EOPvg1zjoXSEBLXUK5OAbQH7mc95xDEUxk+W7u/8RvZ22y45a+MyQ+BAFoXxQzjZsAR5gw0aDWq9kQ9PmkwIeM5ml52SWf8cgeiU23zJ3XArT0VIAbnpSp3U1ziD4E7eMEAvMXMEnDQ+4f7p4ZItgCxPnm0DBBB5WndOp4u/scLfEZb++DBhsm9Jw== 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=MSKEXyVIenyIhnny+0ljW8sRLv+oqrr3PdZEtUnoGB4=; b=oRf5m+OxNkOczk4Z4qeGZ9zK4Y/XqvGLPJxA5zvk57JI1f/WUcxUdCx4k4uzhWLAebZD7NUi6uDcwkoAlqGWPnspZG9XxhxABoX2nfK9uo0YaC1rj98yghZrjsAVZIPH6aDluxSeO9klMFwgVaGfLQeVWaZ1dUu3STgfdn8NlCLpXnULhXzge9JbREriJq5bMrljvhRzUcdFsV0Be84UlRJ1ULtiMfOc7fn71CHhF6GF5iInjKhyOBUcbsu83axUtcSPgXsVGK1gEYN4eYnrEH40p+dAyWvxk0zvEG+6aaCZ5SJjXXtmKcgK1zSa0Xb4gQw7PyQW8TEvC8FFmeX7+w== 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=MSKEXyVIenyIhnny+0ljW8sRLv+oqrr3PdZEtUnoGB4=; b=hKB3b2HKOq+kTtK+tC2qqXKMjwJR8wKSVIFgdkTv/Z85Uc0lcrjb6CxOP1FgBHh7GLwRUSvC/n4zgbRUt53R86YFdJqOLN1B+Z7D5bWraDRIfvZquDn2OBa6UT1IhlOmid4l2WZ1AXE5mkiUcxJuglwMBsFzsLedCNWYl9nEMZk= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by BLAPR10MB5330.namprd10.prod.outlook.com (2603:10b6:208:333::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.22; Fri, 4 Aug 2023 21:04:25 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:24 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 6/8] crash: hotplug support for kexec_load() Date: Fri, 4 Aug 2023 17:03:57 -0400 Message-Id: <20230804210359.8321-7-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: DM6PR02CA0155.namprd02.prod.outlook.com (2603:10b6:5:332::22) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|BLAPR10MB5330:EE_ X-MS-Office365-Filtering-Correlation-Id: 57220b1b-35e0-426c-2296-08db952e6190 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pjZkLjUXBOCdKqNcwvXt9vV6DX8iLvZZQM2qx/rB6Xe0zqG5l3dZL6CTn7MgmXLVJSGNbKvxbk18TU1bJU4U1ug66UGAORLyIVSFtzEDkoNSBbUg5uaK8o/18q1NFlMiAfSSQQrv+t3aPwRyngct9hcQ8C+qkxEpKTO3Zp/2660pQlMueQuPf1mcmoZP2nxKMF+DROL9KZ3V1m4Pwes7J9r/D0y4/zf+ZhYU4B61E+s9f/Kg9gn6jr4vwAhPhWo7KfM0PIhoPsTsOu1rw8Syny9WxRWySnrWfB+Lggf00IDY3VTcsvbuYSOeuKcISMMcgh4NjCenQ8dPnjShddT3Z2epgEWSTE+zu6Wsvb4RMp/tRTBIKYp7pKs8uPnPpmXDQ/ljbCCnuKSrUIIfHY6rPW7EMoLn64LvqhycGOHez26P6RdD5MQQYrr/u0o/CjorZK63xB1uedRWhVVE2VgkLbcOdOXIyTDygwRvfksyTj3XNBzcIGkUVnzMoy9lP0t6P1HSxqGohlwOn+X0fIVBoA1yY2XDW07HerCCLcVMX6OwADiGUD9aj2MnZ0ftTVZeRWdzbhifNMQQcvRHoPVqHKhjH/QDBZBu/VM+sn0atSI= 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)(136003)(366004)(376002)(39860400002)(396003)(346002)(451199021)(186006)(1800799003)(6486002)(6666004)(6512007)(86362001)(921005)(26005)(1076003)(6506007)(107886003)(2616005)(36756003)(83380400001)(38100700002)(66556008)(66476007)(66946007)(4326008)(2906002)(316002)(30864003)(5660300002)(7406005)(7416002)(8936002)(8676002)(478600001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YCkCNMhscrKOKD9EByVCUS1KkTjjh4iTMK8A/FclFCQfKFitd8icKVZZHcyEeJVqE7aSpQ0Er/HsI/OnbC+7pPpEHkEx5EVaS7LgKghMtFxkROg82VDCgEuzmnUQEdf0YTFGFwJlUZOAxawmybbRH9w98zn+3AxDpdRsJ0lozLk34XH5mUl77R6lunpa6PyRDEWK40zLNLWfWz8l47EzGTf/wjujqNO5T+3tUtCcYyEGwd0LxoFaWRKb7Y8dI6a+FLzDpf0agrnm8ZN0YBllriMYhiMouefIg9cjndDTWWwpd1mTod8+v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eb3KuT4cbHpa4L4lwJnxma7SMk/1ZHAiETdj9HN66yUkdn51C4yH0+QztXGD7cn2jMAbZpWr3Rn4kmypyy2pT2Noc0cQC6y7EAi1u8CPyCflBObHUAvrn+Uct0sNnfG7IDQ+MRwyUZi5sy0YIrM9v5ieJ9fgaKBjrm80/sV7kAOThQjT/ro8NbrRwgaB1UTYavaoDhVx0rUhUO/ONc48mxlaW3CKF2hBGcUrJjgss9Vd2NpN1o5WGqjywIp3wUrnY7WO8jl23OXwDw2LYbWJcgVosXf1xtmUcRrNyyLkYB/rkjE9mWQDqshrWWwrVrceSK5Y6+PGop68rPEf6HfOHS+hHYQ7sV18xdpBSJbUDKmavAChroV7W6bAn43vmpQaFa5dDHO+oVG63Qe2OS8dmfrfIMcVgfqaxtDEp2s465MIbx5eXXbMDa6VycI7eRRD/u9+/FylJ6MG/ZEA23JD2bXyTh8nKDb39gVHWzbsBiaFMBRX9Ugaj0dw0ENwV20eWW1nU1xSI3PW6+yrGaVcVUbIQtzOweP2sNs7V41BYG9TrMESAywncfnuoLErDU928rEUdAbXWnXVsmrqR9CjDOY1DFNjbqtGrYgltJUou8VQ5OeTETlocAiEfnt6SLgWqi8CLyxBgJ2VSjEkiyih/VwLtmubJ88lhKTSV4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57220b1b-35e0-426c-2296-08db952e6190 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:24.3015 (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: 9yNQcRrQGiA4opl8RYhGq7Riel8szwSDGeUmsp2HnmeUJJMCEGhzWsxQD11NjK4P7a33VHNZxEYp3oiZWpOX0OVr88faOECj9lbrvNM9ato= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5330 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-GUID: iQVAOJ8-A52nHZRv4rmeimp6mWtiQrOO X-Proofpoint-ORIG-GUID: iQVAOJ8-A52nHZRv4rmeimp6mWtiQrOO 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773335692340460602 X-GMAIL-MSGID: 1773335692340460602 The hotplug support for kexec_load() requires changes to the userspace kexec-tools and a little extra help from the kernel. Given a kdump capture kernel loaded via kexec_load(), and a subsequent hotplug event, the crash hotplug handler finds the elfcorehdr and rewrites it to reflect the hotplug change. That is the desired outcome, however, at kernel panic time, the purgatory integrity check fails (because the elfcorehdr changed), and the capture kernel does not boot and no vmcore is generated. Therefore, the userspace kexec-tools/kexec must indicate to the kernel that the elfcorehdr can be modified (because the kexec excluded the elfcorehdr from the digest, and sized the elfcorehdr memory buffer appropriately). To facilitate hotplug support with kexec_load(): - a new kexec flag KEXEC_UPATE_ELFCOREHDR indicates that it is safe for the kernel to modify the kexec_load()'d elfcorehdr - the /sys/kernel/crash_elfcorehdr_size node communicates the preferred size of the elfcorehdr memory buffer - The sysfs crash_hotplug nodes (ie. /sys/devices/system/[cpu|memory]/crash_hotplug) dynamically take into account kexec_file_load() vs kexec_load() and KEXEC_UPDATE_ELFCOREHDR. This is critical so that the udev rule processing of crash_hotplug is all that is needed to determine if the userspace unload-then-load of the kdump image is to be skipped, or not. The proposed udev rule change looks like: # The kernel updates the crash elfcorehdr for CPU and memory changes SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end" SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end" The table below indicates the behavior of kexec_load()'d kdump image updates (with the new udev crash_hotplug rule in place): Kernel |Kexec -------+-----+---- Old |Old |New | a | a -------+-----+---- New | a | b -------+-----+---- where kexec 'old' and 'new' delineate kexec-tools has the needed modifications for the crash hotplug feature, and kernel 'old' and 'new' delineate the kernel supports this crash hotplug feature. Behavior 'a' indicates the unload-then-reload of the entire kdump image. For the kexec 'old' column, the unload-then-reload occurs due to the missing flag KEXEC_UPDATE_ELFCOREHDR. An 'old' kernel (with 'new' kexec) does not present the crash_hotplug sysfs node, which leads to the unload-then-reload of the kdump image. Behavior 'b' indicates the desired optimized behavior of the kernel directly modifying the elfcorehdr and avoiding the unload-then-reload of the kdump image. If the udev rule is not updated with crash_hotplug node check, then no matter any combination of kernel or kexec is new or old, the kdump image continues to be unload-then-reload on hotplug changes. To fully support crash hotplug feature, there needs to be a rollout of kernel, kexec-tools and udev rule changes. However, the order of the rollout of these pieces does not matter; kexec_load()'d kdump images still function for hotplug as-is. Suggested-by: Hari Bathini Signed-off-by: Eric DeVolder Acked-by: Hari Bathini Acked-by: Baoquan He --- arch/x86/include/asm/kexec.h | 11 +++++++---- arch/x86/kernel/crash.c | 27 +++++++++++++++++++++++++++ include/linux/kexec.h | 14 ++++++++++++-- include/uapi/linux/kexec.h | 1 + kernel/Kconfig.kexec | 4 ++++ kernel/crash_core.c | 31 +++++++++++++++++++++++++++++++ kernel/kexec.c | 5 +++++ kernel/ksysfs.c | 15 +++++++++++++++ 8 files changed, 102 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index 9143100ea3ea..3be6a98751f0 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -214,14 +214,17 @@ 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 +int arch_crash_hotplug_cpu_support(void); +#define crash_hotplug_cpu_support arch_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 +int arch_crash_hotplug_memory_support(void); +#define crash_hotplug_memory_support arch_crash_hotplug_memory_support #endif + +unsigned int arch_crash_get_elfcorehdr_size(void); +#define crash_get_elfcorehdr_size arch_crash_get_elfcorehdr_size #endif #endif /* __ASSEMBLY__ */ diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index c70a111c44fa..caf22bcb61af 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -427,6 +427,33 @@ int crash_load_segments(struct kimage *image) #undef pr_fmt #define pr_fmt(fmt) "crash hp: " fmt +/* These functions provide the value for the sysfs crash_hotplug nodes */ +#ifdef CONFIG_HOTPLUG_CPU +int arch_crash_hotplug_cpu_support(void) +{ + return crash_check_update_elfcorehdr(); +} +#endif + +#ifdef CONFIG_MEMORY_HOTPLUG +int arch_crash_hotplug_memory_support(void) +{ + return crash_check_update_elfcorehdr(); +} +#endif + +unsigned int arch_crash_get_elfcorehdr_size(void) +{ + unsigned int sz; + + /* kernel_map, VMCOREINFO and maximum CPUs */ + sz = 2 + CONFIG_NR_CPUS_DEFAULT; + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) + sz += CONFIG_CRASH_MAX_MEMORY_RANGES; + sz *= sizeof(Elf64_Phdr); + return sz; +} + /** * arch_crash_handle_hotplug_event() - Handle hotplug elfcorehdr changes * @image: a pointer to kexec_crash_image diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 6a8a724ac638..bb0e614f2a05 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -335,6 +335,10 @@ struct kimage { unsigned int preserve_context : 1; /* If set, we are using file mode kexec syscall */ unsigned int file_mode:1; +#ifdef CONFIG_CRASH_HOTPLUG + /* If set, allow changes to elfcorehdr of kexec_load'd image */ + unsigned int update_elfcorehdr:1; +#endif #ifdef ARCH_HAS_KIMAGE_ARCH struct kimage_arch arch; @@ -411,9 +415,9 @@ bool kexec_load_permitted(int kexec_image_type); /* List of defined/legal kexec flags */ #ifndef CONFIG_KEXEC_JUMP -#define KEXEC_FLAGS KEXEC_ON_CRASH +#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_UPDATE_ELFCOREHDR) #else -#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT) +#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT | KEXEC_UPDATE_ELFCOREHDR) #endif /* List of defined/legal kexec file flags */ @@ -501,6 +505,8 @@ static inline void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) { static inline void arch_crash_handle_hotplug_event(struct kimage *image) { } #endif +int crash_check_update_elfcorehdr(void); + #ifndef crash_hotplug_cpu_support static inline int crash_hotplug_cpu_support(void) { return 0; } #endif @@ -509,6 +515,10 @@ static inline int crash_hotplug_cpu_support(void) { return 0; } static inline int crash_hotplug_memory_support(void) { return 0; } #endif +#ifndef crash_get_elfcorehdr_size +static inline unsigned int crash_get_elfcorehdr_size(void) { return 0; } +#endif + #else /* !CONFIG_KEXEC_CORE */ struct pt_regs; struct task_struct; diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h index 981016e05cfa..01766dd839b0 100644 --- a/include/uapi/linux/kexec.h +++ b/include/uapi/linux/kexec.h @@ -12,6 +12,7 @@ /* kexec flags for different usage scenarios */ #define KEXEC_ON_CRASH 0x00000001 #define KEXEC_PRESERVE_CONTEXT 0x00000002 +#define KEXEC_UPDATE_ELFCOREHDR 0x00000004 #define KEXEC_ARCH_MASK 0xffff0000 /* diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec index d0a9a5392035..6e5350d2d7a6 100644 --- a/kernel/Kconfig.kexec +++ b/kernel/Kconfig.kexec @@ -144,4 +144,8 @@ config CRASH_MAX_MEMORY_RANGES memory buffer/segment size under 1MiB. This represents a sane choice to accommodate both baremetal and virtual machine configurations. + For the kexec_load() syscall path, CRASH_MAX_MEMORY_RANGES is part of + the computation behind the value provided through the + /sys/kernel/crash_elfcorehdr_size attribute. + endmenu diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 53d211c690a1..fa918176d46d 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -704,6 +704,33 @@ subsys_initcall(crash_save_vmcoreinfo_init); #ifdef CONFIG_CRASH_HOTPLUG #undef pr_fmt #define pr_fmt(fmt) "crash hp: " fmt + +/* + * This routine utilized when the crash_hotplug sysfs node is read. + * It reflects the kernel's ability/permission to update the crash + * elfcorehdr directly. + */ +int crash_check_update_elfcorehdr(void) +{ + int rc = 0; + + /* Obtain lock while reading crash information */ + if (!kexec_trylock()) { + pr_info("kexec_trylock() failed, elfcorehdr may be inaccurate\n"); + return 0; + } + if (kexec_crash_image) { + if (kexec_crash_image->file_mode) + rc = 1; + else + rc = kexec_crash_image->update_elfcorehdr; + } + /* Release lock now that update complete */ + kexec_unlock(); + + return rc; +} + /* * To accurately reflect hot un/plug changes of cpu and memory resources * (including onling and offlining of those resources), the elfcorehdr @@ -734,6 +761,10 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu) image = kexec_crash_image; + /* Check that updating elfcorehdr is permitted */ + if (!(image->file_mode || image->update_elfcorehdr)) + goto out; + 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); diff --git a/kernel/kexec.c b/kernel/kexec.c index 92d301f98776..107f355eac10 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -129,6 +129,11 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments, if (flags & KEXEC_PRESERVE_CONTEXT) image->preserve_context = 1; +#ifdef CONFIG_CRASH_HOTPLUG + if (flags & KEXEC_UPDATE_ELFCOREHDR) + image->update_elfcorehdr = 1; +#endif + ret = machine_kexec_prepare(image); if (ret) goto out; diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index aad7a3bfd846..1d4bc493b2f4 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -165,6 +165,18 @@ static ssize_t vmcoreinfo_show(struct kobject *kobj, } KERNEL_ATTR_RO(vmcoreinfo); +#ifdef CONFIG_CRASH_HOTPLUG +static ssize_t crash_elfcorehdr_size_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + unsigned int sz = crash_get_elfcorehdr_size(); + + return sysfs_emit(buf, "%u\n", sz); +} +KERNEL_ATTR_RO(crash_elfcorehdr_size); + +#endif + #endif /* CONFIG_CRASH_CORE */ /* whether file capabilities are enabled */ @@ -255,6 +267,9 @@ static struct attribute * kernel_attrs[] = { #endif #ifdef CONFIG_CRASH_CORE &vmcoreinfo_attr.attr, +#ifdef CONFIG_CRASH_HOTPLUG + &crash_elfcorehdr_size_attr.attr, +#endif #endif #ifndef CONFIG_TINY_RCU &rcu_expedited_attr.attr, From patchwork Fri Aug 4 21:03:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp156784vqr; Fri, 4 Aug 2023 16:16:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlzVRC02MBCUx/GK0lnj5ji7UsmJxtmb7ex92Qc1exITetGcO75IoghEgrAfjaj3CP7F7J X-Received: by 2002:a05:6808:221c:b0:3a4:31da:34c5 with SMTP id bd28-20020a056808221c00b003a431da34c5mr4423419oib.39.1691191013636; Fri, 04 Aug 2023 16:16:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691191013; cv=pass; d=google.com; s=arc-20160816; b=xT3TzQcfqr4V/uB4rUU7ZaXlvpeBFLj5nOYgsJp7poH/lp696iq63k+z4HFyEp489r KwEfdwjB/YgwY1w6HZUlit+a3aXtt27vQFbvBE0qpkjC5P1JLOZ0dPBLkNepnPCc0NxY SvP2XW6gwAsSC/zepnZ8vslp06C2Xv6CHxpwLcUfvK1iet0jDG+S5Y4zKkTwqRSm7sIK SMrPKpGHHtaDcJQvLrfF9BXDD/XYep7Bi82Mq0eisp70o7pMbQdUsWYbRi5b/9Rryrxj IEGXAaJLkMRjfTp/wgE0e/aP5M1I+0L73BfbFTaTcxTz3+yEtguhY63pEBLAg+AJbnF2 20SQ== 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=kqZzUcUI7g9GrNNQb568EFpHtig8R3NmjYR2Lpu3gEg=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=rXlLOKjDMwVz4azlIxdo+vWFxyOpOw4Lcnp6O4KucCi75B4Ibj3kQG+AOba/BI2Lco B2M3N2KNa3ND9AFMErJ/vS0HHje43HIXJQMG5lkmX9VaQ81Z/zLV2zbvWWAvSr9WIpB/ iTiYxmptjO3zWP6rd9XhSiGlgJxFQ6U4yucKuCjit4mOzmRgj4bXN2bb/J7bscNKKMTZ skZ8yDXvpPw0dJvGanDygBCrIOxZMP2je2jt+8B1mJd4TVUDEv/ULclMyifHAR7G6O21 MDoLV+c0K7Y+DHgyuA3NFGLuQl+CH+YL8X+VJbrriyfjaJZmNR7jD7lU3+dKTmRMCtzn 4OKw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b="HbIgzU//"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=him0vZtv; 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 i64-20020a636d43000000b005640a32d25esi2326582pgc.517.2023.08.04.16.16.40; Fri, 04 Aug 2023 16:16:53 -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="HbIgzU//"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=him0vZtv; 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 S229795AbjHDWdY (ORCPT + 99 others); Fri, 4 Aug 2023 18:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjHDWdW (ORCPT ); Fri, 4 Aug 2023 18:33:22 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8D8170D; Fri, 4 Aug 2023 15:33:21 -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 374JCask019548; Fri, 4 Aug 2023 21:04: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-2023-03-30; bh=kqZzUcUI7g9GrNNQb568EFpHtig8R3NmjYR2Lpu3gEg=; b=HbIgzU//lmaS2pdv9E9LsMM2eFU3GsqUKNWEgAWLGEq31wVN7n3d6/x3wTAuVnwgzIwt NdOSFuh3xW/9lumim2apr+pbVyxFXhJSZbe3egQw79y5wzyKxK7wBFDfOrumMwuqjqYa Gub3kmkEMrfFwG201uqE1CnvxgPOeF+IVq6h/McEOr8eF2Inp0t0QIVWOoocQNZZFBDU DN6VPi9MoYQQI5r35eDa9gCOk0YOCs75kcJmwHV/Q7xaAi2G5QAGxaiZhDTDRUGVSvgC 4GRNbiOl5R68OSAcNZkU8wSsTTjP0nj+0glFvic1gb4SEqcv5D2Y6s0k7xGilmMqZXAb rQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s79vbxr1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:31 +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 374L0f7t035025; Fri, 4 Aug 2023 21:04:30 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2105.outbound.protection.outlook.com [104.47.55.105]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s8m09x0uu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kHXVipYslLFjbjV89o6jSjTpB3H9LsEaUa9/WdbopJ74e+xI+hcx2sVDslA5efxB5AaEMHtEcNK5strLOk7dsylx31Hb3xgiXHcZkJeNxK0Pg2AI7ppHkMaNNvTeRqAINHNiv6gCT4YNXmvjyIK1xSzvtqleQCF89zWViy9x0myxvbtTX8BkYPfoK13VMhXNflTgW5xZV4ZMPHevxkZWHPjSKq/sB9+r85cATJN7O9oR8EUB6480h8jhNbZpkX+Orjm2U+l9Mvpba9TbAG5mhPOTd5Z2GTqLkUjiJdc4S+6rl+0OG790go19f5XmyhV5smNkvEhTBeNqLChoP5rINw== 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=kqZzUcUI7g9GrNNQb568EFpHtig8R3NmjYR2Lpu3gEg=; b=HHWJJHZTnUINyoxDg8SLUOX44p7gXJyaBqyces0VVZa5EKJ1TmlIgEQwUkt4vh9yuow3ApP4zAw8OWT1qSwuTWUWuZcDUbxwYU657I8XE3lrsl3mGBR9v1LLcoov92B8Hzp3i0qjCVLKCGNIQfRVOtCgpNmmsglzo/R5W6YRmKsZv8cWZESb5UXNwY7zYdA9PQHfciEGbPVzzAcWFC/FI0meKBLpMy5m0A8hYQcJfFUwCMn+lwHCbFWhxZIeqMuU3vSvHgiEppX4bxfxxULZXtjJYF2PnHndR/BcgpeKDEEcyUXWmrl000zXNo1qKyQWC0PJtY6xUpPQV+bW9z5Lwg== 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=kqZzUcUI7g9GrNNQb568EFpHtig8R3NmjYR2Lpu3gEg=; b=him0vZtv8PyA4cUSInkfOCTMyvP5ccfNeZu/oqz332srw2CUklstB27Oyxoc+B8CXjBL4wvmsfxdQ21kPVYXoLsjTKO7MaPivpJF933U9DyPT5UJq2fYMLAQgnCbQ/20oYKEgPoxUIFnAJYaMoYr+YoTibwhgIboJRIc+in1YCs= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by BLAPR10MB5330.namprd10.prod.outlook.com (2603:10b6:208:333::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.22; Fri, 4 Aug 2023 21:04:27 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:27 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 7/8] crash: change crash_prepare_elf64_headers() to for_each_possible_cpu() Date: Fri, 4 Aug 2023 17:03:58 -0400 Message-Id: <20230804210359.8321-8-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: DM6PR07CA0053.namprd07.prod.outlook.com (2603:10b6:5:74::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_|BLAPR10MB5330:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a3adb53-a01e-4218-70d6-08db952e6338 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S4arDRL8Kc8lhVaQqj3NJwEl5MGN22HEffgt2Vd4pROkU3MTvFyHgWCPmozeeJJJ3HX6zLVQwZgAsZSHHzCWvZsId4ymVwJ7lsyOFdFkWt1C08Q+qhKkNJa1I7RgZYDPat4TSRdSKNON//usAY9h29v+HpdQnzzaXXu2mRrG8VgoXmbcCMDFchMqOUQBiwvF8PS+VE3ZQMQvub+gRefHmToqSweHX52KnV/XDLWbhp6McpuSQZMgpBpW1Tg4aYi2U1Avq8YBfMNtsKUxvdx4w0k3wej5qFOd5rAOrMxvKQoctddXbS2J/hdjIF0h7sQa73UlrEa+VVuq1ri21ajEuO7VqV+ZX0heRyQO1QYbb/1qZSVfCEqOJEhkwX43fuUnp92LQvTI7TWOXFE3hd3d6+qbn3fx8IF/7WygWmoZQjCYV6PeCIc8wn1nQ0FEg739TRCXb9UOHksPOx6WcTRDnGC98M0bsWFAxCGBuz++G1mNpQ66q5zKYccLta2srAKFXWSe9auXT9+3S3SQ22LPwy4HeohY5RbG0TZNkUx8BWCcI0hcgQBkDXkYOKDpBCJDzedEXOeyP8BxjhE55Exu3t13SmapsAgrR+Rdi1O641I= 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)(136003)(366004)(376002)(39860400002)(396003)(346002)(451199021)(186006)(1800799003)(6486002)(6666004)(6512007)(86362001)(921005)(26005)(1076003)(6506007)(107886003)(2616005)(36756003)(83380400001)(38100700002)(66556008)(66476007)(66946007)(4326008)(2906002)(316002)(5660300002)(7406005)(7416002)(8936002)(8676002)(478600001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fMb3Ts7UIMyubCTNq5XUKvs8wuwGcFyPZBYF14GxF/X+JAfcZ2lXJWY+s2XLGNQbhSNmuc87JD4xSys4YzvxqHDfY3F93RkB1/k/i4cCLQlWAhDZEI5acl+IF0OhVddo45Eu3nOGjVecCXaqtfMtrHWro9k0kOvpV3VgcT/37zI7n27ftGX3rHq1+90nfiZmJt7oTdu2qWuyoNfU01c+7EIKBIGQ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W6Mo6XOFR9LI/W63270AGtgcs5FvJiIj+hd//f7/F9fNAwIde0UR+vxJ2Ge5LGuYMDkzJsbfYC+PT5ntGcVd5wSKqVoDLk27HBzv5MwpA1Gen+tDshCrd6OEIN73YENH35IxzPBKkua/b6xSjTk4sI+KevDD4fm+bcuLYlrXBGIT4anSZwltg+LSvXvJ48ovSkR7Ia8wPw1IUtQwvFjRgHpeakMkdIn19RD3gm4LgGJkUS6cBcXaFCAgIWtrw5E/6YKad85pWoCLoLW+XxnLyREMIN+fl/ZiMtkuSjp+lTQ4ZwwtsbL0g6a9h28XViJkrWSPZVcAZgLib1vxDtO402jNdNYM7Sax3JN6xegYBmua9Vt7GdTKVEbJc+Nc3iKwgYPxCwAARwsKYP1Wa9HAEIOk//RwT3hYD1mSfYOM4CFO2Z3zolrYjmFMQk6pemfBMhxpLnW+cgVJvpi9gbYa02Agvbof93XflMSUSSNjakSrETVcceABGTcnxhIgk5ntqY/rqxbgi8GSOMgH9VhRhrLBQ90Cpz8Mi/JzLTv+kxZA0zXorwPrIDomjtttD55sc/OXYAQ/byz/xLRIKsfpThMtezUw8awGdOgd8GC7f6aaARlocnUEziEFUXmwIaaSRV/54wiTE4JcBzGNx+81n7Uw1p4dWdVkteg480ZkmRCErJ2x+dY0p42wq1ObG2n0Yu2duwItP3o9IH0EVj5B0voYGoRpJyn5t2whceEQofbhNiZmBE0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a3adb53-a01e-4218-70d6-08db952e6338 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:27.1132 (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: J1T9Vwa2fbTqWHOlYeOtUDGnlLxsYBPygLSIWSyv47JONol+ugOURVk5/0lB/2vtawi8Z65HHIFUhPNGphjbYmOdhtF7ZMByaxFK/uOnCug= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5330 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-GUID: G46q33Rz9DbrPTqOwKfUX7Ic2PWFg7f1 X-Proofpoint-ORIG-GUID: G46q33Rz9DbrPTqOwKfUX7Ic2PWFg7f1 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773342308113996778 X-GMAIL-MSGID: 1773342308113996778 The function crash_prepare_elf64_headers() generates the elfcorehdr which describes the CPUs and memory in the system for the crash kernel. In particular, it writes out ELF PT_NOTEs for memory regions and the CPUs in the system. With respect to the CPUs, the current implementation utilizes for_each_present_cpu() which means that as CPUs are added and removed, the elfcorehdr must again be updated to reflect the new set of CPUs. The reasoning behind the move to use for_each_possible_cpu(), is: - At kernel boot time, all percpu crash_notes are allocated for all possible CPUs; that is, crash_notes are not allocated dynamically when CPUs are plugged/unplugged. Thus the crash_notes for each possible CPU are always available. - The crash_prepare_elf64_headers() creates an ELF PT_NOTE per CPU. Changing to for_each_possible_cpu() is valid as the crash_notes pointed to by each CPU PT_NOTE are present and always valid. Furthermore, examining a common crash processing path of: kernel panic -> crash kernel -> makedumpfile -> 'crash' analyzer elfcorehdr /proc/vmcore vmcore reveals how the ELF CPU PT_NOTEs are utilized: - Upon panic, each CPU is sent an IPI and shuts itself down, recording its state in its crash_notes. When all CPUs are shutdown, the crash kernel is launched with a pointer to the elfcorehdr. - The crash kernel via linux/fs/proc/vmcore.c does not examine or use the contents of the PT_NOTEs, it exposes them via /proc/vmcore. - The makedumpfile utility uses /proc/vmcore and reads the CPU PT_NOTEs to craft a nr_cpus variable, which is reported in a header but otherwise generally unused. Makedumpfile creates the vmcore. - The 'crash' dump analyzer does not appear to reference the CPU PT_NOTEs. Instead it looks-up the cpu_[possible|present|onlin]_mask symbols and directly examines those structure contents from vmcore memory. From that information it is able to determine which CPUs are present and online, and locate the corresponding crash_notes. Said differently, it appears that 'crash' analyzer does not rely on the ELF PT_NOTEs for CPUs; rather it obtains the information directly via kernel symbols and the memory within the vmcore. (There maybe other vmcore generating and analysis tools that do use these PT_NOTEs, but 'makedumpfile' and 'crash' seems to be the most common solution.) This results in the benefit of having all CPUs described in the elfcorehdr, and therefore reducing the need to re-generate the elfcorehdr on CPU changes, at the small expense of an additional 56 bytes per PT_NOTE for not-present-but-possible CPUs. On systems where kexec_file_load() syscall is utilized, all the above is valid. On systems where kexec_load() syscall is utilized, there may be the need for the elfcorehdr to be regenerated once. The reason being that some archs only populate the 'present' CPUs from the /sys/devices/system/cpus entries, which the userspace 'kexec' utility uses to generate the userspace-supplied elfcorehdr. In this situation, one memory or CPU change will rewrite the elfcorehdr via the crash_prepare_elf64_headers() function and now all possible CPUs will be described, just as with kexec_file_load() syscall. Suggested-by: Sourabh Jain Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain Acked-by: Hari Bathini Acked-by: Baoquan He --- kernel/crash_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index fa918176d46d..7378b501fada 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -364,8 +364,8 @@ int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, ehdr->e_ehsize = sizeof(Elf64_Ehdr); ehdr->e_phentsize = sizeof(Elf64_Phdr); - /* Prepare one phdr of type PT_NOTE for each present CPU */ - for_each_present_cpu(cpu) { + /* Prepare one phdr of type PT_NOTE for each possible CPU */ + for_each_possible_cpu(cpu) { 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; From patchwork Fri Aug 4 21:03:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeVolder X-Patchwork-Id: 131391 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp141285vqr; Fri, 4 Aug 2023 15:43:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFq2FGF+tQnutZM2VPmoqqkZtveIO4vHFDHw1ANIv0fhPjPKfeQbbi3xGwo94ghLJSFPx7t X-Received: by 2002:a17:906:5a48:b0:98c:e72c:6b83 with SMTP id my8-20020a1709065a4800b0098ce72c6b83mr2409582ejc.45.1691188983493; Fri, 04 Aug 2023 15:43:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691188983; cv=pass; d=google.com; s=arc-20160816; b=OyYcXe+n9sh09sF4kzs4x5puol+hnRl5KxkZ3GsE2mCBVXOr7ADFuVkaeehYK82GKQ dl0oxlG05JINWxlQmHYflISmQkKrVlgQmFukzXA8g7I7u3Kt7tyuV5gvrOVg/vHhO5ry x+RzVDUhdiENKm/3wTCN6c5qZaGA7hsLTzWlY9+vfhbeRoCry30CyYfNNAGUbJ29p8va 2MRcX+O+aHL8xEMTp7lTU+z5ne+ONQb1I82HQdADcwyIOvnFuZ8ACEkFM6vQlqAKNa5P hPakr8KMcrKJbDPbpq16UYenNRaGXXEff8DhC1ah07ortYsCKdPpWvvBUlvJ+wsYt0Y4 cipg== 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=o+McSM2gKtujfwRfyeOsaE02Y4bKTLqqTyQF/lTUOqg=; fh=ZbNC38sm56YRcxo0eY5DlCjDElPeJYCNHKxhiyVbz2E=; b=LO4g0TH/Ipn4w2qkGXyqRdvEPLnlknMS3hEwnon35Se1Bw+EMnVdcb3FW5OmeD+c5F a1xmWZXw2QnON/e/7Ad3rxuAIXtHfg4rt1Cs9oMuDRUPz5VZiM/d+3ey8jPAi7V0QEk6 APi187CJ8TqIgNjKPh5eTRlOyseqIOCFoEVtaK66Qrxy+Oi11EhlL/H/otcDah0COjFv wn/xIETRt3inqke9tbja0O1f/xYwM2PlhIJ/jR2RXB1Mk87zivgfISf3rA86hZmADY/s djUaZE/wcP/b678ynitpj24q5FlzSTPIyMdX0UPya9pSy3EbDFWjfgNF7GRcwc0x35xh Kkpg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=P5eVvfz0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Wz0B1hdW; 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 f20-20020a1709067f9400b0096f65c97148si2090306ejr.714.2023.08.04.15.42.40; Fri, 04 Aug 2023 15:43:03 -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=P5eVvfz0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Wz0B1hdW; 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 S231189AbjHDVLo (ORCPT + 99 others); Fri, 4 Aug 2023 17:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231130AbjHDVLg (ORCPT ); Fri, 4 Aug 2023 17:11:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 759574ECB; Fri, 4 Aug 2023 14:11:07 -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 374JCasl019548; Fri, 4 Aug 2023 21:04:33 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=o+McSM2gKtujfwRfyeOsaE02Y4bKTLqqTyQF/lTUOqg=; b=P5eVvfz0YAQZr/uS/mBoivaf/re60E7w0zQY20vBcFBP+ADx09tGj5zFBPht8POniY91 kAW7hkx9RaW/iKAAgKi6PwhKgxpWp+Kf6Ft+7Kff5cMmeo3MO5fgJ3YYw66XquxYySNA YErweSEons8yi8ZAClKJSMU3KIqZ/zZkUZM748aY94IDTC5bz8us67rBt91OGFPzEvdf LDakCbLazFO+DyFl9zvTvUzQchWJ7jtoCZiaLDA5LE0b4CIzB5MgDS7YuF26x6NvpgVM OE9ql7d1dD55mmHCG4Mq2qfnP/TKDdIbir3MRu6JtgF5M7EGYgnkJRHk3XdRqPmQeCFN Vg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s79vbxr1f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:33 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 374JVRXZ011643; Fri, 4 Aug 2023 21:04:32 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2176.outbound.protection.outlook.com [104.47.57.176]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s8m2sdn69-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Aug 2023 21:04:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XiX5AaIXSqu+1Q+bGLt2Y4EKjdK1s42K/O6DaaUvdRT2qutpU/nwZ0CnlVmy7EP+JW0Atm2CBHn7SXATGnYlNHmi9lqfh/PSbElKW5tAHoDYiz83VepUL1F1NW2xhUa+wQ7XBq9QzJE/seFVEvo2aYRk7TsyCYpWqj3nwAcc4gxzchmYkmtCNxWBzI0fe7ULcTAnI+oxab2KniFbuksrRKytsAAAMnu61zsfCbh37Ioi68kK6DsHVDBxs3z/OBDWD33FfuaW3EVNaO48c4dp1T83jBu3dbX8PfkQHcJXD8TLrXK/PMl4FQkMt0x6uhdYcdJ7VzZ+6Pvh3uGk4jG4fQ== 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=o+McSM2gKtujfwRfyeOsaE02Y4bKTLqqTyQF/lTUOqg=; b=L6JuN5buvxkmlFxSh9Pszs2Lk7iSbncdSUdqFEESpUAnh7KBQzSJcoXObw//r7NkZ3Gjs8gfmgD1BrIMzi/dIUsehrYentyXpYP3n4+x3g3ENpczeCDj4D/ulbiaPkXvGZmekbtEHwvIs+3w+qvQJ9qwS0/EPe4qEQADj5P/9Jh4bX9hY8fJ9Eo0itHaJKBoYW9Mo84qOrwXoN+OEbQc+yzSWgxUepQo9p8nqGrzZ6WP3JSYXjc8Q1vb/dF/fINOjAO4gXB4cQ8ckQf6Zegc0NJT3KPGSoh67hWOCgrIZCWohWnnzm34xbmTXcKL87XGDAKwTR+ZUjyGTvicrcd0AQ== 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=o+McSM2gKtujfwRfyeOsaE02Y4bKTLqqTyQF/lTUOqg=; b=Wz0B1hdWEeGa9Uq8YowtnHeoqsKiaq1Ko/7FGR03ZlJMXPdwM1B68uJvW7Y1ru37AQv4AKZ/cF2xjHeie3Rde96Gf74hJu01BlJzGjFEUAbKRcsqBotSL37pb+Dh1KqW9llNLQKSUUskfLXtATK2I5RBWSFb7j93LtbwSq9NRiw= Received: from CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) by PH7PR10MB7056.namprd10.prod.outlook.com (2603:10b6:510:275::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 21:04:30 +0000 Received: from CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150]) by CO1PR10MB4531.namprd10.prod.outlook.com ([fe80::9a1:a343:e04c:5150%4]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 21:04:29 +0000 From: Eric DeVolder To: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org Cc: hpa@zytor.com, gregkh@linuxfoundation.org, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, eric.devolder@oracle.com Subject: [PATCH v26 8/8] x86/crash: optimize CPU changes Date: Fri, 4 Aug 2023 17:03:59 -0400 Message-Id: <20230804210359.8321-9-eric.devolder@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230804210359.8321-1-eric.devolder@oracle.com> References: <20230804210359.8321-1-eric.devolder@oracle.com> X-ClientProxiedBy: DM6PR12CA0023.namprd12.prod.outlook.com (2603:10b6:5:1c0::36) To CO1PR10MB4531.namprd10.prod.outlook.com (2603:10b6:303:6c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4531:EE_|PH7PR10MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: 17f8d5f7-ba36-4b55-98da-08db952e64d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MljUi1mRDbmvQ+RiHBShHWagf91Qo6nKwv9gPaR8byJqRcsvJI/psuKXZfiLKUuti+RtJivCk5DGz1GGphENorzehhUaYRaerBhdgmCzhk1vUL8oWFijz+xwW+45xH8/IDdVBwE2vQTm06edkf+2mIYacQFhB3N2EL0CT0bLDLswT32goOGZtt++giTJ5pf8JzQVFIcrQaTIuHyBWfwtOPw6w5TAqEG+2WjZ/v3NYyDOk5XF813njaljgoz+Sdg4Qsg5YiM0d+We1r0OCtV/oDOfZOYSJ9IvDFq80crEj4qUPy3V0QcGG75mdonppoyxzWDgsifyYlTIg2zb01efxZbahgOLgadZ4iesgqdCQEfXIFyj9WzgExbqZcpOznDNyqVYn5WDtLdvQVDASmSrVAS9JwctE2ZhVA+LE/0euUUrjraQgTguKIgfyIRI8d4xrIEwq4zzvRKMedQLTP86m0932CDk2ubsdNUMGT/Sjk4rkPmNSnJ37rXv7yHvsc2Fi8N1Ci1tsLoohuiMUis1ysyH3IAFriTKEWDHD4oQmgBh9vEUcPlhnuNDht3ZFBmmz/9YCZK2WYJReb5PnvIIGsM9t7DUZ5bkSwMT3WDa7eM= 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)(136003)(346002)(39860400002)(396003)(366004)(376002)(451199021)(1800799003)(186006)(1076003)(2616005)(107886003)(26005)(83380400001)(6506007)(8936002)(41300700001)(2906002)(5660300002)(66946007)(66556008)(66476007)(4326008)(316002)(8676002)(6486002)(6666004)(6512007)(7416002)(7406005)(478600001)(921005)(38100700002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yUDPCdEpdF4o9ELq4SQU4RRXNnYWZ/FHX1Qngcvq+anUBm7psW5eLxPwCQo67d1FvpkyHVlsY9izJ/TFE85UbWm3l0aybpV74afBriagjAhtwJ70FFoRLdeILttc+XBVnmLDb75y5KY/yPDRMhizvFKRUqFrVXPyDDSEJeg1R27HHbDXSuvDFxEyZ+laWPtNTjYLz+tfQY7Iz4G+d5UQOdQzqpxhWhlXQEEpwOXV87trqoBAp+lLIwvFTJXBU9hNxodnMZkuA5EGycovKjOqnSBLmQ3Vt8ZosM9C5qiuIIWLnzquZZhg+4R5h4MytAOXvDAsD5bDuEJDV/ySmIqiyx9Acd3/SknztkJtT1g2023vri8dNhai9HudsxH05bXHufbXkVUa5qYatYF+d8pZdZK+k6J52JqWF/3DyXLumAWw3UtZswwyoxGM2EqxmoZkRMe2ukQCVG7R8tUZ0XN3kUb9lvmXmAueFOuaVQPH2V37pdDv85MaSL4GjsADnyBNI6fVjtv+uBTL5uFbtZCnxFb97gLaL/o/+J6+LCSphIWOP5u8wojdQpA8jjMDzUnwQwYh9K8/YgL+wFqTakTkuxxXfmwyulSiS+6XA1YSjr+kulg1+jIzCwu4YHod5cvUM7GPfiJx91wRoYl5judauqdX74vmxEVC6rKX7scrbC59OZfT4zFj28Sr/sPR/hE3HD/Fo1wO+XxDBSuiXWeEwGBegtrReHONXuICYYyM7JNb/YKPhOowlRnmGekFyKtFq716ft6pCzzGAnbuC5s66o786Y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LA00lD+Tnp48AUJF45Ax+LpOLZdjGXsvqZXfUNUJ1c7U4zqBMyGF7WoSZI/TWu8NsQ5LU4mld2pzBZLSI7ArwXziX0wmZq5szR8jd/VvAZYQfE0Cs0mfaF5NBgrMkJ+nkVo1JKkouzulP2Ymw0WgDWVdD41cDhHmDs0pck3+i937eEGmn06mgqX0LSXRMBVqtyxK2+7w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17f8d5f7-ba36-4b55-98da-08db952e64d9 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4531.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:04:29.8144 (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: 24AquRrZsQjVlURjZtoDvDIndIUSXAMgcvEJ9+xT4CDZI6PN6mHKaHlMgsn2Xs+l7mw8Yc3dlNORG6iz1WKF2yjqp8p4K1zMvob0VtbQ6QA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB7056 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-04_21,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308040190 X-Proofpoint-GUID: QZLa1BwoDjBh7ZVHjzwwG0GUtXwyuYum X-Proofpoint-ORIG-GUID: QZLa1BwoDjBh7ZVHjzwwG0GUtXwyuYum 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_H5,RCVD_IN_MSPIKE_WL,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: INBOX X-GMAIL-THRID: 1773340179783773256 X-GMAIL-MSGID: 1773340179783773256 crash_prepare_elf64_headers() writes into the elfcorehdr an ELF PT_NOTE for all possible CPUs. As such, subsequent changes to CPUs (ie. hot un/plug, online/offline) do not need to rewrite the elfcorehdr. The kimage->file_mode term covers kdump images loaded via the kexec_file_load() syscall. Since crash_prepare_elf64_headers() wrote the initial elfcorehdr, no update to the elfcorehdr is needed for CPU changes. The kimage->elfcorehdr_updated term covers kdump images loaded via the kexec_load() syscall. At least one memory or CPU change must occur to cause crash_prepare_elf64_headers() to rewrite the elfcorehdr. Afterwards, no update to the elfcorehdr is needed for CPU changes. This code is intentionally *NOT* hoisted into crash_handle_hotplug_event() as it would prevent the arch-specific handler from running for CPU changes. This would break PPC, for example, which needs to update other information besides the elfcorehdr, on CPU changes. Signed-off-by: Eric DeVolder Reviewed-by: Sourabh Jain Acked-by: Hari Bathini Acked-by: Baoquan He --- arch/x86/kernel/crash.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index caf22bcb61af..18d2a18d1073 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -467,6 +467,16 @@ void arch_crash_handle_hotplug_event(struct kimage *image) unsigned long mem, memsz; unsigned long elfsz = 0; + /* + * As crash_prepare_elf64_headers() has already described all + * possible CPUs, there is no need to update the elfcorehdr + * for additional CPU changes. + */ + if ((image->file_mode || image->elfcorehdr_updated) && + ((image->hp_action == KEXEC_CRASH_HP_ADD_CPU) || + (image->hp_action == KEXEC_CRASH_HP_REMOVE_CPU))) + return; + /* * Create the new elfcorehdr reflecting the changes to CPU and/or * memory resources.