WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] [PATCH 3/6] xenoprof: fix xenoprof_handler()

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH 3/6] xenoprof: fix xenoprof_handler()
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Tue, 11 Dec 2007 18:02:40 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Delivery-date: Tue, 11 Dec 2007 01:03:12 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
# 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;
 }

Attachment: 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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-ia64-devel] [PATCH 3/6] xenoprof: fix xenoprof_handler(), Isaku Yamahata <=