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

[Xen-devel] Re: Lock memory pages

On Thu, 2010-11-18 at 16:57 +0000, Nimgaonkar, Satyajeet wrote:
> Hi Gianni,
>                  I have created a custom hypercall and I want to lock
> the memory pages for this hypercall. Below is the hypercall function I
> wrote in xc_domain.c in tools/libxc.

Ian Campbell is the guy you want to speak to about this issue.

I think you may also have misunderstood my last comment about using
paging to discover when contents of memory are modified.

My original comment was that it seems totally pointless to use a
cryptographically secure hash function to find out when pages are
modified when you can just mark them read-only and prevent their
modification! Then if you wish to allow modification you can use the
page-fault handler to mark them read-only and 'iret' to retry the
faulting instruction. I think Xen already has infrastructure for this
called 'dirty bit tracking'.

Anyway

> int hypercall_test(int handle){
>     
>     int rc;
>     int arg=0;
> 
>     /* Hypercall definitions */
>        
>     DECLARE_HYPERCALL;
>     hypercall.op     = __HYPERVISOR_jeet1;
>     //rc = do_xen_hypercall(handle, &hypercall);
>     hypercall.arg[0] = 0;
>     hypercall.arg[1] = (unsigned long)&arg;
>     if (lock_pages (&arg, sizeof(arg)) != 0)
>       printf ("Could not lock the pages");
>     else
>         printf ("Pages locked successfully");
>         
>         rc = do_xen_hypercall(handle, &hypercall);
>         printf("%d\n", rc);
>               
>     unlock_pages(&arg, sizeof(arg));          
>     
>     return rc;
> }
> 
> Everything compiles correctly and when I call this function from a
> testing program, a hypercall is made successfully along with locking
> pages. But I am not quite sure how to check if the memory pages have
> been locked or not. 
> 
> Can some one please let me know if this is the correct way to achieve
> this?

Is that how other hypercalls do it? Looks fine to me.

> Thanks
> 
> Regards,
> Satyajeet

Gianni


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

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