Answering my own query here – I chased
down the problem to the fact that Dom0’s header files (specifically /usr/src/linux/include/xen/interface/xen.h
and /usr/src/linux/include/asm-x86_64/mach-xen/asm/hypercall.h) did NOT include
the hypercall definition. I think this is because the kernel I am using on dom0
does not match (or has a much older Xen set up within it) the one this
changeset is expected to build against?
I was thinking that a ‘make; make
install’ inside xen-unstable.hg/ would overwrite the existing headers in
Dom0 so that all new drivers will build against the fresh header-files. Did
this step fail because the header file locations in the latest changeset did
not match the ones that were already present in Dom0?
-Hemant
From:
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
[mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Mohapatra, Hemant
Sent: Thursday, May 01, 2008 12:22
PM
To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] issues adding
a small hypercall to Xen
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 */
+ .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 += rcupdate.o
+obj-y += 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 >
...
--- 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
---
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