From nobody Thu Feb 12 23:05:25 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2FE101E6 for ; Fri, 3 Jan 2025 07:13:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735888392; cv=none; b=mEf6wm066V1/jNGZ1Y/FTM9ubgrwMIttNG9s9El066Av0VKiiWH56aVdnyZtyS+Y1KjxbezODQtPLEw9kWHi5wsStzqKgHl64Ju28dyOIpIzSMJCpaYZSfKCZi52ndsYvbiBZlp9S3rnooWRkc7TmMO4yzYA9R4sxAx1zPjETfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735888392; c=relaxed/simple; bh=q6EpZCsfYDi77uPvfLYPa4xIhDDdtR9yHwvrB9Fv5Ts=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=C8aPsZZcd1jtt0RN9M2ls6fwY9TLSRDdIlVN/dYjT3che2HAIlMZeGxdZ/jrHlP6P7XJxHtaWCwkFKMP1IxR6SdrqyDnkITZ7Uylj9if9chW1cIwLSSUiu3y1ZyVA+DbXRLPk3CO2HUpj5O4GGWOXEAOGLs74/Z3I8i5DietGH8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ATmI4Png; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ATmI4Png" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735888391; x=1767424391; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=q6EpZCsfYDi77uPvfLYPa4xIhDDdtR9yHwvrB9Fv5Ts=; b=ATmI4PngpSs40Zcw7X6BrAWDJOL34smyeHUL2q5VJpm2tccos+d9RZGf YiBBZ+EIZ+ORvAZSTP/i4qkr2Z/T1ZAg8G59VRnRlM1R26lfDpTEkI7uF RhmMz/9WAVsIZA5C2x6AiGMEdU1VhDpLaR47Z4RBOy7p0c62inJn+oVtr zPTk/ktcojnKHYP1QFkZkevu80P3ezAMAOtkR4iuon8F7OllfJiGGTZ6P aSdS589eXovn8CLnSB25QSv95xOFZtKTo/haxCMI2FLQFEIV8cVwdVgjR j31D/b43d/PhyrwAhKRzBgcqxgMA4qSjoFNKLCs2hEODxgMscKpZruw9S g==; X-CSE-ConnectionGUID: YOePqu+3QE+eML7vnBmWCQ== X-CSE-MsgGUID: oVug15lURIWYImtU5OYJRA== X-IronPort-AV: E=McAfee;i="6700,10204,11303"; a="39817257" X-IronPort-AV: E=Sophos;i="6.12,286,1728975600"; d="scan'208";a="39817257" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2025 23:13:10 -0800 X-CSE-ConnectionGUID: fD/XXd/qSkuIOzh6YzXNUg== X-CSE-MsgGUID: kwP40DpjQlmb74PmXD1A6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,286,1728975600"; d="scan'208";a="101798438" Received: from zhiquan-linux-dev.bj.intel.com ([10.238.156.102]) by orviesa006.jf.intel.com with ESMTP; 02 Jan 2025 23:13:09 -0800 From: Zhiquan Li To: bhe@redhat.com, vgoyal@redhat.com, dyoung@redhat.com, kirill.shutemov@linux.intel.com Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, zhiquan1.li@intel.com Subject: [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo Date: Fri, 3 Jan 2025 15:49:41 +0800 Message-Id: <20250103074941.3651765-1-zhiquan1.li@intel.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On Intel TDX guest, unaccepted memory is unusable free memory which is not managed by buddy, until it's accepted by guest. Before that, it cannot be accessed by the first kernel as well as the kexec'ed kernel. The kexec'ed kernel will skip these pages and fill in zero data for the reader of vmcore. The dump tool like makedumpfile creates a page descriptor (size 24 bytes) for each non-free page, including zero data page, but it will not create descriptor for free pages. If it is not able to distinguish these unaccepted pages with zero data pages, a certain amount of space will be wasted in proportion. In fact, as a special kind of free page the unaccepted pages should be excluded, like the real free pages. Export the page type PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo, so that dump tool can identify whether a page is unaccepted. Signed-off-by: Zhiquan Li Reviewed-by: Kirill A. Shutemov --- kernel/vmcore_info.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/vmcore_info.c b/kernel/vmcore_info.c index 1fec61603ef3..e066d31d08f8 100644 --- a/kernel/vmcore_info.c +++ b/kernel/vmcore_info.c @@ -210,6 +210,10 @@ static int __init crash_save_vmcoreinfo_init(void) VMCOREINFO_NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE); #define PAGE_OFFLINE_MAPCOUNT_VALUE (PGTY_offline << 24) VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE); +#ifdef CONFIG_UNACCEPTED_MEMORY +#define PAGE_UNACCEPTED_MAPCOUNT_VALUE (PGTY_unaccepted << 24) + VMCOREINFO_NUMBER(PAGE_UNACCEPTED_MAPCOUNT_VALUE); +#endif =20 #ifdef CONFIG_KALLSYMS VMCOREINFO_SYMBOL(kallsyms_names); base-commit: fc033cf25e612e840e545f8d5ad2edd6ba613ed5 --=20 2.25.1