All of lore.kernel.org
 help / color / mirror / Atom feed
* Cannot access memory beyond end of bootstrap direct-map area
@ 2010-03-18  9:18 Florian Wagner
  2010-03-18  9:22 ` Keir Fraser
  2010-03-18 22:03 ` Keir Fraser
  0 siblings, 2 replies; 11+ messages in thread
From: Florian Wagner @ 2010-03-18  9:18 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 933 bytes --]

Hi,

there was a thread about this problem on xen-users and xen-devel, where
on 32-bit systems using grub2 Xen doesn't boot but crashes with this
error.

Keir Fraser wrote:

> But I will help someone get 32-bit Xen working with GRUB2 if they are
> really stuck and are capable of applying, building and testing my
> patches.

I am stuck with a bunch of 32bit systems and willing and capable of
applying and testing patches.


Regards
Florian Wagner

--------------

Florian Wagner
Abteilung EDV
Telefon: 0821 / 4201 - 453
Fax: 0821 / 4201 - 411
E-Mail: f_wagner@syscomp.de

Syscomp Biochemische Dienstleistungen GmbH
August-Wessels-Straße 5, 86154 Augsburg
Postfach 102506, 86015 Augsburg
Telefon: 0821 / 4201 - 0
Fax: 0821 / 417992
Web: http://www.syscomp.de
E-Mail: syscomp@syscomp.de

Geschäftsführer:
  Dr. med. Bernd Schottdorf
  Gabriele Schottdorf

Registergericht Augsburg HRB 8670

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot access memory beyond end of bootstrap direct-map area
  2010-03-18  9:18 Cannot access memory beyond end of bootstrap direct-map area Florian Wagner
@ 2010-03-18  9:22 ` Keir Fraser
  2010-03-18 22:03 ` Keir Fraser
  1 sibling, 0 replies; 11+ messages in thread
From: Keir Fraser @ 2010-03-18  9:22 UTC (permalink / raw)
  To: Florian Wagner, xen-devel

On 18/3/10 09:18, "Florian Wagner" <f_wagner@syscomp.de> wrote:

>> But I will help someone get 32-bit Xen working with GRUB2 if they are
>> really stuck and are capable of applying, building and testing my
>> patches.
> 
> I am stuck with a bunch of 32bit systems and willing and capable of
> applying and testing patches.

I'm on holiday this week. I'll sort out a patch probably on Monday.

 -- Keir

> Regards
> Florian Wagner
> 
> --------------
> 
> Florian Wagner
> Abteilung EDV
> Telefon: 0821 / 4201 - 453
> Fax: 0821 / 4201 - 411
> E-Mail: f_wagner@syscomp.de
> 
> Syscomp Biochemische Dienstleistungen GmbH
> August-Wessels-Straße 5, 86154 Augsburg
> Postfach 102506, 86015 Augsburg
> Telefon: 0821 / 4201 - 0
> Fax: 0821 / 417992
> Web: http://www.syscomp.de
> E-Mail: syscomp@syscomp.de
> 
> Geschäftsführer:
>   Dr. med. Bernd Schottdorf
>   Gabriele Schottdorf
> 
> Registergericht Augsburg HRB 8670

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot access memory beyond end of bootstrap direct-map area
  2010-03-18  9:18 Cannot access memory beyond end of bootstrap direct-map area Florian Wagner
  2010-03-18  9:22 ` Keir Fraser
@ 2010-03-18 22:03 ` Keir Fraser
  2010-03-24  7:16   ` Florian Wagner
  1 sibling, 1 reply; 11+ messages in thread
From: Keir Fraser @ 2010-03-18 22:03 UTC (permalink / raw)
  To: Florian Wagner, xen-devel

[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]

On 18/3/10 09:18, "Florian Wagner" <f_wagner@syscomp.de> wrote:

>> But I will help someone get 32-bit Xen working with GRUB2 if they are
>> really stuck and are capable of applying, building and testing my
>> patches.
> 
> I am stuck with a bunch of 32bit systems and willing and capable of
> applying and testing patches.

Okay, please try the attached patch. You only need to rebuild/install the
hypervisor itself (xen.gz). If it works okay for you I will apply it to the
next stable releases of 4.0 and 3.4.

 -- Keir


> 
> Regards
> Florian Wagner
> 
> --------------
> 
> Florian Wagner
> Abteilung EDV
> Telefon: 0821 / 4201 - 453
> Fax: 0821 / 4201 - 411
> E-Mail: f_wagner@syscomp.de
> 
> Syscomp Biochemische Dienstleistungen GmbH
> August-Wessels-Straße 5, 86154 Augsburg
> Postfach 102506, 86015 Augsburg
> Telefon: 0821 / 4201 - 0
> Fax: 0821 / 417992
> Web: http://www.syscomp.de
> E-Mail: syscomp@syscomp.de
> 
> Geschäftsführer:
>   Dr. med. Bernd Schottdorf
>   Gabriele Schottdorf
> 
> Registergericht Augsburg HRB 8670


[-- Attachment #2: 00-reloc --]
[-- Type: application/octet-stream, Size: 2314 bytes --]

diff -r 7b63f677f245 xen/arch/x86/boot/Makefile
--- a/xen/arch/x86/boot/Makefile	Thu Mar 18 11:03:07 2010 +0000
+++ b/xen/arch/x86/boot/Makefile	Thu Mar 18 18:05:31 2010 +0000
@@ -4,6 +4,6 @@
 
 BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\+BOOT_TRAMPOLINE[[:space:]]\+,,p' $(BASEDIR)/include/asm-x86/config.h)
 %.S: %.c
-	RELOC=$(BOOT_TRAMPOLINE) $(MAKE) -f build32.mk $@
+	RELOC=$(BOOT_TRAMPOLINE) XEN_BITSPERLONG=$(patsubst x86_%,%,$(TARGET_SUBARCH)) $(MAKE) -f build32.mk $@
 
 reloc.S: $(BASEDIR)/include/asm-x86/config.h
diff -r 7b63f677f245 xen/arch/x86/boot/build32.mk
--- a/xen/arch/x86/boot/build32.mk	Thu Mar 18 11:03:07 2010 +0000
+++ b/xen/arch/x86/boot/build32.mk	Thu Mar 18 18:05:31 2010 +0000
@@ -22,6 +22,6 @@
 	$(LD) $(LDFLAGS_DIRECT) -N -Ttext $(RELOC) -o $@ $<
 
 %.o: %.c
-	$(CC) $(CFLAGS) -c $< -o $@
+	$(CC) $(CFLAGS) -DXEN_BITSPERLONG=$(XEN_BITSPERLONG) -c $< -o $@
 
 reloc.o: $(BASEDIR)/include/asm-x86/config.h
diff -r 7b63f677f245 xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c	Thu Mar 18 11:03:07 2010 +0000
+++ b/xen/arch/x86/boot/reloc.c	Thu Mar 18 18:05:31 2010 +0000
@@ -70,8 +70,28 @@
             (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t));
         mbi->mods_addr = (u32)mods;
         for ( i = 0; i < mbi->mods_count; i++ )
+        {
+#if XEN_BITSPERLONG == 32
+            /*
+             * 32-bit Xen only maps bottom 1GB of memory at boot time.
+             * Relocate modules which extend beyond this (GRUB2 in particular
+             * likes to place modules as high as possible below 4GB).
+             */
+#define BOOTMAP_END (1ul<<30) /* 1GB */
+            static void *mod_alloc = (void *)BOOTMAP_END;
+            u32 mod_len = mods[i].mod_end - mods[i].mod_start;
+            if ( mods[i].mod_end > BOOTMAP_END )
+            {
+                mod_alloc = (void *)
+                    (((unsigned long)mod_alloc - mod_len) & ~15ul);
+                mods[i].mod_start = (u32)memcpy(
+                    mod_alloc, (char *)mods[i].mod_start, mod_len);
+                mods[i].mod_end = mods[i].mod_start + mod_len;
+            }
+#endif
             if ( mods[i].string )
                 mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
+        }
     }
 
     if ( mbi->flags & MBI_MEMMAP )

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot access memory beyond end of bootstrap direct-map area
  2010-03-18 22:03 ` Keir Fraser
