All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/EFI: improve boot time diagnostics
@ 2014-06-06  6:25 Jan Beulich
  2014-06-06  9:47 ` Andrew Cooper
  2014-06-10 16:11 ` [PATCH] x86/EFI: improve boot time diagnostics (try 2) Jan Beulich
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2014-06-06  6:25 UTC (permalink / raw)
  To: xen-devel

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

To aid analysis of eventual errors, print EFI status codes with error
messages where available.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init get_parent
         ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
                                      &fs_protocol, (void **)&fio);
         if ( EFI_ERROR(ret) )
-            blexit(L"Couldn't obtain the File System Protocol Interface");
+            PrintErrMesg(L"Couldn't obtain the File System Protocol Interface",
+                         ret);
         ret = fio->OpenVolume(fio, &dir_handle);
     } while ( ret == EFI_MEDIA_CHANGED );
     if ( ret != EFI_SUCCESS )
-        blexit(L"OpenVolume failure");
+        PrintErrMesg(L"OpenVolume failure", ret);
 
 #define buffer ((CHAR16 *)keyhandler_scratch)
 #define BUFFERSIZE sizeof(keyhandler_scratch)
@@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
                     (void **)&shim_lock)) &&
-         shim_lock->Verify(kernel.ptr, kernel.size) != EFI_SUCCESS )
-        blexit(L"Dom0 kernel image could not be verified.");
+         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
+        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
 
     name.s = get_value(&cfg, section.s, "ramdisk");
     if ( name.s )
@@ -1381,6 +1382,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
+    if ( EFI_ERROR(status) )
+        PrintErrMesg(L"Cannot size memory map", status);
     mbi.mem_upper -= efi_memmap_size;
     mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
     if ( mbi.mem_upper < xen_phys_start )
@@ -1389,7 +1392,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
     status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
     if ( EFI_ERROR(status) )
-        blexit(L"Cannot obtain memory map");
+        PrintErrMesg(L"Cannot obtain memory map", status);
 
     /* Populate E820 table and check trampoline area availability. */
     e = e820map - 1;



[-- Attachment #2: x86-EFI-boot-diagnostics.patch --]
[-- Type: text/plain, Size: 2426 bytes --]

x86/EFI: improve boot time diagnostics

To aid analysis of eventual errors, print EFI status codes with error
messages where available.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init get_parent
         ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
                                      &fs_protocol, (void **)&fio);
         if ( EFI_ERROR(ret) )
-            blexit(L"Couldn't obtain the File System Protocol Interface");
+            PrintErrMesg(L"Couldn't obtain the File System Protocol Interface",
+                         ret);
         ret = fio->OpenVolume(fio, &dir_handle);
     } while ( ret == EFI_MEDIA_CHANGED );
     if ( ret != EFI_SUCCESS )
-        blexit(L"OpenVolume failure");
+        PrintErrMesg(L"OpenVolume failure", ret);
 
 #define buffer ((CHAR16 *)keyhandler_scratch)
 #define BUFFERSIZE sizeof(keyhandler_scratch)
@@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
                     (void **)&shim_lock)) &&
-         shim_lock->Verify(kernel.ptr, kernel.size) != EFI_SUCCESS )
-        blexit(L"Dom0 kernel image could not be verified.");
+         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
+        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
 
     name.s = get_value(&cfg, section.s, "ramdisk");
     if ( name.s )
@@ -1381,6 +1382,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
+    if ( EFI_ERROR(status) )
+        PrintErrMesg(L"Cannot size memory map", status);
     mbi.mem_upper -= efi_memmap_size;
     mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
     if ( mbi.mem_upper < xen_phys_start )
@@ -1389,7 +1392,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
     status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
     if ( EFI_ERROR(status) )
-        blexit(L"Cannot obtain memory map");
+        PrintErrMesg(L"Cannot obtain memory map", status);
 
     /* Populate E820 table and check trampoline area availability. */
     e = e820map - 1;

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

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

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

* Re: [PATCH] x86/EFI: improve boot time diagnostics
  2014-06-06  6:25 [PATCH] x86/EFI: improve boot time diagnostics Jan Beulich
@ 2014-06-06  9:47 ` Andrew Cooper
  2014-06-10 16:11 ` [PATCH] x86/EFI: improve boot time diagnostics (try 2) Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2014-06-06  9:47 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel


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

On 06/06/14 07:25, Jan Beulich wrote:
> To aid analysis of eventual errors, print EFI status codes with error
> messages where available.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/efi/boot.c
> +++ b/xen/arch/x86/efi/boot.c
> @@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init get_parent
>          ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
>                                       &fs_protocol, (void **)&fio);
>          if ( EFI_ERROR(ret) )
> -            blexit(L"Couldn't obtain the File System Protocol Interface");
> +            PrintErrMesg(L"Couldn't obtain the File System Protocol Interface",
> +                         ret);
>          ret = fio->OpenVolume(fio, &dir_handle);
>      } while ( ret == EFI_MEDIA_CHANGED );
>      if ( ret != EFI_SUCCESS )
> -        blexit(L"OpenVolume failure");
> +        PrintErrMesg(L"OpenVolume failure", ret);
>  
>  #define buffer ((CHAR16 *)keyhandler_scratch)
>  #define BUFFERSIZE sizeof(keyhandler_scratch)
> @@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>  
>      if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
>                      (void **)&shim_lock)) &&
> -         shim_lock->Verify(kernel.ptr, kernel.size) != EFI_SUCCESS )
> -        blexit(L"Dom0 kernel image could not be verified.");
> +         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
> +        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
>  
>      name.s = get_value(&cfg, section.s, "ramdisk");
>      if ( name.s )
> @@ -1381,6 +1382,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>  
>      status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
>                                    &efi_mdesc_size, &mdesc_ver);
> +    if ( EFI_ERROR(status) )
> +        PrintErrMesg(L"Cannot size memory map", status);
>      mbi.mem_upper -= efi_memmap_size;
>      mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
>      if ( mbi.mem_upper < xen_phys_start )
> @@ -1389,7 +1392,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>      status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
>                                    &efi_mdesc_size, &mdesc_ver);
>      if ( EFI_ERROR(status) )
> -        blexit(L"Cannot obtain memory map");
> +        PrintErrMesg(L"Cannot obtain memory map", status);
>  
>      /* Populate E820 table and check trampoline area availability. */
>      e = e820map - 1;
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 3589 bytes --]

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

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

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

* [PATCH] x86/EFI: improve boot time diagnostics (try 2)
  2014-06-06  6:25 [PATCH] x86/EFI: improve boot time diagnostics Jan Beulich
  2014-06-06  9:47 ` Andrew Cooper
@ 2014-06-10 16:11 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2014-06-10 16:11 UTC (permalink / raw)
  To: xen-devel

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

To aid analysis of eventual errors, print EFI status codes with error
messages where available. Also remove a case where the status gets
stored into a local variable without being used examined (which mis-
guided me to add an error check there in try 1 of this patch).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init get_parent
         ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
                                      &fs_protocol, (void **)&fio);
         if ( EFI_ERROR(ret) )
-            blexit(L"Couldn't obtain the File System Protocol Interface");
+            PrintErrMesg(L"Couldn't obtain the File System Protocol Interface",
+                         ret);
         ret = fio->OpenVolume(fio, &dir_handle);
     } while ( ret == EFI_MEDIA_CHANGED );
     if ( ret != EFI_SUCCESS )
-        blexit(L"OpenVolume failure");
+        PrintErrMesg(L"OpenVolume failure", ret);
 
 #define buffer ((CHAR16 *)keyhandler_scratch)
 #define BUFFERSIZE sizeof(keyhandler_scratch)
@@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
                     (void **)&shim_lock)) &&
-         shim_lock->Verify(kernel.ptr, kernel.size) != EFI_SUCCESS )
-        blexit(L"Dom0 kernel image could not be verified.");
+         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
+        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
 
     name.s = get_value(&cfg, section.s, "ramdisk");
     if ( name.s )
@@ -1379,8 +1380,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
         }
     }
 
-    status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
-                                  &efi_mdesc_size, &mdesc_ver);
+    efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
+                         &efi_mdesc_size, &mdesc_ver);
     mbi.mem_upper -= efi_memmap_size;
     mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
     if ( mbi.mem_upper < xen_phys_start )
@@ -1389,7 +1390,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
     status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
     if ( EFI_ERROR(status) )
-        blexit(L"Cannot obtain memory map");
+        PrintErrMesg(L"Cannot obtain memory map", status);
 
     /* Populate E820 table and check trampoline area availability. */
     e = e820map - 1;




[-- Attachment #2: x86-EFI-boot-diagnostics.patch --]
[-- Type: text/plain, Size: 2657 bytes --]

x86/EFI: improve boot time diagnostics (try 2)

To aid analysis of eventual errors, print EFI status codes with error
messages where available. Also remove a case where the status gets
stored into a local variable without being used examined (which mis-
guided me to add an error check there in try 1 of this patch).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init get_parent
         ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
                                      &fs_protocol, (void **)&fio);
         if ( EFI_ERROR(ret) )
-            blexit(L"Couldn't obtain the File System Protocol Interface");
+            PrintErrMesg(L"Couldn't obtain the File System Protocol Interface",
+                         ret);
         ret = fio->OpenVolume(fio, &dir_handle);
     } while ( ret == EFI_MEDIA_CHANGED );
     if ( ret != EFI_SUCCESS )
-        blexit(L"OpenVolume failure");
+        PrintErrMesg(L"OpenVolume failure", ret);
 
 #define buffer ((CHAR16 *)keyhandler_scratch)
 #define BUFFERSIZE sizeof(keyhandler_scratch)
@@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
                     (void **)&shim_lock)) &&
-         shim_lock->Verify(kernel.ptr, kernel.size) != EFI_SUCCESS )
-        blexit(L"Dom0 kernel image could not be verified.");
+         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
+        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
 
     name.s = get_value(&cfg, section.s, "ramdisk");
     if ( name.s )
@@ -1379,8 +1380,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
         }
     }
 
-    status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
-                                  &efi_mdesc_size, &mdesc_ver);
+    efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
+                         &efi_mdesc_size, &mdesc_ver);
     mbi.mem_upper -= efi_memmap_size;
     mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
     if ( mbi.mem_upper < xen_phys_start )
@@ -1389,7 +1390,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
     status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
     if ( EFI_ERROR(status) )
-        blexit(L"Cannot obtain memory map");
+        PrintErrMesg(L"Cannot obtain memory map", status);
 
     /* Populate E820 table and check trampoline area availability. */
     e = e820map - 1;

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

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

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

end of thread, other threads:[~2014-06-10 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-06  6:25 [PATCH] x86/EFI: improve boot time diagnostics Jan Beulich
2014-06-06  9:47 ` Andrew Cooper
2014-06-10 16:11 ` [PATCH] x86/EFI: improve boot time diagnostics (try 2) Jan Beulich

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.