public inbox for kvm@vger.kernel.org
 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 v2 0/5] KVM/x86: Enhancements to static calls
Date: Fri, 19 Apr 2024 19:29:47 +0800	[thread overview]
Message-ID: <20240419112952.15598-1-wei.w.wang@intel.com> (raw)

This patchset addresses two primary concerns with the current
implementation related to static calls in kvm/x86:
1) It is implemented based on the assumption that static_call() cannot
handle undefined (i.e., NULL) hooks. As Sean pointed out, this is no
longer accurate as static_call() has treated a "NULL" pointer as a NOP
on x86.
2) Its usage is 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.

This patchset aims to rectify the above issues. Patch 4 and 5 are marked
as RFC, as they were not accepted yet at the idea level in the previous
discussions, so present the code changes here and give it one more try,
in case I didn't explain that well. Despite being marked as RFC, they've
gone through my tests (guest launch, a few vPMU tests, live migration
tests) without an issue.

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 (5):
  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
  KVM: x86: Remove KVM_X86_OP_OPTIONAL
  KVM: x86/pmu: Remove KVM_X86_PMU_OP_OPTIONAL

 arch/x86/include/asm/kvm-x86-ops.h     | 100 ++++----
 arch/x86/include/asm/kvm-x86-pmu-ops.h |  20 +-
 arch/x86/include/asm/kvm_host.h        |  14 +-
 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                     |  31 +--
 arch/x86/kvm/smm.c                     |  44 ++--
 arch/x86/kvm/trace.h                   |  12 +-
 arch/x86/kvm/x86.c                     | 342 ++++++++++++-------------
 arch/x86/kvm/x86.h                     |   2 +-
 arch/x86/kvm/xen.c                     |   4 +-
 18 files changed, 317 insertions(+), 330 deletions(-)


base-commit: 49ff3b4aec51e3abfc9369997cc603319b02af9a
-- 
2.27.0


             reply	other threads:[~2024-04-19 11:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 11:29 Wei Wang [this message]
2024-04-19 11:29 ` [PATCH v2 1/5] KVM: x86: Replace static_call_cond() with static_call() Wei Wang
2024-04-19 11:29 ` [PATCH v2 2/5] KVM: x86: Introduce KVM_X86_CALL() to simplify static calls of kvm_x86_ops Wei Wang
2024-04-22 10:34   ` Paolo Bonzini
2024-04-22 16:43     ` Sean Christopherson
2024-04-19 11:29 ` [PATCH v2 3/5] KVM: x86/pmu: Add KVM_PMU_CALL() to simplify static calls of kvm_pmu_ops Wei Wang
2024-04-19 11:29 ` [RFC PATCH v2 4/5] KVM: x86: Remove KVM_X86_OP_OPTIONAL Wei Wang
2024-04-19 13:41   ` Sean Christopherson
2024-04-19 15:12     ` Wang, Wei W
2024-04-19 15:58       ` Sean Christopherson
2024-04-20  3:01         ` Wang, Wei W
2024-04-19 11:29 ` [RFC PATCH v2 5/5] KVM: x86/pmu: Remove KVM_X86_PMU_OP_OPTIONAL Wei Wang

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=20240419112952.15598-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