From mboxrd@z Thu Jan 1 00:00:00 1970 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 80952348477 for ; Tue, 16 Jun 2026 13:46:27 +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=1781617588; cv=none; b=aKPDrhxYwSGRGs3I2UDudLm07Bh90a4OK6+WWQejuxjRaMrE0UR6i17IlXv7L3oJ+385futWY6OMX5Or/iulr45PKdS3Lgpf6edyLOB+bfuCXcEeFntlU/+oWGd2LFWTgyyySVcvZse5DbLtQN75qWkrhWRM4M2lc6ff7RoKMao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781617588; c=relaxed/simple; bh=zpqCbuZUSV9U4kvdFR4aG3Quv+Wg0PvI12C9Bcubcjw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UPJEV5kFQGzGoAR6HfI4DHGdfgOc5+Z1CxXrkQU5atAt3EjlygYGh+oc91sGjuoy9SS3Cx3gJFSsPBaD8d7ZVgigokLBuksg1bKKERY1mLIofuEoY0kIfdGA8SITpCSKMRSKItvImrFI3u7vhxqTyTjdwqRkFrQQ17d5IOqhKZ4= 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=NrkZvUnR; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=B6cnYyhk; 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="NrkZvUnR"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="B6cnYyhk" Date: Tue, 16 Jun 2026 15:46:24 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1781617585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p8zRGpl5FfY+Gl7WOa3iMZiIVmhE69TSDB/6RJ5EbHI=; b=NrkZvUnRRuXITSM5r/VUnKt8lFaleD2K5RESDpsLmfAszGZWQwIF31M9D9yfe32Axv0DBu +loUEAyxtxnTmqPNDwynV8VWTUS6oUNM9hnmy0qIQZlV+bcWiPW2Lh1S9a24OFJxLqRNEZ DzHCVP2ZNeiDaGHW4HHy48uCt70o0KKD73birL9bC3OYs+KZFFLfmIXOVQy8VVPlYjXqvu q8/kOSrPGTD55c9HIDgRMLBjz0/IlTbM/ZJhpUK65HXdfohdg9HRSMEQrO1PY3x5sRNOKA qbwuWu4IYEHgAX5TCNeThrlQrXe6vYV4FiWDMlCOrxgnNXU8bafz8ANWntxwPA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1781617585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p8zRGpl5FfY+Gl7WOa3iMZiIVmhE69TSDB/6RJ5EbHI=; b=B6cnYyhkE7p/VnID2CwS2mdxVEFCHQqhcGjc4CCDmK2zRJscBYGWfDgh0Miz0nmbm1anFt 5TC4RoF553tc+GCg== From: Sebastian Andrzej Siewior To: Chuyi Zhou Cc: tglx@kernel.org, mingo@redhat.com, luto@kernel.org, peterz@infradead.org, paulmck@kernel.org, muchun.song@linux.dev, bp@alien8.de, dave.hansen@linux.intel.com, pbonzini@redhat.com, clrkwllms@kernel.org, rostedt@goodmis.org, nadav.amit@gmail.com, vkuznets@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 13/14] x86/kvm: Disable preemption in kvm_flush_tlb_multi() Message-ID: <20260616134624.vq44xb8q@linutronix.de> References: <20260616111127.966468-1-zhouchuyi@bytedance.com> <20260616111127.966468-14-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260616111127.966468-14-zhouchuyi@bytedance.com> On 2026-06-16 19:11:26 [+0800], Chuyi Zhou wrote: > 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(). Today the > x86/mm callers enter flush_tlb_multi() while pinned to a CPU, but a > subsequent x86/mm change will drop that caller-side CPU pinning before > issuing the remote TLB flush so the caller can be preempted while waiting > for remote CPUs. > > Make the KVM backend protect its own 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 Reviewed-by: Sebastian Andrzej Siewior Sebastian