@ 2010-03-24  7:16   ` Florian Wagner
  2010-03-24  8:35     ` Keir Fraser
  0 siblings, 1 reply; 11+ messages in thread
From: Florian Wagner @ 2010-03-24  7:16 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1724 bytes --]

> Okay, please try the attached patch. You only need to rebuild/install
> the hypervisor itself (xen.gz). If it works okay for you I will apply
> it to the next stable releases of 4.0 and 3.4.

The patch didn't apply cleanly to the xen 3.4.2 release so I modified
it to do so (see attached reloc-3.4.2).

All it did is turn the original problem into another one. I now get a
"elf_init: not an ELF binary" error instead.

For reference I've attached the full Xen Hypervisor output of unpatched
and patched versions. Also the GRUB2 entries I use to boot look like
this:

  menuentry "Xen Unpatched" {
    insmod ext2
    set root='(hd0,4)'
    multiboot /xen-unpatched.gz dummy=dummy noreboot com1=38400,8n1 console=com1 sync_console
    module /vmlinuz-2.6.26-2-xen-686 dummy=dummy root=UUID=29475092-583f-4a90-9bac-c5afda9ac352 ro pci=nomsi
    module /initrd.img-2.6.26-2-xen-686
  }
  
  menuentry "Xen Patched" {
    insmod ext2
    set root='(hd0,4)'
    multiboot /xen-patched.gz dummy=dummy noreboot com1=38400,8n1 console=com1 sync_console
    module /vmlinuz-2.6.26-2-xen-686 dummy=dummy root=UUID=29475092-583f-4a90-9bac-c5afda9ac352 ro pci=nomsi
    module /initrd.img-2.6.26-2-xen-686
  }


Regards
Florian Wagner

--------------

Florian Wagner
Abteilung EDV
Telefon: 0821 / 4201 - 453
Fax: 0821 / 4201 - 411
E-Mail: f_wagner@syscomp.de

Syscomp Biochemische Dienstleistungen GmbH
August-Wessels-Straße 5, 86154 Augsburg
Postfach 102506, 86015 Augsburg
Telefon: 0821 / 4201 - 0
Fax: 0821 / 417992
Web: http://www.syscomp.de
E-Mail: syscomp@syscomp.de

Geschäftsführer:
  Dr. med. Bernd Schottdorf
  Gabriele Schottdorf

Registergericht Augsburg HRB 8670

[-- Attachment #1.1.2: output-patched.txt --]
[-- Type: text/plain, Size: 2910 bytes --]

 __  __            _____ _  _    ____  
 \ \/ /___ _ __   |___ /| || |  |___ \ 
  \  // _ \ '_ \    |_ \| || |_   __) |
  /  \  __/ | | |  ___) |__   _| / __/ 
 /_/\_\___|_| |_| |____(_) |_|(_)_____|
                                       
