All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
	Liang Chen <liangchen.linux@gmail.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86: count actual tlb flushes
Date: Thu, 18 Sep 2014 16:08:59 +0200	[thread overview]
Message-ID: <20140918140859.GA16780@potion.brq.redhat.com> (raw)
In-Reply-To: <541AD47B.2010102@redhat.com>

2014-09-18 14:47+0200, Paolo Bonzini:
> Il 18/09/2014 07:05, Xiao Guangrong ha scritto:
> > On 09/18/2014 02:35 AM, Liang Chen wrote:
> >> - we count KVM_REQ_TLB_FLUSH requests, not actual flushes
> >> (KVM can have multiple requests for one flush)
> >> - flushes from kvm_flush_remote_tlbs aren't counted
> >> - it's easy to make a direct request by mistake
> >>
> >> Solve these by postponing the counting to kvm_check_request(),
> > 
> > It's good.
> > 
> >> and refactor the code to use kvm_make_request again.
> > 
> > Why this refactor is needed? It's really a bad idea using
> > raw-bit-set instead of meaningful name.
> 
> set_bit is worse than kvm_make_request, but adding a one-line wrapper
> around kvm_make_request is not particularly useful.
> 
> We have the following requests:
> 
> - used multiple times:
>         kvm_make_request(KVM_REQ_APF_HALT, vcpu);
>         kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
>         kvm_make_request(KVM_REQ_EVENT, vcpu);
>         kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
>         kvm_make_request(KVM_REQ_PMU, pmc->vcpu);
>         kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
>         kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
>         kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
> 
> - used once:
>         kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu);
>         kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
>         kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
>         kvm_make_request(KVM_REQ_NMI, vcpu);
>         kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu);
>         kvm_make_request(KVM_REQ_PMI, pmc->vcpu);
>         kvm_make_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu);
> 
> So I'm pretty much ambivalent about that.

I love abstractions, but consistency is above that, so I'd rather use
kvm_make_requests unless we modified all of them ... which is a lot of
work for the gain.  (make_request is just clunky)

> However, I agree with this > suggestion:
> 
> > [ Btw, maybe kvm_mmu_flush_local_tlb is a better name than
> > kvm_mmu_flush_tlb() in the current code. ]
> 
> Or even better, call it kvm_vcpu_flush_tlb since it is all within
> x86.c/vmx.c/svm.c and the MMU is not involved at all.

Good ideas.

  parent reply	other threads:[~2014-09-18 14:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 18:35 [PATCH v2] KVM: x86: count actual tlb flushes Liang Chen
2014-09-18  5:05 ` Xiao Guangrong
2014-09-18 12:47   ` Paolo Bonzini
2014-09-18 13:49     ` Liang Chen
2014-09-18 14:08     ` Radim Krčmář [this message]
2014-09-18 14:00 ` Radim Krčmář
2014-09-18 14:47   ` Liang Chen

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=20140918140859.GA16780@potion.brq.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=liangchen.linux@gmail.com \
    --cc=pbonzini@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 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.