Port-xen archive

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

Re: [suspend/resume] memory_op hypercall failure: XENMEM_maximum_gpfn



Manuel Bouyer wrote:
That's strange as the hypervisor already has this info, which it gives us
from xen_start_info.mfn_list. Anyway it shouldn't be hard to fill in this.

There is also machine_to_phys_mapping[] which is the opposite; this
one is also provided by Xen.
I had the exact same impression. Mini-os does it, and so does Linux (with a comment claiming that it is necessary for dump/save/restore). See mm.c in extra/mini-os, for example, or the Linux sources given with sysutils/xentools.

Commenting out those lines and using a mini-os guest results in the behavior I described above (error reporting p2m table as empty).

I am looking into it, but yes, this entry is redundant with the information available to hypervisor. The real purpose is unclear to me.
see the xpmap_phys_to_machine_mapping[] array, and xpmap_ptom().
in pmap.c this is used mainly by pmap_pa2pte().

xpmap_phys_to_machine_mapping[] is keept up to date by the NetBSD kernel,
machine_to_phys_mapping[] is updated though xpq_queue_machphys_update().
Ok, thanks

BTW, the patch-ad of sysutils/xentools uses mlock() to lock pages for the dump-core operation, with address (resp. len) rounded /down/ to page mask (resp. page size):

int lock_pages(void *addr, size_t len)
{
      int e = 0;
+      void *laddr = (void *)((u_long)addr & ~0xfffUL);
+      size_t llen = (len + 0xfffUL) & ~0xfffUL;
#ifndef __sun__
-      e = mlock(addr, len);
+      e = mlock(laddr, llen);
#endif
      return (e);
}

While the mlock() code for NetBSD (uvm/uvm_mmap.c) already rounds both /up/, and check bounds.

       /*
* align the address to a page boundary and adjust the size accordingly
        */

       pageoff = (addr & PAGE_MASK);
       addr -= pageoff;
       size += pageoff;
       size = (vsize_t)round_page(size);

Why is it so?

--
Jean-Yves Migeon
jean-yves.migeon%espci.fr@localhost




Home | Main Index | Thread Index | Old Index