[packages/grub2] Added patch to improve EFI PXE boot performance

jajcus jajcus at pld-linux.org
Wed Apr 23 19:12:09 CEST 2014


commit c287192df5fdf32ad4109b8980fe6e98048fa411
Author: Jacek Konieczny <jajcus at jajcus.net>
Date:   Wed Apr 23 19:11:50 2014 +0200

    Added patch to improve EFI PXE boot performance
    
    https://savannah.gnu.org/bugs/?41731

 efi-net-fix.patch | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 grub2.spec        |  4 +++-
 2 files changed, 62 insertions(+), 1 deletion(-)
---
diff --git a/grub2.spec b/grub2.spec
index f323ca6..194cd87 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -47,7 +47,7 @@ Summary(pt_BR.UTF-8):	Gerenciador de inicialização GRUB2
 %define	beta	beta2
 Name:		grub2
 Version:	2.02
-Release:	0.%{beta}.2
+Release:	0.%{beta}.3
 License:	GPL v2
 Group:		Base
 # git://git.savannah.gnu.org/grub.git
@@ -74,6 +74,7 @@ Patch9:		just-say-linux.patch
 Patch10:	ignore-kernel-symlinks.patch
 Patch11:	choose-preferred-initrd.patch
 Patch12:	%{name}-cfg.patch
+Patch13:	efi-net-fix.patch
 URL:		http://www.gnu.org/software/grub/
 BuildRequires:	autoconf >= 2.53
 BuildRequires:	automake >= 1:1.11.1-1
@@ -300,6 +301,7 @@ Motyw starfield dla GRUB-a.
 %patch10 -p1
 %patch11 -p1
 %patch12 -p0
+%patch13 -p1
 
 # we don't have C.utf-8 and need an UTF-8 locale for build
 sed -i -e 's/LC_ALL=C.UTF-8/LC_ALL=en_US.utf-8/g' po/Makefile* po/Rules*
diff --git a/efi-net-fix.patch b/efi-net-fix.patch
new file mode 100644
index 0000000..41872c0
--- /dev/null
+++ b/efi-net-fix.patch
@@ -0,0 +1,59 @@
+From 886d93184b894a29b0bef1f2467230a20c7a33ce Mon Sep 17 00:00:00 2001
+From: Mark Salter <msalter at redhat.com>
+Date: Tue, 8 Apr 2014 10:58:11 -0400
+Subject: [PATCH] reopen SNP protocol for exclusive use by grub
+
+While working with pxeboot of grub on an ARM platform, I noticed
+very poor network performance while grub was loading a kernel
+and initramfs. The performance during the loading of grub itself
+seemed reasonable. Digging into the issue, I found that the UEFI
+firmware was periodically polling for network packets while grub
+was downloading files. This was causing timeouts and retries in
+the grub network stack.
+
+The solution I found was to reopen the SNP protocol for exclusive
+use. This forces UEFI to shutdown its use of SNP so that grub is
+not competing for incoming packets.
+
+Signed-off-by: Mark Salter <msalter at redhat.com>
+---
+ grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
+index 2b344d6..a6e4c79 100644
+--- a/grub-core/net/drivers/efi/efinet.c
++++ b/grub-core/net/drivers/efi/efinet.c
+@@ -223,6 +223,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
+ {
+   struct grub_net_card *card;
+   grub_efi_device_path_t *dp;
++  grub_efi_simple_network_t *net;
+ 
+   dp = grub_efi_get_device_path (hnd);
+   if (! dp)
+@@ -250,6 +251,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
+ 				    &pxe_mode->dhcp_ack,
+ 				    sizeof (pxe_mode->dhcp_ack),
+ 				    1, device, path);
++    net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
++				  GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
++    if (net) {
++      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
++	  && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
++	continue;
++
++      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
++	continue;
++
++      if (net->mode->state == GRUB_EFI_NETWORK_STARTED
++	  && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
++	continue;
++      card->efi_net = net;
++    }
+     return;
+   }
+ }
+-- 
+1.8.5.3
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/grub2.git/commitdiff/c287192df5fdf32ad4109b8980fe6e98048fa411



More information about the pld-cvs-commit mailing list