Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2644214rdb; Tue, 12 Sep 2023 08:03:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhcBBWR+hPPKsm8Dlgr9NT2dRa79//Foto3Wbaol6MZab4UMfsLFIfcPmkiFpp0NZXacyp X-Received: by 2002:a05:6871:207:b0:1b0:43b6:e13b with SMTP id t7-20020a056871020700b001b043b6e13bmr16094113oad.54.1694531010356; Tue, 12 Sep 2023 08:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694531010; cv=none; d=google.com; s=arc-20160816; b=JdDrSArysTFYDRNlC88bFA387NApdJP/JwoFlukKKNbK0h0w5F66HfRmQQC47KYKTf 34crvdkiqWYx18ogYN8ZBBIHHJVm+f31clgWvBKL23TIIBpe9o2KTk6FiYMbofkzw2iS jjGz1R8P3G22ZXmqvRqF+UUPoU+qQ79j/NH3x3PkwZtWHIT9xkISx13zYJ250ForP5CS fgO0gYQybMHnLkH2/j4fiLZpWDPrJqJB8UdzUa4CYAzu3Hgm2nuneNvG058BQjgdSPBr A1FOUBplhP9H8YYUug++heL4tYeQgpxkuVZOGNQgFerpmHM4a9xMVgSRf01M5GIV0rUU BVfw== 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 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j190-20020a6380c7000000b0057748a05fcfsi5616858pgd.27.2023.09.12.08.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 08:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; 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 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id CE3B98082A51; Tue, 12 Sep 2023 01:30:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbjILIaX (ORCPT + 99 others); Tue, 12 Sep 2023 04:30:23 -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 ); 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 ; 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 To: lkml , linuxppc-dev , Kexec-ml Cc: Dave Young , Baoquan He , Mahesh J Salgaonkar , Sourabh Jain , Michael Ellerman 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Sep 2023 01:30:30 -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 lipwig.vger.email 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(-) 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