From patchwork Mon Dec 23 02:55:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 13918385 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 3E426E77188 for ; Mon, 23 Dec 2024 03:02:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C66956B0082; Sun, 22 Dec 2024 22:02:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C15186B0083; Sun, 22 Dec 2024 22:02:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADD436B0088; Sun, 22 Dec 2024 22:02:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8E1976B0082 for ; Sun, 22 Dec 2024 22:02:48 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0CC5F121646 for ; Mon, 23 Dec 2024 03:02:48 +0000 (UTC) X-FDA: 82924725156.21.33A43C5 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf30.hostedemail.com (Postfix) with ESMTP id CE3DA80007 for ; Mon, 23 Dec 2024 03:01:34 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf30.hostedemail.com: domain of riel@shelob.surriel.com designates 96.67.55.147 as permitted sender) smtp.mailfrom=riel@shelob.surriel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734922949; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SXXuSMpFNCfzTFZ81LFvoO369pHVUEu6XId56aIoa+E=; b=gR30CdsNYQnLoVIFizu94RvZYgRHLcHVZW/N/vUhgzoBQO+jU9yNnBElr/zgnjiXXd/2y3 YlY4A4/zL4W7mcERd9GWyEC/NCeFjScAJAj+Po+jtip2ETWQ4Ba7+IYEmqC17L4IvDTOjn /Hh2T/iC1bOq/QxK+WuviuCRrkZopVs= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf30.hostedemail.com: domain of riel@shelob.surriel.com designates 96.67.55.147 as permitted sender) smtp.mailfrom=riel@shelob.surriel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734922949; a=rsa-sha256; cv=none; b=U1e8d7ASBRIwhVKHyYU6VSryYT0XPW3l5qu/IGdOa6YKNh/m6xm3iXajeFE6Y2gFxvxSdy S4bZ9IHJFrxijhG6z3ubrYPFBMQX+TeHxPIAa8KihuK9/q5YsuloR8Faozo91XfsVH1QG5 V7p8rMs2e+OGc5spWZNvuAaS0bHvuCE= 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 1tPYdq-000000001Ih-1jeK; Sun, 22 Dec 2024 21:57:58 -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, linux-mm@kvack.org, Rik van Riel Subject: [PATCH 11/11] x86/mm: only invalidate final translations with INVLPGB Date: Sun, 22 Dec 2024 21:55:17 -0500 Message-ID: <20241223025751.3268975-12-riel@surriel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241223025751.3268975-1-riel@surriel.com> References: <20241223025751.3268975-1-riel@surriel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: CE3DA80007 X-Stat-Signature: akw1o9gfnbjinnrrkae3w3okooe11zwa X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1734922894-679612 X-HE-Meta: U2FsdGVkX18I4XBGrl4dfnBDtLjex33mKEp8IkdP24V9ePZDv8Ir5dZIeonvNCGn+tTm7Bc7wNrqdns0BgkqjWiCHmA2C4UCfI+/RgP85ab68zVxuyzeRqCVu+niaiMNH3tDXocLjgkiCoSvCnCVoChiLPmb44C9S40BB6ltQwDRFxx4T1sv9Qml1PW/5lH7Q6tsTjMfjuN/tG1XYQOgjVJkifIrB0BfkWWsFIZB26pIlQTbxWOPVTEd96FtFEQAk5bOLBVHlk09Ujy+eC6VvbynoHg/1WUOm7k8ydwYT9Z+RSYR258QNgdfJsSBwCrgMS1lcmm4jd8catjfPPhIdW5IQlJApwNFkEvjE9unM80928fmVE6EsyKuAilI9x8JCzDGgDJ2b/I0CJ1SlEkToEfCHc0ou6iX5UbNMEnUo8LQr0KU+9WBM5Bi9TEKfzywVab93JhDGXx/FGeEyBFkBbRvPaJtaG4RzJr0qeIHU4AFJ8vIvQo5uauZU3h/+vby1FEOWVohdRphDT8zUfcm74o1EMLcyoUc87uXgWn7p/EkpPwvZzHM5/6d74npbkAYOVFH2+8gNYJU39HTSN/bvoP5yzFiHwVjCJErlj830/2d3YIx0P7HPMdMtN+jl1kCwMY17I8QSDYLT0pEVQZZFd+YCbH6gDjzyuoGg+WEQmbjvyDrMUCCoodcGtrVp2v7WNeEoDKe20/ov0wqefAMWQq1r5IzKQRqrIHoJmH9FJcJ0mZQijVui1xqMgtW4D1Ko3OjOudN41xXdwqhrTEMcPKmnAloohmmUyuwrGqF5sfdy2UZFRhEaXTs7mPYivMhrfpvlCWII0NDaC2ooNT0P7H8KUUY4emm2bDdg44GAePsLyHR6OAD+qjqHEr+soWPw6kp7/G3jfID2Ka3Cexw2JLK+0v4MGv6A8MEmiAXZQPQnQMUwFG+A5UDfTvP7u0faWJiJzq4pIk1+GFWFqY QTrLqJRc TS//1Bk2Ub0a3gcI4hT0RjH5Pj2tH7N3AQVH4PO99pmFxvs9W2467yU7gmz6AwyPTDOTubfaTxtl6erMv6tw2RsBUWxfAurZbq6vd/id7pjfJhdv4mX7uUE9qbffxItzj/UkYc1oW3FOKUBp1oFvHA34gtbIwQnrbOw+e7bCtymCR+rlq1Cwz9oAjDsK7DUZbupT5Wmeg4VDoXdcWXRLLta3pAgq323nb2De9gZncw34/v8osjBPBRO1YmzAKJ98ES0DuYCysOzefAG7mgmY/rdjnLSx/HEheiExAusETryNLW45/Fv65GWrSR/eLIDLAFoQr 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: List-Subscribe: List-Unsubscribe: Use the INVLPGB_FINAL_ONLY flag when invalidating mappings with INVPLGB. This way only leaf mappings get removed from the TLB, leaving intermediate translations cached. 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 862775897a54..2669ebfffe81 100644 --- a/arch/x86/include/asm/invlpgb.h +++ b/arch/x86/include/asm/invlpgb.h @@ -51,7 +51,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. */