Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4575419rdb; Fri, 15 Sep 2023 06:30:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFE4UHSZWCZoJowe6OjeAkrT6gAeQYwvHGPskqUHdPdroWkKybZM+enf/eMvNl37KmAQkBh X-Received: by 2002:a05:6358:a10:b0:142:e3ff:ed76 with SMTP id 16-20020a0563580a1000b00142e3ffed76mr1713381rwa.3.1694784605240; Fri, 15 Sep 2023 06:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694784605; cv=none; d=google.com; s=arc-20160816; b=SRifg5xR3T5gv/0uPsnKvFOx5BthbSYWdTBNIDbUrs+eaxVuDmWbmEnrDGjoPUeE6g F5YRaAdW7I9uuvPH7V3mk5iJScjPu1QpYgh2ghm8mnIQRy/PXY94l8+Bga96RYS+5uJL 7bODkzYvSkEERGnketaqjHG7gxUuueobkUE72GKlpzecM8cyyr/hCjm2MbaTw7wBf6uw fS14PBUtCXAOfWB0Jj3VmZDv4hvq+WB6Y/WP5BRqjCm3nxjT/aNQDps3Wy7NwkodG9qY cqyqgZwfNbXCg9T6JJXsAsEC9aa6GZkex3bj52hR5rjazW4p39ZJOYGgbTewI2lDX5hO pIDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=e3bXAX87RWvBbot/wl4o5o2psWRwLqLOl+iTFzlKLtg=; fh=e9JvlmcAGZRuR/BfURkfe+hznuhRXehHid83aBVrjbU=; b=YHMakXPmdy1u5QQjgaXQuLw2b/YINJlOtmBJE164KA+qDGJHR+u3NQ/zBZk7Z47T2d T+WoxSf9oI7uPhH5z+O8N4tkcUTHlTN0TNGC0AqZKYqu5M8nrEJCcRLy56z9YwhG9fht 6sTl206TDT2Y70i7WFZL5p1B+2T91RlOWigaUHlpkeLLRRYg99+uvN6YfGU/M2PDbD6h fhgSFmMgKMxK2I7nx+3SzUel9K5OEhpP6fQegWQ5XzoO7ROs0q6FtRlR7Jupn3yJJwy/ +eGwI2d5DG+oWX4bhG01QXW1Q27rjJ4+3SG90wQUAV6kV4HAyEl4t/MSr+kFmX4KmO2S crew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GYzPkfmY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id a35-20020a631a63000000b00565218f25c4si3167791pgm.858.2023.09.15.06.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 06:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GYzPkfmY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 016F4801F115; Wed, 13 Sep 2023 21:41:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233817AbjINElx (ORCPT + 99 others); Thu, 14 Sep 2023 00:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbjINElw (ORCPT ); Thu, 14 Sep 2023 00:41:52 -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 ESMTP id AC250A8 for ; Wed, 13 Sep 2023 21:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694666463; 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=e3bXAX87RWvBbot/wl4o5o2psWRwLqLOl+iTFzlKLtg=; b=GYzPkfmYry7boFq05aXGP2L5+bQSSkBsYa84h0Cb9jxHqg35I1yjmEcFzd3OaoPYv05kU4 IMgx9C9GZUPvhwkKg4XQH/RZcVRIsMJJrr0TPNqSjCxZzIKqhm6a0Z8Qif3UVmnNgiS4HF TWvw0htnCDhvDZufsB+sOxGBASCWAdM= 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-212-LS6BjVi7O8qDXux5J0weow-1; Thu, 14 Sep 2023 00:40:58 -0400 X-MC-Unique: LS6BjVi7O8qDXux5J0weow-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF40280523C; Thu, 14 Sep 2023 04:40:57 +0000 (UTC) Received: from localhost (unknown [10.72.112.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEFC240C6EA8; Thu, 14 Sep 2023 04:40:56 +0000 (UTC) Date: Thu, 14 Sep 2023 12:40:53 +0800 From: Baoquan He To: Hari Bathini Cc: lkml , linuxppc-dev , Kexec-ml , Dave Young , Mahesh J Salgaonkar , Sourabh Jain , Michael Ellerman Subject: Re: [PATCH v3 1/2] vmcore: remove dependency with is_kdump_kernel() for exporting vmcore Message-ID: References: <20230912082950.856977-1-hbathini@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230912082950.856977-1-hbathini@linux.ibm.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 21:41:51 -0700 (PDT) On 09/12/23 at 01:59pm, Hari Bathini wrote: > Currently, is_kdump_kernel() returns true when elfcorehdr_addr is set. > While elfcorehdr_addr is set for kexec based kernel dump mechanism, > alternate dump capturing methods like fadump [1] also set it to export > the vmcore. Since, is_kdump_kernel() is used to restrict resources in > crash dump capture kernel and such restrictions may not be desirable > for fadump, allow is_kdump_kernel() to be defined differently for such > scenarios. With this, is_kdump_kernel() could be false while vmcore is > usable. So, remove unnecessary dependency with is_kdump_kernel(), for > exporting vmcore. > > [1] https://docs.kernel.org/powerpc/firmware-assisted-dump.html > > Suggested-by: Michael Ellerman > Signed-off-by: Hari Bathini > --- > > Changes in v3: > * Decoupled is_vmcore_usable() & vmcore_unusable() from is_kdump_kernel() > as suggested here: > https://lore.kernel.org/linuxppc-dev/ZP7si3UMVpPfYV+w@MiWiFi-R3L-srv/T/#m13ae5a7e4ba6f4d8397f0f66581832292eee3a85 > > > include/linux/crash_dump.h | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) LGTM, Acked-by: Baoquan He > > diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h > index 0f3a656293b0..acc55626afdc 100644 > --- a/include/linux/crash_dump.h > +++ b/include/linux/crash_dump.h > @@ -50,6 +50,7 @@ void vmcore_cleanup(void); > #define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) > #endif > > +#ifndef is_kdump_kernel > /* > * is_kdump_kernel() checks whether this kernel is booting after a panic of > * previous kernel or not. This is determined by checking if previous kernel > @@ -64,6 +65,7 @@ static inline bool is_kdump_kernel(void) > { > return elfcorehdr_addr != ELFCORE_ADDR_MAX; > } > +#endif > > /* is_vmcore_usable() checks if the kernel is booting after a panic and > * the vmcore region is usable. > @@ -75,7 +77,8 @@ static inline bool is_kdump_kernel(void) > > static inline int is_vmcore_usable(void) > { > - return is_kdump_kernel() && elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0; > + return elfcorehdr_addr != ELFCORE_ADDR_ERR && > + elfcorehdr_addr != ELFCORE_ADDR_MAX ? 1 : 0; > } > > /* vmcore_unusable() marks the vmcore as unusable, > @@ -84,8 +87,7 @@ static inline int is_vmcore_usable(void) > > static inline void vmcore_unusable(void) > { > - if (is_kdump_kernel()) > - elfcorehdr_addr = ELFCORE_ADDR_ERR; > + elfcorehdr_addr = ELFCORE_ADDR_ERR; > } > > /** > -- > 2.41.0 >