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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0060CA0EF3 for ; Thu, 14 Sep 2023 04:42:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234692AbjINEm5 (ORCPT ); Thu, 14 Sep 2023 00:42:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234535AbjINEmu (ORCPT ); Thu, 14 Sep 2023 00:42:50 -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 7B0831985 for ; Wed, 13 Sep 2023 21:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694666522; 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=gXhGZ4r4I1glj6Lql+/mnOOXVMF05GnccbGV18evrsY=; b=idRpOPTGg7jESA1+DTY1WhHelCAqQ1fxZyET17gswbhWaSNtz2SWNxvEN2PVvYtZkwQwy3 6FJfkfyahzgtNCcXUWtU8uWPOsiUUC/Hf0ikodze+MjoG66/9y91z2cUvAyo9+Ujm60FuB lkCo60OmwTE28kvhk+BW0GxlvlLOpAk= 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-412-Y8Vp1GdGOnaFVVQXkIOowA-1; Thu, 14 Sep 2023 00:41:58 -0400 X-MC-Unique: Y8Vp1GdGOnaFVVQXkIOowA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 086B2101A529; Thu, 14 Sep 2023 04:41:58 +0000 (UTC) Received: from localhost (unknown [10.72.112.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01CD92026D4B; Thu, 14 Sep 2023 04:41:56 +0000 (UTC) Date: Thu, 14 Sep 2023 12:41: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 2/2] powerpc/fadump: make is_kdump_kernel() return false when fadump is active Message-ID: References: <20230912082950.856977-1-hbathini@linux.ibm.com> <20230912082950.856977-2-hbathini@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230912082950.856977-2-hbathini@linux.ibm.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/12/23 at 01:59pm, Hari Bathini wrote: > Currently, is_kdump_kernel() returns true in crash dump capture kernel > for both kdump and fadump crash dump capturing methods, as both these > methods set elfcorehdr_addr. Some restrictions enforced for crash dump > capture kernel, based on is_kdump_kernel(), are specifically meant for > kdump case and not desirable for fadump - eg. IO queues restriction in > device drivers. So, define is_kdump_kernel() to return false when f/w > assisted dump is active. > > Signed-off-by: Hari Bathini > --- > arch/powerpc/include/asm/kexec.h | 8 ++++++-- > arch/powerpc/kernel/crash_dump.c | 12 ++++++++++++ > 2 files changed, 18 insertions(+), 2 deletions(-) LGTM, Acked-by: Baoquan He > > diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h > index a1ddba01e7d1..e1b43aa12175 100644 > --- a/arch/powerpc/include/asm/kexec.h > +++ b/arch/powerpc/include/asm/kexec.h > @@ -99,10 +99,14 @@ void relocate_new_kernel(unsigned long indirection_page, unsigned long reboot_co > > void kexec_copy_flush(struct kimage *image); > > -#if defined(CONFIG_CRASH_DUMP) && defined(CONFIG_PPC_RTAS) > +#if defined(CONFIG_CRASH_DUMP) > +bool is_kdump_kernel(void); > +#define is_kdump_kernel is_kdump_kernel > +#if defined(CONFIG_PPC_RTAS) > void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); > #define crash_free_reserved_phys_range crash_free_reserved_phys_range > -#endif > +#endif /* CONFIG_PPC_RTAS */ > +#endif /* CONFIG_CRASH_DUMP */ > > #ifdef CONFIG_KEXEC_FILE > extern const struct kexec_file_ops kexec_elf64_ops; > diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c > index 9a3b85bfc83f..2086fa6cdc25 100644 > --- a/arch/powerpc/kernel/crash_dump.c > +++ b/arch/powerpc/kernel/crash_dump.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > > #ifdef DEBUG > #include > @@ -92,6 +93,17 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, > return csize; > } > > +/* > + * Return true only when kexec based kernel dump capturing method is used. > + * This ensures all restritions applied for kdump case are not automatically > + * applied for fadump case. > + */ > +bool is_kdump_kernel(void) > +{ > + return !is_fadump_active() && elfcorehdr_addr != ELFCORE_ADDR_MAX; > +} > +EXPORT_SYMBOL_GPL(is_kdump_kernel); > + > #ifdef CONFIG_PPC_RTAS > /* > * The crashkernel region will almost always overlap the RTAS region, so > -- > 2.41.0 >