(XEN) Xen version 3.4.2 (root@syscomp.de) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) Tue Mar 23 14:48:26 CET 2010
(XEN) Latest ChangeSet: unavailable
(XEN) Console output is synchronous.
(XEN) Command line: noreboot com1=38400,8n1 console=com1 sync_console
(XEN) Video information:
(XEN)  VGA is text mode 80x25, font 8x16
(XEN) Disc information:
(XEN)  Found 1 MBR signatures
(XEN)  Found 1 EDD information structures
(XEN) Xen-e820 RAM map:
(XEN)  0000000000000000 - 000000000009f800 (usable)
(XEN)  000000000009f800 - 00000000000a0000 (reserved)
(XEN)  00000000000ca000 - 0000000000100000 (reserved)
(XEN)  0000000000100000 - 000000007fef0000 (usable)
(XEN)  000000007fef0000 - 000000007feff000 (ACPI data)
(XEN)  000000007feff000 - 000000007ff00000 (ACPI NVS)
(XEN)  000000007ff00000 - 000000007ff80000 (usable)
(XEN)  000000007ff80000 - 0000000080000000 (reserved)
(XEN)  00000000fec00000 - 00000000fec04000 (reserved)
(XEN)  00000000fee00000 - 00000000fee01000 (reserved)
(XEN)  00000000fff80000 - 0000000100000000 (reserved)
(XEN) System RAM: 2047MB (2096188kB)
(XEN) ACPI: RSDP 000F7100, 0014 (r0 PTLTD )
(XEN) ACPI: RSDT 7FEFCF28, 002C (r1 PTLTD    RSDT    6040000  LTP        0)
(XEN) ACPI: FACP 7FEFEF2E, 0074 (r1 AMD    TECATE    6040000 PTL     F4240)
(XEN) ACPI: DSDT 7FEFCF54, 1FDA (r1    AMD  AMDACPI  6040000 MSFT  100000D)
(XEN) ACPI: FACS 7FEFFFC0, 0040
(XEN) ACPI: APIC 7FEFEFA2, 005E (r1 PTLTD        APIC    6040000  LTP        0)
(XEN) Xen heap: 9MB (9768kB)
(XEN) Domain heap initialised
(XEN) Processor #1 6:8 APIC version 16
(XEN) Processor #0 6:8 APIC version 16
(XEN) IOAPIC[0]: apic_id 2, version 17, address 0xfec00000, GSI 0-23
(XEN) Enabling APIC mode:  Flat.  Using 1 I/O APICs
(XEN) Using scheduler: SMP Credit Scheduler (credit)
(XEN) Detected 2000.113 MHz processor.
(XEN) CPU0: AMD Athlon(tm) MP 2400+ stepping 01
(XEN) Booting processor 1/0 eip 8c000
(XEN) CPU1: AMD Athlon(tm) Processor stepping 01
(XEN) Total of 2 processors activated.
(XEN) ENABLING IO-APIC IRQs
(XEN)  -> Using new ACK method
(XEN) checking TSC synchronization across 2 CPUs: passed.
(XEN) Platform timer is 3.579MHz ACPI PM Timer
(XEN) Brought up 2 CPUs
(XEN) I/O virtualisation disabled
(XEN) CPUIDLE: disabled due to no HPET. Force enable with 'cpuidle'.
(XEN) mtrr: your CPUs had inconsistent fixed MTRR settings
(XEN) *** LOADING DOMAIN 0 ***
(XEN) elf_init: not an ELF binary
(XEN) 
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Could not set up DOM0 guest OS
(XEN) ****************************************
(XEN) 
(XEN) Manual reset required ('noreboot' specified)

[-- Attachment #1.1.3: output-unpatched.txt --]
[-- Type: text/plain, Size: 2749 bytes --]

 __  __            _____ _  _    ____  
 \ \/ /___ _ __   |___ /| || |  |___ \ 
  \  // _ \ '_ \    |_ \| || |_   __) |
  /  \  __/ | | |  ___) |__   _| / __/ 
 /_/\_\___|_| |_| |____(_) |_|(_)_____|
                                       
(XEN) Xen version 3.4.2 (root@syscomp.de) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) Wed Mar 24 08:07:02 CET 2010
(XEN) Latest ChangeSet: unavailable
(XEN) Console output is synchronous.
(XEN) Command line: noreboot com1=38400,8n1 console=com1 sync_console
(XEN) Video information:
(XEN)  VGA is text mode 80x25, font 8x16
(XEN) Disc information:
(XEN)  Found 1 MBR signatures
(XEN)  Found 1 EDD information structures
(XEN) Xen-e820 RAM map:
(XEN)  0000000000000000 - 000000000009f800 (usable)
(XEN)  000000000009f800 - 00000000000a0000 (reserved)
(XEN)  00000000000ca000 - 0000000000100000 (reserved)
(XEN)  0000000000100000 - 000000007fef0000 (usable)
(XEN)  000000007fef0000 - 000000007feff000 (ACPI data)
(XEN)  000000007feff000 - 000000007ff00000 (ACPI NVS)
(XEN)  000000007ff00000 - 000000007ff80000 (usable)
(XEN)  000000007ff80000 - 0000000080000000 (reserved)
(XEN)  00000000fec00000 - 00000000fec04000 (reserved)
(XEN)  00000000fee00000 - 00000000fee01000 (reserved)
(XEN)  00000000fff80000 - 0000000100000000 (reserved)
(XEN) 
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Cannot access memory beyond end of bootstrap direct-map area
(XEN) ****************************************
(XEN) 
(XEN) Manual reset required ('noreboot' specified)
(XEN) Unknown interrupt (cr2=00000000)
(XEN)   ff204084  5fe00000  00000002  ff22be54  00000082  00000002  ff1d78dc  ff1d78dc  ff14efa6  0000e008  00000286  5fe00000  ff204084  00000002  00000000  00000082  5fe00000  00000082  ff122ec5  ff1d77bc  00000082  ff1d0768  ff22bea4  ff1d77c0  0000000a  60400000  ff1f8424  ff1d0768  00000001  ff1c56e4  ff1e8250  ff249ac0  6120a800  60243000  ff1f8997  ff203680  ff08c298  ff08cbd0  00000010  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  ff1e8250  ff08bf60  00000000  00000000  00000000  00000000  00000000  0008bf60  00000000  00000000  ff08bfc0  01295600  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  ffea4980  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000008  0000006e  00000001  00000003  000002f8  00000000  00000000  001e0d70  ff260040  0007feac  ff10006c  0008bfc0  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  00000000  fffff000

