kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Xu <jacobhxu@google.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: tlb_flush stat on Intel/AMD
Date: Tue, 28 Jul 2020 11:07:52 -0700	[thread overview]
Message-ID: <CAJ5mJ6h6WYJHTKNWvyZ2co0HEBWjkrNC5yX4hn9v9VdMzyqo3g@mail.gmail.com> (raw)
In-Reply-To: <20200721201643.GI22083@linux.intel.com>

> The VMX APIC flush could be deferred by hoisting KVM_REQ_APIC_PAGE_RELOAD
> up.  I think that's safe?  But it's a very infrequent operation so I'm not
> exactly chomping at the bit to get it fixed.

Could moving KVM_REQ_TLB_FLUSH and _CURRENT down also work?
It seems that none of the check_request() calls below depend on them.

> Given that you see 0 on SVM and a low number on VMX, my money is on the
> difference being that VMX accounts the TLB flush that occurs on vCPU
> migration.  vmx_vcpu_load_vmcs() makes a KVM_REQ_TLB_FLUSH request, whereas
> svm_vcpu_load() resets asid_generation but doesn't increment the stats.

I'll try adding a one-off stat increment here, and check the results.

> I think a better option is to keep the current accounting, defer flushes
> when possible to naturally fix accounting, and then fix the remaining one
> off cases, e.g. kvm_mmu_load() and svm_vcpu_load().
>
> I can prep a small series unless you want the honors?

I'll try making a small series:
kvm: selftests: add get_debugfs_stat to kvm_util
kvm: x86: increment tlb_flush stat on svm_vcpu_load(), kvm_mmu_load()
# omit kvm_mmu_load() if feasible to move check_request(KVM_REQ_TLB_FLUSH) down
kvm: x86: re-order check_request() to prefer use of deferred tlb_flush

Thanks for the explanations! Sorry for my late reply, I've updated my
email filter accordingly.

      reply	other threads:[~2020-07-28 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 19:08 tlb_flush stat on Intel/AMD Jacob Xu
2020-07-21 20:16 ` Sean Christopherson
2020-07-28 18:07   ` Jacob Xu [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=CAJ5mJ6h6WYJHTKNWvyZ2co0HEBWjkrNC5yX4hn9v9VdMzyqo3g@mail.gmail.com \
    --to=jacobhxu@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sean.j.christopherson@intel.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).