Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1698766rdb; Sat, 3 Feb 2024 19:26:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbCcI3lAMCbqyciJ46pVVCh9zvun5DFjW8RfgwUbubMM1KCeOioOLRjckwy/oGNoAmkJ2A X-Received: by 2002:a05:6214:301e:b0:686:ad1a:ecb7 with SMTP id ke30-20020a056214301e00b00686ad1aecb7mr3179683qvb.42.1707017191146; Sat, 03 Feb 2024 19:26:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707017191; cv=pass; d=google.com; s=arc-20160816; b=m34OuB1wBl40BJlf4xwtL1Fq4ebvqtRCd1Q13mXSmZHyxIOQgwnmD+Igd4i7Zd0kL/ VdJTpztd/IxpYpXLX+7LL78FCvmvUjcxiGBLLHW7uE2AsTAk+bgj3DqitPD9H61QLstJ lLS9/Q3/IfHNcbh7j9osPujeWcRoysEf9r7vFgnDD3fxhEvr/lduMCcA+KmHU0v9yxK3 56+Rxcyzd2LkG40bUypR3vQszsEnHURUwt9i9oeTZfWzrlVUuGSmDsECiatm1TqWRRfO HtoKaxPQMu/mx31ZAlEYHVAFH46dFq1771jAG1UCWawqw7XfeRbhBwkox9wIc5LjMQoU 8pKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eysYxb9qJ6RxmbOxjXjjrpSobYnMDkjTn7GmoY0o3W4=; fh=3nRP8A9PC9pWodRv32MB0unmowhRccyQQJzzuY2Dy+4=; b=cWPimtRc40v05NcayUHi5UbbKMlbLdPj9wSmRI1Cf3h8WY0I9+aI7vAPUCWxyV2qu6 OabXdpoMPdMdaNpibVZ18U/IUwyuat8msIuBHxMNnA+sde1FyWYeqvQSGtzaMJQyRcPQ UELPPdLxo9i4Vs5w0raZEXUAPJiWQpShLC9yHMpSngFVP4Vcrxasp3LIeDIBNzufSSvL haEqkp5Ta8Lw3txpLS2L5cxIg2VFuvO//Hw24ldonEI42t3G/+MZ+l2JoLzKuHZJO5Nq gffbS5XKV7TPL7Z7d5Fr8Ios4YOBDHZf+2oKOVMfQEOvZKLEIbLc+hdGmv6ktu1vso2o 4/Dg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g+wbH4xV; 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-51400-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51400-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCWUM989cwWFiRys0c/XdBCEV6Pv5vALxkb5KgCBDyt12c1BrF7qD7nmQ+nKKNEvK12x+MyBAlzzPhrrmcPUt88O0QLwRsIl4PgoYqI/cA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y4-20020a0cf144000000b0068c539ee759si5789603qvl.310.2024.02.03.19.26.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 19:26:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51400-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g+wbH4xV; 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-51400-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51400-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D3F6C1C21711 for ; Sun, 4 Feb 2024 03:26:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB24015CC; Sun, 4 Feb 2024 03:26:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="g+wbH4xV" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 C7BE9322E for ; Sun, 4 Feb 2024 03:26:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707017183; cv=none; b=ta7HQJNTfwRjQohzd3D7GoLZY7oIL+4HFBGTfPndA0SjCozcjyBy4kYI2K1GGgJmxe3ewupp/sjcAlIsRUY9SbP7AaBOYg1RjcGGkL981JWcQW0cA1r9brrC9IU/zheL3AzY5NVGnTxpimKy85jjbc52Raqllp1dcoM4LeI7BtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707017183; c=relaxed/simple; bh=cCrUgip/wd0GQevGmH2jhQsDZoc4azCewghl3pZSqRw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vq+P/k2WPWT8Fspl3bBfKF4sOcT+98a3Nn3GYnqItyUbi1s7gVBt9yEzR+6NBzAxLP/oYJohoLUALFbWaQ7k7tNQZRlAIvssCzNpQBmzPyYFNMiAw2ZCjeO9gUlANyec5z13xQ+Rws2HGZQyB/PPmbGx+pnIupGL55jMepF93Nk= 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=g+wbH4xV; arc=none smtp.client-ip=170.10.133.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=1707017180; 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: in-reply-to:in-reply-to:references:references; bh=eysYxb9qJ6RxmbOxjXjjrpSobYnMDkjTn7GmoY0o3W4=; b=g+wbH4xVR5TIYGbaJPaTOUcd6/yTBulfvWmc3axUFTVbL4AyCT7rt+Ig59r0dh0FV5SVC3 3kajx+qSUwJf92cHEKcZHsod704pldGgsWDrVkSB/rfAFiGj8wwuIubIeD98JOfyAjAvyl vsMFTS53aCvNX3PNUao8USQUk5fGLcw= 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-220-x_mqoEOfNmSyHGbxxMyZPQ-1; Sat, 03 Feb 2024 22:26:17 -0500 X-MC-Unique: x_mqoEOfNmSyHGbxxMyZPQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 D9FBD1C0514F; Sun, 4 Feb 2024 03:26:16 +0000 (UTC) Received: from localhost (unknown [10.72.116.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED10F2026F95; Sun, 4 Feb 2024 03:26:15 +0000 (UTC) Date: Sun, 4 Feb 2024 11:26:12 +0800 From: Baoquan He To: Hari Bathini Cc: linux-kernel@vger.kernel.org, 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, piliu@redhat.com, viro@zeniv.linux.org.uk Subject: Re: [PATCH v2 00/14] Split crash out from kexec and clean up related config items Message-ID: References: <20240119145241.769622-1-bhe@redhat.com> <9101bb07-70f1-476c-bec9-ec67e9899744@linux.ibm.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; charset=us-ascii Content-Disposition: inline In-Reply-To: <9101bb07-70f1-476c-bec9-ec67e9899744@linux.ibm.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 On 02/02/24 at 10:53am, Hari Bathini wrote: > Hi Baoquan, > > On 19/01/24 8:22 pm, Baoquan He wrote: > > Motivation: > > ============= > > Previously, LKP reported a building error. When investigating, it can't > > be resolved reasonablly with the present messy kdump config items. > > > > https://lore.kernel.org/oe-kbuild-all/202312182200.Ka7MzifQ-lkp@intel.com/ > > > > The kdump (crash dumping) related config items could causes confusions: > > > > Firstly, > > --- > > CRASH_CORE enables codes including > > - crashkernel reservation; > > - elfcorehdr updating; > > - vmcoreinfo exporting; > > - crash hotplug handling; > > > > Now fadump of powerpc, kcore dynamic debugging and kdump all selects > > CRASH_CORE, while fadump > > - fadump needs crashkernel parsing, vmcoreinfo exporting, and accessing > > global variable 'elfcorehdr_addr'; > > - kcore only needs vmcoreinfo exporting; > > - kdump needs all of the current kernel/crash_core.c. > > > > So only enabling PROC_CORE or FA_DUMP will enable CRASH_CORE, this > > mislead people that we enable crash dumping, actual it's not. > > > > Secondly, > > --- > > It's not reasonable to allow KEXEC_CORE select CRASH_CORE. > > > > Because KEXEC_CORE enables codes which allocate control pages, copy > > kexec/kdump segments, and prepare for switching. These codes are > > shared by both kexec reboot and kdump. We could want kexec reboot, > > but disable kdump. In that case, CRASH_CORE should not be selected. > > > > -------------------- > > CONFIG_CRASH_CORE=y > > CONFIG_KEXEC_CORE=y > > CONFIG_KEXEC=y > > CONFIG_KEXEC_FILE=y > > --------------------- > > > > Thirdly, > > --- > > It's not reasonable to allow CRASH_DUMP select KEXEC_CORE. > > > > That could make KEXEC_CORE, CRASH_DUMP are enabled independently from > > KEXEC or KEXEC_FILE. However, w/o KEXEC or KEXEC_FILE, the KEXEC_CORE > > code built in doesn't make any sense because no kernel loading or > > switching will happen to utilize the KEXEC_CORE code. > > --------------------- > > CONFIG_CRASH_CORE=y > > CONFIG_KEXEC_CORE=y > > CONFIG_CRASH_DUMP=y > > --------------------- > > > > In this case, what is worse, on arch sh and arm, KEXEC relies on MMU, > > while CRASH_DUMP can still be enabled when !MMU, then compiling error is > > seen as the lkp test robot reported in above link. > > > > ------arch/sh/Kconfig------ > > config ARCH_SUPPORTS_KEXEC > > def_bool MMU > > > > config ARCH_SUPPORTS_CRASH_DUMP > > def_bool BROKEN_ON_SMP > > --------------------------- > > > > Changes: > > =========== > > 1, split out crash_reserve.c from crash_core.c; > > 2, split out vmcore_infoc. from crash_core.c; > > 3, move crash related codes in kexec_core.c into crash_core.c; > > 4, remove dependency of FA_DUMP on CRASH_DUMP; > > 5, clean up kdump related config items; > > 6, wrap up crash codes in crash related ifdefs on all 9 arch-es > > which support crash dumping; > > > > Achievement: > > =========== > > With above changes, I can rearrange the config item logic as below (the right > > item depends on or is selected by the left item): > > > > PROC_KCORE -----------> VMCORE_INFO > > > > |----------> VMCORE_INFO > > FA_DUMP----| > > |----------> CRASH_RESERVE > > FA_DUMP also needs PROC_VMCORE (CRASH_DUMP by dependency, I guess). > So, the FA_DUMP related changes here will need a relook.. Thanks for checking this. So FA_DUMP needs vmcoreinfo exporting, crashkernel reservation, /proc/vmcore. Then it's easy to adjust the kernel config item of FA_DUMP to make it select CRASH_DUMP. Except of this, do you have concern about the current code and Kconfig refactorying? ---->VMCORE_INFO /| FA_DUMP--> CRASH_DUMP-->/-|---->CRASH_RESERVE \ | \---->PROC_VMCORE > > > > ---->VMCORE_INFO > > / > > |---->CRASH_RESERVE > > KEXEC --| /| > > |--> KEXEC_CORE--> CRASH_DUMP-->/-|---->PROC_VMCORE > > KEXEC_FILE --| \ | > > \---->CRASH_HOTPLUG > > > > > > KEXEC --| > > |--> KEXEC_CORE (for kexec reboot only) > > KEXEC_FILE --| > > > > Test > > ======== > > On all 8 architectures, including x86_64, arm64, s390x, sh, arm, mips, > > riscv, loongarch, I did below three cases of config item setting and > > building all passed. Let me take configs on x86_64 as exampmle here: > > > > (1) Both CONFIG_KEXEC and KEXEC_FILE is unset, then all kexec/kdump > > items are unset automatically: > > # Kexec and crash features > > # CONFIG_KEXEC is not set > > # CONFIG_KEXEC_FILE is not set > > # end of Kexec and crash features > > > > (2) set CONFIG_KEXEC_FILE and 'make olddefconfig': > > --------------- > > # Kexec and crash features > > CONFIG_CRASH_RESERVE=y > > CONFIG_VMCORE_INFO=y > > CONFIG_KEXEC_CORE=y > > CONFIG_KEXEC_FILE=y > > CONFIG_CRASH_DUMP=y > > CONFIG_CRASH_HOTPLUG=y > > CONFIG_CRASH_MAX_MEMORY_RANGES=8192 > > # end of Kexec and crash features > > --------------- > > > > (3) unset CONFIG_CRASH_DUMP in case 2 and execute 'make olddefconfig': > > ------------------------ > > # Kexec and crash features > > CONFIG_KEXEC_CORE=y > > CONFIG_KEXEC_FILE=y > > # end of Kexec and crash features > > ------------------------ > > > > Note: > > For ppc, it needs investigation to make clear how to split out crash > > code in arch folder. > > On powerpc, both kdump and fadump need PROC_VMCORE & CRASH_DUMP. > Hope that clears things. So, patch 3/14 breaks things for FA_DUMP.. I see it now. We can easily fix that with below patch. What do you think? By the way, do you have chance to help test these on powerpc system? I can find ppc64le machine, while I don't know how to operate to test fadump. From fa8e6c3930d4f22f2b3768399c5bf0523c17adde Mon Sep 17 00:00:00 2001 From: Baoquan He Date: Sun, 4 Feb 2024 11:06:54 +0800 Subject: [PATCH] power/fadump: make FA_DUMP select CRASH_DUMP Content-type: text/plain FA_DUMP which is similar with kdump needs vmcoreinfo exporting, crashkernel reservation and /proc/vmcore file . After refactoring crash related codes and Kconfig items, make FA_DUMP select CRASH_DUMP. Now the dependency layout is like below: ---->VMCORE_INFO /| FA_DUMP--> CRASH_DUMP-->/-|---->CRASH_RESERVE \ | \---->PROC_VMCORE Signed-off-by: Baoquan He --- arch/powerpc/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index f182fb354bef..d5d4c890f010 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -695,8 +695,7 @@ config ARCH_SELECTS_CRASH_DUMP config FA_DUMP bool "Firmware-assisted 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, -- 2.41.0 > > > Hope Hari and Pingfan can help have a look, see if > > it's doable. Now, I make it either have both kexec and crash enabled, or > > disable both of them altogether. > > > Sure. I will take a closer look... Thanks a lot. Please feel free to post patches to make that, or I can do it with your support or suggestion.