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-changelog

[Xen-changelog] [xen-unstable] [XENOPROFILE] Replace x86 specific code i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XENOPROFILE] Replace x86 specific code in xen/common/xenoprof.c
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Nov 2006 11:10:14 +0000
Delivery-date: Wed, 22 Nov 2006 03:09:54 -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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID da5c5fc8908fd966772eed40b1c1ab63793dbc1e
# Parent  fc11c91e537166535b797e39f381a474413af3f0
[XENOPROFILE] Replace x86 specific code in xen/common/xenoprof.c
 - replace nmi_ prefix with xenoprof_arch_ prefix
 - move config_counter to xen/arch/x86/oprofile/xenoprof.c

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 xen/arch/x86/oprofile/xenoprof.c |   22 +++++++++++++++
 xen/common/xenoprof.c            |   52 ++++++++---------------------------
 xen/include/asm-x86/xenoprof.h   |   57 +++++++++++++++++++++++++++++++++++++++
 xen/include/xen/xenoprof.h       |    3 +-
 4 files changed, 93 insertions(+), 41 deletions(-)

diff -r fc11c91e5371 -r da5c5fc8908f xen/arch/x86/oprofile/xenoprof.c
--- a/xen/arch/x86/oprofile/xenoprof.c  Wed Nov 22 09:35:50 2006 +0000
+++ b/xen/arch/x86/oprofile/xenoprof.c  Wed Nov 22 09:48:42 2006 +0000
@@ -12,6 +12,28 @@
 #include <xen/sched.h>
 #include <public/xenoprof.h>
 #include <asm/hvm/support.h>
+
+#include "op_counter.h"
+
+int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
+{
+    struct xenoprof_counter counter;
+
+    if ( copy_from_guest(&counter, arg, 1) )
+        return -EFAULT;
+
+    if ( counter.ind > OP_MAX_COUNTER )
+        return -E2BIG;
+
+    counter_config[counter.ind].count     = counter.count;
+    counter_config[counter.ind].enabled   = counter.enabled;
+    counter_config[counter.ind].event     = counter.event;
+    counter_config[counter.ind].kernel    = counter.kernel;
+    counter_config[counter.ind].user      = counter.user;
+    counter_config[counter.ind].unit_mask = counter.unit_mask;
+
+    return 0;
+}
 
 int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
 {
diff -r fc11c91e5371 -r da5c5fc8908f xen/common/xenoprof.c
--- a/xen/common/xenoprof.c     Wed Nov 22 09:35:50 2006 +0000
+++ b/xen/common/xenoprof.c     Wed Nov 22 09:48:42 2006 +0000
@@ -12,8 +12,6 @@
 #include <public/xenoprof.h>
 #include <asm/hvm/support.h>
 
-#include "../arch/x86/oprofile/op_counter.h"
-
 /* Limit amount of pages used for shared buffer (per domain) */
 #define MAX_OPROF_SHARED_PAGES 32
 
@@ -39,16 +37,6 @@ u64 passive_samples;
 u64 passive_samples;
 u64 idle_samples;
 u64 others_samples;
-
-
-extern int nmi_init(int *num_events, int *is_primary, char *cpu_type);
-extern int nmi_reserve_counters(void);
-extern int nmi_setup_events(void);
-extern int nmi_enable_virq(void);
-extern int nmi_start(void);
-extern void nmi_stop(void);
-extern void nmi_disable_virq(void);
-extern void nmi_release_counters(void);
 
 int is_active(struct domain *d)
 {
@@ -445,9 +433,9 @@ static int xenoprof_op_init(XEN_GUEST_HA
     if ( copy_from_guest(&xenoprof_init, arg, 1) )
         return -EFAULT;
 
-    if ( (ret = nmi_init(&xenoprof_init.num_events, 
-                         &xenoprof_init.is_primary, 
-                         xenoprof_init.cpu_type)) )
+    if ( (ret = xenoprof_arch_init(&xenoprof_init.num_events, 
+                                   &xenoprof_init.is_primary, 
+                                   xenoprof_init.cpu_type)) )
         return ret;
 
     if ( copy_to_guest(arg, &xenoprof_init, 1) )
@@ -574,14 +562,12 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
             ret = -EPERM;
             break;
         }
-        ret = nmi_reserve_counters();
+        ret = xenoprof_arch_reserve_counters();
         if ( !ret )
             xenoprof_state = XENOPROF_COUNTERS_RESERVED;
         break;
 
     case XENOPROF_counter:
-    {
-        struct xenoprof_counter counter;
         if ( (xenoprof_state != XENOPROF_COUNTERS_RESERVED) ||
              (adomains == 0) )
         {
@@ -589,22 +575,8 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
             break;
         }
 
-        if ( copy_from_guest(&counter, arg, 1) )
-            return -EFAULT;
-
-        if ( counter.ind > OP_MAX_COUNTER )
-            return -E2BIG;
-
-        counter_config[counter.ind].count     = counter.count;
-        counter_config[counter.ind].enabled   = counter.enabled;
-        counter_config[counter.ind].event     = counter.event;
-        counter_config[counter.ind].kernel    = counter.kernel;
-        counter_config[counter.ind].user      = counter.user;
-        counter_config[counter.ind].unit_mask = counter.unit_mask;
-
-        ret = 0;
-        break;
-    }
+        ret = xenoprof_arch_counter(arg);
+        break;
 
     case XENOPROF_setup_events:
         if ( xenoprof_state != XENOPROF_COUNTERS_RESERVED )
@@ -612,7 +584,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
             ret = -EPERM;
             break;
         }
-        ret = nmi_setup_events();
+        ret = xenoprof_arch_setup_events();
         if ( !ret )
             xenoprof_state = XENOPROF_READY;
         break;
@@ -622,7 +594,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         int i;
         if ( current->domain == primary_profiler )
         {
-            nmi_enable_virq();
+            xenoprof_arch_enable_virq();
             xenoprof_reset_stat();
             for ( i = 0; i < pdomains; i++ )
                 xenoprof_reset_buf(passive_domains[i]);
@@ -636,7 +608,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
         ret = -EPERM;
         if ( (xenoprof_state == XENOPROF_READY) &&
              (activated == adomains) )
-            ret = nmi_start();
+            ret = xenoprof_arch_start();
 
         if ( ret == 0 )
             xenoprof_state = XENOPROF_PROFILING;
@@ -647,7 +619,7 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
             ret = -EPERM;
             break;
         }
-        nmi_stop();
+        xenoprof_arch_stop();
         xenoprof_state = XENOPROF_READY;
         break;
 
@@ -667,8 +639,8 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN
              (xenoprof_state == XENOPROF_READY) )
         {
             xenoprof_state = XENOPROF_IDLE;
-            nmi_release_counters();
-            nmi_disable_virq();
+            xenoprof_arch_release_counters();
+            xenoprof_arch_disable_virq();
             reset_passive_list();
             ret = 0;
         }
