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 2/6] xenoprof: make xenoprofile_get_mode() vti d

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH 2/6] xenoprof: make xenoprofile_get_mode() vti domain aware
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:02:59 -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 1197360897 -32400
# Node ID cbff581a8cf8362b1e58b97377c299ab235ac371
# Parent  c9623eb65ac2fe2c718767555d96043ef931f921
make xenoprofile_get_mode() VTi domain aware.
PATCHNAME: make_xenoprofile_get_mode_vti_domain_aware

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r c9623eb65ac2 -r cbff581a8cf8 xen/arch/ia64/xen/oprofile/xenoprof.c
--- a/xen/arch/ia64/xen/oprofile/xenoprof.c     Fri Dec 07 12:02:12 2007 +0900
+++ b/xen/arch/ia64/xen/oprofile/xenoprof.c     Tue Dec 11 17:14:57 2007 +0900
@@ -24,29 +24,58 @@
 #include <xen/sched.h>
 #include <public/xen.h>
 #include <xen/xenoprof.h>
+#include <asm/vmx.h>    /* for vmx_user_mode() */
 
 int
 xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
 {
     int mode;
 
-    // mode
-    // 0: user, 1: kernel, 2: xen
-    switch (ring(regs))
-    {
+    /*
+     * mode
+     * 0: user, 1: kernel, 2: xen
+     * see linux/driver/oprofile/cpu_buffer.h
+     */
+#define CPU_MODE_USER           0
+#define CPU_MODE_KERNEL         1
+#define CPU_MODE_XEN            2
+    if (VMX_DOMAIN(v)) {
+        if (vmx_user_mode(regs)) {
+            switch (ring(regs)) {
+            case 3:
+                mode = CPU_MODE_USER;
+                break;
+            case 0:
+                mode = CPU_MODE_KERNEL;
+                break;
+            /* case 0: case 1: */
+            default:
+                gdprintk(XENLOG_ERR, "%s:%d ring%d in vmx is used!\n",
+                         __func__, __LINE__, ring(regs));
+                mode = CPU_MODE_KERNEL; /* fall back to kernel mode. */
+                break;
+            }
+        } else {
+            mode = CPU_MODE_XEN;
+            BUG_ON(ring(regs) != 0);
+        }
+    } else {
+        switch (ring(regs)) {
         case 3:
-                mode = 0;
-                break;
+            mode = CPU_MODE_USER;
+            break;
         case CONFIG_CPL0_EMUL:
-                mode = 1;
-                break;
+            mode = CPU_MODE_KERNEL;
+            break;
         case 0:
-                mode = 2;
-                break;
+            mode = CPU_MODE_XEN;
+            break;
         default:
-                gdprintk(XENLOG_ERR, "%s:%d ring%d is used!\n", __func__,
-                         __LINE__, 3 - CONFIG_CPL0_EMUL);
-                mode = 1; /* fall back to kernel mode. */
+            gdprintk(XENLOG_ERR, "%s:%d ring%d in pv is used!\n", __func__,
+                     __LINE__, 3 - CONFIG_CPL0_EMUL);
+            mode = CPU_MODE_KERNEL; /* fall back to kernel mode. */
+            break;
+        }
     }
     return mode;
 }

Attachment: 16580_cbff581a8cf8_make_xenoprofile_get_mode_vti_domain_aware.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 2/6] xenoprof: make xenoprofile_get_mode() vti domain aware, Isaku Yamahata <=