Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796099830; b=Zy7+oqGf57hTAfDL2TaMuwkUm84xYp39MvJ1OvI9DHAuEJp+o7P7ks/MM76qVyyRF2ho skXPeVFaEx7JJcs9oEydkPUQ1zKYTM8P5KpQRA9R0dQWCKMkPwhcOUxexaNAMZygEWJJV BinI71zcbT78E3LWwLxd2zv/sViMPwJ5gMGem32cRd5LojPmbBDPUm3TQHxTrbKvI44uL fxXG5MnFIj8KZs4jY244fWZfvRv0W4Y5oY62JvvT9G/uV6LqCShS5fKLPK4CvgiUW/jND IwHPG4Ue4hfxDACEuvyD50MoNItwdcYr1Bwiumii2FLfH7bs4XZ5LrwLxySL0bXDV8A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796099830; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=m6Dor6kTaBylA7igv5C5QaEdtMCfItEfzvUigAxAW1Y=; b=NjPJhvWdshPm52CSJzr/N8pm6LFrmr0QqiDPOTrT7+08rJNMjr3t+G/pfJNl+1Shzsry lZ2MWk2D0oDDPRjvWl9syK5u1irng9f4JMTZjIyDaPXnz07XOk+SexCCsyle/WMboxdz3 76jnBIyFeGCh+nnV8fRbI2xnJ1tCQJSuxh2gcKL1FERQMgfmvVqWjWS5x5XvBIx9bRNpt /5WrDh0qhc9wBwg7CcntE1ZVv2TaSWzP1dmd8xu0/Syvn33+oMz71IfXQO/uIZwYTAflM bkIeFdQby1/7ou2BHa75FXmqdvhGr5mRvRCMASSeD2iQZhruq9lzaC4v8lVaKnzDugQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=QRjAosP4; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7624606A329; Tue, 1 Dec 2026 04:37:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C7624606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=QRjAosP4 Received: from CPC-namja-026ON.localdomain (unknown [4.213.232.23]) by linux.microsoft.com (Postfix) with ESMTPSA id 9A85F20B716A; Mon, 30 Nov 2026 20:36:56 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9A85F20B716A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1796099821; bh=m6Dor6kTaBylA7igv5C5QaEdtMCfItEfzvUigAxAW1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QRjAosP4O6I+Uza4IW1+vIKFmpx0yASKXGoSR2zNTI6Ko1nu4vzt5dPKrtuCrF0N5 d03PINk9YDPAFY9DevnSwuJWC+i8v33AWDg65Byy3cnDKdGSn4P0i3hskFwRBB9Q7U eA+0zIhvqM5/sBgX4z+8p5zm9MzMSNjVZMeNTvAg= From: Naman Jain To: haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, luto@kernel.org, peterz@infradead.org Cc: dave.hansen@intel.com, hpa@zytor.com, riel@surriel.com, mhklinux@outlook.com, schandna@linux.microsoft.com, namjain@linux.microsoft.com, qq570070308@gmail.com, houwenlong.hwl@antgroup.com, zhouchuyi@bytedance.com, jgross@suse.com, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] x86/hyperv: Use native flushes for mask trimming and ASID transitions Date: Tue, 1 Dec 2026 04:36:40 +0000 Message-ID: <20261201043642.1054258-4-namjain@linux.microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261201043642.1054258-1-namjain@linux.microsoft.com> References: <20261201043642.1054258-1-namjain@linux.microsoft.com> X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When trimming mm_cpumask(), Linux needs to run flush_tlb_func() on remote CPUs so they can clear their stale bits. A Hyper-V TLB flush hypercall invalidates translations but does not run this function. The same applies during a global ASID transition. CPUs still using local ASIDs need to run flush_tlb_func() to switch to the global ASID. Call native_flush_tlb_multi() in both cases so the required work runs on the target CPUs. Signed-off-by: Naman Jain --- arch/x86/hyperv/mmu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c index 1ea57d642faa4..375f23b157ab3 100644 --- a/arch/x86/hyperv/mmu.c +++ b/arch/x86/hyperv/mmu.c @@ -70,6 +70,14 @@ static void hyperv_flush_tlb_multi(const struct cpumask *cpus, if (!hv_hypercall_pg) goto do_native; + /* + * Trimming needs callbacks on stale members. Global ASID transitions + * need callbacks to switch CPUs still using local ASIDs. A Hyper-V + * flush hypercall does neither. + */ + if (info->trim_cpumask || mm_in_asid_transition(info->mm)) + goto do_native; + local_irq_save(flags); flush = *this_cpu_ptr(hyperv_pcpu_input_arg); -- 2.43.0