Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WdUav-0008QA-4G for mharc-grub-devel@gnu.org; Thu, 24 Apr 2014 21:06:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WdUTn-00011c-09 for grub-devel@gnu.org; Thu, 24 Apr 2014 20:59:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WdRo8-000249-3r for grub-devel@gnu.org; Thu, 24 Apr 2014 18:08:01 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:47130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WdRo7-00020L-SO for grub-devel@gnu.org; Thu, 24 Apr 2014 18:07:52 -0400 Received: from /spool/local by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 Apr 2014 16:07:48 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 24 Apr 2014 16:07:46 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id D66C51FF003B for ; Thu, 24 Apr 2014 16:07:45 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08025.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s3OM7jE08126742 for ; Fri, 25 Apr 2014 00:07:45 +0200 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s3OM7ix7023532 for ; Thu, 24 Apr 2014 16:07:45 -0600 Received: from ram.oc3035372033.ibm.com (dyn9050018046.mts.ibm.com [9.50.18.46] (may be forged)) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s3OM7YF3023096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 24 Apr 2014 16:07:43 -0600 Date: Thu, 24 Apr 2014 15:07:33 -0700 From: Ram Pai To: grub-devel@gnu.org Subject: [PATCH 1/1] grub: fix hang in netboot Message-ID: <20140424220733.GA9786@ram.oc3035372033.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042422-0928-0000-0000-000001788B30 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.110.150 Cc: arvidjaar@gmail.com, phcoder@gmail.com, dvaleev@suse.de, linuxram@us.ibm.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Apr 2014 01:06:23 -0000 Grub can busy-loop and hang while network booting, if the network has some fair amount of activity. This is because grub's net module sniffs the network for packets, and busy-loops in receive_packets() till it finds network packet of type IP or IPV6. During this period grub will not respond to any user input, thus hanging up the system. The following patch lets grub to relax every few iterations, so that it can respond to other user inputs. Signed-off-by: Ram Pai diff --git a/grub-core/net/net.c b/grub-core/net/net.c index 0e57e93..4b316fa 100644 --- a/grub-2.02~beta2/grub-core/net/net.c +++ b/grub-2.02~beta2/grub-core/net/net.c @@ -1500,10 +1500,11 @@ grub_net_poll_cards_idle_real (void) FOR_NET_CARDS (card) { grub_uint64_t ctime = grub_get_time_ms (); + int stop_condition = 1; if (ctime < card->last_poll || ctime >= card->last_poll + card->idle_poll_delay_ms) - receive_packets (card, 0); + receive_packets (card, &stop_condition); } grub_net_tcp_retransmit (); }