KVM Archive mirror
 help / color / mirror / Atom feed
From: Wei Wang <wei.w.wang@intel.com>
To: seanjc@google.com, pbonzini@redhat.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wei Wang <wei.w.wang@intel.com>
Subject: [PATCH v3 0/3] KVM/x86: Enhancements to static calls
Date: Thu, 25 Apr 2024 20:52:49 +0800	[thread overview]
Message-ID: <20240425125252.48963-1-wei.w.wang@intel.com> (raw)

This patchset introduces the KVM_X86_CALL() and KVM_PMU_CALL() macros to
streamline the usage of static calls of kvm_x86_ops and kvm_pmu_ops. The
current static_call() usage is a bit verbose and can lead to code
alignment challenges, and the addition of kvm_x86_ prefix to hooks at the
static_call() sites hinders code readability and navigation. The use of
static_call_cond() is essentially the same as static_call() on x86, so it
is replaced by static_call() to simplify the code. The changes have gone
through my tests (guest launch, a few vPMU tests, live migration tests)
without an issue.

v2->v3 changes:
- Change the KVM_X86_CALL() definition to have the parameters in their
  owen paratheses.
- Update the .get_cpl() hook in pmu.c to use KVM_X86_CALL().
  (it was omitted in v2)

v1->v2 changes:
- Replace static_call_cond() with static_call()
- Rename KVM_X86_SC to KVM_X86_CALL, and updated all the call sites
- Add KVM_PMU_CALL() 
- Add patch 4 and 5 to review the idea of removing KVM_X86_OP_OPTIONAL

Wei Wang (3):
  KVM: x86: Replace static_call_cond() with static_call()
  KVM: x86: Introduce KVM_X86_CALL() to simplify static calls of
    kvm_x86_ops
  KVM: x86/pmu: Add KVM_PMU_CALL() to simplify static calls of
    kvm_pmu_ops

 arch/x86/include/asm/kvm_host.h |  11 +-
 arch/x86/kvm/cpuid.c            |   2 +-
 arch/x86/kvm/hyperv.c           |   6 +-
 arch/x86/kvm/irq.c              |   2 +-
 arch/x86/kvm/kvm_cache_regs.h   |  10 +-
 arch/x86/kvm/lapic.c            |  42 +++--
 arch/x86/kvm/lapic.h            |   2 +-
 arch/x86/kvm/mmu.h              |   6 +-
 arch/x86/kvm/mmu/mmu.c          |   4 +-
 arch/x86/kvm/mmu/spte.c         |   4 +-
 arch/x86/kvm/pmu.c              |  29 +--
 arch/x86/kvm/smm.c              |  44 ++---
 arch/x86/kvm/trace.h            |  15 +-
 arch/x86/kvm/x86.c              | 322 ++++++++++++++++----------------
 arch/x86/kvm/x86.h              |   2 +-
 arch/x86/kvm/xen.c              |   4 +-
 16 files changed, 259 insertions(+), 246 deletions(-)


base-commit: 44ecfa3e5f1ce2b5c7fa7003abde8a667c158f88
-- 
2.27.0


             reply	other threads:[~2024-04-25 12:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 12:52 Wei Wang [this message]
2024-04-25 12:52 ` [PATCH v3 1/3] KVM: x86: Replace static_call_cond() with static_call() Wei Wang
2024-04-25 12:52 ` [PATCH v3 2/3] KVM: x86: Introduce KVM_X86_CALL() to simplify static calls of kvm_x86_ops Wei Wang
2024-04-25 12:52 ` [PATCH v3 3/3] KVM: x86/pmu: Add KVM_PMU_CALL() to simplify static calls of kvm_pmu_ops Wei Wang
2024-05-02 23:36   ` Sean Christopherson
2024-05-03  2:15     ` Wang, Wei W
2024-05-03 13:24       ` Sean Christopherson

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=20240425125252.48963-1-wei.w.wang@intel.com \
    --to=wei.w.wang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.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 read-only IMAP folder(s) and NNTP newsgroup(s).