[Lguest] Error inserting lg: Cannot allocate memory
Fabio Checconi
fabio at gandalf.sssup.it
Wed Mar 5 00:47:34 EST 2008
> From: Rusty Russell <rusty at rustcorp.com.au>
> Date: Tue, Mar 04, 2008 09:11:25PM +1100
>
...
> lguest should pass a valid "end" parameter, not some random constant.
>
> Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
> Cc: Robert Bragg <robert at sixbynine.org>
>
> diff -r f5dc1442dc61 drivers/lguest/core.c
> --- a/drivers/lguest/core.c Tue Mar 04 14:21:38 2008 +1100
> +++ b/drivers/lguest/core.c Tue Mar 04 21:06:41 2008 +1100
> @@ -71,9 +71,11 @@ static __init int map_switcher(void)
>
> /* Now we reserve the "virtual memory area" we want: 0xFFC00000
> * (SWITCHER_ADDR). We might not get it in theory, but in practice
> - * it's worked so far. */
> + * it's worked so far. The +1 is because __get_vm_area allocates a
> + * guard page, so we need space for that. */
> switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE,
> - VM_ALLOC, SWITCHER_ADDR, VMALLOC_END);
> + VM_ALLOC, SWITCHER_ADDR, SWITCHER_ADDR
> + + (TOTAL_SWITCHER_PAGES+1) * PAGE_SIZE);
> if (!switcher_vma) {
> err = -ENOMEM;
> printk("lguest: could not map switcher pages high\n");
With the original .config, VMALLOC_END was lower than SWITCHER_ADDR,
with this patch we may be forcing an allocation beyond VMALLOC_END,
and this may cause the allocated region to fall in the fixmap/PKMAP
area.
VMALLOC_END does not seem to be a random constant, as, e.g.,
get_vm_area() is still returning:
__get_vm_area(size, flags, VMALLOC_START, VMALLOC_END)
I apologize in advance if I'm missing something trivial here.
More information about the Lguest
mailing list