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: [RFC PATCH v2 5/5] KVM: x86/pmu: Remove KVM_X86_PMU_OP_OPTIONAL
Date: Fri, 19 Apr 2024 19:29:52 +0800 [thread overview]
Message-ID: <20240419112952.15598-6-wei.w.wang@intel.com> (raw)
In-Reply-To: <20240419112952.15598-1-wei.w.wang@intel.com>
Similar to the removal of KVM_X86_OP_OPTIONAL, remove
KVM_X86_PMU_OP_OPTIONAL() to simplify the usage of kvm_pmu_ops.
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
arch/x86/include/asm/kvm-x86-pmu-ops.h | 20 +++++++-------------
arch/x86/kvm/pmu.c | 7 +------
2 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/arch/x86/include/asm/kvm-x86-pmu-ops.h b/arch/x86/include/asm/kvm-x86-pmu-ops.h
index f852b13aeefe..ac10ac5cb1fa 100644
--- a/arch/x86/include/asm/kvm-x86-pmu-ops.h
+++ b/arch/x86/include/asm/kvm-x86-pmu-ops.h
@@ -1,28 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0 */
-#if !defined(KVM_X86_PMU_OP) || !defined(KVM_X86_PMU_OP_OPTIONAL)
+#if !defined(KVM_X86_PMU_OP)
BUILD_BUG_ON(1)
#endif
/*
- * KVM_X86_PMU_OP() and KVM_X86_PMU_OP_OPTIONAL() are used to help generate
- * both DECLARE/DEFINE_STATIC_CALL() invocations and
- * "static_call_update()" calls.
- *
- * KVM_X86_PMU_OP_OPTIONAL() can be used for those functions that can have
- * a NULL definition, for example if "static_call_cond()" will be used
- * at the call sites.
+ * KVM_X86_PMU_OP() is used to help generate both DECLARE/DEFINE_STATIC_CALL()
+ * invocations and static_call_update() calls.
*/
KVM_X86_PMU_OP(rdpmc_ecx_to_pmc)
KVM_X86_PMU_OP(msr_idx_to_pmc)
-KVM_X86_PMU_OP_OPTIONAL(check_rdpmc_early)
+KVM_X86_PMU_OP(check_rdpmc_early)
KVM_X86_PMU_OP(is_valid_msr)
KVM_X86_PMU_OP(get_msr)
KVM_X86_PMU_OP(set_msr)
KVM_X86_PMU_OP(refresh)
KVM_X86_PMU_OP(init)
-KVM_X86_PMU_OP_OPTIONAL(reset)
-KVM_X86_PMU_OP_OPTIONAL(deliver_pmi)
-KVM_X86_PMU_OP_OPTIONAL(cleanup)
+KVM_X86_PMU_OP(reset)
+KVM_X86_PMU_OP(deliver_pmi)
+KVM_X86_PMU_OP(cleanup)
#undef KVM_X86_PMU_OP
-#undef KVM_X86_PMU_OP_OPTIONAL
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index c6f8e9ab2866..7a145a9b75ca 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -80,20 +80,15 @@ static struct kvm_pmu_ops kvm_pmu_ops __read_mostly;
#define KVM_X86_PMU_OP(func) \
DEFINE_STATIC_CALL_NULL(kvm_x86_pmu_##func, \
*(((struct kvm_pmu_ops *)0)->func));
-#define KVM_X86_PMU_OP_OPTIONAL KVM_X86_PMU_OP
#include <asm/kvm-x86-pmu-ops.h>
void kvm_pmu_ops_update(const struct kvm_pmu_ops *pmu_ops)
{
memcpy(&kvm_pmu_ops, pmu_ops, sizeof(kvm_pmu_ops));
-#define __KVM_X86_PMU_OP(func) \
- static_call_update(kvm_x86_pmu_##func, kvm_pmu_ops.func);
#define KVM_X86_PMU_OP(func) \
- WARN_ON(!kvm_pmu_ops.func); __KVM_X86_PMU_OP(func)
-#define KVM_X86_PMU_OP_OPTIONAL __KVM_X86_PMU_OP
+ static_call_update(kvm_x86_pmu_##func, kvm_pmu_ops.func);
#include <asm/kvm-x86-pmu-ops.h>
-#undef __KVM_X86_PMU_OP
}
static inline void __kvm_perf_overflow(struct kvm_pmc *pmc, bool in_pmi)
--
2.27.0
prev parent reply other threads:[~2024-04-19 11:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-19 11:29 [PATCH v2 0/5] KVM/x86: Enhancements to static calls Wei Wang
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 ` Wei Wang [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=20240419112952.15598-6-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 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.