[-- Attachment #1.1.4: reloc-3.4.2 --]
[-- Type: application/octet-stream, Size: 2594 bytes --]

diff -Naur xen-3.4.2/xen/arch/x86/boot/build32.mk xen-3.4.2-patched/xen/arch/x86/boot/build32.mk
--- xen-3.4.2/xen/arch/x86/boot/build32.mk	2009-11-10 16:12:57.000000000 +0100
+++ xen-3.4.2-patched/xen/arch/x86/boot/build32.mk	2010-03-19 07:52:23.657000576 +0100
@@ -19,7 +19,7 @@
 	$(OBJCOPY) -O binary $< $@
 
 %.lnk: %.o
-	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x8c000 -o $@ $<
+	$(LD) $(LDFLAGS_DIRECT) -N -Ttext $(RELOC) -o $@ $<
 
 %.o: %.c
-	$(CC) $(CFLAGS) -c $< -o $@
+	$(CC) $(CFLAGS) -DXEN_BITSPERLONG=$(XEN_BITSPERLONG) -c $< -o $@
diff -Naur xen-3.4.2/xen/arch/x86/boot/Makefile xen-3.4.2-patched/xen/arch/x86/boot/Makefile
--- xen-3.4.2/xen/arch/x86/boot/Makefile	2009-11-10 16:12:57.000000000 +0100
+++ xen-3.4.2-patched/xen/arch/x86/boot/Makefile	2010-03-19 07:51:07.561270017 +0100
@@ -2,6 +2,6 @@
 
 head.o: reloc.S
 
-# NB. BOOT_TRAMPOLINE == 0x8c000
+BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\+BOOT_TRAMPOLINE[[:space:]]\+,,p' $(BASEDIR)/include/asm-x86/config.h)
 %.S: %.c
-	RELOC=0x8c000 $(MAKE) -f build32.mk $@
+	RELOC=$(BOOT_TRAMPOLINE) XEN_BITSPERLONG=$(patsubst x86_%,%,$(TARGET_SUBARCH)) $(MAKE) -f build32.mk $@
diff -Naur xen-3.4.2/xen/arch/x86/boot/reloc.c xen-3.4.2-patched/xen/arch/x86/boot/reloc.c
--- xen-3.4.2/xen/arch/x86/boot/reloc.c	2009-11-10 16:12:57.000000000 +0100
+++ xen-3.4.2-patched/xen/arch/x86/boot/reloc.c	2010-03-19 07:50:23.317529357 +0100
@@ -70,8 +70,28 @@
             (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t));
         mbi->mods_addr = (u32)mods;
         for ( i = 0; i < mbi->mods_count; i++ )
