linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	rkrcmar@redhat.com, dplotnikov@virtuozzo.com
Subject: Re: [PATCH 1/6] KVM: x86: add VCPU stat for KVM_REQ_EVENT processing
Date: Tue, 20 Dec 2016 10:32:13 +0100	[thread overview]
Message-ID: <2bff3865-f731-c504-08be-5473db61b0c6@redhat.com> (raw)
In-Reply-To: <20161220092101.GE2081@rkaganb.sw.ru>



On 20/12/2016 10:21, Roman Kagan wrote:
> On Mon, Dec 19, 2016 at 10:47:13AM +0100, Paolo Bonzini wrote:
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  arch/x86/include/asm/kvm_host.h | 1 +
>>  arch/x86/kvm/x86.c              | 2 ++
>>  2 files changed, 3 insertions(+)
>>
>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>> index 994d8ed9fc6c..08cfd45a9452 100644
>> --- a/arch/x86/include/asm/kvm_host.h
>> +++ b/arch/x86/include/asm/kvm_host.h
>> @@ -850,6 +850,7 @@ struct kvm_vcpu_stat {
>>  	u64 hypercalls;
>>  	u64 irq_injections;
>>  	u64 nmi_injections;
>> +	u64 req_event;
>>  };
>>  
>>  struct x86_instruction_info;
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index e95d94edbdc3..e9b512090865 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -180,6 +180,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
>>  	{ "insn_emulation_fail", VCPU_STAT(insn_emulation_fail) },
>>  	{ "irq_injections", VCPU_STAT(irq_injections) },
>>  	{ "nmi_injections", VCPU_STAT(nmi_injections) },
>> +	{ "req_event", VCPU_STAT(req_event) },
>>  	{ "mmu_shadow_zapped", VM_STAT(mmu_shadow_zapped) },
>>  	{ "mmu_pte_write", VM_STAT(mmu_pte_write) },
>>  	{ "mmu_pte_updated", VM_STAT(mmu_pte_updated) },
>> @@ -6691,6 +6692,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
>>  	}
>>  
>>  	if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
>> +		++vcpu->stat.req_event;
>>  		kvm_apic_accept_events(vcpu);
>>  		if (vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) {
>>  			r = 1;
> 
> Just curious what kind of information you expect to be able to extract
> from this counter?  I mean, I'm not opposed to introducing it, I just
> want to figure out how to use it properly.  Compare against
> irq_injections?

Yes, exactly.  Since vmexit cycle counts are always a bit noisy, I could
compare irq_injections against req_event and get an idea of the expected
improvement.

Also for example the stat shows that the sti_hlt case has a higher # of
req_event than sti_nop.  I have a patch to fix that, but it's left for
later because I don't know of a workload that triggers it.

I don't really need this patch of course.

> Also I guess it may be interesting to count branching to
> cancel_injection label in vcpu_enter_guest.

Interesting one too.

Paolo

  parent reply	other threads:[~2016-12-20  9:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19  9:47 [RFC PATCH v3 0/6] KVM: x86: avoid redundant REQ_EVENT Paolo Bonzini
2016-12-19  9:47 ` [PATCH 1/6] KVM: x86: add VCPU stat for KVM_REQ_EVENT processing Paolo Bonzini
     [not found]   ` <20161220092101.GE2081@rkaganb.sw.ru>
2016-12-20  9:32     ` Paolo Bonzini [this message]
2016-12-19  9:47 ` [PATCH 2/6] KVM: lapic: do not set KVM_REQ_EVENT unnecessarily on EOI Paolo Bonzini
2016-12-23 12:08   ` Paolo Bonzini
2016-12-19  9:47 ` [PATCH 3/6] KVM: vmx: speed up TPR below threshold vmexits Paolo Bonzini
2016-12-19  9:47 ` [PATCH 4/6] KVM: lapic: avoid unnecessary KVM_REQ_EVENT on IRR scan Paolo Bonzini
2016-12-19  9:47 ` [PATCH 5/6] KVM: lapic: do not set KVM_REQ_EVENT unnecessarily on PPR update Paolo Bonzini
2016-12-19  9:47 ` [PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt Paolo Bonzini
2016-12-20 17:11   ` Paolo Bonzini
2016-12-19 13:05 ` [RFC PATCH v3 0/6] KVM: x86: avoid redundant REQ_EVENT Denis Plotnikov
2016-12-19 14:30   ` Paolo Bonzini
2016-12-20 10:01     ` Roman Kagan

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=2bff3865-f731-c504-08be-5473db61b0c6@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dplotnikov@virtuozzo.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkagan@virtuozzo.com \
    --cc=rkrcmar@redhat.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).