Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5939698rwd; Sun, 18 Jun 2023 23:07:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4SrjUSl3yNbqawuvoLE/Fus+Ns+UiFjyya6BoeEy9F2OX0N2PM9kFhA9vM77M66WPcZYek X-Received: by 2002:a67:ee42:0:b0:43f:5da3:22ca with SMTP id g2-20020a67ee42000000b0043f5da322camr1293334vsp.26.1687154852612; Sun, 18 Jun 2023 23:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687154852; cv=none; d=google.com; s=arc-20160816; b=Ggd31F86iY0zIkNQ+0Bn6oz18U10N+vn2WwykX6HIqbe2RmwuHlIS09nKByfLG3gIn PWKSDNDFwwHYumSUWyqy60lOhFaOoe6QZL9Z8Eg9zdzQVcvFmrJctHtbCRBMK85vMwVt OPh57R6nItFY1Mqc1KNdkG0xZCbp3/QdOOf0zWEiHThzn2mgNVGMyVeK6yzpK+n7EXMs oAc3MiETrz3oePGV7x1HmInkVX618pU74ARmiRpCqjKK+wR69H3e0p7tUCKyf5P1mI0R zI+xOINLqirGglMQRAKbMDe3Kytcjiff6XxF3Ecqv2JPgVzZerKICHWL2g7yvpcSUt6x uFWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=1Z+NO+U3mF4VkZPV3TiZ9hDCsNGYkiNE2A8dRovLHfw=; b=RoJvSgRJzATLjpFiFHh1Yhx6NVerlSqEKrl3Rtr62leXLyf3OTLYYpAB5seXhrI1NT 1UKSicoDJO59N3b/NM0eLDucNay9jgxcs4oQGtUAHGqT9emWe2MAeFi/umLFCDL3c2G/ Q4AvB/EzRBbh6mqSqTPYhJnhgtWNZGWcdQLxYUjJsgrhW3En2pK2fFQaW9rV0JyX60Sk iuZ0P5xhiEqsV7sg0a06CiFyQ7OazntF90qv4DiplR6BCY3aP4F9nzh/WIsvEebsxy5/ jKrH+d6x4o9el3+OvwqxEd8Xs2PM8ZZ1RfIAB9lbFfcAcQepCm50OMNd3/hei0GtKip+ PL8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KFCHLeaN; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a637e48000000b00542d69c515bsi6011217pgn.533.2023.06.18.23.07.17; Sun, 18 Jun 2023 23:07:32 -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=@redhat.com header.s=mimecast20190719 header.b=KFCHLeaN; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbjFSGA5 (ORCPT + 99 others); Mon, 19 Jun 2023 02:00:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjFSGAz (ORCPT ); Mon, 19 Jun 2023 02:00:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D3E91A6 for ; Sun, 18 Jun 2023 23:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687154407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1Z+NO+U3mF4VkZPV3TiZ9hDCsNGYkiNE2A8dRovLHfw=; b=KFCHLeaNT+RfLyBxagPhlw5qcoabJ0e2DM2HtXEi3t4MV62idz/VJF/3YuSKGih9T9B9je WsYQze4my65b9jgHAY6HVsq111K6dRqjhSQVpXan3I7vUHCF8M5Ax2jyd/ZO4BT196CNT3 K1SoXXZ6OQgI1tTcluCQ5XGBnMj8oiM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-384-e-TQ8zTVO1GPjKCn5TdD5g-1; Mon, 19 Jun 2023 02:00:01 -0400 X-MC-Unique: e-TQ8zTVO1GPjKCn5TdD5g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B2E3800888; Mon, 19 Jun 2023 06:00:01 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-194.pek2.redhat.com [10.72.12.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20987112132C; Mon, 19 Jun 2023 05:59:54 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, thunder.leizhen@huawei.com, John.p.donnelly@oracle.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, horms@kernel.org, chenjiahao16@huawei.com, linux-riscv@lists.infradead.org, x86@kernel.org, bp@alien8.de, Baoquan He Subject: [RFC PATCH 0/4] kdump: add generic functions to simplify crashkernel crashkernel in architecture Date: Mon, 19 Jun 2023 13:59:47 +0800 Message-Id: <20230619055951.45620-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the current arm64, crashkernel=,high support has been finished after several rounds of posting and careful reviewing. The code in arm64 which parses crashkernel kernel parameters firstly, then reserve memory can be a good example for other ARCH to refer to. Whereas in x86_64, the code mixing crashkernel parameter parsing and memory reserving is twisted, and looks messy. Refactoring the code to make it more readable maintainable is necessary. Here, try to abstract the crashkernel parameter parsing code into a generic function parse_crashkernel_generic(), and the crashkernel memory reserving code into a generic function reserve_crashkernel_generic(). Then, in ARCH which crashkernel=,high support is needed, a simple arch_reserve_crashkernel() can be added to call above two generic functions. This can remove the duplicated implmentation code in each ARCH, like arm64, x86_64. I only change the arm64 and x86_64 implementation to make use of the generic functions to simplify code. Risc-v can be done very easily refer to the steps in arm64 and x86_64. I leave this to Jiahao or other risc-v developer since Jiahao have posted a patchset to add crashkernel=,high support to risc-v. This patchset is based on the latest linus's tree, and on top of below patch: arm64: kdump: simplify the reservation behaviour of crashkernel=,high https://git.kernel.org/arm64/c/6c4dcaddbd36 Baoquan He (4): kdump: rename parse_crashkernel() to parse_crashkernel_common() kdump: add generic functions to parse crashkernel and do reservation arm64: kdump: use generic interfaces to simplify crashkernel reservation code x86: kdump: use generic interfaces to simplify crashkernel reservation code arch/arm/kernel/setup.c | 4 +- arch/arm64/Kconfig | 3 + arch/arm64/include/asm/kexec.h | 8 ++ arch/arm64/mm/init.c | 141 ++---------------------- arch/ia64/kernel/setup.c | 4 +- arch/loongarch/kernel/setup.c | 3 +- arch/mips/cavium-octeon/setup.c | 2 +- arch/mips/kernel/setup.c | 4 +- arch/powerpc/kernel/fadump.c | 5 +- arch/powerpc/kexec/core.c | 4 +- arch/powerpc/mm/nohash/kaslr_booke.c | 4 +- arch/riscv/mm/init.c | 5 +- arch/s390/kernel/setup.c | 4 +- arch/sh/kernel/machine_kexec.c | 5 +- arch/x86/Kconfig | 3 + arch/x86/include/asm/kexec.h | 32 ++++++ arch/x86/kernel/setup.c | 141 +++--------------------- include/linux/crash_core.h | 33 +++++- kernel/crash_core.c | 158 +++++++++++++++++++++++++-- 19 files changed, 274 insertions(+), 289 deletions(-) -- 2.34.1