+        {
+#if XEN_BITSPERLONG == 32
+            /*
+             * 32-bit Xen only maps bottom 1GB of memory at boot time.
+             * Relocate modules which extend beyond this (GRUB2 in particular
+             * likes to place modules as high as possible below 4GB).
+             */
+#define BOOTMAP_END (1ul<<30) /* 1GB */
+            static void *mod_alloc = (void *)BOOTMAP_END;
+            u32 mod_len = mods[i].mod_end - mods[i].mod_start;
+            if ( mods[i].mod_end > BOOTMAP_END )
+            {
+                mod_alloc = (void *)
+                    (((unsigned long)mod_alloc - mod_len) & ~15ul);
+                mods[i].mod_start = (u32)memcpy(
+                    mod_alloc, (char *)mods[i].mod_start, mod_len);
+                mods[i].mod_end = mods[i].mod_start + mod_len;
+            }
+#endif
             if ( mods[i].string )
                 mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
+        }
     }
 
     if ( mbi->flags & MBI_MEMMAP )

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot access memory beyond end of bootstrap direct-map area
  2010-03-24  7:16   ` Florian Wagner
@ 2010-03-24  8:35     ` Keir Fraser
  2010-03-24  9:32       ` Florian Wagner
  0 siblings, 1 reply; 11+ messages in thread
From: Keir Fraser @ 2010-03-24  8:35 UTC (permalink / raw)
  To: Florian Wagner; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

On 24/03/2010 07:16, "Florian Wagner" <f_wagner@syscomp.de> wrote:

>> Okay, please try the attached patch. You only need to rebuild/install
>> the hypervisor itself (xen.gz). If it works okay for you I will apply
>> it to the next stable releases of 4.0 and 3.4.
> 
> The patch didn't apply cleanly to the xen 3.4.2 release so I modified
> it to do so (see attached reloc-3.4.2).
> 
> All it did is turn the original problem into another one. I now get a
> "elf_init: not an ELF binary" error instead.

Please try the attached patch, which applies on top of the previous patch.

  -- Keir


[-- Attachment #2: 00-reloc --]
[-- Type: application/octet-stream, Size: 2279 bytes --]

diff -r 0475c567c708 xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c	Tue Mar 23 09:37:59 2010 +0000
+++ b/xen/arch/x86/boot/reloc.c	Wed Mar 24 08:32:36 2010 +0000
@@ -68,29 +68,37 @@
     {
         module_t *mods = reloc_mbi_struct(
             (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t));
+        u32 max_addr = 0;
+
         mbi->mods_addr = (u32)mods;
+
         for ( i = 0; i < mbi->mods_count; i++ )
         {
-#if XEN_BITSPERLONG == 32
-            /*
-             * 32-bit Xen only maps bottom 1GB of memory at boot time.
-             * Relocate modules which extend beyond this (GRUB2 in particular
-             * likes to place modules as high as possible below 4GB).
-             */
+            if ( mods[i].string )
+                mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
+            if ( mods[i].mod_end > max_addr )
+                max_addr = mods[i].mod_end;
+        }
+
+        /*
+         * 32-bit Xen only maps bottom 1GB of memory at boot time. Relocate 
+         * modules which extend beyond this (GRUB2 in particular likes to 
+         * place modules as high as possible below 4GB).
+         */
 #define BOOTMAP_END (1ul<<30) /* 1GB */
-            static void *mod_alloc = (void *)BOOTMAP_END;
-            u32 mod_len = mods[i].mod_end - mods[i].mod_start;
-            if ( mods[i].mod_end > BOOTMAP_END )
+        if ( (XEN_BITSPERLONG == 32) && (max_addr > BOOTMAP_END) )
+        {
+            char *mod_alloc = (char *)BOOTMAP_END;
+            for ( i = 0; i < mbi->mods_count; i++ )
+                mod_alloc -= mods[i].mod_end - mods[i].mod_start;
+            for ( i = 0; i < mbi->mods_count; i++ )
             {
-                mod_alloc = (void *)
-                    (((unsigned long)mod_alloc - mod_len) & ~15ul);
+                u32 mod_len = mods[i].mod_end - mods[i].mod_start;
                 mods[i].mod_start = (u32)memcpy(
                     mod_alloc, (char *)mods[i].mod_start, mod_len);
                 mods[i].mod_end = mods[i].mod_start + mod_len;
+                mod_alloc += mod_len;
             }
-#endif
-            if ( mods[i].string )
-                mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
         }
     }
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot access memory beyond end of bootstrap direct-map area
  2010-03-24  8:35     ` Keir Fraser
