Skip to contentSkip to conversation

x86/setup: don't relocate the VGA hole

PATCH Superseded Tim Deegan 4 participants 6 messages Feb 7, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/1 x86/setup: don't relocate the VGA hole

# HG changeset patch
# User Tim Deegan <[email protected]>
# Date 1360259288 0
# Node ID 7feb83e3f79a3094e3002560c896a9ee97f1e907 # Parent 6c1b12c884b4521a940e079c8dfebc5d8e88d2e9 x86/setup: don't relocate the VGA hole.

Copying the contents of the VGA hole is at best pointless and at worst dangerous. Booting Xen on Xen, it causes a very long delay as each byte is referred to qemu.

Since we were already discarding the first 1MB of the relocated area, just avoid copying it in the first place.

xen/arch/x86/setup.c +2 -5
diff -r 6c1b12c884b4 -r 7feb83e3f79a xen/arch/x86/setup.c
@@ -826,7 +826,6 @@ void __init __start_xen(unsigned long mb
             l3_pgentry_t *pl3e;
             l2_pgentry_t *pl2e;
             int i, j, k;
-            void *dst;
 
             /* Select relocation address. */
             e = end - reloc_size;
@@ -840,10 +839,8 @@ void __init __start_xen(unsigned long mb
              * data until after we have switched to the relocated pagetables!
              */
             barrier();
-            dst = move_memory(e, 0, (unsigned long)&_end - XEN_VIRT_START, 1);
-
-            /* Poison low 1MB to detect stray pointers to physical 0-1MB. */
-            memset(dst, 0x55, 1U << 20);
+            move_memory(e + (1u << 20), (1u << 20),
+                      ((unsigned long)&_end - XEN_VIRT_START) - (1u << 20), 1);
 
             /* Walk initial pagetables, relocating page directory entries. */
             pl4e = __va(__pa(idle_pg_table));
#1 lore raw

xen/arch/x86/setup.c void __init __start_xen(unsigned long mb · line 846

Quoted 8 lines
xen/arch/x86/setup.c +0 -4
@@ -840,10 +839,8 @@ void __init __start_xen(unsigned long mb
              * data until after we have switched to the relocated pagetables!
              */
             barrier();
-            dst = move_memory(e, 0, (unsigned long)&_end - XEN_VIRT_START, 1);
-
-            /* Poison low 1MB to detect stray pointers to physical 0-1MB. */
-            memset(dst, 0x55, 1U << 20);

Is this poisoning not still desirable?

Quoted 3 lines
xen/arch/x86/setup.c +2 -0
+            move_memory(e + (1u << 20), (1u << 20),
+                      ((unsigned long)&_end - XEN_VIRT_START) - (1u << 20), 1);
 
#2 lore raw
Quoted 4 lines · Ian Campbell
Quoted 4 lines
(quoted diff) +0 -0
@@ -840,10 +839,8 @@ void __init __start_xen(unsigned long mb
              * data until after we have switched to the relocated

pagetables!

              */
Quoted 8 lines

xen/arch/x86/setup.c void __init __start_xen(unsigned long mb · line 846

Quoted 6 lines
             barrier();

- dst = move_memory(e, 0, (unsigned long)&_end - XEN_VIRT_START,
1);

xen/arch/x86/setup.c +0 -3
-
-            /* Poison low 1MB to detect stray pointers to physical 0-1MB. */
-            memset(dst, 0x55, 1U << 20);

Is this poisoning not still desirable?

If we don't copy that low 1MB I don't see any reason to poison it at the destination.

Quoted 3 lines
Quoted 3 lines
(quoted diff) +2 -0
+            move_memory(e + (1u << 20), (1u << 20),
+                      ((unsigned long)&_end - XEN_VIRT_START) - (1u << 20),

1);

1MB here is actually something of a magic number. We could make use of _start instead, eg:

off = (ulong)&_start - XEN_VIRT_START; move_memory(e + off, off, (ulong)&_end - (ulong)&_start, 1);

This would be my preference.

-- Keir

Quoted 7 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 15 lines · Keir Fraser
Quoted 4 lines · Ian Campbell
Quoted 4 lines
(quoted diff) +0 -0
@@ -840,10 +839,8 @@ void __init __start_xen(unsigned long mb
              * data until after we have switched to the relocated

pagetables!

              */
Quoted 8 lines

xen/arch/x86/setup.c void __init __start_xen(unsigned long mb · line 846

Quoted 6 lines
             barrier();

- dst = move_memory(e, 0, (unsigned long)&_end - XEN_VIRT_START,
1);

xen/arch/x86/setup.c +0 -3
-
-            /* Poison low 1MB to detect stray pointers to physical 0-1MB. */
-            memset(dst, 0x55, 1U << 20);

Is this poisoning not still desirable?

Quoted 2 lines

If we don't copy that low 1MB I don't see any reason to poison it at the destination.

The poisoning was to protect against stray pointers out of the low 1MB region? I assumed it was against pointers into it...

Ian.

#4 lore raw
Quoted 17 lines · Ian Campbell
Quoted 16 lines · Keir Fraser
Quoted 13 lines · Ian Campbell
Quoted 11 lines
(quoted diff) +0 -0
@@ -840,10 +839,8 @@ void __init __start_xen(unsigned long mb
              * data until after we have switched to the relocated

pagetables!

              */
             barrier();

- dst = move_memory(e, 0, (unsigned long)&_end - XEN_VIRT_START,
1);

(quoted diff) +0 -2
-
-            /* Poison low 1MB to detect stray pointers to physical 0-1MB.

*/
- memset(dst, 0x55, 1U << 20);

Is this poisoning not still desirable?

Quoted 5 lines
Quoted 2 lines

If we don't copy that low 1MB I don't see any reason to poison it at the destination.

The poisoning was to protect against stray pointers out of the low 1MB region? I assumed it was against pointers into it...

I mean any stray pointers into that region are only going to see garbage at the relocated highmem address anyway, as contents of 0-1MB are no longer being copied. So deliberate poisoning seems even more paranoid than it already was (it was already really quite paranoid).

-- Keir

Quoted 2 lines

Ian.

#5 lore raw
Quoted 7 lines · Keir Fraser
Quoted 2 lines

The poisoning was to protect against stray pointers out of the low 1MB region? I assumed it was against pointers into it...

I mean any stray pointers into that region are only going to see garbage at the relocated highmem address anyway, as contents of 0-1MB are no longer being copied. So deliberate poisoning seems even more paranoid than it already was (it was already really quite paranoid).

Right, I assumed the idea was that you could recognise the 0x55...55 as being something more specific than random garbage. It is indeed quite paranoid ;-)

Ian.