From: Nitin A Kamble Subject: [Patch] a bugfix to the oprofile code Date: Wed, 14 Jan 2009 13:59:01 -0800 Message-ID: <1231970341.2477.7.camel@mukti.sc.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-2FMO7UlwyNlRKNq//tIu" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: keir.fraser@eu.citrix.com Cc: xen-devel@lists.xensource.com, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org --=-2FMO7UlwyNlRKNq//tIu Content-Type: text/plain Content-Transfer-Encoding: 7bit Keir, 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 Signed-off-by: Jun Nakajima Please Apply, Thanks & Regards, Nitin --=-2FMO7UlwyNlRKNq//tIu Content-Disposition: attachment; filename="oprofile_bugfix.patch" Content-Type: text/x-patch; name="oprofile_bugfix.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit exporting patch: # HG changeset patch # User Nitin A Kamble # Date 1231854695 28800 # Branch pmu_bugfix # Node ID 05673257cd479e1bd03f706e738ac8001dcac4a2 # Parent e2f36d066b7b66a538bbe240d46f49bede51d9ed 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 Signed-off-by: Jun Nakajima diff -r e2f36d066b7b -r 05673257cd47 xen/arch/x86/oprofile/nmi_int.c --- a/xen/arch/x86/oprofile/nmi_int.c Mon Dec 22 13:48:40 2008 +0000 +++ b/xen/arch/x86/oprofile/nmi_int.c Tue Jan 13 05:51:35 2009 -0800 @@ -38,19 +38,29 @@ extern int is_active(struct domain *d); extern int is_passive(struct domain *d); +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, 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; - struct vpmu_struct *vpmu = vcpu_vpmu(current); - if ( model->is_arch_pmu_msr == NULL ) + if ( !passive_domain_msr_op_checks(regs, &type, &index)) 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; model->load_msr(current, type, index, &msr_content); regs->eax = msr_content & 0xFFFFFFFF; @@ -58,23 +68,13 @@ 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 ) + if ( !passive_domain_msr_op_checks(regs, &type, &index)) 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; msr_content = (u32)regs->eax | ((u64)regs->edx << 32); model->save_msr(current, type, index, msr_content); --=-2FMO7UlwyNlRKNq//tIu Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-2FMO7UlwyNlRKNq//tIu--