From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 013.lax.mailroute.net (013.lax.mailroute.net [199.89.1.16]) (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 0843037998F; Mon, 23 Feb 2026 21:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771883501; cv=none; b=dJIRu1lX/PrJ76YXi8rMlJhiOU65l8Zqj275RuXGX5LZm8vebggpv8feZ0V7fBGQ+/RF2yy2rSESYB0a+YSGmK2uY0RxTSvuhdH7mpTDIFhfLsTDk3OquTGHtMp+lg7MlYLdlGEcMRTrWvCdvJxqeisKUPw2c5paOMCZHBlToo4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771883501; c=relaxed/simple; bh=QYCXc/vB9DxQdb00BuJBNc58h9ZeSHNFRJ42Bx4WGCI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mQNnNH3Tn7FrsZwC458lJsFSffAQhTxX/6//gx0UYv9bhXTJfHjK21sO8db7r7/0hpmC/W5llZEIV64eQFDXxM6g3IioyE/HdFvM0rN/FohgYU9Z3hDQFYNNdMoqx7nrEFltWF4IQJrpyYK1kbw9jAl+rSvPtYC3kyDwueA3u0M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=Op12PJ/c; arc=none smtp.client-ip=199.89.1.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="Op12PJ/c" Received: from localhost (localhost [127.0.0.1]) by 013.lax.mailroute.net (Postfix) with ESMTP id 4fKZLg5m91zlfddf; Mon, 23 Feb 2026 21:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1771883496; x=1774475497; bh=//njW 9JPPBtas9P8/yhoGtlWZGfoIZrsR3E99SonYGE=; b=Op12PJ/ckHIuaNT5xF7V+ paJphTNY4DXImgNT5ekQ8dSz/I6KzXYIlzUceskeO+GKX8UYAy6a9vqSaGLDOzux WGGDAO8UyJK+pKrMlY8LIdcpjaBS3+emK8H0NV80ka7vpcYzIDweGMkW8rDwGRjd hwMV5sjOrrktfCKHGPBvz4HVpbsFJZPAnv1BrWmyOHKJk0jzdB4rIrsswSew+06T zUuvTAToprMtfsWH4lcH32+iGPDG37FjOwoe1mssTkFTWFQQ7dXKXwCeiksJ+kUW SJqh1c4KNcL04/XlOWHb8X9X3iYwbbDjgRdNfCDcRiUPTjGkYheKFOug5fQVVCn7 A== X-Virus-Scanned: by MailRoute Received: from 013.lax.mailroute.net ([127.0.0.1]) by localhost (013.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id 6v5hPw-TNd1z; Mon, 23 Feb 2026 21:51:36 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.180.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 013.lax.mailroute.net (Postfix) with ESMTPSA id 4fKZLX4nHnzlfgQH; Mon, 23 Feb 2026 21:51:32 +0000 (UTC) From: Bart Van Assche To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org, Marco Elver , Christoph Hellwig , Steven Rostedt , Nick Desaulniers , Nathan Chancellor , Kees Cook , Jann Horn , Bart Van Assche , Sean Christopherson , Paolo Bonzini , kvm@vger.kernel.org Subject: [PATCH 01/62] kvm: Make pi_enable_wakeup_handler() easier to analyze Date: Mon, 23 Feb 2026 13:50:16 -0800 Message-ID: <20260223215118.2154194-2-bvanassche@acm.org> X-Mailer: git-send-email 2.53.0.371.g1d285c8824-goog In-Reply-To: <20260223215118.2154194-1-bvanassche@acm.org> References: <20260223215118.2154194-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The Clang thread-safety analyzer does not support comparing expressions that use per_cpu(). Hence introduce a new local variable to capture the address of a per-cpu spinlock. This patch prepares for enabling the Clang thread-safety analyzer. Cc: Sean Christopherson Cc: Paolo Bonzini Cc: kvm@vger.kernel.org Signed-off-by: Bart Van Assche --- arch/x86/kvm/vmx/posted_intr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_int= r.c index 4a6d9a17da23..f8711b7b85a8 100644 --- a/arch/x86/kvm/vmx/posted_intr.c +++ b/arch/x86/kvm/vmx/posted_intr.c @@ -164,6 +164,7 @@ static void pi_enable_wakeup_handler(struct kvm_vcpu = *vcpu) struct pi_desc *pi_desc =3D vcpu_to_pi_desc(vcpu); struct vcpu_vt *vt =3D to_vt(vcpu); struct pi_desc old, new; + raw_spinlock_t *wakeup_lock; =20 lockdep_assert_irqs_disabled(); =20 @@ -179,11 +180,11 @@ static void pi_enable_wakeup_handler(struct kvm_vcp= u *vcpu) * entirety of the sched_out critical section, i.e. the wakeup handler * can't run while the scheduler locks are held. */ - raw_spin_lock_nested(&per_cpu(wakeup_vcpus_on_cpu_lock, vcpu->cpu), - PI_LOCK_SCHED_OUT); + wakeup_lock =3D &per_cpu(wakeup_vcpus_on_cpu_lock, vcpu->cpu); + raw_spin_lock_nested(wakeup_lock, PI_LOCK_SCHED_OUT); list_add_tail(&vt->pi_wakeup_list, &per_cpu(wakeup_vcpus_on_cpu, vcpu->cpu)); - raw_spin_unlock(&per_cpu(wakeup_vcpus_on_cpu_lock, vcpu->cpu)); + raw_spin_unlock(wakeup_lock); =20 WARN(pi_test_sn(pi_desc), "PI descriptor SN field set before blocking")= ; =20