From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v2] KVM: MMU: Don't use RCU for lockless shadow walking
Date: Sun, 29 Apr 2012 12:38:55 +0300 [thread overview]
Message-ID: <4F9D0C2F.9000209@redhat.com> (raw)
In-Reply-To: <20120427214946.GA5762@amt.cnet>
On 04/28/2012 12:49 AM, Marcelo Tosatti wrote:
> > >> + smp_mb();
> > >> + vcpu->mode = OUTSIDE_GUEST_MODE;
> > >
> > > Don't you want
> > >
> > > vcpu->mode = OUTSIDE_GUEST_MODE;
> > > smp_mb();
> > >
> >
> >
> > It is unsafe i think, it is a problem if spte read / spte update is ordered
> > to the behind of vcpu->mode = OUTSIDE_GUEST_MODE, like below:
> >
> > VCPU 0 VCPU 1
> > commit_zapped_page:
> > /*
> > * setting vcpu->mode is reordered
> > * to the head of read spte.
> > */
> > vcpu->mode = OUTSIDE_GUEST_MODE;
> >
> > see VCPU 0 is out-of-guest-mode, IPI is
> > not sent, and the sp is free immediately.
> >
> > read spte;
> > OOPS!!!
Ouch!
> >
> > (It is invalid since spte is freed.)
> >
> > smp_mb
>
> Right. In that case a compiler barrier is sufficient (stores are not
> reordered with earlier loads on x86).
I think it's customary not to depend on arch specific memory barrier
behaviour (but I don't have anything to base this on, just a feeling).
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-04-29 9:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 9:47 [PATCH v2] KVM: MMU: Don't use RCU for lockless shadow walking Avi Kivity
2012-04-24 10:13 ` Xiao Guangrong
2012-04-24 10:42 ` Avi Kivity
2012-04-26 22:00 ` Marcelo Tosatti
2012-04-27 6:07 ` Xiao Guangrong
2012-04-27 21:49 ` Marcelo Tosatti
2012-04-29 9:38 ` Avi Kivity [this message]
2012-04-29 9:35 ` Avi Kivity
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=4F9D0C2F.9000209@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=xiaoguangrong@linux.vnet.ibm.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