]> Pileus Git - ~andy/linux/commitdiff
lguest: map Switcher below fixmap.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 22 Apr 2013 04:40:42 +0000 (14:10 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 22 Apr 2013 06:15:03 +0000 (15:45 +0930)
Now we've adjusted all the code, we can simply set switcher_addr to
wherever it needs to go below the fixmaps, rather than asserting that
it should be so.

With large NR_CPUS and PAE, people were hitting the "mapping switcher
would thwack fixmap" message.

Reported-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
arch/x86/include/asm/lguest.h
drivers/lguest/core.c

index 74edebd010aba1420052120c3c9de01fa8b51e46..e2d4a4afa8c3070374f3617fa405f5733b5624b1 100644 (file)
 /* Page for Switcher text itself, then two pages per cpu */
 #define TOTAL_SWITCHER_PAGES (1 + 2 * nr_cpu_ids)
 
-/* We map at -4M (-2M for PAE) for ease of mapping (one PTE page). */
-#ifdef CONFIG_X86_PAE
-#define SWITCHER_ADDR 0xFFE00000
-#else
-#define SWITCHER_ADDR 0xFFC00000
-#endif
 /* Where we map the Switcher, in both Host and Guest. */
 extern unsigned long switcher_addr;
 
index 7e1d7ee364788d10e78947fe320ec107517a7e78..0bf1e4edf04d04a838c9d4cdc8f96aa17dfaa896 100644 (file)
@@ -83,18 +83,13 @@ static __init int map_switcher(void)
                }
        }
 
-       switcher_addr = SWITCHER_ADDR;
-
        /*
-        * First we check that the Switcher won't overlap the fixmap area at
-        * the top of memory.  It's currently nowhere near, but it could have
-        * very strange effects if it ever happened.
+        * We place the Switcher underneath the fixmap area, which is the
+        * highest virtual address we can get.  This is important, since we
+        * tell the Guest it can't access this memory, so we want its ceiling
+        * as high as possible.
         */
-       if (switcher_addr + (TOTAL_SWITCHER_PAGES+1)*PAGE_SIZE > FIXADDR_START){
-               err = -ENOMEM;
-               printk("lguest: mapping switcher would thwack fixmap\n");
-               goto free_pages;
-       }
+       switcher_addr = FIXADDR_START - (TOTAL_SWITCHER_PAGES+1)*PAGE_SIZE;
 
        /*
         * Now we reserve the "virtual memory area" we want.  We might