From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0ECFF2DF73; Mon, 8 Apr 2024 13:07:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712581627; cv=none; b=Dr6ZFFsmw+FdDLVssir6Y0VPnD6EP0Z5Eiu3hcu2hEGvesx94VmONPhwI+1uT/mYShdU51BFGxssLakhQ7UHxQcY8u1jzzxCYDVOrxCdQ1xij+vC/7q/6De7ReF0graqZb0G3Atual8gEeDXSKf+jvP6lVZujgZstchuMLB0TXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712581627; c=relaxed/simple; bh=nbeRvAYO1CjPWz0d4afKdaeGxPfGQOfbAXNKNjlU7as=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OuNFmu8qnCEVdTPDCBuvZk/rLuofXDwhq3MIyXgDkH6LFegvkpBd3kSK3SU+sj/OTAIo/dFIKDO5IJEPhy3pt6HoxKwzCYTvDFu5JouQ/iv7JL+SNV0ZpaNeKg2fCfq5C/9XUo1ejN80KojsNZaZ4Ar3ZjMUwrC/rjw2LGjdrqw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VrGCWYMk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VrGCWYMk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87D38C433F1; Mon, 8 Apr 2024 13:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712581626; bh=nbeRvAYO1CjPWz0d4afKdaeGxPfGQOfbAXNKNjlU7as=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrGCWYMkFtTdhaf+Z6p2Up3whZccq95QdSjfnd/vEOwO64AVlyreIQTJwZYh9C8L5 DMM+HjTPfgaqI8FseQxKHmK79RxiPqf6CWEwW3VfGaUynq/eZ9Oh4O6XwGu3Jl103D BxFdx4UC9dCZRMmOx/5GAZD3WvOkG+F7w7ZFqvc4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ingo Molnar , Russ Anderson , Steve Wahl , Dave Hansen Subject: [PATCH 6.1 039/138] Revert "x86/mm/ident_map: Use gbpages only where full GB page should be mapped." Date: Mon, 8 Apr 2024 14:57:33 +0200 Message-ID: <20240408125257.440200695@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240408125256.218368873@linuxfoundation.org> References: <20240408125256.218368873@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ingo Molnar commit c567f2948f57bdc03ed03403ae0234085f376b7d upstream. This reverts commit d794734c9bbfe22f86686dc2909c25f5ffe1a572. While the original change tries to fix a bug, it also unintentionally broke existing systems, see the regressions reported at: https://lore.kernel.org/all/3a1b9909-45ac-4f97-ad68-d16ef1ce99db@pavinjoseph.com/ Since d794734c9bbf was also marked for -stable, let's back it out before causing more damage. Note that due to another upstream change the revert was not 100% automatic: 0a845e0f6348 mm/treewide: replace pud_large() with pud_leaf() Signed-off-by: Ingo Molnar Cc: Cc: Russ Anderson Cc: Steve Wahl Cc: Dave Hansen Link: https://lore.kernel.org/all/3a1b9909-45ac-4f97-ad68-d16ef1ce99db@pavinjoseph.com/ Fixes: d794734c9bbf ("x86/mm/ident_map: Use gbpages only where full GB page should be mapped.") Signed-off-by: Steve Wahl Signed-off-by: Greg Kroah-Hartman --- arch/x86/mm/ident_map.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) --- a/arch/x86/mm/ident_map.c +++ b/arch/x86/mm/ident_map.c @@ -26,31 +26,18 @@ static int ident_pud_init(struct x86_map for (; addr < end; addr = next) { pud_t *pud = pud_page + pud_index(addr); pmd_t *pmd; - bool use_gbpage; next = (addr & PUD_MASK) + PUD_SIZE; if (next > end) next = end; - /* if this is already a gbpage, this portion is already mapped */ - if (pud_large(*pud)) - continue; - - /* Is using a gbpage allowed? */ - use_gbpage = info->direct_gbpages; - - /* Don't use gbpage if it maps more than the requested region. */ - /* at the begining: */ - use_gbpage &= ((addr & ~PUD_MASK) == 0); - /* ... or at the end: */ - use_gbpage &= ((next & ~PUD_MASK) == 0); - - /* Never overwrite existing mappings */ - use_gbpage &= !pud_present(*pud); - - if (use_gbpage) { + if (info->direct_gbpages) { pud_t pudval; + if (pud_present(*pud)) + continue; + + addr &= PUD_MASK; pudval = __pud((addr - info->offset) | info->page_flag); set_pud(pud, pudval); continue;