From: Suravee Suthikulanit <suravee.suthikulpanit@amd.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: jun.nakajima@intel.com, haitao.shan@intel.com,
jacob.shin@amd.com, dietmar.hahn@ts.fujitsu.com,
xen-devel@lists.xen.org, JBeulich@suse.com
Subject: Re: [PATCH v2 8/9] x86/AMD: Clean up context_update() in AMD VPMU code
Date: Mon, 15 Apr 2013 13:00:41 -0500 [thread overview]
Message-ID: <516C4049.2060308@amd.com> (raw)
In-Reply-To: <1365789566-3733-9-git-send-email-boris.ostrovsky@oracle.com>
Acked
Thanks,
Suravee
On 4/12/2013 12:59 PM, Boris Ostrovsky wrote:
> Clean up context_update() in AMD VPMU code.
>
> Rename restore routine to "load" to be consistent with Intel
> code and with arch_vpmu_ops names
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Reviewed-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
> ---
> xen/arch/x86/hvm/svm/vpmu.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/svm/vpmu.c b/xen/arch/x86/hvm/svm/vpmu.c
> index efe2b7c..b36ab2b 100644
> --- a/xen/arch/x86/hvm/svm/vpmu.c
> +++ b/xen/arch/x86/hvm/svm/vpmu.c
> @@ -173,7 +173,7 @@ static int amd_vpmu_do_interrupt(struct cpu_user_regs *regs)
> return 1;
> }
>
> -static inline void context_restore(struct vcpu *v)
> +static inline void context_load(struct vcpu *v)
> {
> unsigned int i;
> struct vpmu_struct *vpmu = vcpu_vpmu(v);
> @@ -186,7 +186,7 @@ static inline void context_restore(struct vcpu *v)
> }
> }
>
> -static void amd_vpmu_restore(struct vcpu *v)
> +static void amd_vpmu_load(struct vcpu *v)
> {
> struct vpmu_struct *vpmu = vcpu_vpmu(v);
> struct amd_vpmu_context *ctxt = vpmu->context;
> @@ -203,7 +203,7 @@ static void amd_vpmu_restore(struct vcpu *v)
> return;
> }
>
> - context_restore(v);
> + context_load(v);
> }
>
> static inline void context_save(struct vcpu *v)
> @@ -262,12 +262,18 @@ static void context_update(unsigned int msr, u64 msr_content)
> }
>
> for ( i = 0; i < num_counters; i++ )
> - if ( msr == counters[i] )
> + {
> + if ( msr == ctrls[i] )
> + {
> + ctxt->ctrls[i] = msr_content;
> + return;
> + }
> + else if (msr == counters[i] )
> + {
> ctxt->counters[i] = msr_content;
> -
> - for ( i = 0; i < num_counters; i++ )
> - if ( msr == ctrls[i] )
> - ctxt->ctrls[i] = msr_content;
> + return;
> + }
> + }
> }
>
> static int amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
> @@ -311,7 +317,7 @@ static int amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
> if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED)
> || vpmu_is_set(vpmu, VPMU_FROZEN) )
> {
> - context_restore(v);
> + context_load(v);
> vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
> vpmu_reset(vpmu, VPMU_FROZEN);
> }
> @@ -332,7 +338,7 @@ static int amd_vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
> if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED)
> || vpmu_is_set(vpmu, VPMU_FROZEN) )
> {
> - context_restore(v);
> + context_load(v);
> vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
> vpmu_reset(vpmu, VPMU_FROZEN);
> }
> @@ -414,7 +420,7 @@ struct arch_vpmu_ops amd_vpmu_ops = {
> .do_interrupt = amd_vpmu_do_interrupt,
> .arch_vpmu_destroy = amd_vpmu_destroy,
> .arch_vpmu_save = amd_vpmu_save,
> - .arch_vpmu_load = amd_vpmu_restore
> + .arch_vpmu_load = amd_vpmu_load
> };
>
> int svm_vpmu_initialise(struct vcpu *v, unsigned int vpmu_flags)
next prev parent reply other threads:[~2013-04-15 18:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-12 17:59 [PATCH v2 0/9] Various VPMU patches, version 2 Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 1/9] x86/AMD: Allow more fine-grained control of VMCB MSR Permission Map Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 2/9] x86/AMD: Do not intercept access to performance counters MSRs Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 3/9] x86/AMD: Load context when attempting to read VPMU MSRs Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 4/9] x86/AMD: Stop counters on VPMU save Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 5/9] x86/VPMU: Add Haswell support Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 6/9] x86/VPMU: Factor out VPMU common code Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 7/9] x86/VPMU: Save/restore VPMU only when necessary Boris Ostrovsky
2013-04-12 17:59 ` [PATCH v2 8/9] x86/AMD: Clean up context_update() in AMD VPMU code Boris Ostrovsky
2013-04-15 18:00 ` Suravee Suthikulanit [this message]
2013-04-12 17:59 ` [PATCH v2 9/9] x86/AMD: Dump AMD VPMU info Boris Ostrovsky
2013-04-15 17:54 ` Suravee Suthikulanit
2013-04-15 18:04 ` [PATCH v2 0/9] Various VPMU patches, version 2 Suravee Suthikulanit
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=516C4049.2060308@amd.com \
--to=suravee.suthikulpanit@amd.com \
--cc=JBeulich@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=dietmar.hahn@ts.fujitsu.com \
--cc=haitao.shan@intel.com \
--cc=jacob.shin@amd.com \
--cc=jun.nakajima@intel.com \
--cc=xen-devel@lists.xen.org \
/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.