Sending data from Xen
Forgive me if this is not the correct place to ask this question, but I suspect only someone fairly intimate with the Xen source code will be able to provide an answer. My goal is to be able to send a stream of data from the xen hypervisor itself to dom0. My first thought on how to do this was simply to have the hypervisor implement a device that could be exported to dom0 and used just like any other split device driver. Unfortunately this does not appear to be a common thing and I have only found examples of how to offer the shared pages of the device from a domain, not from the hypervisor itself. Although it appears that the code sets up a grant table for the hypervisor, I cannot see that it is actually used, nor do I see any mechanism for allocating grant entries for use (allocating as in marking them as valid, not as in allocating memory for them). So I'm starting to wonder if the hypervisor uses grant tables at all. Soooo ....
Given my goal, am I going down the wrong track here? Is there a simpler, quicker, better mechanism for doing what I need to do? Should I perhaps be investigating xenprof instead?
If providing a device that they hypervisor can export, should I be using the grant table mechanism or not?
Thanks for your patience.
Bernie Lofaso
Reading HVM guest memory
Hi,
I'm trying to pass some information from an HVM guest to the hypervisor. The guest kernel allocates a buffer and writes all the necessary stuff in it. It then makes a hypercall (hvm_op) to notify Xen of the buffer location.
My problem is that I can't read the buffer from the hypervisor. The pointer is being passed correctly. I tried copying it to a local buffer via copy_from_user() function but this function fails. I noticed that access_ok() function fails for this pointer, so I tried to use the __copy_from_user_ll() function. All to no avail.
How can I read this guest buffer which resides in guest kernel space?
The information I'm trying to pass is simple events like a module being loaded or a new page allocation. There are 4 types of events alltogether so I could make individual hypercalls for each. But I'm curious why I cann't read the guest memory. Also if there is an easier way of passing information from an HVM guest to Xen, I'd love to hear it.
Thanks in advance.
John
PS. I'm using 64-bit guest.
Re: Reading HVM guest memory
Quoted 5 lines
My problem is that I can't read the buffer from the hypervisor. The pointer is being passed correctly. I tried copying it to a local buffer via
copy_from_user()function but this function fails. I noticed thataccess_ok()function fails for this pointer, so I tried to use the__copy_from_user_ll()function. All to no avail.
I think you want to use copy_from_user_hvm()
Mike
Re: Reading HVM guest memory
Quoted 9 lines
Quoted 5 lines
My problem is that I can't read the buffer from the hypervisor. The pointer is being passed correctly. I tried copying it to a local buffer via
copy_from_user()function but this function fails. I noticed thataccess_ok()function fails for this pointer, so I tried to use the__copy_from_user_ll()function. All to no avail.I think you want to use
copy_from_user_hvm()Mike
Worked like a charm. Thank you very much!
John
Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel