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



On Tue, May 20, 2008 at 01:17:02AM +0200, Jean-Yves Migeon wrote:
> 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).

It unfortunate that it has a different format than xen_start_info.mfn_list.
We need to build it then, I guess. Fortunably, it shouldn't change beyond
boot or suspend/resume.


> [...]
> 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?

I just did change it to make it compile. As you can see I use the same
rounding as on linux, and I'm not sure why it wouldn't work here (mlock()
is supposed to be standard).

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index