From: Wei Huang <wei@redhat.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, gleb@kernel.org,
rkrcmar@redhat.com
Subject: Re: [PATCH V4 2/4] KVM: x86/vPMU: Create vPMU interface for VMX and SVM
Date: Wed, 10 Jun 2015 13:47:42 -0500 [thread overview]
Message-ID: <5578864E.7010808@redhat.com> (raw)
In-Reply-To: <20150610180531.GD20384@8bytes.org>
On 06/10/2015 01:05 PM, Joerg Roedel wrote:
> On Wed, Jun 10, 2015 at 11:43:20AM -0500, Wei Huang wrote:
>> On 06/10/2015 05:12 AM, Joerg Roedel wrote:
>>> On Fri, Jun 05, 2015 at 01:20:14AM -0400, Wei Huang wrote:
>>>> +
>>>> + struct kvm_pmu_ops *(*get_pmu_ops)(void);
>>>
>>> Can't you just set kvm_pmu_ops in svm.c and vmx.c and save this
>>> call-back? Besides that the patch looks good.
>> Hi Joerg,
>>
>> Thanks for your review. How about setting up kvm_pmu_ops in
>> .hardware_setup function of VMX and SVM? More specifically:
>>
>> 1) EXPORT_SYMBOL_GPL(kvm_pmu_ops) from pmu.c file;
>> 2) In vmx.c, set "kvm_pmu_ops = &intel_pmu_ops" in hardware_setup();
>> 3) In svm.c, set "kvm_pmu_ops = &amd_pmu_ops" in svm_hardware_setup().
>>
>> With that, we can get rid of the call-back.
>
> Okay, just had a look at how this works with kvm_x86_ops, because my
> suggestion needs the EXPORT_SYMBOL_GPL(kvm_pmu_ops), which is better
> also avoided.
>
> So how about putting the pmu-ops directly into the kvm_x86_ops as a
> (const) member,
I like this idea better. Here is the (expanded) design:
1) add const "struct kvm_pmu_ops *pmu_ops" to kvm_x86_ops;
2) In VMX, "vmx_x86_ops.pmu_ops = &intel_pmu_ops";
3) In SVM, "svm_x86_ops.pmu_ops = &amd_pmu_ops".
Common kvm_pmu_xxxx functions (in pmu.c) will change accordingly
afterwards. If no objection, I will do this way.
or alternativly as an additional parameter to kvm_init?
> This still saves us the access functions.
Passing pmu-ops to kvm_init() implies that we have to change the public
API (adding a new parameter) to kvm_init, which will affect many
architectures. I will try to avoid it unless have to.
>
>
> Joerg
>
next prev parent reply other threads:[~2015-06-10 18:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 5:20 [PATCH V4 0/4] Consolidated KVM vPMU support for x86 Wei Huang
2015-06-05 5:20 ` [PATCH V4 1/4] KVM: x86/vPMU: Define kvm_pmu_ops to support vPMU function dispatch Wei Huang
2015-06-05 5:20 ` [PATCH V4 2/4] KVM: x86/vPMU: Create vPMU interface for VMX and SVM Wei Huang
2015-06-10 10:12 ` Joerg Roedel
2015-06-10 16:43 ` Wei Huang
2015-06-10 18:05 ` Joerg Roedel
2015-06-10 18:47 ` Wei Huang [this message]
2015-06-10 20:18 ` Joerg Roedel
2015-06-05 5:20 ` [PATCH V4 3/4] KVM: x86/vPMU: Implement AMD vPMU code for KVM Wei Huang
2015-06-05 5:20 ` [PATCH V4 4/4] KVM: x86/vPMU: Enable PMU handling for AMD PERFCTRn and EVNTSELn MSRs Wei Huang
2015-06-10 10:43 ` [PATCH V4 0/4] Consolidated KVM vPMU support for x86 Joerg Roedel
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=5578864E.7010808@redhat.com \
--to=wei@redhat.com \
--cc=gleb@kernel.org \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.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.