# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1197362469 -32400
# Node ID 612d0d9e3c53e20f54c079b075186bf697f0cabe
# Parent cbff581a8cf8362b1e58b97377c299ab235ac371
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.
PATCHNAME: fix_xenoprof_handler
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
diff -r cbff581a8cf8 -r 612d0d9e3c53 xen/arch/ia64/xen/oprofile/perfmon.c
--- a/xen/arch/ia64/xen/oprofile/perfmon.c Tue Dec 11 17:14:57 2007 +0900
+++ b/xen/arch/ia64/xen/oprofile/perfmon.c Tue Dec 11 17:41:09 2007 +0900
@@ -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;
}
16581_612d0d9e3c53_fix_xenoprof_handler.patch
Description: Text Data
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|