kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nadav Har'El" <nyh@math.technion.ac.il>
To: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] KVM: send IPI to vcpu only when it's in guest mode
Date: Wed, 12 Jan 2011 11:54:28 +0200	[thread overview]
Message-ID: <20110112095428.GA15835@fermat.math.technion.ac.il> (raw)
In-Reply-To: <4D2D5AEF.1070006@cn.fujitsu.com>

On Wed, Jan 12, 2011, Xiao Guangrong wrote about "[PATCH v3 2/3] KVM: send IPI to vcpu only when it's in guest mode":
> We can interrupt the vcpu only when it's running in guest mode
> to reduce IPI

Hi,

I am afraid there's a risk of confusion between the new

	vcpu->mode = IN_GUEST_MODE;

and the existing

	is_guest_mode()   (i.e., vcpu->arch.hflags & HF_GUEST_MASK)

The latter says that the virtual cpu is in guest mode (i.e., the guest used
VMLAUNCH and is runnning a nested guest), while the former says that the
physical CPU that this vcpu is currently being run on, is in guest mode - or
in other words, this vcpu is currently running.

I'm not sure what is the best way to resolve this potential for confusion.
Maybe on of them is better renamed (e.g., instead of vcpu->mode = IN_GUEST_MODE
have something like vcpu->running = NOW_RUNNING). Or maybe some good comments
need to to be written to explain the situation.

Actually, I just noticed that there's already a vcpu->guest_mode which you
are apparently replacing, so the potential for confusion is already in the
current code... I.e., in the current code, is_guest_mode(vcpu) does NOT check
vcpu->guest_mode...


-- 
Nadav Har'El                        |    Wednesday, Jan 12 2011, 7 Shevat 5771
nyh@math.technion.ac.il             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |Hi! I'm a signature virus! Copy me into
http://nadav.harel.org.il           |your signature to help me spread!

  reply	other threads:[~2011-01-12  9:54 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 [this message]
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

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=20110112095428.GA15835@fermat.math.technion.ac.il \
    --to=nyh@math.technion.ac.il \
    --cc=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).