[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xenoprof: The checks in the function passive_domain_do_rdmsr() were



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1232022989 0
# Node ID f6a455c9f01db586832c0eb98c14965c045e07ac
# Parent  5b75d99acf9c970dac9775d0d988554bd678bda3
xenoprof: The checks in the function passive_domain_do_rdmsr() were
not sufficient.
Also the same checks were done in the function
passive_domain_do_wrmsr().
So these common checks are moved in a new single function
passive_domain_msr_op_checks().

Signed-off-by: Nitin A Kamble <nitin.a.kamble@xxxxxxxxx>
Signed-off-by: Jun Nakajima <jun.nakajima@xxxxxxxxx>
---
 xen/arch/x86/oprofile/nmi_int.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff -r 5b75d99acf9c -r f6a455c9f01d xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c   Thu Jan 15 12:35:09 2009 +0000
+++ b/xen/arch/x86/oprofile/nmi_int.c   Thu Jan 15 12:36:29 2009 +0000
@@ -38,19 +38,29 @@ extern int is_active(struct domain *d);
 extern int is_active(struct domain *d);
 extern int is_passive(struct domain *d);
 
-int passive_domain_do_rdmsr(struct cpu_user_regs *regs)
-{
-       u64 msr_content;
-       int type, index;
+static int passive_domain_msr_op_checks(struct cpu_user_regs *regs ,int 
*typep, int *indexp)
+{
        struct vpmu_struct *vpmu = vcpu_vpmu(current);
-
+       if ( model == NULL )
+               return 0;
        if ( model->is_arch_pmu_msr == NULL )
                return 0;
-       if ( !model->is_arch_pmu_msr((u64)regs->ecx, &type, &index) )
-               return 0;
+       if ( !model->is_arch_pmu_msr((u64)regs->ecx, typep, indexp) )
+               return 0;
+
        if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) )
                if ( ! model->allocated_msr(current) )
                        return 0;
+       return 1;
+}
+
+int passive_domain_do_rdmsr(struct cpu_user_regs *regs)
+{
+       u64 msr_content;
+       int type, index;
+
+       if ( !passive_domain_msr_op_checks(regs, &type, &index))
+               return 0;
 
        model->load_msr(current, type, index, &msr_content);
        regs->eax = msr_content & 0xFFFFFFFF;
@@ -58,23 +68,13 @@ int passive_domain_do_rdmsr(struct cpu_u
        return 1;
 }
 
-
 int passive_domain_do_wrmsr(struct cpu_user_regs *regs)
 {
        u64 msr_content;
        int type, index;
-       struct vpmu_struct *vpmu = vcpu_vpmu(current);
-
-       if ( model == NULL )
-               return 0;
-       if ( model->is_arch_pmu_msr == NULL )
-               return 0;
-       if ( !model->is_arch_pmu_msr((u64)regs->ecx, &type, &index) )
-               return 0;
-
-       if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) )
-               if ( ! model->allocated_msr(current) )
-                       return 0;
+
+       if ( !passive_domain_msr_op_checks(regs, &type, &index))
+               return 0;
 
        msr_content = (u32)regs->eax | ((u64)regs->edx << 32);
        model->save_msr(current, type, index, msr_content);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.