@ 2010-03-24  9:32       ` Florian Wagner
  0 siblings, 0 replies; 11+ messages in thread
From: Florian Wagner @ 2010-03-24  9:32 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1213 bytes --]

> >> Okay, please try the attached patch. You only need to
> >> rebuild/install the hypervisor itself (xen.gz). If it works okay
> >> for you I will apply it to the next stable releases of 4.0 and 3.4.
> > 
> > The patch didn't apply cleanly to the xen 3.4.2 release so I
> > modified it to do so (see attached reloc-3.4.2).
> > 
> > All it did is turn the original problem into another one. I now get
> > a "elf_init: not an ELF binary" error instead.
> 
> Please try the attached patch, which applies on top of the previous
> patch.

That fixed the problem. I've verified it to work with Xen 3.4.2 vanilla
as well as the Xen package from Debian squeeze (3.4.2 with additional
patches).

Thank you!


Regards
Florian Wagner

--------------

Florian Wagner
Abteilung EDV
Telefon: 0821 / 4201 - 453
Fax: 0821 / 4201 - 411
E-Mail: f_wagner@syscomp.de

Syscomp Biochemische Dienstleistungen GmbH
August-Wessels-Straße 5, 86154 Augsburg
Postfach 102506, 86015 Augsburg
Telefon: 0821 / 4201 - 0
Fax: 0821 / 417992
Web: http://www.syscomp.de
E-Mail: syscomp@syscomp.de

Geschäftsführer:
  Dr. med. Bernd Schottdorf
  Gabriele Schottdorf

Registergericht Augsburg HRB 8670

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cannot access memory beyond end of bootstrap direct-map area
  2009-08-28  6:38     ` Keir Fraser
@ 2009-08-28  7:44       ` Pascal Bouchareine
  0 siblings, 0 replies; 11+ messages in thread
From: Pascal Bouchareine @ 2009-08-28  7:44 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Aug 28, 2009, at 8:38 AM, Keir Fraser wrote:

> Initial_images_start and e would already be correct for the loop.  
> Just the
> move_memory() call outside the loop is completely unnecessary. Try  
> removing
> just that call and see if that works.
>

Ho, I have been misreading it. Indeed, just removing the call works too.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cannot access memory beyond end of bootstrap direct-map area
  2009-08-27 21:41   ` Pascal Bouchareine
@ 2009-08-28  6:38     ` Keir Fraser
  2009-08-28  7:44       ` Pascal Bouchareine
  0 siblings, 1 reply; 11+ messages in thread
From: Keir Fraser @ 2009-08-28  6:38 UTC (permalink / raw)
  To: Pascal Bouchareine; +Cc: xen-devel

On 27/08/2009 22:41, "Pascal Bouchareine" <pascal@gandi.net> wrote:

>> You should be able to remove the bogus move_memory() call, and change
>> absolutely nothing else. Does that also work for you? That's the
>> change I
>> would check in.
> 
> Yup, I thought that's what the patch did, modulo we need to keep track
> of initial_images_start
> and need "e" in place for the loop ? Or I need a look at the original
> fix.

