All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>,
	avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [RFC PATCH] KVM: x86: Skip request checking branches in vcpu_enter_guest() more effectively
Date: Fri, 5 Oct 2012 01:11:52 +0900	[thread overview]
Message-ID: <20121005011152.0ef3b66c729bbcedf952f0f5@gmail.com> (raw)
In-Reply-To: <20120924071612.GE20907@redhat.com>

On Mon, 24 Sep 2012 09:16:12 +0200
Gleb Natapov <gleb@redhat.com> wrote:

> Yes, for guests that do not enable steal time KVM_REQ_STEAL_UPDATE
> should be never set, but currently it is. The patch (not tested) should
> fix this.

Thinking a bit more about KVM_REQ_STEAL_UPDATE...

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 901ad00..01572f5 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1544,6 +1544,8 @@ static void accumulate_steal_time(struct kvm_vcpu *vcpu)
>  	delta = current->sched_info.run_delay - vcpu->arch.st.last_steal;
>  	vcpu->arch.st.last_steal = current->sched_info.run_delay;
>  	vcpu->arch.st.accum_steal = delta;
> +
> +	kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
>  }

Even without this flag, we know when we should record the steal time:
that's when vcpu->arch.st.accum_steal != 0.

>  
>  static void record_steal_time(struct kvm_vcpu *vcpu)

So we can live without KVM_REQ_STEAL_UPDATE and make record_steal_time()
do the job when vcpu->arch.st.accum_steal != 0 so that it can be called
unconditionally in vcpu_enter_guest().

Why didn't we do that?  The only reason I can think of is we wanted to
eliminate that check for the zero-requests case.

But does such a micro-optimization really help us?

Thanks,
	Takuya

  parent reply	other threads:[~2012-10-04 16:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24  6:24 [RFC PATCH] KVM: x86: Skip request checking branches in vcpu_enter_guest() more effectively Takuya Yoshikawa
2012-09-24  6:59 ` Xiao Guangrong
2012-09-24 10:09   ` Avi Kivity
2012-09-24 14:32     ` Takuya Yoshikawa
2012-09-24 14:53       ` Avi Kivity
2012-09-24 13:55   ` Takuya Yoshikawa
2012-09-24  7:16 ` Gleb Natapov
2012-09-24 10:10   ` Avi Kivity
2012-09-24 13:58   ` Takuya Yoshikawa
2012-10-04 16:11   ` Takuya Yoshikawa [this message]
2012-09-24 10:18 ` Avi Kivity
2012-09-24 14:14   ` Takuya Yoshikawa
2012-09-24 14:50     ` Avi Kivity
2012-09-26  2:06       ` Takuya Yoshikawa
2012-09-27  9:28         ` 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=20121005011152.0ef3b66c729bbcedf952f0f5@gmail.com \
    --to=takuya.yoshikawa@gmail.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=yoshikawa_takuya_b1@lab.ntt.co.jp \
    /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.