From patchwork Thu Apr 27 00:08:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Yznaga X-Patchwork-Id: 13225084 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1ED2C77B60 for ; Thu, 27 Apr 2023 01:27:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55D0B6B0078; Wed, 26 Apr 2023 21:27:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50D7D6B007B; Wed, 26 Apr 2023 21:27:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D5266B007D; Wed, 26 Apr 2023 21:27:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2DE926B0078 for ; Wed, 26 Apr 2023 21:27:01 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 05389120124 for ; Thu, 27 Apr 2023 01:27:00 +0000 (UTC) X-FDA: 80725432242.23.AB36060 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf24.hostedemail.com (Postfix) with ESMTP id E1BA3180013 for ; Thu, 27 Apr 2023 01:26:58 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=J9766iWR; spf=pass (imf24.hostedemail.com: domain of anthony.yznaga@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=anthony.yznaga@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682558819; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=VQwaugMMgK/MS0E/urOkz6I4ukGs9iD4CWV4YSx/1xc=; b=vFMMZUbnsDma+MNdohI4jz+GdTi6nE4HKpcJNLguyylecrvHUFIMWv2uPhcxNgbi+dBJPP 1Rp+MhqO4pa3ZaDETA3e/JFZD8g5/2p4z0WOdnf9kBI3reziysYEWVZZ6Gc+PEjp0eSUkz qk6o2TFM4jyfBr6ro5jut3F7fZqmouU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682558819; a=rsa-sha256; cv=none; b=U3s3EmaUKTjsTFzYn5O+lEZQ2Pg2XyHUZASQqUppJ/5cQ7qn2iEzOn1GZvY+pgwDUiPWcJ P89VIBHHVR1kaCNErI9YGID30mcG1hLnuzSMhPTmIZ+pJ1JNrpyKauuuWzvZVRMN3EIWNF ZrC1WLfsotLOLK+28lu9GJEL/dFefRY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=J9766iWR; spf=pass (imf24.hostedemail.com: domain of anthony.yznaga@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=anthony.yznaga@oracle.com; dmarc=pass (policy=none) header.from=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33QGxFQg025361; Thu, 27 Apr 2023 00:09:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-03-30; bh=VQwaugMMgK/MS0E/urOkz6I4ukGs9iD4CWV4YSx/1xc=; b=J9766iWR8G77hZ7IvzmoZgr4vzzvhIrhZGyputyh0qhGelOn0BZzz+TYbnctnLfB2tXh 00taSjRcT8LFpZEslBFSSAM+7RpAZLoDdPLhJX6aat3Xus05BlbcMz45pXDselmAKTQL 4j9iCnvsVigM9pq/Hn6cRChdsGBc3RcS+agLBtC0Ryp+vhjYvDipYwOzgG+fZ0YtUBKh ywDBGNDhlrFvWYIx2fSMBZzPveVn06sAanl2zckyI7jdur2dQ1+8SRVOAnEI4OnwJAyu qzNFfHr6Mb0eJ2sQWEFZDyiF5ZYwCvt6ZBGbB2qNbzLkGSSfha9z8223RFFTKeqKIbV2 AQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q46622tym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Apr 2023 00:09:33 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 33QNUZGN007329; Thu, 27 Apr 2023 00:09:32 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q4618mpux-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Apr 2023 00:09:32 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33R09390013888; Thu, 27 Apr 2023 00:09:32 GMT Received: from ca-qasparc-x86-2.us.oracle.com (ca-qasparc-x86-2.us.oracle.com [10.147.24.103]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3q4618mp42-20; Thu, 27 Apr 2023 00:09:31 +0000 From: Anthony Yznaga To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, rppt@kernel.org, akpm@linux-foundation.org, ebiederm@xmission.com, keescook@chromium.org, graf@amazon.com, jason.zeng@intel.com, lei.l.li@intel.com, steven.sistare@oracle.com, fam.zheng@bytedance.com, mgalaxy@akamai.com, kexec@lists.infradead.org Subject: [RFC v3 19/21] PKRAM: disable feature when running the kdump kernel Date: Wed, 26 Apr 2023 17:08:55 -0700 Message-Id: <1682554137-13938-20-git-send-email-anthony.yznaga@oracle.com> X-Mailer: git-send-email 1.9.4 In-Reply-To: <1682554137-13938-1-git-send-email-anthony.yznaga@oracle.com> References: <1682554137-13938-1-git-send-email-anthony.yznaga@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_10,2023-04-26_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304270000 X-Proofpoint-ORIG-GUID: jPzpZYiuahk2b6x6CL1T4-5GRvhXf1gU X-Proofpoint-GUID: jPzpZYiuahk2b6x6CL1T4-5GRvhXf1gU X-Rspam-User: X-Rspamd-Queue-Id: E1BA3180013 X-Rspamd-Server: rspam09 X-Stat-Signature: 3pgmki6bc35qugs7tzkszc64ujk1bcb7 X-HE-Tag: 1682558818-950794 X-HE-Meta: U2FsdGVkX1/qFpKMMxf8xvc7tclLiQHugcx/sbYfQvv2TVvh9/ysaY9qXGWyrsaavo6vVr191SFM4CxZRFeBr6Us9t1s6+5/WObe9M93fN4Xi8O79+0A6OMjwUVEmn7766OfbgimiZk+RcyJPM5RpY4pw1/ZIIPmx5XJ0wzyORhvWwooQCUILlFr9ZQgVCR/PVswU+Z2iExZjst5IYpAtg+6Mf+5GaYNT0dEqqZlKxahug/Y8YzAdj0BOl2OxaVvcVYUsasQz/NesJ2eZ3ONtd6R246apY6yw5G3HRqlpLd5CPWcwVC7siHYFUhiJgsn1IOe7eqxdvgJS2Y4Y88IvCZov45jC/wCL6NgOvRfUN+Z35PWuAS2Y/rzVHJH7zqqQfhxKC401DJqgjaislozLxdHHX2QkC84PK9KNMh92+kdFJ+Z691CyvZaa8NdiMPjb+YS+QbyUOS8RZGWR//ffLihiEA+QPEh3t3i6WNHEVL+UuShUag/XqNTLdc1IkS2DUrZvwnXsYxJUYPdKpGSb3RvWtbrsCQIXJbtouTg5fkY7gntZUbRScJdSIZW7YHtYzkgTL1fGdshQvVLEB5VVsTfuStUtu60A3exrHZai6Zmg/gDvjbGoXEknvPD5+UUNYq2xcys3/uXjlQJaGKakmY93dyN4zdU6nbZ5OeBGapw83xHkk0mcSRLDl9eBZDdUjLF2h6U92AkrbbeEmxtN+SO4NcVnfZT+pyodN3ODEPupAw+5NxqbASMXzdZmt+TVclEAcpgHRVgb1JlInYFQT73XvTS6mywXV3bWR+GQdU9EtOXUImext/he/rEyeiVv2SRsCELCeQwxbcI1nKdqIcNKvKkJnXwupczwH/ig01Hw/nmyPAGBQMC/gLCGLMd+IzzlUFPF4EczcxCgqbhZKZko4K9HQpZy1Zr5SL5FXpAf9XN1KQUVCPJqQOlXkaW7je5RyQ6g/7odY6DXqP NkIz0imK tK2IpLdLCR4X4UT5453F92OW0nBedClreqlF+/XP7MpajRubEi+3kjRbv1TgzhByYFgNwmjduTULQV21Es1U5kB39uMkmt8VE8l+akQDLSKpeULYHWN432SiBXtiK7WyKKSmu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The kdump kernel should not preserve or restore pages. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/pkram.c b/mm/pkram.c index d404e415f3cb..f38236e5d836 100644 --- a/mm/pkram.c +++ b/mm/pkram.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#include #include #include #include @@ -188,7 +189,7 @@ void __init pkram_reserve(void) { int err = 0; - if (!pkram_sb_pfn) + if (!pkram_sb_pfn || is_kdump_kernel()) return; pr_info("PKRAM: Examining preserved memory...\n"); @@ -285,6 +286,9 @@ static void pkram_show_banned(void) int i; unsigned long n, total = 0; + if (is_kdump_kernel()) + return; + pr_info("PKRAM: banned regions:\n"); for (i = 0; i < nr_banned; i++) { n = banned[i].end - banned[i].start + 1; @@ -1334,7 +1338,7 @@ static int __init pkram_init_sb(void) static int __init pkram_init(void) { - if (pkram_init_sb()) { + if (!is_kdump_kernel() && pkram_init_sb()) { register_reboot_notifier(&pkram_reboot_notifier); register_shrinker(&banned_pages_shrinker, "pkram"); sysfs_update_group(kernel_kobj, &pkram_attr_group);