All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, Jim Mattson <jmattson@google.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Joerg Roedel <joro@8bytes.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/4] KVM: x86: Move kvm_ops_static_call_update() to x86.c
Date: Tue, 29 Mar 2022 23:26:25 +0000	[thread overview]
Message-ID: <YkOVofVoJD6s1W7I@google.com> (raw)
In-Reply-To: <YkOPT7TJf74C2Wq8@google.com>

On Tue, Mar 29, 2022, Sean Christopherson wrote:
> On Mon, Mar 07, 2022, Like Xu wrote:
> > From: Like Xu <likexu@tencent.com>
> > 
> > The kvm_ops_static_call_update() is defined in kvm_host.h. That's
> > completely unnecessary, it should have exactly one caller,
> > kvm_arch_hardware_setup().  As a prep match, move
> > kvm_ops_static_call_update() to x86.c, then it can reference
> > the kvm_pmu_ops stuff.
> > 
> > Suggested-by: Sean Christopherson <seanjc@google.com>
> > Signed-off-by: Like Xu <likexu@tencent.com>
> > ---
> 
> Reviewed-by: Sean Christopherson <seanjc@google.com>

Actually, I take that back.  If we pass in @ops, and do some other minor tweaks
along the way, then we can make kvm_pmu_ops static.

I'll post a very compile-tested-only v3.1, trying to generate diffs against your
series is going to be painful due to conflicts.  The changes aren't big, just
annoying.

Below is the diff for this patch.  Then in patch 2, kvm_ops_update() adds a call
to kvm_pmu_ops_update().  Patch 3 just tweaks the call to use ops->pmu_ops instead
of ops->runtime_ops->pmu_ops.  Patch 4 becomes purely code shuffling (I think).

---
 arch/x86/kvm/x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9cb8672aab92..99aa2d16845a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -11595,8 +11595,10 @@ void kvm_arch_hardware_disable(void)
 	drop_user_return_notifiers();
 }

-static inline void kvm_ops_static_call_update(void)
+static inline void kvm_ops_update(struct kvm_x86_init_ops *ops)
 {
+	memcpy(&kvm_x86_ops, ops->runtime_ops, sizeof(kvm_x86_ops));
+
 #define __KVM_X86_OP(func) \
 	static_call_update(kvm_x86_##func, kvm_x86_ops.func);
 #define KVM_X86_OP(func) \
@@ -11623,8 +11625,7 @@ int kvm_arch_hardware_setup(void *opaque)
 	if (r != 0)
 		return r;

-	memcpy(&kvm_x86_ops, ops->runtime_ops, sizeof(kvm_x86_ops));
-	kvm_ops_static_call_update();
+	kvm_ops_update(ops);

 	kvm_register_perf_callbacks(ops->handle_intel_pt_intr);


base-commit: bd6b09f0754bea388a189d544ce11d83206579a2
--


  reply	other threads:[~2022-03-29 23:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 11:59 [PATCH v3 0/4] KVM: x86: Use static calls to reduce kvm_pmu_ops overhead Like Xu
2022-03-07 11:59 ` [PATCH v3 1/4] KVM: x86: Move kvm_ops_static_call_update() to x86.c Like Xu
2022-03-29 22:59   ` Sean Christopherson
2022-03-29 23:26     ` Sean Christopherson [this message]
2022-03-07 11:59 ` [PATCH v3 2/4] KVM: x86: Copy kvm_pmu_ops by value to eliminate layer of indirection Like Xu
2022-03-07 11:59 ` [PATCH v3 3/4] KVM: x86: Move .pmu_ops to kvm_x86_init_ops and tag as __initdata Like Xu
2022-03-07 11:59 ` [PATCH v3 4/4] KVM: x86: Use static calls to reduce kvm_pmu_ops overhead Like Xu
2022-03-29 23:48   ` Sean Christopherson
2022-03-21 13:55 ` [PATCH v3 0/4] " Like Xu

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=YkOVofVoJD6s1W7I@google.com \
    --to=seanjc@google.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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.