From nobody Fri Jul 24 21:53:35 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 611E4352C28; Thu, 23 Jul 2026 10:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784802747; cv=none; b=LdwAkW1g6+eRHkvIZ7XkvCV0EqqNI7aI8YD/3v4J0AE0rGtfex8RToz1foDPUW+zUBcLOd9jhAxACtah96kIgIL86IBiuaop9U70gWYTLmIntlzvciT1nvhdw55kGkC72LnwFE4e0xrcDepMtf4Cvcz6QPQsIrjtkySPy89dYOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784802747; c=relaxed/simple; bh=l5v6k9qoFa5PHHr4EW+IZsuRd6vrjKbSgcDAFm/8a2A=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=SHSgIsK9LbSrma37UI3YL8hzWsq2jgk9t8TxtKdX+XbI/Rjq+9y47x/8BBpjbRXc5+psmsIed9McDwQwMVZqaptgNUm6m3HTidnIfh4YuEzo1QL5EgFQQvPVczbZytar8INP7vTCct0K1nYbIfXc2tD1jVDWSVghngOB2mMotZw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Oo9RR7ug; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=We1KFMh4; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Oo9RR7ug"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="We1KFMh4" Date: Thu, 23 Jul 2026 10:32:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1784802744; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jy/Wfte+i9lmDUgUOEqRkbPeQHaU8X/yWuVznF6Xn6A=; b=Oo9RR7ugUHn8kXlU4OqAUAmzqcSQMVx3dn+GRI71yq1lP5SEOeAIlAwIm3rjOuVPmoC6h1 T43sA6rlKdOnL1bdr6g0pUeeDBQC722/4LcJg9FJFa4M/N4p/B5XczmhuQbXKGYdZjE7JI Ot/BHhvyjiCs0wsKwSyL9tEFmMLxB1c8OL7jqykNcUVnD7AtZB5FV2VFEZ/1dJdaTDDIkM uxbNzoBDESkIeuIjqaO/qyXif/RNVpZ0oP6lBAkFyZ19QGLTBStIUe2PaPWLyGMhoHquAc zNR9L3CPETtI7uryDoqZUCcyUuywHaggdWoR0DvR9wkqd3rAkhKeqI/ZekvFfQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1784802744; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jy/Wfte+i9lmDUgUOEqRkbPeQHaU8X/yWuVznF6Xn6A=; b=We1KFMh4FFlQnG/0Sxrb0VSCp5ucTTVvGf2r5D69NE3CAupxBduvGndyGeSA7SFt+O3pgK iAa4bF4VUEvX0ACA== From: "tip-bot2 for Chuyi Zhou" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/kvm: Disable preemption in kvm_flush_tlb_multi() Cc: Chuyi Zhou , Thomas Gleixner , Sebastian Andrzej Siewior , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260709122933.4021501-14-zhouchuyi@bytedance.com> References: <20260709122933.4021501-14-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178480274307.2943223.10495624882605395264.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/mm branch of tip: Commit-ID: ae397bb32d2a4cb97d93539a5e50d1d081a7569a Gitweb: https://git.kernel.org/tip/ae397bb32d2a4cb97d93539a5e50d1d08= 1a7569a Author: Chuyi Zhou AuthorDate: Thu, 09 Jul 2026 20:29:32 +08:00 Committer: Thomas Gleixner CommitterDate: Thu, 23 Jul 2026 12:30:31 +02:00 x86/kvm: Disable preemption in kvm_flush_tlb_multi() kvm_flush_tlb_multi() is installed as an x86 PV TLB flush backend, so flush_tlb_multi() can reach it through pv_ops when running as a KVM guest. kvm_flush_tlb_multi() uses the per-CPU scratch cpumask __pv_cpu_mask. That buffer must remain tied to the current CPU until the mask has been copied, filtered, and consumed by native_flush_tlb_multi(). The x86/mm callers currently enter flush_tlb_multi() while pinned to a CPU. To let those callers drop CPU pinning before issuing the remote TLB flush, each PV backend must protect its own CPU-local scratch state. Make the KVM backend protect its per-CPU scratch cpumask by disabling preemption locally. This is harmless with the current callers, where the preemption disable is nested, and makes the KVM pv_ops dependency explicit before changing the x86/mm call sites. Signed-off-by: Chuyi Zhou Signed-off-by: Thomas Gleixner Reviewed-by: Sebastian Andrzej Siewior Link: https://patch.msgid.link/20260709122933.4021501-14-zhouchuyi@bytedanc= e.com --- arch/x86/kernel/kvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index dcef84d..5b554e4 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -663,8 +663,10 @@ static void kvm_flush_tlb_multi(const struct cpumask *= cpumask, u8 state; int cpu; struct kvm_steal_time *src; - struct cpumask *flushmask =3D this_cpu_cpumask_var_ptr(__pv_cpu_mask); + struct cpumask *flushmask; =20 + guard(preempt)(); + flushmask =3D this_cpu_cpumask_var_ptr(__pv_cpu_mask); cpumask_copy(flushmask, cpumask); /* * We have to call flush only on online vCPUs. And