# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1197909534 25200
# Node ID 9a545d45b1921c5951ccd5c62355b2c54dfe8f22
# Parent e88253dfefdc33e773ce5c4489512875fec262ad
[IA64] xenoprof: fix xenoprof_handler()
- Use profile_pc() to get instruction pointer.
- Make xenoprof_handler() VTi domain aware
- Pass current to xenoprofile_get_mode() instead of task=NULL.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
xen/arch/ia64/xen/oprofile/perfmon.c | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diff -r e88253dfefdc -r 9a545d45b192 xen/arch/ia64/xen/oprofile/perfmon.c
--- a/xen/arch/ia64/xen/oprofile/perfmon.c Mon Dec 17 09:36:46 2007 -0700
+++ b/xen/arch/ia64/xen/oprofile/perfmon.c Mon Dec 17 09:38:54 2007 -0700
@@ -35,6 +35,7 @@
#include <xen/xenoprof.h>
#include <asm/perfmon.h>
#include <asm/ptrace.h>
+#include <asm/vmx.h> /* for vmx_user_mode() */
// XXX move them to an appropriate header file
extern void xenoprof_log_event(struct vcpu *vcpu, struct pt_regs * regs,
@@ -45,24 +46,37 @@ static int allow_ints;
static int allow_ints;
static int
+xenoprof_is_xen_mode(struct vcpu *v, struct pt_regs *regs)
+{
+ if (VMX_DOMAIN(v))
+ return !vmx_user_mode(regs);
+ return ring_0(regs);
+}
+
+static int
xenoprof_handler(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg,
struct pt_regs *regs, unsigned long stamp)
{
- unsigned long ip = regs->cr_iip;
+ unsigned long ip = profile_pc(regs);
int event = arg->pmd_eventid;
-
+ struct vcpu *v = current;
+ int mode = xenoprofile_get_mode(v, regs);
+
+ // see pfm_do_interrupt_handler() in xen/arch/ia64/linux-xen/perfmon.c.
+ // It always passes task as NULL. This is work around
+ BUG_ON(task != NULL);
+
arg->ovfl_ctrl.bits.reset_ovfl_pmds = 1;
if (!allow_virq || !allow_ints)
return 0;
// Note that log event actually expect cpu_user_regs, cast back
// appropriately when doing the backtrace implementation in ia64
- xenoprof_log_event(current, regs, ip, xenoprofile_get_mode(task, regs),
- event);
-
+ xenoprof_log_event(v, regs, ip, mode, event);
// send VIRQ_XENOPROF
- if (is_active(current->domain) && !ring_0(regs))
- send_guest_vcpu_virq(current, VIRQ_XENOPROF);
+ if (is_active(v->domain) && !xenoprof_is_xen_mode(v, regs) &&
+ !is_idle_vcpu(v))
+ send_guest_vcpu_virq(v, VIRQ_XENOPROF);
return 0;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|