From nobody Sun Feb 8 17:04:36 2026 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) (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 5E50D57876; Fri, 22 Mar 2024 16:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.143.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711124562; cv=none; b=tkADdNLz/hxZynMV7dQvTCSY0g1D8fJr/OmSeKv0XkbVQJTL0hJwLCKwSyT5/+yUOJwIsJeSUg/1g9vPTly8lkye6lrO0KfeiZYrGd1pfnIlyKEKQl2HRj2UfCigFdCDwk62GhJyEmVvvUxTqw/jxDR8xDIs4Q7KlgEu88HFAj0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711124562; c=relaxed/simple; bh=MAE8WIHU9ta7n4x/BR5+OwfH/AdkCJB+DKep9CrSiJ4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=WU6L7jKXUFPk3aDOtkKkN3SfREgFK7IAXzX05wqAG+e7t+dZBoyBj/lo7jXik4/6Y+yThKCQm2HQU/cWaRue7VlMa9LO+L7zBzOGBCOWtvuuty/3eL8sLZte9+R/RzIT9KcQK3APyysYM3vdffFN7Y68A4XOdd4367rIUVTu3Wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hpe.com; spf=pass smtp.mailfrom=hpe.com; dkim=pass (2048-bit key) header.d=hpe.com header.i=@hpe.com header.b=Ip4ViCWf; arc=none smtp.client-ip=148.163.143.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hpe.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hpe.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hpe.com header.i=@hpe.com header.b="Ip4ViCWf" Received: from pps.filterd (m0134425.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42MDWoAc020466; Fri, 22 Mar 2024 16:21:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pps0720; bh=UkvndrBpowbSq2m7Khs+/6kDy0TN1ypmmFxO26zOD98=; b=Ip4ViCWf/re1gFk8m+T/teZhgpZs46nWSlanj0dgUdQM+i3bi6ofXxeEhI0whQMxJQxP 55CHzRjLhQqxA9Fvv1CyvB30sh1I72nWJ6f7ZvvMl/jTYYvaZGKQWTxRd0Q8NOqPjuBx PLMShfMn/BGNilt7LHzLs4T10FIRDOfLkEK2XyW+oI9LSDxTX4x3YnR93LpO2AgNqkn0 w7pxLQKU8ERnIBwQXSvOoWGwZLvH67X22uDS1/dg4nrsUT/48KTmYTZxHIOyMR5D7e6m JS1ZILLydV4+/XXoNiNjuMSVcdANOybSJcJW3R3fl/bVabV8uKdxiywkBRNnD6L7mlqW Ow== Received: from p1lg14881.it.hpe.com ([16.230.97.202]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3x183dbayg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Mar 2024 16:21:57 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id EC9B68059E3; Fri, 22 Mar 2024 16:21:55 +0000 (UTC) Received: from dog.eag.rdlabs.hpecorp.net (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id DA6E9808350; Fri, 22 Mar 2024 16:21:51 +0000 (UTC) Received: by dog.eag.rdlabs.hpecorp.net (Postfix, from userid 200934) id A1A6B3000059D; Fri, 22 Mar 2024 11:21:35 -0500 (CDT) From: Steve Wahl To: Steve Wahl , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Linux regressions mailing list , Pavin Joseph , stable@vger.kernel.org, Eric Hagberg Cc: Simon Horman , Eric Biederman , Dave Young , Sarah Brofeldt , Russ Anderson , Dimitri Sivanich Subject: [PATCH] x86/mm/ident_map: Use full gbpages in identity maps except on UV platform. Date: Fri, 22 Mar 2024 11:21:35 -0500 Message-Id: <20240322162135.3984233-1-steve.wahl@hpe.com> X-Mailer: git-send-email 2.26.2 X-Proofpoint-GUID: oYOSRYdA2RlWrO_MVfNl-dLggOq7mrmq X-Proofpoint-ORIG-GUID: oYOSRYdA2RlWrO_MVfNl-dLggOq7mrmq Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-22_08,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 clxscore=1011 spamscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2403210000 definitions=main-2403220117 Content-Type: text/plain; charset="utf-8" Some systems have ACPI tables that don't include everything that needs to be mapped for a successful kexec. These systems rely on identity maps that include the full gigabyte surrounding any smaller region requested for kexec success. Without this, they fail to kexec and end up doing a full firmware reboot. So, reduce the use of GB pages only on systems where this is known to be necessary (specifically, UV systems). Signed-off-by: Steve Wahl Fixes: d794734c9bbf ("x86/mm/ident_map: Use gbpages only where full GB page= should be mapped.") Reported-by: Pavin Joseph Closes: https://lore.kernel.org/all/3a1b9909-45ac-4f97-ad68-d16ef1ce99db@pa= vinjoseph.com/ Tested-by: Pavin Joseph Tested-by: Eric Hagberg Tested-by: Sarah Brofeldt --- arch/x86/include/asm/init.h | 1 + arch/x86/kernel/machine_kexec_64.c | 3 +++ arch/x86/mm/ident_map.c | 13 +++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/init.h b/arch/x86/include/asm/init.h index cc9ccf61b6bd..4ae843e8fefb 100644 --- a/arch/x86/include/asm/init.h +++ b/arch/x86/include/asm/init.h @@ -10,6 +10,7 @@ struct x86_mapping_info { unsigned long page_flag; /* page flag for PMD or PUD entry */ unsigned long offset; /* ident mapping offset */ bool direct_gbpages; /* PUD level 1GB page support */ + bool direct_gbpages_always; /* use 1GB pages exclusively */ unsigned long kernpg_flag; /* kernel pagetable flag override */ }; =20 diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_k= exec_64.c index b180d8e497c3..1e1c6633bbec 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -28,6 +28,7 @@ #include #include #include +#include =20 #ifdef CONFIG_ACPI /* @@ -212,6 +213,8 @@ static int init_pgtable(struct kimage *image, unsigned = long start_pgtable) =20 if (direct_gbpages) info.direct_gbpages =3D true; + if (!is_uv_system()) + info.direct_gbpages_always =3D true; =20 for (i =3D 0; i < nr_pfn_mapped; i++) { mstart =3D pfn_mapped[i].start << PAGE_SHIFT; diff --git a/arch/x86/mm/ident_map.c b/arch/x86/mm/ident_map.c index a204a332c71f..8039498b9713 100644 --- a/arch/x86/mm/ident_map.c +++ b/arch/x86/mm/ident_map.c @@ -39,12 +39,13 @@ static int ident_pud_init(struct x86_mapping_info *info= , pud_t *pud_page, /* Is using a gbpage allowed? */ use_gbpage =3D info->direct_gbpages; =20 - /* Don't use gbpage if it maps more than the requested region. */ - /* at the begining: */ - use_gbpage &=3D ((addr & ~PUD_MASK) =3D=3D 0); - /* ... or at the end: */ - use_gbpage &=3D ((next & ~PUD_MASK) =3D=3D 0); - + if (!info->direct_gbpages_always) { + /* Don't use gbpage if it maps more than the requested region. */ + /* at the beginning: */ + use_gbpage &=3D ((addr & ~PUD_MASK) =3D=3D 0); + /* ... or at the end: */ + use_gbpage &=3D ((next & ~PUD_MASK) =3D=3D 0); + } /* Never overwrite existing mappings */ use_gbpage &=3D !pud_present(*pud); =20 --=20 2.26.2