From: Paolo Bonzini <pbonzini@redhat.com>
To: Wincy Van <fanwenyi0529@gmail.com>
Cc: gleb@kernel.org, yang.z.zhang@intel.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Wanpeng Li <wanpeng.li@linux.intel.com>,
Jan Kiszka <jan.kiszka@web.de>
Subject: Re: [PATCH 5/5] KVM: nVMX: Enable nested posted interrupt processing.
Date: Tue, 20 Jan 2015 08:34:15 +0100 [thread overview]
Message-ID: <54BE04F7.7030402@redhat.com> (raw)
In-Reply-To: <CACzj_yVTWDB6_JMsV_itHoOudBio1YgkBosBYz70O6JeQ6w_Ug@mail.gmail.com>
On 19/01/2015 13:34, Wincy Van wrote:
>
> Actually, there is a race window between
> vmx_deliver_nested_posted_interrupt and nested_release_vmcs12
> since posted intr delivery is async:
>
> cpu 1
> cpu 2
> (nested posted intr) (dest vcpu,
> release vmcs12)
> vmcs12 = get_vmcs12(vcpu);
> if (!is_guest_mode(vcpu) || !vmcs12) {
> r = -1;
> goto out;
> }
>
>
> kunmap(vmx->nested.current_vmcs12_page);
>
> ......
>
>
> oops! current vmcs12 is invalid.
>
> However, we have already checked that the destination vcpu
> is_in_guest_mode, and if L1
> want to destroy vmcs12(in handle_vmptrld/clear, etc..), the dest vcpu
> must have done a nested
> vmexit and a non-nested vmexit(handle_vmptr***).
>
> Hence, we can disable local interrupts while delivering nested posted
> interrupts to make sure
> we are faster than the destination vcpu. This is a bit tricky but it
> an avoid that race. I think we
> do not need to add a spin lock here. RCU does not fit this case, since
> it will introduce a
> new race window between the rcu handler and handle_vmptr**.
>
> I am wondering that whether there is a better way : )
Why not just use a spinlock?
Paolo
next prev parent reply other threads:[~2015-01-20 7:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 5:59 [PATCH 5/5] KVM: nVMX: Enable nested posted interrupt processing Wincy Van
2015-01-19 11:43 ` Paolo Bonzini
2015-01-19 12:34 ` Wincy Van
2015-01-20 7:34 ` Paolo Bonzini [this message]
2015-01-20 7:54 ` Wincy Van
2015-01-20 8:04 ` Paolo Bonzini
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=54BE04F7.7030402@redhat.com \
--to=pbonzini@redhat.com \
--cc=fanwenyi0529@gmail.com \
--cc=gleb@kernel.org \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wanpeng.li@linux.intel.com \
--cc=yang.z.zhang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox