grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory
@ 2010-04-21  7:53 gburanov
  2010-04-21  8:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: gburanov @ 2010-04-21  7:53 UTC (permalink / raw)
  To: grub-devel

In Febryary I was testing GRUB for UEFI and noticed that it was simply crashing.

See topic
http://lists.gnu.org/archive/html/grub-devel/2010-02/msg00000.html

At that time I blamed incorrect UEFI implementation on that computer (cause it worked fine on another one), but now I noticed that when I took off one memory stick, everything is working fine on that special computer!!!!

So, it seems that GRUB2 is crashing on computers with  8 gb of memory (or more?)

Is it known bug? Are there workarounds?


--
This message was sent on behalf of gburanov@gmail.com at openSubscriber.com
http://www.opensubscriber.com/messages/grub-devel@gnu.org/topic.html



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

* Re: GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory
  2010-04-21  7:53 GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory gburanov
@ 2010-04-21  8:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2010-04-21 12:06   ` gburanov
  2010-04-21  8:34 ` Seth Goldberg
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-04-21  8:31 UTC (permalink / raw)
  To: The development of GNU GRUB

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

gburanov@gmail.com wrote:
> In Febryary I was testing GRUB for UEFI and noticed that it was simply crashing.
>
> See topic
> http://lists.gnu.org/archive/html/grub-devel/2010-02/msg00000.html
>
> At that time I blamed incorrect UEFI implementation on that computer (cause it worked fine on another one), but now I noticed that when I took off one memory stick, everything is working fine on that special computer!!!!
>
> So, it seems that GRUB2 is crashing on computers with  8 gb of memory (or more?)
>
> Is it known bug? Are there workarounds?
>
>   
It may be a recent regression because we have a reports of successful
boot in such configuration
(http://lists.gnu.org/archive/html/grub-devel/2009-05/msg00179.html and
neighbour threads).
Be sure that grub is compiled with -mcmodel=large. You can also try
disable usage of >4GiB memory by adding
#define MCMODEL_SMALL
to kern/efi/mm.c
> --
> This message was sent on behalf of gburanov@gmail.com at openSubscriber.com
> http://www.opensubscriber.com/messages/grub-devel@gnu.org/topic.html
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

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

* Re: GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory
  2010-04-21  7:53 GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory gburanov
  2010-04-21  8:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-04-21  8:34 ` Seth Goldberg
  2010-04-21  9:12 ` Bean
  2011-01-04 12:59 ` Vladimir 'φ-coder/phcoder' Serbinenko
  3 siblings, 0 replies; 8+ messages in thread
From: Seth Goldberg @ 2010-04-21  8:34 UTC (permalink / raw)
  To: The development of GNU GRUB

Hi,

Quoting gburanov@gmail.com, who wrote the following on Wed, 21 Apr 2010:

> In Febryary I was testing GRUB for UEFI and noticed that it was simply crashing.
>
> See topic
> http://lists.gnu.org/archive/html/grub-devel/2010-02/msg00000.html
>
> At that time I blamed incorrect UEFI implementation on that computer (cause it worked fine on another one), but now I noticed that when I took off one memory stick, everything is working fine on that special computer!!!!
>
> So, it seems that GRUB2 is crashing on computers with  8 gb of memory (or more?)
>
> Is it known bug? Are there workarounds?

   Have you tried the latest GRUB2 from the Bazaar repository?  If it still 
fails there, and phcoder doesn't already have a fix for this in his newreloc 
branch, then I would consider it a bug.

  --S



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

* Re: GRUB2 for UEFI crashes at startup when we got 8 gigabyte of  memory
  2010-04-21  7:53 GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory gburanov
  2010-04-21  8:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2010-04-21  8:34 ` Seth Goldberg
@ 2010-04-21  9:12 ` Bean
  2010-04-21  9:40   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-01-04 12:59 ` Vladimir 'φ-coder/phcoder' Serbinenko
  3 siblings, 1 reply; 8+ messages in thread
From: Bean @ 2010-04-21  9:12 UTC (permalink / raw)
  To: The development of GNU GRUB

On Wed, Apr 21, 2010 at 3:53 PM,  <gburanov@gmail.com> wrote:
> In Febryary I was testing GRUB for UEFI and noticed that it was simply crashing.
>
> See topic
> http://lists.gnu.org/archive/html/grub-devel/2010-02/msg00000.html
>
> At that time I blamed incorrect UEFI implementation on that computer (cause it worked fine on another one), but now I noticed that when I took off one memory stick, everything is working fine on that special computer!!!!
>
> So, it seems that GRUB2 is crashing on computers with  8 gb of memory (or more?)
>
> Is it known bug? Are there workarounds?

