From: Sean Christopherson <seanjc@google.com>
To: Kai Huang <kai.huang@intel.com>
Cc: "nicoyip.dev@gmail.com" <nicoyip.dev@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
Yan Y Zhao <yan.y.zhao@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"tglx@kernel.org" <tglx@kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: x86/mmu: Protect noncoherent DMA zaps with SRCU
Date: Mon, 24 Aug 2026 14:49:23 -0700 [thread overview]
Message-ID: <aoy8Y19RV_Dgm7Te@google.com> (raw)
In-Reply-To: <303eb59af516335e288647c19254928f89fa833a.camel@intel.com>
On Mon, Aug 24, 2026, Kai Huang wrote:
> On Mon, 2026-08-24 at 10:49 -0700, Sean Christopherson wrote:
> > Alternatively, what if we have kvm_zap_gfn_range() acquire SRCU? Nesting "locks"
> > is a-ok, and two of the three users of kvm_zap_gfn_range() have had this bug (see
> > commit 074c00800719 ("KVM: x86: Use SRCU to protect zap in
> > __kvm_set_or_clear_apicv_inhibit()").
>
> kvm_vcpu_srcu_read_lock() doesn't allow nesting lock of KVM's SRCU.
No, kvm_vcpu_srcu_read_lock() doesn't allow nested usage of itself. Commit
2031f2876896 ("KVM: Add helpers to wrap vcpu->srcu_idx and yell if it's abused")
added the protection because we had multiple bugs where KVM would clobber
vcpu->srcu_idx and cause a deadlock by leaking a grace period reference.
> Doesn't seem to be a problem for this particular case, though, because
> sev_handle_rmp_fault() calls kvm_zap_gfn_range() after
> kvm_vcpu_srcu_read_lock() is called.
kvm_vcpu_srcu_read_lock() can nested inside an existing kvm->srcu critical section,
just so long as the existing critical section isn't tracking its grace period via
vcpu->____srcu_idx.
next prev parent reply other threads:[~2026-08-24 21:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 19:02 [PATCH] KVM: x86/mmu: Protect noncoherent DMA zaps with SRCU Chengfeng Ye
2026-08-24 9:50 ` Huang, Kai
2026-08-24 17:49 ` Sean Christopherson
2026-08-24 21:36 ` Huang, Kai
2026-08-24 21:49 ` Sean Christopherson [this message]
2026-08-24 22:15 ` Huang, Kai
2026-08-25 18:40 ` Chengfeng Ye
2026-08-25 18:39 ` [PATCH v2] KVM: x86: Take SRCU in kvm_zap_gfn_range() Chengfeng Ye
2026-08-26 0:13 ` Huang, Kai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aoy8Y19RV_Dgm7Te@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nicoyip.dev@gmail.com \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
--cc=yan.y.zhao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.