diff -r fc11c91e5371 -r da5c5fc8908f xen/include/xen/xenoprof.h
--- a/xen/include/xen/xenoprof.h        Wed Nov 22 09:35:50 2006 +0000
+++ b/xen/include/xen/xenoprof.h        Wed Nov 22 09:48:42 2006 +0000
@@ -11,6 +11,7 @@
 #define __XEN_XENOPROF_H__
 
 #include <public/xenoprof.h>
+#include <asm/xenoprof.h>
 
 #define XENOPROF_DOMAIN_IGNORED    0
 #define XENOPROF_DOMAIN_ACTIVE     1
@@ -27,7 +28,7 @@ struct xenoprof_vcpu {
 };
 
 struct xenoprof {
-    char* rawbuf;
+    char *rawbuf;
     int npages;
     int nbuf;
     int bufsize;
diff -r fc11c91e5371 -r da5c5fc8908f xen/include/asm-x86/xenoprof.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-x86/xenoprof.h    Wed Nov 22 09:48:42 2006 +0000
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * asm-x86/xenoprof.h
+ * xenoprof x86 arch specific header file
+ *
+ * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ASM_X86_XENOPROF_H__
+#define __ASM_X86_XENOPROF_H__
+
+int nmi_init(int *num_events, int *is_primary, char *cpu_type);
+int nmi_reserve_counters(void);
+int nmi_setup_events(void);
+int nmi_enable_virq(void);
+int nmi_start(void);
+void nmi_stop(void);
+void nmi_disable_virq(void);
+void nmi_release_counters(void);
+
+#define xenoprof_arch_init(num_events, is_primary, cpu_type)    \
+    nmi_init(num_events, is_primary, cpu_type)
+#define xenoprof_arch_reserve_counters()        nmi_reserve_counters()
+#define xenoprof_arch_setup_events()            nmi_setup_events()
+#define xenoprof_arch_enable_virq()             nmi_enable_virq()
+#define xenoprof_arch_start()                   nmi_start()
+#define xenoprof_arch_stop()                    nmi_stop()
+#define xenoprof_arch_disable_virq()            nmi_disable_virq()
+#define xenoprof_arch_release_counters()        nmi_release_counters()
+
+int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
+
+#endif /* __ASM_X86_XENOPROF_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

_______________________________________________
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] [XENOPROFILE] Replace x86 specific code in xen/common/xenoprof.c, Xen patchbot-unstable <=