Initial_images_start and e would already be correct for the loop. Just the
move_memory() call outside the loop is completely unnecessary. Try removing
just that call and see if that works.

 -- Keir

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cannot access memory beyond end of bootstrap direct-map area
  2009-08-27 18:55 ` Keir Fraser
@ 2009-08-27 21:41   ` Pascal Bouchareine
  2009-08-28  6:38     ` Keir Fraser
  0 siblings, 1 reply; 11+ messages in thread
From: Pascal Bouchareine @ 2009-08-27 21:41 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Aug 27, 2009, at 8:55 PM, Keir Fraser wrote:

>> If this were ok, attached patch fixes the panic on my system.
>
> You should be able to remove the bogus move_memory() call, and change
> absolutely nothing else. Does that also work for you? That's the  
> change I
> would check in.

Yup, I thought that's what the patch did, modulo we need to keep track  
of initial_images_start
and need "e" in place for the loop ? Or I need a look at the original  
fix.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cannot access memory beyond end of bootstrap direct-map area
  2009-08-27 17:28 cannot " Pascal Bouchareine
@ 2009-08-27 18:55 ` Keir Fraser
  2009-08-27 21:41   ` Pascal Bouchareine
  0 siblings, 1 reply; 11+ messages in thread
From: Keir Fraser @ 2009-08-27 18:55 UTC (permalink / raw)
  To: Pascal Bouchareine, xen-devel

On 27/08/2009 18:28, "Pascal Bouchareine" <pascal@gandi.net> wrote:

> Investigating the above message during xen 3.3 boot, found we left
> a wrong assumption [modules_length == (mod[n].end - mod[0].start)]
> in move_memory call, leading to an access above BOOTSTRAP_DIRECTMAP_END
> and this panic on x86_32.
> 
> In my understanding Keir's patch 18630 was fixing this kind of problem
> and I'm wondering why this move_memory call didn't go away with it ?

Looks like a backporting mistake. The original bug didn't happen on my
system so the bad backport wasn't noticed.

> If this were ok, attached patch fixes the panic on my system.

You should be able to remove the bogus move_memory() call, and change
absolutely nothing else. Does that also work for you? That's the change I
would check in.

 -- Keir

^ permalink raw reply	[flat|nested] 11+ messages in thread

* cannot access memory beyond end of bootstrap direct-map area
@ 2009-08-27 17:28 Pascal Bouchareine
  2009-08-27 18:55 ` Keir Fraser
  0 siblings, 1 reply; 11+ messages in thread
From: Pascal Bouchareine @ 2009-08-27 17:28 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

Hi,

Investigating the above message during xen 3.3 boot, found we left
a wrong assumption [modules_length == (mod[n].end - mod[0].start)]
in move_memory call, leading to an access above BOOTSTRAP_DIRECTMAP_END
and this panic on x86_32.

In my understanding Keir's patch 18630 was fixing this kind of problem
and I'm wondering why this move_memory call didn't go away with it ?

If this were ok, attached patch fixes the panic on my system.

Cheers,
Pascal

-- 
\o/   Pascal Bouchareine - Gandi 
 g    0170393757           15, place de la Nation - 75011 Paris      

[-- Attachment #2: xen-setup-remap-modules.patch --]
[-- Type: text/x-diff, Size: 1045 bytes --]

Signed-off-by: Pascal Bouchareine <pascal@gandi.net>

diff -r d9289e28e5e7 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Thu Aug 06 13:29:39 2009 +0100
+++ b/xen/arch/x86/setup.c	Thu Aug 27 18:53:08 2009 +0200
@@ -737,11 +737,6 @@ void __init __start_xen(unsigned long mb
         if ( !initial_images_start && (s < e) && ((e-s) >= modules_length) )
         {
             initial_images_end = e;
-            e = (e - modules_length) & PAGE_MASK;
-            initial_images_start = e;
-            move_memory(initial_images_start, 
-                        mod[0].mod_start, mod[mbi->mods_count-1].mod_end);
-            e += modules_length;
             for ( j = mbi->mods_count-1; j >= 0; j-- )
             {
                 e -= mod[j].mod_end - mod[j].mod_start;
@@ -749,6 +744,7 @@ void __init __start_xen(unsigned long mb
                 mod[j].mod_end += e - mod[j].mod_start;
                 mod[j].mod_start = e;
             }
+	    initial_images_start = e;
         }
 
         if ( !kexec_crash_area.start && (s < e) &&

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-03-24  9:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-18  9:18 Cannot access memory beyond end of bootstrap direct-map area Florian Wagner
2010-03-18  9:22 ` Keir Fraser
2010-03-18 22:03 ` Keir Fraser
2010-03-24  7:16   ` Florian Wagner
2010-03-24  8:35     ` Keir Fraser
2010-03-24  9:32       ` Florian Wagner
  -- strict thread matches above, loose matches on Subject: below --
2009-08-27 17:28 cannot " Pascal Bouchareine
2009-08-27 18:55 ` Keir Fraser
2009-08-27 21:41   ` Pascal Bouchareine
2009-08-28  6:38     ` Keir Fraser
2009-08-28  7:44       ` Pascal Bouchareine

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.