Thanks, I've found out the reason it page-faulting is because I used malloc() to allocate the output buffer, which turns out to allocate lazily. Therefore the hypervisor page-fault because the memory is still waiting to be mapped by the kernel.
I simply touched all the allocated memory, and it works fine now. Cheers. On 7 November 2014 19:01, Andrew Cooper <andrew.coop...@citrix.com> wrote: > On 07/11/14 10:57, And Dinh wrote: > > how does it get page fault? I made sure the output buffer at the user > space is properly allocated with the correct size. > > When page fault, do I have no choice but abort? It seems calling the > hypercall again does not solve it. > > > And nothing guarentees that your userspace process is in context when Xen > is running, or that the kernel hasn't played with the pagetables behind > your back. > > You must use the hypercall buffer mechanism to avoid issues like this. > See the hypercall implementations in libxc. In Xen, you must have a > XEN_GUEST_HANDLE() which is an opaque reference to your buffer, and use > copy_{to,from}_guest() rather than {to/from}_user(), which is generally > only safe for kernel addresses. > > ~Andrew >
_______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel