From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 171CC17548 for ; Sun, 22 Dec 2024 04:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734840473; cv=none; b=NJIgZcBEvG3+XnUAK9Yie3JLGRbuRM+y+riO8ombOJe7doDBQinD47hJiWm6RoDGQJiLavQbEv77AvPJGzdU/6B6fyUZwvRek+pzokz25t+l1Gj8nWkN1xz70hvhHYDz6yHzjC4TGYcvGYABFkKbid/w0Ve7RvY2Ifz3Bv7xTR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734840473; c=relaxed/simple; bh=eMptX+aum0YAjf4dcRtsXsOq6Mx4IYmL80tiV5nWSmk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QueqdnW4pgZih8jqUFolKOU4NCAeeqCqROaV+8wFNM/FXiVETUDKhUMUwTOodO3zAmNXYbE36Tyu9MJQN2D7iK61q9wm+UM1YHY4lA7G11+7DNv3f+nAqP1wVxCSOgx9uoV9fwiiiQbb4FeiLyFbqDbKMT2Pl3WitJAamhT3toA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=shelob.surriel.com; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shelob.surriel.com Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1tPDFU-000000000V0-1PzJ; Sat, 21 Dec 2024 23:07:24 -0500 From: Rik van Riel To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, akpm@linux-foundation.org, Rik van Riel Subject: [PATCH 10/10] x86/mm: only invalidate final translations with INVLPGB Date: Sat, 21 Dec 2024 23:06:42 -0500 Message-ID: <20241222040717.3096835-11-riel@surriel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222040717.3096835-1-riel@surriel.com> References: <20241222040717.3096835-1-riel@surriel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: riel@surriel.com Use the INVLPGB_FINAL_ONLY flag when invalidating mappings with INVPLGB. This leaves intermediate translations cached in the TLB. On the (rare) occasions where we free page tables we do a full flush, ensuring intermediate translations get flushed from the TLB. Signed-off-by: Rik van Riel --- arch/x86/include/asm/invlpgb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/invlpgb.h b/arch/x86/include/asm/invlpgb.h index ef12ea4a8d65..c1478277b9ea 100644 --- a/arch/x86/include/asm/invlpgb.h +++ b/arch/x86/include/asm/invlpgb.h @@ -56,7 +56,7 @@ static inline void invlpgb_flush_user(unsigned long pcid, static inline void invlpgb_flush_user_nr(unsigned long pcid, unsigned long addr, int nr, bool pmd_stride) { - __invlpgb(0, pcid, addr, nr - 1, pmd_stride, INVLPGB_PCID | INVLPGB_VA); + __invlpgb(0, pcid, addr, nr - 1, pmd_stride, INVLPGB_PCID | INVLPGB_VA | INVLPGB_FINAL_ONLY); } /* Flush all mappings for a given ASID, not including globals. */ -- 2.47.1