Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1051015rdb; Fri, 19 Jan 2024 06:53:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEZWIcB4RMI2RkEmS2EukI6O3vkR35K9KUEm4UeHPR+n7tfKWK2SnuqqdRMfAh5TyUXOiO X-Received: by 2002:aa7:cfd4:0:b0:55a:749f:8b3c with SMTP id r20-20020aa7cfd4000000b0055a749f8b3cmr190634edy.12.1705676033079; Fri, 19 Jan 2024 06:53:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705676033; cv=pass; d=google.com; s=arc-20160816; b=EiJQmgOKqqlTrD7UdGS/kPGliqYAZURgZledOWT/fKGdV5ZgYcvp+SQNjpbmrUIgLe zmI9sCee0Cm7q9pbpehoNNis6KdHA9TMZ8htOEglu1Tfid4uxjO1Cp41i9hW2EsevwBz SHO5743zk5nPFuTcoJ9jVWTrNPc4OJ29SxLqV1acXf8nHsO1/5axpYn3FDhkehGcWUMd /M0iJvfiRnec8oDQrl2RwjZjc5pH3mzz9RzKUqGGFpLJlHtsPw8Jl92E0ncKi4TTyDJe PJLePwgkGLyAVcxjqGlAhmsvbG1k7viUX4dRkJf6phFKU8WGgkm/zmRbVtcxo1Lqpx4x HrEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7S3FI85k6ctO+BbrXXBIV/RwVoqMqQpFkEo8oxKhpCE=; fh=zRw2lYWZmEZ+xk8Dyhrd0rqHIpogjnUXaVblO2ikfrI=; b=v7EbBKNV1AW7TQHT/G5zNHdJaxsAlXCduQS81Ivx94klUVQZj4nm24DjA4MSoa2Edm IaGJx6jrM6b1jdUUG4KrgSsySYIKZkL0hBIbHtKS/8moEyo2MoI0MlFOvrAWyoBs7fX6 YmMU4mxANrYAYm8UsbR0rn7EjEzx1xG4IzK8Hlwm03UoKmCkvSY4UM4L3UoBxYmntlI7 GultW9ZLPEWf4mz6v+NYEHN52lMAtGA9mVfJjeG+yeMRSjbzyOF8ltPOdI9giVK7+ueo MW3ck+zQqB7cv9pIc7Fx9MQEepOJQ0J8xXSpkwhJCTAFkP+dLPYtL6fM5mCxdfd195yt O4Iw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="JAY2/lmG"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-31279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31279-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bl5-20020a056402210500b00558611c29f4si8426109edb.246.2024.01.19.06.53.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 06:53:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="JAY2/lmG"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-31279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31279-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 91A5F1F215EF for ; Fri, 19 Jan 2024 14:53:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A63E54656; Fri, 19 Jan 2024 14:53:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JAY2/lmG" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5E7F54650 for ; Fri, 19 Jan 2024 14:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705676007; cv=none; b=gNhhJkgvVerib6j2x3F1C2wAVU8H026H4kCiNK2rHUvnl2YBCTf+pgjrBr9BP2OjgbcArHm7uE7WGEY1ObXYrU6Q2A9Z23DuZ8zpcsHVjabBUTwgJAva0rBaD4WIPTp6FFOCsgCeFp5IvsjC6ooG3GlgDn5yQix/J3KoLg4A3o8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705676007; c=relaxed/simple; bh=Jw7BcSkg+fkI0cJf+FHKdJvseRkkfHEF7sMWUXh86Hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=Zv/FPohwDINyeoZCPaGzBIpMqu9Bi9zj03+polENlxEzSYDW8UlOpa7sKwwBm+fkZHOICpiYnv8cQA24ZUSC+12f5tqAvVSSdbtR+HDhkFsogXupmELJXmmwfwqJ8JOLeJAB/goeTdAb+ARFH3jsbGxb6sz7pV0dZ0eFI7Y1uIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JAY2/lmG; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705676004; 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: in-reply-to:in-reply-to:references:references; bh=7S3FI85k6ctO+BbrXXBIV/RwVoqMqQpFkEo8oxKhpCE=; b=JAY2/lmGbXteVpg24ONlIrEEEyqO4rckGA0Vl7TAzlRzGPm4A/oZ6lAyBNG9XIrvxRee82 BBKkActo4bE8EfHzKiGn0jS/NYl6suAI3CTEZ9+wCtxROismkFHI9tJla9jsZdYU4zpXmo XK88Bh2/Jz2yCRQPspFYe99ev9rQNac= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-bX-7zOb-MIWHGXFxchsW9g-1; Fri, 19 Jan 2024 09:53:19 -0500 X-MC-Unique: bX-7zOb-MIWHGXFxchsW9g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DB4FB3C11CC4; Fri, 19 Jan 2024 14:53:18 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 992D351D5; Fri, 19 Jan 2024 14:53:09 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, akpm@linux-foundation.org, ebiederm@xmission.com, hbathini@linux.ibm.com, piliu@redhat.com, viro@zeniv.linux.org.uk, Baoquan He Subject: [PATCH v2 03/14] crash: remove dependency of FA_DUMP on CRASH_DUMP Date: Fri, 19 Jan 2024 22:52:30 +0800 Message-ID: <20240119145241.769622-4-bhe@redhat.com> In-Reply-To: <20240119145241.769622-1-bhe@redhat.com> References: <20240119145241.769622-1-bhe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 In kdump kernel, /proc/vmcore is an elf file mapping the crashed kernel's old memory content. Its elf header is constructed in 1st kernel and passed to kdump kernel via elfcorehdr_addr. Config CRASH_DUMP enables the code of 1st kernel's old memory accessing in different architectures. Currently, config FA_DUMP has dependency on CRASH_DUMP because fadump needs access global variable 'elfcorehdr_addr' to judge if it's in kdump kernel within function is_kdump_kernel(). In the current kernel/crash_dump.c, variable 'elfcorehdr_addr' is defined, and function setup_elfcorehdr() used to parse kernel parameter to fetch the passed value of elfcorehdr_addr. Only for accessing elfcorehdr_addr, FA_DUMP really doesn't have to depends on CRASH_DUMP. To remove the dependency of FA_DUMP on CRASH_DUMP to avoid confusion, rename kernel/crash_dump.c to kernel/elfcorehdr.c, and build it when CONFIG_VMCORE_INFO is ebabled. With this, FA_DUMP doesn't need to depend on CRASH_DUMP. Signed-off-by: Baoquan He --- arch/powerpc/Kconfig | 1 - kernel/Makefile | 3 +-- kernel/{crash_dump.c => elfcorehdr.c} | 0 kernel/kexec_internal.h | 2 ++ 4 files changed, 3 insertions(+), 3 deletions(-) rename kernel/{crash_dump.c => elfcorehdr.c} (100%) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1520146d7c2c..1cdb8fdd3735 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -692,7 +692,6 @@ config FA_DUMP depends on PPC64 && (PPC_RTAS || PPC_POWERNV) select VMCORE_INFO select CRASH_RESERVE - select CRASH_DUMP help A robust mechanism to get reliable kernel crash dump with assistance from firmware. This approach does not use kexec, diff --git a/kernel/Makefile b/kernel/Makefile index 649272a1d6b9..35abc65e1f1a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -68,7 +68,7 @@ obj-$(CONFIG_MODULE_SIG_FORMAT) += module_signature.o obj-$(CONFIG_KALLSYMS) += kallsyms.o obj-$(CONFIG_KALLSYMS_SELFTEST) += kallsyms_selftest.o obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o -obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o +obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o elfcorehdr.o obj-$(CONFIG_CRASH_RESERVE) += crash_reserve.o obj-$(CONFIG_KEXEC_CORE) += kexec_core.o crash_core.o obj-$(CONFIG_KEXEC) += kexec.o @@ -121,7 +121,6 @@ obj-$(CONFIG_PERF_EVENTS) += events/ obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o obj-$(CONFIG_PADATA) += padata.o -obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_JUMP_LABEL) += jump_label.o obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o obj-$(CONFIG_TORTURE_TEST) += torture.o diff --git a/kernel/crash_dump.c b/kernel/elfcorehdr.c similarity index 100% rename from kernel/crash_dump.c rename to kernel/elfcorehdr.c diff --git a/kernel/kexec_internal.h b/kernel/kexec_internal.h index 74da1409cd14..2595defe8c0d 100644 --- a/kernel/kexec_internal.h +++ b/kernel/kexec_internal.h @@ -4,6 +4,8 @@ #include +struct kexec_segment; + struct kimage *do_kimage_alloc_init(void); int sanity_check_segment_list(struct kimage *image); void kimage_free_page_list(struct list_head *list); -- 2.41.0