From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] KVM: fix rcu usage warning in kvm_arch_vcpu_ioctl_set_sregs()
Date: Thu, 27 Jan 2011 15:15:50 +0200 [thread overview]
Message-ID: <4D417006.4030201@redhat.com> (raw)
In-Reply-To: <20110120152736.GA3922@amt.cnet>
On 01/20/2011 05:27 PM, Marcelo Tosatti wrote:
> > Before patch:
> >
> > real 5m6.493s
> > user 3m57.847s
> > sys 9m7.115s
> >
> > real 5m1.750s
> > user 4m0.109s
> > sys 9m10.192s
> >
> >
> > After patch:
> > real 5m0.140s
> > user 3m57.956s
> > sys 8m58.339s
> >
> > real 4m56.314s
> > user 4m0.303s
> > sys 8m55.774s
>
> Nice. One disadvantageous side effect for the kvm_vcpu_kick path
> is that it can race with make_all_cpus_request, which is possibly
> doing unrelated, slower work (IPI'ing other vcpus, waiting for
> response).
I think we're fine here. The kvm_vcpu_kick() check is
me = get_cpu();
if (cpu != me&& (unsigned)cpu< nr_cpu_ids&& cpu_online(cpu))
- if (atomic_xchg(&vcpu->guest_mode, 0))
+ if (kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE)
smp_send_reschedule(cpu);
put_cpu();
even if it did race, ->mode becomes EXITING_GUEST_MODE and we still
avoid the IPI. Note that make_all_cpus_request() cleverly checks for !=
OUTSIDE_GUEST_MODE, so if it loses the race with kvm_vcpu_kick(), it
still sends the IPI to be sure the vcpu loop sees vcpu->requests in time.
> Looks ok, but lets wait for more careful reviews before applying.
Patches applied.
--
error compiling committee.c: too many arguments to function
prev parent reply other threads:[~2011-01-27 13:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 7:39 [PATCH v3 1/3] KVM: fix rcu usage warning in kvm_arch_vcpu_ioctl_set_sregs() Xiao Guangrong
2011-01-12 7:40 ` [PATCH v3 2/3] KVM: send IPI to vcpu only when it's in guest mode Xiao Guangrong
2011-01-12 9:54 ` Nadav Har'El
2011-01-12 9:59 ` Avi Kivity
2011-01-12 7:41 ` [PATCH v3 3/3] KVM: make make_all_cpus_request() lockless Xiao Guangrong
2011-01-19 5:16 ` [PATCH v3 1/3] KVM: fix rcu usage warning in kvm_arch_vcpu_ioctl_set_sregs() Xiao Guangrong
2011-01-19 18:13 ` Marcelo Tosatti
2011-01-20 3:03 ` Xiao Guangrong
2011-01-20 15:27 ` Marcelo Tosatti
2011-01-27 2:35 ` Xiao Guangrong
2011-01-27 13:15 ` Avi Kivity [this message]
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=4D417006.4030201@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=xiaoguangrong@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).