From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Zmqd9-0007AE-90 for mharc-grub-devel@gnu.org; Thu, 15 Oct 2015 18:04:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmQDj-0007rn-Me for grub-devel@gnu.org; Wed, 14 Oct 2015 13:52:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmQDg-0003cX-F0 for grub-devel@gnu.org; Wed, 14 Oct 2015 13:52:11 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:34694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmQDg-0003cP-3b for grub-devel@gnu.org; Wed, 14 Oct 2015 13:52:08 -0400 Received: by lfaz124 with SMTP id z124so16354658lfa.1 for ; Wed, 14 Oct 2015 10:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=d3XvTGi3LyYyN/ELXflSAPu5LKCtUQMJEwxcvSnVl5w=; b=W1s8vo2so0pbkSSqv77vSungT/HG3GBXqYOqZGwesoqhQhK9Xhe0NKmVU3HUx7gX+j Srj+RGaFc+BPw7lGsYR3ySiSEeuf8wFPOsEHe5mb98zzkoWTUjct/gZPGmjqBy2gDGht V+kIwLMddMCuOAsUtyZSjKfIm29d4oUgS94IG69/EAHb2zQmlxGulGiO4TXMbD30Li8t vBp/pafMARZ8bZ68zka/9VDPRbzpHU9Z2Koeu47mLn14U45LpyVf2KQAtE1PrbF4/s/l 86Carx0De8BYt5h1N6rjIoN/9z4l0CaKBzVaI0sLCqCt47IUZy2kZFK5bDetlgnIT8bI kEFQ== X-Received: by 10.25.19.216 with SMTP id 85mr1543897lft.68.1444845127082; Wed, 14 Oct 2015 10:52:07 -0700 (PDT) Received: from [192.168.1.43] (ppp91-76-142-206.pppoe.mtu-net.ru. [91.76.142.206]) by smtp.gmail.com with ESMTPSA id ps9sm1479263lbb.19.2015.10.14.10.52.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 10:52:06 -0700 (PDT) Subject: Re: [edk2] [grub PATCH] efinet: disable MNP background polling To: "Ye, Ting" , Laszlo Ersek , "daniel.kiper@oracle.com" , "grub-devel@gnu.org" References: <20151001.182655.371384337.d.hatayama@jp.fujitsu.com> <560D1E07.3090902@redhat.com> <20151013214919.GA6140@router-fw-old.local.net-space.pl> <561D83E9.6050703@redhat.com> <561DEED6.7050601@gmail.com> <561DFCFE.9080408@gmail.com> From: Andrei Borzenkov Message-ID: <561E9644.5080709@gmail.com> Date: Wed, 14 Oct 2015 20:52:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c07::234 Cc: edk2-devel-01 , "glin@suse.com" , "seth.goldberg@oracle.com" , Mark Salter 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: Wed, 14 Oct 2015 17:52:13 -0000 14.10.2015 11:00, Ye, Ting пишет: > Could you please describe the details how does GRUB use UEFI network protocols? > When efinet driver is loaded it enumerates handles with SNP; these handles represent network cards for grub. If driver is part of initial core.img (default for network boot image) it additionally queries loaded image handle for PXE for DhcpAck using EFI_PXE_BASE_CODE_PROTOCOL and is using it for autoconfiguration. Before the first send/receive request on network card SNP on associated handle is opened exclusively and SNP Transmit/Receive are used. > I see the thread says that EXCLUSIVE open SNP causes PXE boot fail. > > If you read below description about 'EXCLUSIVE' in UEFI specification, you will find when GRUB exclusive opens SNP protocol, the UEFI will remove any drivers that opened SNP with BY_DRIVER by calling the driver's Stop() function. In UEFI network stack, MNP driver will open SNP 'BY_DRIVER'. So if GRUB/iPXE exclusive opens SNP, MNP will uninstall itself and the whole UEFI network stack is disconnected except SNP and UNDI. Hence, the UEFI PXE no longer work. > > >>> EXCLUSIVE Used by applications to gain exclusive access to a protocol interface. >>> If any drivers have the protocol interface opened with an attribute of BY_DRIVER, >>> then an attempt will be made to remove them by calling the driver's Stop() function. > > > If GRUB would like to call SNP protocol only, it should use EXCLUSIVE open to gain the exclusive access and disconnect UEFI network stack since MNP. Then the MNP background polling is also disabled. It does it already. > If GRUB still needs UEFI PXE capability, it should utilize PXE base code protocol to continue the process, rather than calling SNP, as SNP is already consumed by UEFI network stack. > It does not use PXE after initial autoconfiguration as described above nor does it need it. All data transmission is performed using SNP only. > Thanks, > Ye Ting > > > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Andrei Borzenkov > Sent: Wednesday, October 14, 2015 2:58 PM > To: Ye, Ting; Laszlo Ersek; daniel.kiper@oracle.com; grub-devel@gnu.org > Cc: edk2-devel-01; Mark Salter; glin@suse.com; seth.goldberg@oracle.com; konrad.wilk@oracle.com > Subject: Re: [edk2] [grub PATCH] efinet: disable MNP background polling > > 14.10.2015 09:15, Ye, Ting пишет: >> May I know the details what problems it causes in some cases? >> > > One is being discussed in this thread: > > http://lists.gnu.org/archive/html/grub-devel/2015-10/msg00013.html > http://lists.gnu.org/archive/html/grub-devel/2015-10/msg00068.html > > Another was reported recently: > > http://lists.gnu.org/archive/html/help-grub/2015-09/msg00033.html > http://lists.gnu.org/archive/html/grub-devel/2015-10/msg00071.html > > >> Thanks, >> Ye Ting >> >> -----Original Message----- >> From: Andrei Borzenkov [mailto:arvidjaar@gmail.com] >> Sent: Wednesday, October 14, 2015 1:58 PM >> To: Ye, Ting; Laszlo Ersek; daniel.kiper@oracle.com; grub-devel@gnu.org >> Cc: konrad.wilk@oracle.com; edk2-devel-01; glin@suse.com; seth.goldberg@oracle.com; Mark Salter >> Subject: Re: [edk2] [grub PATCH] efinet: disable MNP background polling >> >> 14.10.2015 08:19, Ye, Ting пишет: >>> Hi all, >>> >>> If I understand the issue correctly, I don't quite agree that UEFI spec is imprecise about SNP constraints described as following. >>> The "constraint" described here is that the grub should use attribute "EXCLUSIVE" to open SNP protocol to gain exclusive access. This usage is clearly described in page 184, chapter 6.3 EFI_BOOT_SERVICES.OpenProtocol(). >>> >>> EXCLUSIVE Used by applications to gain exclusive access to a protocol interface. >>> If any drivers have the protocol interface opened with an attribute of BY_DRIVER, >>> then an attempt will be made to remove them by calling the driver's Stop() function. >>> >>> The grub code should not assume that the SNP is not occupied by other drivers, instead, it should use EXCLUSIVE to open SNP protocol, or to be more precise, use OpenProtocolInformation() to check whether SNP is already opened by other driver, then decide whether need to use EXCLUSIVE to disconnect the other drivers. This is the typical usage for all UEFI protocol, not particular constraints to SNP protocol. >>> >> >> That is exactly what grub currently does - it opens SNP exclusively. >> Apparently it is causing problems in some cases. >> > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel >