[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Correctly mapping in a Dom0 page globally


  • To: Xen-devel@xxxxxxxxxxxxx
  • From: Bread Cutter <cutter409@xxxxxxxxx>
  • Date: Sat, 7 Nov 2015 14:02:41 -0500
  • Delivery-date: Sat, 07 Nov 2015 19:03:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Hello all,

I'm mapping in some memory from Dom0 to use globally, based on a
domctl that sends up a virtual address. It seems to be working for me
so far.

Here's my current code
----------------
{
    struct page_info* page_info = NULL;
    l1_pgentry_t pte;

    /* Attempt to read the PTE that maps the VA being accessed. */
    guest_get_eff_l1e(current, va, &pte);

    /* Make sure the page is present */
    if ( ((l1e_get_flags(pte) & (_PAGE_PRESENT)) != _PAGE_PRESENT) )
    {
        ret = -ENOMEM;
        break;
    }

    /* Get the page_info struct */
    page_info = l1e_get_page(pte);
    if ( !page_info )
    {
        ret = -ESRCH;
        break;
   }

    d->arch.hvm_domain.test.buffer =
(uint8_t*)__map_domain_page_global(page_info);
    if ( !d->arch.hvm_domain.test.buffer )
    {
        ret = -ESRCH;
        break;
    }
----------------

In the unmap function, I simply call
"map_domain_page_global(d->arch.hvm_domain.test.buffer)"

My concern is that I'm not actually calling get_page()/put_page().
The function "l1e_get_page()" seems to always succeed, but simply does
some math to find the structure. It doesn't end up calling get_page()
and incrementing the reference count.

My question is, am I doing this correctly? Will l1e_get_page() always
succeed? I was having issues getting get_page() and put_page() to work
using the pte.

Any comments will be greatly appreciated.

Thanks!

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.