Message ID | 20230912082950.856977-1-hbathini@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp282670vqx; Tue, 12 Sep 2023 02:31:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmelK18aWReN+5YZpa07ZvijI0Uib+HEqFH7hDKAh0Wmf7WyEm+8FlzR9npRg1pTNiqoOk X-Received: by 2002:a17:90a:3481:b0:268:557e:1848 with SMTP id p1-20020a17090a348100b00268557e1848mr9414365pjb.2.1694511067943; Tue, 12 Sep 2023 02:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694511067; cv=none; d=google.com; s=arc-20160816; b=DcJYDBJP9PEe7GxbwOybQKEGPSkOPyT/sSQaOUM2iHfIud3IGkUlqZKfZ3llw+8Xy8 2YsRRrYVf4OjZQ+zD3J6Izg4qn6r0BPKh3ho8O9OvLLkTBDpQstRG1gWx5Mn3wQttqlg UCdeD4TyZ9HGUbu891WyjaJ0rKaV7ZN9QYfVPgCqPAh16h3DoISJ7Ozs3BesDqCHztsA wsCuhCBeW3Q7MxIBZaN5Wm0q4QXygXWQ9w9i4qEUyeE091NXki6N7SydRPjCwoPBd/26 057vYSan03VmX7/85K7PQGL1bXm4/hijcDZBgEQE5V1/d9HMSKmxS9Bi3yo885xzmYsR lrUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=to9w5yrqCHLi29TMkR3+kZKXKZXXIvDAGsAhn9dw/yI=; fh=/r/XfnyBdIfnMnGpPKRoqF0R3n93LLjkzols1+yexsY=; b=X9fh/nUgO0op/s/4Luqv3iuI6s2xOQD563GyAqHJIc10t7kibrm9DFB28AWX9xgtS2 GA6SJn1FOdQs+lYxsICxSINShQQW9PZTiDrwdBR5Ufu+axh6WvP3T0O4UQBwUK5TQpAD qlCX6kcZcvgyOz03Qbira5EZftxgr5RFsZwJHOOksNQ7VjHooHxUbKi/reWyHD2mg99g 2sJGjFs+N4H4LF/4/yeu+8ASdaqbSOGUdySEJ3s5NpxtZLtcTOACjZ38dl9g8v5tQnZA fVPt3uZ/V9/BMKhyju9Mr6AfILI2ZrWBmnNU2/0QDaNyIa66AxFENBxHvITCKWwdHeEi lURQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=bTwtvG0Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id mm20-20020a17090b359400b0026b4d5844ccsi7558970pjb.27.2023.09.12.02.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 02:31:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=bTwtvG0Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 542F880BB3C2; Tue, 12 Sep 2023 01:30:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232734AbjILIaY (ORCPT <rfc822;pwkd43@gmail.com> + 38 others); Tue, 12 Sep 2023 04:30:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbjILIaP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Sep 2023 04:30:15 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47012E6F for <linux-kernel@vger.kernel.org>; Tue, 12 Sep 2023 01:30:11 -0700 (PDT) Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38C88xgt024983; Tue, 12 Sep 2023 08:29:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=to9w5yrqCHLi29TMkR3+kZKXKZXXIvDAGsAhn9dw/yI=; b=bTwtvG0YmubKG4vqG8tZKYHLnYxe+ArOSp4HTFeQqaoN/Bs1FRyIuVuoVBmKnDdFVkgk dcMuQ0Ib2m73Rkuvi83f2SYcTjjRiF58VX4qZP4BsWvJbQL2rseZbiNoVCVFcB2yB4Xz h8YVw2qGLQqHiPIhaUYxUj3GO+SS29cdYKfIN0X7WW3Y3IRvu2k/oiMuApLgZ7XdaRe/ vzqHoVnIM6bc8VUfr2Nj0/LRv7dpFIHjEpKDVEimewfkgnBXGAWyXzgM3L0ZQHKBnCkv hg8Xk+kTAzVOyVEIHulor7ukWmOFcxYQsp/naLkJiCTYHwq2v5FLKxWPJJSKTIPLELTG GA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t2j5jcbv4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 08:29:59 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38C89doZ029507; Tue, 12 Sep 2023 08:29:59 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t2j5jcbuv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 08:29:58 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38C6wIJe002401; Tue, 12 Sep 2023 08:29:58 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3t158k18md-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 08:29:55 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38C8Tqbk54526208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Sep 2023 08:29:52 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A093C2004B; Tue, 12 Sep 2023 08:29:52 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E740320040; Tue, 12 Sep 2023 08:29:50 +0000 (GMT) Received: from li-bd3f974c-2712-11b2-a85c-df1cec4d728e.in.ibm.com (unknown [9.203.106.137]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 12 Sep 2023 08:29:50 +0000 (GMT) From: Hari Bathini <hbathini@linux.ibm.com> To: lkml <linux-kernel@vger.kernel.org>, linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, Kexec-ml <kexec@lists.infradead.org> Cc: Dave Young <dyoung@redhat.com>, Baoquan He <bhe@redhat.com>, Mahesh J Salgaonkar <mahesh@linux.ibm.com>, Sourabh Jain <sourabhjain@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au> Subject: [PATCH v3 1/2] vmcore: remove dependency with is_kdump_kernel() for exporting vmcore Date: Tue, 12 Sep 2023 13:59:49 +0530 Message-ID: <20230912082950.856977-1-hbathini@linux.ibm.com> X-Mailer: git-send-email 2.41.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: EIk-mFTGMjHmkefYEWiZ-GstYmU1pwQ_ X-Proofpoint-ORIG-GUID: 7srt9IEhyvE3vzJikvVf5Z4KGm7-Pkiy Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-12_06,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 mlxlogscore=957 lowpriorityscore=0 suspectscore=0 clxscore=1015 malwarescore=0 spamscore=0 bulkscore=0 priorityscore=1501 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309120068 Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Sep 2023 01:30:40 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776823637558972830 X-GMAIL-MSGID: 1776823637558972830 |
Series |
[v3,1/2] vmcore: remove dependency with is_kdump_kernel() for exporting vmcore
|
|
Commit Message
Hari Bathini
Sept. 12, 2023, 8:29 a.m. UTC
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 <mpe@ellerman.id.au>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
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(-)
Comments
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 <mpe@ellerman.id.au> > Signed-off-by: Hari Bathini <hbathini@linux.ibm.com> > --- > > 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 <bhe@redhat.com> > > 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 >
On Tue, 12 Sep 2023 13:59:49 +0530, 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. > > [...] Applied to powerpc/next. [1/2] vmcore: remove dependency with is_kdump_kernel() for exporting vmcore https://git.kernel.org/powerpc/c/86328b338c3996b814417dd68e3f899a1a649059 [2/2] powerpc/fadump: make is_kdump_kernel() return false when fadump is active https://git.kernel.org/powerpc/c/b098f1c32365304633077d73e4ae21c72d4241b3 cheers
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; } /**