From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from SNT004-OMC2S46.hotmail.com (snt004-omc2s46.hotmail.com [65.54.61.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7340E81D87 for ; Sat, 5 Nov 2016 09:48:19 -0700 (PDT) Received: from EUR02-AM5-obe.outbound.protection.outlook.com ([65.55.90.72]) by SNT004-OMC2S46.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Sat, 5 Nov 2016 09:48:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=y6pf1Dnwr+ffAqxAsrddKqaQshTuaiCPATd9P4yN9bI=; b=I1V56xgTlPbjT6dlFQKGgHxFrIdA8Mk0fIzAaGBRuu0W/bFmDqaSAgXwWmYfO/hgvnFtCceTtBSPY46CJFZyJzbszUINGVqgq5c5VzQC0DBYGLgFnSfVbKvBAmBU+vRIrd9SunFQjUblB9hM16O612zILKHMyMXt3iiRODEEcNhj8SRffY5GrJrfaT8SfybYmiz4a8IOKcB4fAPqv7495+fmRxzEwhe4gq+mZWZT0TsMfSz3lZewl+lieoEsfyXcIgg52OByDzNLd8R4JVq/9KsuQZGXdDJIu5RDAOW2eoM+v1GDbLb+jRlXVysU6bWxsAQGHE/eyJDbD9gG7qjXVA== Received: from VE1EUR02FT042.eop-EUR02.prod.protection.outlook.com (10.152.12.59) by VE1EUR02HT158.eop-EUR02.prod.protection.outlook.com (10.152.13.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.6; Sat, 5 Nov 2016 16:48:19 +0000 Received: from AM5PR0601MB2579.eurprd06.prod.outlook.com (10.152.12.58) by VE1EUR02FT042.mail.protection.outlook.com (10.152.13.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.3 via Frontend Transport; Sat, 5 Nov 2016 16:48:19 +0000 Received: from AM5PR0601MB2579.eurprd06.prod.outlook.com ([10.168.154.13]) by AM5PR0601MB2579.eurprd06.prod.outlook.com ([10.168.154.13]) with mapi id 15.01.0707.006; Sat, 5 Nov 2016 16:48:19 +0000 From: =?iso-8859-1?Q?Marvin_H=E4user?= To: "edk2-devel@lists.01.org" CC: "Zeng, Star" , "feng.tian@intel.com" Thread-Topic: [PATCH v2 1/2] MdeModulePkg: Do not free memory during ExitBootServices (). Thread-Index: AQHSNidtNdv9Y2VlQE+ywGajW/iMv6DICr1AgAKRCOA= Date: Sat, 5 Nov 2016 16:48:19 +0000 Message-ID: References: <0C09AFA07DD0434D9E2A0C6AEB04831039596200@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB04831039596200@shsmsx102.ccr.corp.intel.com> Accept-Language: de-DE, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: lists.01.org; dkim=none (message not signed) header.d=none;lists.01.org; dmarc=none action=none header.from=outlook.com; x-incomingtopheadermarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:2791; Count:39 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [5f4ZXQ86lC2SC6Mjm7ZuBQEe6i72Dcuj] x-incomingheadercount: 39 x-eopattributedmessage: 0 x-microsoft-exchange-diagnostics: 1; VE1EUR02HT158; 7:/t/KrJpFywrLmEd7FlE1OB8tdUSSa6FcKacoizZD3avSS4WekMv8vcT8xJzSAq+LpjMIbJI5U4IHaPvscrasZ5H4q1bnRwmw8vxYsivdsb7VdNQLp7DTxwdZtrzqtv9KvSSKQwO3IsZqer+fOQJF54qHpr8w+OlnX2BCtqUXv90ALLbxiKnuS2SCS3r5OCaFvFtoJgVvDvUj4WEEiT4WtOdR/XymKwQxjo2/rwelMhOV8aCM3ZhGWbhd/7xN3Gx8ne89dCDgxClUjBZnvousiCdUphUbUHk6DfNG1jVgHQrvb1e8eW2av8fhuk6ZFg742slCh/kI0/Z1Nd9eopSnAwOizNEl1GCepCl0TE8H+Z0= x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003); DIR:OUT; SFP:1102; SCL:1; SRVR:VE1EUR02HT158; H:AM5PR0601MB2579.eurprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: 71a8df1a-5a53-4b8b-be4d-08d4059b8bf7 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VE1EUR02HT158; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015012)(82015046); SRVR:VE1EUR02HT158; BCL:0; PCL:0; RULEID:; SRVR:VE1EUR02HT158; x-forefront-prvs: 011787B9DD spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2016 16:48:19.1370 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR02HT158 X-OriginalArrivalTime: 05 Nov 2016 16:48:21.0169 (UTC) FILETIME=[6AA6C210:01D23784] Subject: Re: [PATCH v2 1/2] MdeModulePkg: Do not free memory during ExitBootServices (). X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Nov 2016 16:48:19 -0000 Content-Language: de-DE Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I forgot to note that this patch is not everything needed to not call the = Memory Allocation Services. The event also calls a function which calls Tcp4IoDestroySocket() and Netbu= fQueFlush(). This should not be needed, should it? The first one calls the Memory Alloca= tion Services. Unfortunately I can't test not calling the function, hence I didn't include= the change and hope you know the answer. Regards, Marvin. > -----Original Message----- > From: Zeng, Star [mailto:star.zeng@intel.com] > Sent: Friday, November 4, 2016 2:34 AM > To: Marvin.Haeuser@outlook.com; edk2-devel@lists.01.org > Cc: Tian, Feng ; Zeng, Star > Subject: RE: [PATCH v2 1/2] MdeModulePkg: Do not free memory during > ExitBootServices (). >=20 > Reviewed-by: Star Zeng >=20 > -----Original Message----- > From: Marvin H=E4user [mailto:Marvin.Haeuser@outlook.com] > Sent: Friday, November 4, 2016 7:10 AM > To: edk2-devel@lists.01.org > Cc: Tian, Feng ; Zeng, Star > Subject: [PATCH v2 1/2] MdeModulePkg: Do not free memory during > ExitBootServices (). >=20 > During exiting Boot Services, there should be no changes made to the > Memory Map. This patch eliminates explicit and implicit calls to the Memo= ry > Allocation Services and, where applicable, zeros the memory instead. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Marvin Haeuser > --- > MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 11 +++++++++-- > MdeModulePkg/Universal/Network/SnpDxe/Snp.c | 12 ++++++++++++ > 2 files changed, 21 insertions(+), 2 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c > b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c > index ae202c3fe24a..b5e36b8bec06 100644 > --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c > +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c > @@ -872,9 +872,16 @@ IScsiOnExitBootService ( > ISCSI_DRIVER_DATA *Private; >=20 > Private =3D (ISCSI_DRIVER_DATA *) Context; > - gBS->CloseEvent (Private->ExitBootServiceEvent); >=20 > - IScsiSessionAbort (&Private->Session); > + if (Private->Session.Signature !=3D 0) { > + IScsiSessionAbort (&Private->Session); > + > + // > + // Empty Session as it will not be freed. > + // This will also prevent this code from being re-run. > + // > + ZeroMem (&Private->Session, sizeof (Private->Session)); } > } >=20 > /** > diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c > b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c > index 9f61aee05773..e15e79c7065f 100644 > --- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c > +++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c > @@ -32,6 +32,18 @@ SnpNotifyExitBootServices ( >=20 > Snp =3D (SNP_DRIVER *)Context; >=20 > + if (Snp->TxRxBuffer !=3D NULL) { > + // > + // Empty TxRxBuffer as it will not be freed. > + // > + ZeroMem (Snp->TxRxBuffer, Snp->TxRxBufferSize); > + > + // > + // Set TxRxBuffer to NULL so FreeBuffer () will not be called. > + // > + Snp->TxRxBuffer =3D NULL; > + } > + > // > // Shutdown and stop UNDI driver > // > -- > 2.10.1.windows.1