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

Re: [Xen-devel] Xen File functions

To: sowmya dayanand <sowmyad@xxxxxxxxx>
Subject: Re: [Xen-devel] Xen File functions
From: Rob Gardner <rob.gardner@xxxxxx>
Date: Sun, 30 Oct 2005 21:49:06 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 31 Oct 2005 04:46:23 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <83c5685b0510301641scfcee4fl36a204b368ff055a@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <83c5685b0510301641scfcee4fl36a204b368ff055a@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
sowmya dayanand wrote:

Hi,

We are trying to modify the file /xen-2.0/xen/common/dom0_ops.c function: long do_dom0_op(dom0_op_t *u_dom0_op) to log all the calls made. We need to write all these calls to a file. I am not able to use standard C functions ( fopen , fprintf) as we get compilation error. Are there any xen specific functions that we need to use to read/write files?


Since I/O in Xen is done by the "device domains", the Xen hypervisor itself cannot simply open files and write data. Where would the files reside? I can think of a few possible solutions for you off the top of my head. First, consider hooking the dom0_op on the calling side. The do_dom0_op() call that is used by most (if not all) the hypercalls is just user code in a shared library. Just make your own version of tools/libxc/xc_private.c with the logging you like, then compile it up to create a new shared library. Install that, and you will be logging hypercalls, since most code I believe is linked against the shared library, so any executable will automatically run your code. If that doesn't work, you can hook in a little bit deeper; The hypercall as made from a domain is actually an ioctl() made to a pseudo-driver. Look at linux-2.6.12-xen0/drivers/xen/privcmd/privcmd.c. This doesn't completely solve your problem, but it will be much easier to do file I/O from the linux kernel that it will be from xen. If these two ideas fail for some reason, or if you insist on working within the hypervisor, the other possibliity is to log the calls in common/dom0_ops.c to a memory buffer, then share that memory bufer with a dom0 user app that periodically reads the stuff out of it. This is basically how the xen trace buffer works. For that matter, you might be able to just use the xen trace buffers if there is enough space in the trace() parameters to hold all the information you need. Hope one of these ideas proves useful to you.

Rob Gardner
Hewlett Packard



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>