From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0A62C4167B for ; Mon, 11 Dec 2023 08:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3/FSGne97ik9SifyYhuj1upKa7JOEvMGuFclDsvEe7I=; b=i1rgOxoZs004us A6qwyYtxp9owli7T2FeY0Vq3X0c4QBEBdTEDVY3I3njHy2z4lA09mtnuGAxH15o/3xBNJ8d3Pdmm4 b5RuxIkBjsrcSLJ8vY+LB0rJEkFMDuY9Mwy9xb096aOekZLE3HKkiLsiztPZWGGrCMY/WGgVCY+rg BnrJwvib0TwiKzrwDCwGl5edO5UMhbw2JbEVbRMYSHvOtTl1s2EUIFwWFpp4XKUiG1tI9SX6oyePs 3BdLMdubirzTzzkL0pgruuA3IlpgGtU9SozZSGr99oSQU7tfLxkrvCXCt7zBXyI8bXhvf9Grvu4Xr /rjvTG0Axbo8TQT7+AiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rCbiZ-004Ld5-35; Mon, 11 Dec 2023 08:32:48 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rCbiR-004LaK-1h for kexec@lists.infradead.org; Mon, 11 Dec 2023 08:32:41 +0000 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BB8LOYM010595; Mon, 11 Dec 2023 08:32:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=9aS92prpDDW3MDLFbkAEaNOcU+LxXEhM6zI2Q2pz5iQ=; b=iNcQCLOmSIheyUYoLhLoz7GS8gi2JVXZazflP5c6i4cW602ExeQWn0IGVR5aPBW/3mhm sD2rSDjDI4W90jI6YRG/bDbZGgJdAkbkkSWdJnKnBu+aHo5QMjseZd4BxpywrxVv7w+R gIM0Um3mLbzPH6vGC7+V8ySU8D2qVjag/SPoG08Pb7+Yv4nbNa6xXB3RgMWqpwpMETu/ uyHxQ73/D5qXWGGeEI1lydOMo32d1xF+xtV9JAqr/BnSeICqgL6oPFjWlOHo3RMtmTwZ 7OxBNUKLNUVEBFQ4rn9Kv1KBihcyRA+CdeFwt7+nWib5EdkXLy0DkbppB/zTpfMeCAhV WA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uvw10hpdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Dec 2023 08:32:24 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3BB8LXJY011551; Mon, 11 Dec 2023 08:32:22 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uvw10hnu4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Dec 2023 08:32:22 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3BB65Mvl004390; Mon, 11 Dec 2023 08:31:15 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uw4sjyqnf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Dec 2023 08:31:15 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BB8VCo925952884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Dec 2023 08:31:12 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D85620043; Mon, 11 Dec 2023 08:31:12 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B61D20040; Mon, 11 Dec 2023 08:31:00 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.c4p-in.ibmmobiledemo.com (unknown [9.177.92.36]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Dec 2023 08:30:59 +0000 (GMT) From: Sourabh Jain To: linuxppc-dev@ozlabs.org Cc: Sourabh Jain , Akhil Raj , Andrew Morton , "Aneesh Kumar K . V" , Baoquan He , Borislav Petkov , Boris Ostrovsky , Christophe Leroy , Dave Hansen , Dave Young , David Hildenbrand , Eric DeVolder , Greg Kroah-Hartman , Hari Bathini , Laurent Dufour , Mahesh Salgaonkar , Michael Ellerman , Mimi Zohar , Naveen N Rao , Oscar Salvador , Thomas Gleixner , Valentin Schneider , Vivek Goyal , kexec@lists.infradead.org, x86@kernel.org Subject: [PATCH v14 0/6] powerpc/crash: Kernel handling of CPU and memory hotplug Date: Mon, 11 Dec 2023 14:00:50 +0530 Message-ID: <20231211083056.340404-1-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.41.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QxvVAu_ePZjAMJ6aiHJRBZe4vCJgZ-z- X-Proofpoint-ORIG-GUID: GHpFtAdjGpSEzN8b415kIGBWGDk5aGz4 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-11_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312110071 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231211_003239_683485_43221665 X-CRM114-Status: GOOD ( 35.96 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org Commit 247262756121 ("crash: add generic infrastructure for crash hotplug support") added a generic infrastructure that allows architectures to selectively update the kdump image component during CPU or memory add/remove events within the kernel itself. This patch series adds crash hotplug handler for PowerPC and enable support to update the kdump image on CPU/Memory add/remove events. Among the 6 patches in this series, the first three patches make changes to the generic crash hotplug handler to assist PowerPC in adding support for this feature. The last three patches add support for this feature. The following section outlines the problem addressed by this patch series, along with the current solution, its shortcomings, and the proposed resolution. Problem: ======== Due to CPU/Memory hotplug or online/offline events the elfcorehdr (which describes the CPUs and memory of the crashed kernel) and FDT (Flattened Device Tree) of kdump image becomes outdated. Consequently, attempting dump collection with an outdated elfcorehdr or FDT can lead to failed or inaccurate dump collection. Going forward CPU hotplug or online/offline events are referred as CPU/Memory add/remove events. Existing solution and its shortcoming: ====================================== The current solution to address the above issue involves monitoring the CPU/memory add/remove events in userspace using udev rules and whenever there are changes in CPU and memory resources, the entire kdump image is loaded again. The kdump image includes kernel, initrd, elfcorehdr, FDT, purgatory. Given that only elfcorehdr and FDT get outdated due to CPU/Memory add/remove events, reloading the entire kdump image is inefficient. More importantly, kdump remains inactive for a substantial amount of time until the kdump reload completes. Proposed solution: ================== Instead of initiating a full kdump image reload from userspace on CPU/Memory hotplug and online/offline events, the proposed solution aims to update only the necessary kdump image component within the kernel itself. Git tree for testing: ===================== Git tree rebased on top of v6.7-rc4: https://github.com/sourabhjains/linux/tree/kdump-in-kernel-crash-update-v14 To realize this feature, the kdump udev rule must be updated. On RHEL, add the following two lines at the top of the "/usr/lib/udev/rules.d/98-kexec.rules" file. SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end" SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end" With the above change to the kdump udev rule, kdump reload is avoided during CPU/Memory add/remove events if this feature is enabled in the kernel. Note: only kexec_file_load syscall will work. For kexec_load minor changes are required in kexec tool. Changelog: ---------- v14: - Fix build warnings by including necessary header files - Rebase to v6.7-rc5 v13: - Fix a build warning, take ranges.c out of CONFIG_KEXEC_FILE - Rebase to v6.7-rc4 v12: - A patch to add new kexec flags to support this feature on kexec_load system call - Change in the way this feature is advertise to userspace for both kexec_load syscall - Rebase to v6.6-rc7 v11: - Rebase to v6.4-rc6 - The patch that introduced CONFIG_CRASH_HOTPLUG for PowerPC has been removed. The config is now part of common configuration: https://lore.kernel.org/all/87ilbpflsk.fsf@mail.lhotse/ v10: - Drop the patch that adds fdt_index attribute to struct kimage_arch Find the fdt segment index when needed. - Added more details into commits messages. - Rebased onto 6.3.0-rc5 v9: - Removed patch to prepare elfcorehdr crash notes for possible CPUs. The patch is moved to generic patch series that introduces generic infrastructure for in kernel crash update. - Removed patch to pass the hotplug action type to the arch crash hotplug handler function. The generic patch series has introduced the hotplug action type in kimage struct. - Add detail commit message for better understanding. v8: - Restrict fdt_index initialization to machine_kexec_post_load it work for both kexec_load and kexec_file_load.[3/8] Laurent Dufour - Updated the logic to find the number of offline core. [6/8] - Changed the logic to find the elfcore program header to accommodate future memory ranges due memory hotplug events. [8/8] v7 - added a new config to configure this feature - pass hotplug action type to arch specific handler v6 - Added crash memory hotplug support v5: - Replace COFNIG_CRASH_HOTPLUG with CONFIG_HOTPLUG_CPU. - Move fdt segment identification for kexec_load case to load path instead of crash hotplug handler - Keep new attribute defined under kimage_arch to track FDT segment under CONFIG_HOTPLUG_CPU config. v4: - Update the logic to find the additional space needed for hotadd CPUs post kexec load. Refer "[RFC v4 PATCH 4/5] powerpc/crash hp: add crash hotplug support for kexec_file_load" patch to know more about the change. - Fix a couple of typo. - Replace pr_err to pr_info_once to warn user about memory hotplug support. - In crash hotplug handle exit the for loop if FDT segment is found. v3 - Move fdt_index and fdt_index_vaild variables to kimage_arch struct. - Rebase patche on top of https://lore.kernel.org/lkml/20220303162725.49640-1-eric.devolder@oracle.com/ - Fixed warning reported by checpatch script v2: - Use generic hotplug handler introduced by https://lore.kernel.org/lkml/20220209195706.51522-1-eric.devolder@oracle.com/ a significant change from v1. Cc: Akhil Raj Cc: Andrew Morton Cc: Aneesh Kumar K.V Cc: Baoquan He Cc: Borislav Petkov (AMD) Cc: Boris Ostrovsky Cc: Christophe Leroy Cc: Dave Hansen Cc: Dave Young Cc: David Hildenbrand Cc: Eric DeVolder Cc: Greg Kroah-Hartman Cc: Hari Bathini Cc: Laurent Dufour Cc: Mahesh Salgaonkar Cc: Michael Ellerman Cc: Mimi Zohar Cc: Naveen N Rao Cc: Oscar Salvador Cc: Thomas Gleixner Cc: Valentin Schneider Cc: Vivek Goyal Cc: kexec@lists.infradead.org Cc: x86@kernel.org Sourabh Jain (6): crash: forward memory_notify arg to arch crash hotplug handler crash: make CPU and Memory hotplug support reporting flexible crash: add a new kexec flag for FDT update powerpc/kexec: turn some static helper functions public powerpc: add crash CPU hotplug support powerpc: add crash memory hotplug support arch/powerpc/Kconfig | 4 + arch/powerpc/include/asm/kexec.h | 25 ++ arch/powerpc/include/asm/kexec_ranges.h | 1 + arch/powerpc/kexec/Makefile | 4 +- arch/powerpc/kexec/core_64.c | 369 ++++++++++++++++++++++++ arch/powerpc/kexec/elf_64.c | 12 +- arch/powerpc/kexec/file_load_64.c | 211 +++----------- arch/powerpc/kexec/ranges.c | 85 ++++++ arch/x86/include/asm/kexec.h | 10 +- arch/x86/kernel/crash.c | 23 +- include/linux/kexec.h | 21 +- include/uapi/linux/kexec.h | 1 + kernel/crash_core.c | 37 ++- kernel/kexec.c | 2 + 14 files changed, 605 insertions(+), 200 deletions(-) -- 2.41.0 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec