From: "Mohapatra, Hemant" Subject: issues adding a small hypercall to Xen Date: Thu, 1 May 2008 12:21:37 -0500 Message-ID: <9BCA02B0979C2A429C5965B8AE292698038ADB30@SAUSEXMB2.amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0315629618==" Return-path: Content-class: urn:content-classes:message List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============0315629618== Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C8ABAF.D06ABE73" This is a multi-part message in MIME format. ------_=_NextPart_001_01C8ABAF.D06ABE73 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable To begin with: I am using xen-unstable-3.2.0 changeset 16747.=20 =20 I am trying to add a small and quick Hypercall for some performance related testing on xen (using xenoprofile isn't feasible since we already have our tools working on native linux and would only like to add some features to make it work under Xen). The basic idea is that our application will issue a hypercall that we install into xen and then the hypercall does what we tell it to do and returns with the results. Here's a _trimmed/cleaned out_ version of the dummy hypercall, just to show you which files have been touched : =20 +++ xen-unstable.hg/xen/arch/x86/x86_32/entry.S 2008-04-25 21:44:11.000000000 -0500 @@ -682,6 +682,7 @@ .long do_kexec_op + .long do_perfcall_op /* 38 */ @@ -725,6 +726,7 @@ .byte 2 /* do_kexec_op */ + .byte 2 /* do_perfcall_op */ =20 =20 --- xen-unstable.hg-orig/xen/arch/x86/x86_64/entry.S 2008-04-22 14:14:57.000000000 -0500 +++ xen-unstable.hg/xen/arch/x86/x86_64/entry.S 2008-04-25 21:43:37.000000000 -0500 @@ -672,6 +672,7 @@ .quad do_kexec_op + .quad do_perfcall_op /*38 - added for perflab hack --hrm */ .rept NR_hypercalls-((.-hypercall_table)/8) =20 @@ -716,6 +717,7 @@ .byte 1 /* do_xsm_op */ + .byte 2 /* do_perfcall_op */ =20 --- xen-unstable.hg-orig/xen/common/Makefile 2008-04-22 14:14:57.000000000 -500 +++ xen-unstable.hg/xen/common/Makefile 2008-04-24 20:33:09.000000000 -0500 @@ -26,6 +26,7 @@ obj-y +=3D rcupdate.o +obj-y +=3D perfcall.o =20 --- xen-unstable.hg-orig/xen/common/perfcall.c 1969-12-31 18:00:00.000000000 -0600 +++ xen-unstable.hg/xen/common/perfcall.c 2008-04-30 21:55:56.000000000 -0500 @@ -0,0 +1,52 @@ ... ... =20 =20 =20 --- xen-unstable.hg-orig/xen/include/public/xen.h 2008-04-22 14:14:57.000000000 -0500 +++ xen-unstable.hg/xen/include/public/xen.h 2008-04-29 18:33:15.000000000 -0500 @@ -80,6 +80,7 @@ #define __HYPERVISOR_kexec_op 37 +#define __HYPERVISOR_perfcall_op 38 =20 --- xen-unstable.hg-orig/xen/include/xen/hypercall.h 2008-04-22 14:14:58.000000000 -0500 +++ xen-unstable.hg/xen/include/xen/hypercall.h 2008-04-25 18:27:35.000000000 -0500 @@ -116,6 +116,11 @@ +extern long +do_perfcall_op( + int cmd, + XEN_GUEST_HANDLE(void) arg); + =20 =20 -- =20 I 'make; make install' the modified xen. I see the 'do_perfcall_op' symbol in the latest /boot/xen-syms file.=20 =20 Now, I trying to compile a kernel driver on Dom0 that will call this hypercall via (HYPERVISOR_perfcall_op()). However, the compiler isn't able to translate HYPERVISOR_perfcall_op and errors out. If I use HYPERVISOR_xen_version() in its place, it works OK.=20 =20 I am guessing there is some header file I am not modifying that'll tell Dom0 about this new hypercall (although I do see an entry for __HYPERVISOR_perfcall_op in /usr/include/xen/xen.h)? Is it because the correct hypercall doesn't exist in the hypercall page at the right place? What am I missing? =20 Thanks for your inputs. Hemant ------_=_NextPart_001_01C8ABAF.D06ABE73 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

To begin with: I am using xen-unstable-3.2.0 changeset 16747. =

 

I am trying to add a small and quick Hypercall for some = performance related testing on xen (using xenoprofile isn’t feasible since we = already have our tools working on native linux and would only like to add some = features to make it work under Xen). The basic idea is that our application will = issue a hypercall that we install into xen and then the hypercall does what we = tell it to do and returns with the results. Here’s a _trimmed/cleaned out_ version of the dummy hypercall, just to show you which files have been = touched :

 

+++ xen-unstable.hg/xen/arch/x86/x86_32/entry.S   = 2008-04-25 21:44:11.000000000 -0500

@@ -682,6 +682,7 @@

         .long = do_kexec_op

+        .long do_perfcall_op        /* 38 = */

@@ -725,6 +726,7 @@

         .byte 2 /* do_kexec_op          = */

+        .byte 2 /* do_perfcall_op       */  =

 

--- xen-unstable.hg-orig/xen/arch/x86/x86_64/entry.S   2008-04-22 14:14:57.000000000 -0500

+++ xen-unstable.hg/xen/arch/x86/x86_64/entry.S   = 2008-04-25 21:43:37.000000000 -0500

@@ -672,6 +672,7 @@

         .quad = do_kexec_op

+        .quad do_perfcall_op      /*38 - added for perflab = hack --hrm */

         .rept NR_hypercalls-((.-hypercall_table)/8)

 

@@ -716,6 +717,7 @@

         .byte 1 /* do_xsm_op          &nbs= p; */

+        .byte 2 /* do_perfcall_op       = */

 

--- xen-unstable.hg-orig/xen/common/Makefile 2008-04-22 14:14:57.000000000 -500

+++ xen-unstable.hg/xen/common/Makefile 2008-04-24 = 20:33:09.000000000 -0500

@@ -26,6 +26,7 @@

obj-y +=3D rcupdate.o

+obj-y +=3D perfcall.o

 

--- xen-unstable.hg-orig/xen/common/perfcall.c    1969-12-31 18:00:00.000000000 -0600

+++ xen-unstable.hg/xen/common/perfcall.c    = 2008-04-30 21:55:56.000000000 -0500

@@ -0,0 +1,52 @@

           = ;            ...

<this is where the hypercall ‘do_perfcall_op’ is implemented; currently it just returns the xen-version = >

           = ;            ...          &nbs= p;         

 

 

--- xen-unstable.hg-orig/xen/include/public/xen.h 2008-04-22 14:14:57.000000000 -0500

+++ xen-unstable.hg/xen/include/public/xen.h 2008-04-29 18:33:15.000000000 -0500

@@ -80,6 +80,7 @@

#define __HYPERVISOR_kexec_op        &nbs= p;    37

+#define __HYPERVISOR_perfcall_op        &= nbsp; 38

 

--- xen-unstable.hg-orig/xen/include/xen/hypercall.h   2008-04-22 14:14:58.000000000 -0500

+++ xen-unstable.hg/xen/include/xen/hypercall.h   = 2008-04-25 18:27:35.000000000 -0500

@@ -116,6 +116,11 @@

+extern long

+do_perfcall_op(

+         int = cmd,

+  =        XEN_GUEST_HANDLE(void) arg);

+

 

 

--

 

I 'make; make install' the modified xen. I see the = 'do_perfcall_op' symbol in the latest /boot/xen-syms file.

 

Now, I trying to compile a kernel driver on Dom0 that will call = this hypercall via (HYPERVISOR_perfcall_op()). However, the compiler isn't = able to translate HYPERVISOR_perfcall_op and errors out. If I use HYPERVISOR_xen_version() in its place, it works OK. =

 

I am guessing there is some header file I am not modifying = that'll tell Dom0 about this new hypercall (although I do see an entry for __HYPERVISOR_perfcall_op in  /usr/include/xen/xen.h)? Is it because = the correct hypercall doesn't exist in the hypercall page at the right = place? What am I missing?

 

Thanks for your inputs.

Hemant

------_=_NextPart_001_01C8ABAF.D06ABE73-- --===============0315629618== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0315629618==--