Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [IA64] xenoprof: fix xenoprof_handler()

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] xenoprof: fix xenoprof_handler()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2007 05:40:18 -0800
Delivery-date: Wed, 19 Dec 2007 05:40:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] xenoprof: fix xenoprof_handler(), Xen patchbot-unstable <=