From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 20FEC22402E1E for ; Thu, 1 Mar 2018 17:34:23 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2018 17:40:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,409,1515484800"; d="scan'208";a="35294067" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 01 Mar 2018 17:40:32 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 1 Mar 2018 17:40:31 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 1 Mar 2018 17:40:31 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by shsmsx102.ccr.corp.intel.com ([169.254.2.124]) with mapi id 14.03.0319.002; Fri, 2 Mar 2018 09:40:29 +0800 From: "Wu, Jiaxin" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Wang, Fan" , "Ye, Ting" Thread-Topic: [Patch] MdeModulePkg/Mtftp4Dxe: Restore the TPL before the poll function. Thread-Index: AQHTsUzM6YP+fViJ9EuUg6GtQTcfQ6O8GYhg//+H/gCAAIq5sA== Date: Fri, 2 Mar 2018 01:40:29 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B727416388A1E@SHSMSX103.ccr.corp.intel.com> References: <20180301093828.16440-1-jiaxin.wu@intel.com> <20180301093828.16440-2-jiaxin.wu@intel.com> <895558F6EA4E3B41AC93A00D163B7274163889B1@SHSMSX103.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTQ5MDI2NmEtMjNkNC00YzY0LWI4NWItNGU1ZTQwNzgyN2JlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkVPYzRjRm85SXFqd0JzSFl2bWJsRWVEcFwvSTdPTmx3ellCcno4ZzB6M2pnPSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] MdeModulePkg/Mtftp4Dxe: Restore the TPL before the poll function. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2018 01:34:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, I agree with you. But we still can't raise time event to TPL_NOTIFY, b= ecause in the notify callback function, Udp protocol will be called to retr= ansmit the packet while it's not allowed to call UDP in the TPL_NOTIFY. > -----Original Message----- > From: Fu, Siyuan > Sent: Friday, March 2, 2018 9:24 AM > To: Wu, Jiaxin ; edk2-devel@lists.01.org > Cc: Wang, Fan ; Ye, Ting > Subject: RE: [Patch] MdeModulePkg/Mtftp4Dxe: Restore the TPL before the > poll function. >=20 > Jiaxin, >=20 > There will be problem if someone calls Mtftp.Start() at TPL Callback to > send/receive a file with your patch. In such case the RestoreTpl() won't = be > able to restore the TPL to application level so it will still while loop = in the Poll. >=20 > BestRegards > Fu Siyuan >=20 > > -----Original Message----- > > From: Wu, Jiaxin > > Sent: Friday, March 2, 2018 9:18 AM > > To: Fu, Siyuan ; edk2-devel@lists.01.org > > Cc: Wang, Fan ; Ye, Ting > > Subject: RE: [Patch] MdeModulePkg/Mtftp4Dxe: Restore the TPL before > the > > poll function. > > > > It's not actual hang but always running at while-poll function in the T= PL > > call back level , meanwhile, the while condition depends on another tim= e > > event that running on the same TPL. If so, the time event might have no > > chance to be triggered. So, the code will never run out of while () {}: > > > > while (Token->Status =3D=3D EFI_NOT_READY) { > > This->Poll (This); > > } > > > > > > Thanks, > > Jiaxin > > > > > -----Original Message----- > > > From: Fu, Siyuan > > > Sent: Thursday, March 1, 2018 7:03 PM > > > To: Wu, Jiaxin ; edk2-devel@lists.01.org > > > Cc: Wang, Fan ; Ye, Ting > > > Subject: RE: [Patch] MdeModulePkg/Mtftp4Dxe: Restore the TPL before > the > > > poll function. > > > > > > Hi, Jiaxin > > > > > > Do you mean the code which calls MTFTP4->Poll() at TPL_CALLBACK will > > > cause system hang? This should not happen because all network protoco= l > > > should be able to run at TPL_CALLBACK. > > > > > > BestRegards > > > Fu Siyuan > > > > > > > > > > -----Original Message----- > > > > From: Wu, Jiaxin > > > > Sent: Thursday, March 1, 2018 5:38 PM > > > > To: edk2-devel@lists.01.org > > > > Cc: Wang, Fan ; Fu, Siyuan > ; > > > Ye, > > > > Ting > > > > Subject: [Patch] MdeModulePkg/Mtftp4Dxe: Restore the TPL before > the > > > poll > > > > function. > > > > > > > > This patch is to fix the hang issue, which was enrolled by the comm= it > > of > > > > 39b0867d. > > > > The TPL should be restored before calling poll function at > > TPL_CALLBACK. > > > > > > > > Cc: Wang Fan > > > > Cc: Fu Siyuan > > > > Cc: Ye Ting > > > > Contributed-under: TianoCore Contribution Agreement 1.0 > > > > Signed-off-by: Jiaxin Wu > > > > --- > > > > MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 9 > > > ++++++--- > > > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > > > > > > diff --git > a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > > > > b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > > > > index f5f9e6d8f7..64e0463dd9 100644 > > > > --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > > > > +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > > > > @@ -507,24 +507,27 @@ Mtftp4Start ( > > > > if (EFI_ERROR (Status)) { > > > > Status =3D EFI_DEVICE_ERROR; > > > > goto ON_ERROR; > > > > } > > > > > > > > + // > > > > + // Restore the TPL now, don't call poll function at TPL_CALLBACK= . > > > > + // > > > > + gBS->RestoreTPL (OldTpl); > > > > + > > > > if (Token->Event !=3D NULL) { > > > > - gBS->RestoreTPL (OldTpl); > > > > return EFI_SUCCESS; > > > > } > > > > > > > > // > > > > // Return immediately for asynchronous operation or poll the > > > > // instance for synchronous operation. > > > > // > > > > while (Token->Status =3D=3D EFI_NOT_READY) { > > > > This->Poll (This); > > > > } > > > > - > > > > - gBS->RestoreTPL (OldTpl); > > > > + > > > > return Token->Status; > > > > > > > > ON_ERROR: > > > > Mtftp4CleanOperation (Instance, Status); > > > > gBS->RestoreTPL (OldTpl); > > > > -- > > > > 2.16.2.windows.1