Hi,

You could try BURG and see if it has the same problem, binary package
for EFI is available for download at:

http://code.google.com/p/burg/downloads/list

-- 
Bean



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

* Re: GRUB2 for UEFI crashes at startup when we got 8 gigabyte of  memory
  2010-04-21  9:12 ` Bean
@ 2010-04-21  9:40   ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-04-21  9:40 UTC (permalink / raw)
  To: The development of GNU GRUB

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

Bean wrote:
> On Wed, Apr 21, 2010 at 3:53 PM,  <gburanov@gmail.com> wrote:
>   
>> In Febryary I was testing GRUB for UEFI and noticed that it was simply crashing.
>>
>> See topic
>> http://lists.gnu.org/archive/html/grub-devel/2010-02/msg00000.html
>>
>> At that time I blamed incorrect UEFI implementation on that computer (cause it worked fine on another one), but now I noticed that when I took off one memory stick, everything is working fine on that special computer!!!!
>>
>> So, it seems that GRUB2 is crashing on computers with  8 gb of memory (or more?)
>>
>> Is it known bug? Are there workarounds?
>>     
>
> Hi,
>
> You could try BURG and see if it has the same problem, binary package
> for EFI is available for download at:
>
>   
As I already told you before the bugs which are reported for GRUB2 must
be fixed in GRUB2, not in any kind of fork. Moreover any discussion of
BURG is off-topic here. And advertisement of it is not unlike spam.

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

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

* Re: Re: GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory
  2010-04-21  8:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-04-21 12:06   ` gburanov
  2010-04-21 18:58     ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 8+ messages in thread
From: gburanov @ 2010-04-21 12:06 UTC (permalink / raw)
  To: grub-devel

> It may be a recent regression because we have a reports of successful
> boot in such configuration
> (http://lists.gnu.org/archive/html/grub-devel/2009-05/msg00179.html and
> neighbour threads).
> Be sure that grub is compiled with -mcmodel=large. You can also try
> disable usage of >4GiB memory by adding
> #define MCMODEL_SMALL
> to kern/efi/mm.c

Hm, as far as I can understand, the grub is always compiled with mcmodel=large for UEFI

if test "$target_cpu"-"$platform" = x86_64-efi; then
  # Use large model to support 4G memory
  { echo "$as_me:$LINENO: checking whether option -mcmodel=large works" >&5
echo $ECHO_N "checking whether option -mcmodel=large works... $ECHO_C" >&6; }
if test "${grub_cv_cc_mcmodel+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

    SAVED_CFLAGS=$CFLAGS
    CFLAGS="$CFLAGS -m64 -mcmodel=large"
    cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */




--
This message was sent on behalf of gburanov@gmail.com at openSubscriber.com
http://www.opensubscriber.com/message/grub-devel@gnu.org/13789927.html



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

* Re: GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory
  2010-04-21 12:06   ` gburanov
@ 2010-04-21 18:58     ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-04-21 18:58 UTC (permalink / raw)
  To: The development of GNU GRUB

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

gburanov@gmail.com wrote:
>> It may be a recent regression because we have a reports of successful
>> boot in such configuration
>> (http://lists.gnu.org/archive/html/grub-devel/2009-05/msg00179.html and
>> neighbour threads).
>> Be sure that grub is compiled with -mcmodel=large. You can also try
>> disable usage of >4GiB memory by adding
>> #define MCMODEL_SMALL
>> to kern/efi/mm.c
>>     
>
> Hm, as far as I can understand, the grub is always compiled with mcmodel=large for UEFI
>
>   
It's checked that gcc supports -mcmodel=large and if it doesn't it
defaults to smaller models and modifes module loader in order to satisfy
the necessary placement requirements. However grub.efi itself is loaded
by EFI and there is no way of informing it where grub should be loaded.
I guess I should remove this hack and just refuse to compile to 64-bit
efi if -mcmodel=large doesn't work.
Also it's possible that flags aren't propagated correctly so please
check that -mcmodel=large is really passed to gcc

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

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

* Re: GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory
  2010-04-21  7:53 GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory gburanov
                   ` (2 preceding siblings ...)
  2010-04-21  9:12 ` Bean
@ 2011-01-04 12:59 ` Vladimir 'φ-coder/phcoder' Serbinenko
  3 siblings, 0 replies; 8+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-01-04 12:59 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: gburanov


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

On 04/21/2010 09:53 AM, gburanov@gmail.com wrote:
> In Febryary I was testing GRUB for UEFI and noticed that it was simply crashing.
>
> See topic
> http://lists.gnu.org/archive/html/grub-devel/2010-02/msg00000.html
>
> At that time I blamed incorrect UEFI implementation on that computer (cause it worked fine on another one), but now I noticed that when I took off one memory stick, everything is working fine on that special computer!!!!
>
> So, it seems that GRUB2 is crashing on computers with  8 gb of memory (or more?)
>
>   
It has been discovered that some EFI implementations contrary to the
following sentence from the spec "                           any memory
space defined by the UEFI memory map is identity
mapped (virtual address equals physical address).
"
do not map the post-4G memory. Attached is a possible workaround. Can
you test it?
> Is it known bug? Are there workarounds?
>
>
> --
> This message was sent on behalf of gburanov@gmail.com at openSubscriber.com
> http://www.opensubscriber.com/messages/grub-devel@gnu.org/topic.html
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: efi_l4.diff --]
[-- Type: text/x-diff; name="efi_l4.diff", Size: 1188 bytes --]

=== modified file 'grub-core/kern/efi/mm.c'
--- grub-core/kern/efi/mm.c	2010-10-16 15:50:48 +0000
+++ grub-core/kern/efi/mm.c	2011-01-04 12:56:14 +0000
@@ -52,13 +52,13 @@
   grub_efi_status_t status;
   grub_efi_boot_services_t *b;
 
-#if GRUB_TARGET_SIZEOF_VOID_P < 8
+#if 1
   /* Limit the memory access to less than 4GB for 32-bit platforms.  */
   if (address > 0xffffffff)
     return 0;
 #endif
 
-#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
+#if 1
   if (address == 0)
     {
       type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
@@ -251,7 +251,7 @@
        desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
     {
       if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
-#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
+#if 1
 	  && desc->physical_start <= 0xffffffff
 #endif
 	  && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
@@ -267,7 +267,7 @@
 	      desc->physical_start = 0x100000;
 	    }
 
-#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
+#if 1
 	  if (BYTES_TO_PAGES (filtered_desc->physical_start)
 	      + filtered_desc->num_pages
 	      > BYTES_TO_PAGES (0x100000000LL))


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: efi4G.diff --]
[-- Type: text/x-diff; name="efi4G.diff", Size: 1608 bytes --]

=== modified file 'grub-core/lib/efi/relocator.c'
--- grub-core/lib/efi/relocator.c	2010-04-20 16:08:26 +0000
+++ grub-core/lib/efi/relocator.c	2011-01-04 11:02:37 +0000
@@ -62,13 +62,25 @@
        (char *) desc < ((char *) descs + mmapsize);
        desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
     {
+      grub_uint64_t start = desc->physical_start;
+      grub_uint64_t end = desc->physical_start + (desc->num_pages << 12);
+
+      /* post-4G addresses are never supported on 32-bit EFI. 
+	 Moreover it has been reported that some 64-bit EFI contrary to the
+	 spec don't map post-4G pages. So if you enable post-4G allocations,
+	 map pages manually or check that they are mapped.
+       */
+      if (end >= 0x100000000ULL)
+	end = 0x100000000ULL;
+      if (end <= start)
+	continue;
       if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY)
 	continue;
       events[counter].type = REG_FIRMWARE_START;
-      events[counter].pos = desc->physical_start;
+      events[counter].pos = start;
       counter++;
       events[counter].type = REG_FIRMWARE_END;
-      events[counter].pos = desc->physical_start + (desc->num_pages << 12);
+      events[counter].pos = end;
       counter++;      
     }
 
@@ -85,6 +97,9 @@
   if (grub_efi_is_finished)
     return 1;
 
+  grub_dprintf ("relocator", "EFI alloc: %llx, %llx\n",
+		(unsigned long long) start, (unsigned long long) size);
+
   b = grub_efi_system_table->boot_services;
   status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS,
 		       GRUB_EFI_LOADER_DATA, size >> 12, &address);


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

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

end of thread, other threads:[~2011-01-04 12:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21  7:53 GRUB2 for UEFI crashes at startup when we got 8 gigabyte of memory gburanov
2010-04-21  8:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-04-21 12:06   ` gburanov
2010-04-21 18:58     ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-04-21  8:34 ` Seth Goldberg
2010-04-21  9:12 ` Bean
2010-04-21  9:40   ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-01-04 12:59 ` Vladimir 'φ-coder/phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).