From mboxrd@z Thu Jan 1 00:00:00 1970 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 D3F25C3ABB6 for ; Tue, 6 May 2025 00:38:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF2D26B000A; Mon, 5 May 2025 20:38:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA0E76B0082; Mon, 5 May 2025 20:38:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C424D6B0083; Mon, 5 May 2025 20:38:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A150C6B000A for ; Mon, 5 May 2025 20:38:26 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6C190C0D76 for ; Tue, 6 May 2025 00:38:27 +0000 (UTC) X-FDA: 83410621854.06.2279C10 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf09.hostedemail.com (Postfix) with ESMTP id BA93B140002 for ; Tue, 6 May 2025 00:38:25 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.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=1746491906; a=rsa-sha256; cv=none; b=mTGdqGUqLYu+C6hMw/yhGI6n4O/I9Xm2BgqwWhlFhHmTuGKnd0SyyiG+/0uV6L1NI/ipKm HY0d44hipZOdRyORRcQwiu1JFTSuS6lZpYCtNJFxb56XZ7gVIS4wooLqUs72HyW8vY3hGq L5/buUH47lKQv64DLB/ddWHK9uD9Ypk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.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=1746491906; 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:references; bh=C7Z7DFlInWaubwJR0m/KktOXxPWm7nUG7sOvQV6+fO4=; b=is4/Fb5ofg3yHogZPEuzm+muJam5N9o8ePxj9X50Ae0hamZoUP7nn30KwM99jwNIjCnK+/ SYc0LBu4+Kz42DaZJvqEKNokN+C1/CMVfV3q1GKHj2xfWbpMUrK6H+zjTzlsXuSHEOrZLC v5PIQEoeUYJxYbEqgj1ejNxPeEUAgd8= 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 1uC6K6-000000000IF-32G6; Mon, 05 May 2025 20:38:14 -0400 From: Rik van Riel To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, x86@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 Subject: [RFC PATCH 0/9] Intel RAR TLB invalidation Date: Mon, 5 May 2025 20:37:38 -0400 Message-ID: <20250506003811.92405-1-riel@surriel.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: BA93B140002 X-Stat-Signature: 6m3tshtng4sus73nktgmaew4gfstt9pw X-Rspam-User: X-HE-Tag: 1746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k5SpQ93BFUNxeBeGNdlUAp7XyRctWof/pTSNzLk/zUUYBhmPbNhnfzpYyBxDmU5SjA38TPuUXc+BYTkyQHrfGGLpA7+x0CO8mlyGsAi52fO3lkkJ0G/lm2argn3v2gP00RA1t7BuLtEbyds89SI2pTeV2opJ3+/Q2kDFht3mL94OGSH7CeU6lhN4juffRnXUJ8eha80l5BqN2HYuW2zPZg== 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: This patch series adds support for IPI-less TLB invalidation using Intel RAR technology. Intel RAR differs from AMD INVLPGB in a few ways: - RAR goes through (emulated?) APIC writes, not instructions - RAR flushes go through a memory table with 64 entries - RAR flushes can be targeted to a cpumask - The RAR functionality must be set up at boot time before it can be used The cpumask targeting has resulted in Intel RAR and AMD INVLPGB having slightly different rules: - Processes with dynamic ASIDs use IPI based shootdowns - INVLPGB: processes with a global ASID - always have the TLB up to date, on every CPU - never need to flush the TLB at context switch time - RAR: processes with global ASIDs - have the TLB up to date on CPUs in the mm_cpumask - can skip a TLB flush at context switch time if the CPU is in the mm_cpumask - need to flush the TLB when scheduled on a cpu not in the mm_cpumask, in case it used to run there before and the TLB has stale entries RAR functionality is present on Sapphire Rapids and newer CPUs. Information about Intel RAR can be found in this whitepaper. https://www.intel.com/content/dam/develop/external/us/en/documents/341431-remote-action-request-white-paper.pdf This patch series is based off a 2019 patch series created by Intel, with patches later in the series modified to fit into the TLB flush code structure we have after AMD INVLPGB functionality was integrated. This first version of the code still has issues with segfaults and kernel oopses. Clearly something is still wrong with how or when flushes are done, but the code could use more eyeballs. I have some idas for additional code cleanups as well, but would like to get the last bugs sorted out first...