From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.11837.1594693152631980545 for ; Mon, 13 Jul 2020 19:19:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=oWAf4E14; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: hao.a.wu@intel.com) IronPort-SDR: kongm0FdRVrMzDxMiHRBLCEBL7MaDdrmwU4/D5+h4BNzdd4vmbfO5eq7SxmCWmc/lvwdevVFYa Q2QBPiQTTakg== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="233634148" X-IronPort-AV: E=Sophos;i="5.75,349,1589266800"; d="scan'208";a="233634148" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2020 19:19:12 -0700 IronPort-SDR: QC/UMpZ6Oe1/e5QxDeZTHSefGl8q0QbutnvVKLC5bJf/KZDU/O50TRHgnnOSYuqsOfW0z/Xwfk C1FkEZATSDug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,349,1589266800"; d="scan'208";a="268525822" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga007.fm.intel.com with ESMTP; 13 Jul 2020 19:19:12 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 13 Jul 2020 19:19:11 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 13 Jul 2020 19:19:11 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (104.47.37.50) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 13 Jul 2020 19:19:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HwmR9fyeXGMosezsObMnef3tjxIk8fj7wcjwKODs0iiq6lPFcqgmryHxZauUKfpp5GAzuRsmwye5HVJ29rbtclOvUEtwzhkxTTkQu/buZjbQYmU/WMMGa8fn9CgEZMQkgzN6SuNZYy52kS1Mge9bNJkz8YKTev2sszmL2zwfeUZasYJhcXWElxhdDz7Zb+nwRz/ftfmMyT/eTMBCKadMSIMdGKxPqluIuEqGgnnV/CS1VIAVel1B6DUWD9Cb1uA50u8FdyeR0sdwHi98SZ+7ljAcJJDHdobri1OQfZJ2oNGGy5PoI416ayvKnreNqxbnprGQtDTdZuQsHK4le33qDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wfc45rqar8ZscDVwOJRO4jwm4ZN+Lri/MDtJT8aSp08=; b=liWWQtjjpLxu3rgNqy4uW6JFyNO8kRMoYGTN+DssdLkPMliPXR8mIrMe8gqDlt3p8nizJnsPlcAU9TDOG57UFBv0re91m1m6gcAS9I/JfM0aIaMv7V6XRYMrJaYgRNxOEhUk7+waYEO8QbUhP3FQY21ahLyKBOO5D9Heo0zSXACMvaXMgo3JGE0h3SM9X8xynaW1RtywoFDygLYSbWfOBTGvVdI7Y+/87owFRN57SPOCHiO4AGl9WAxQxEzgfTrSh4l3e5hxws+Xqy8MI+j3gU7umMuHWPTp0V2wlnKp3TCP2SjSaohRcpX/Zz+TrJTDQn7qcer0pzAuQJCxG36z4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wfc45rqar8ZscDVwOJRO4jwm4ZN+Lri/MDtJT8aSp08=; b=oWAf4E14zQEEpmoTCmqM028o49hsor3AElU1/E/gczV0FYCKYFeyyLmSrPgF3LyW+NidFVwiH7YlnJSzoqq7ONnppkx4CQYasj4bvl5WJCt7w/ZUWqxR+GkijHv9K0GR3Br2l/fmgZENlBNOwjtKEvUa+Xvr4bSAy5Ub4IzQ/aE= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN8PR11MB3620.namprd11.prod.outlook.com (2603:10b6:408:91::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21; Tue, 14 Jul 2020 02:19:10 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::dd04:b759:2ef1:e86a]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::dd04:b759:2ef1:e86a%7]) with mapi id 15.20.3174.025; Tue, 14 Jul 2020 02:19:10 +0000 From: "Wu, Hao A" To: "Kinney, Michael D" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [Patch] MdeModulePkg/Variable/RuntimeDxe: Fix return status from Reclaim() Thread-Topic: [Patch] MdeModulePkg/Variable/RuntimeDxe: Fix return status from Reclaim() Thread-Index: AQHWVmbxL8YYUOEReEyzzIx7WataMakGXVuw Date: Tue, 14 Jul 2020 02:19:10 +0000 Message-ID: References: <20200710030455.6036-1-michael.d.kinney@intel.com> In-Reply-To: <20200710030455.6036-1-michael.d.kinney@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0792c353-f656-4b7d-ac2c-08d8279c4b7f x-ms-traffictypediagnostic: BN8PR11MB3620: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dK6bKS9wAjr//oALRKclmislG1BQ10q8ackQWuKXfv6uxjeMmjWFXhYu5iEwn8MhJcLJdhg9VM8eFFmsUjG3kOcKBdC+MQ2UeMCx0X167iCHuSKL+RpHQ6jaPvpDBB6B4IGhXE0wL3FoJfjKrEnzBPad8/bNebucaQa+vVWgyVcGB1YVCwtVSRGMKqwCObkzZuYOZWPqQu/NN4X+8ZaX43/3lhsAbrJr59axZg4NJYIuph3Y/QSsKRqZC1FQY6lrk7DeFv7dVuP7HZ+jASpMVU0pJN80ycRY3AQwFpY4/LIyJAqujaa2plqnKmQ7/o7wTc0bgPP98Q6nOY2NZTdVPHPQijs+6SNsdEQNnRK61ngxuJuP2KTunlSz8BMUJrU9wB9Abi5CYNyaV1zrTpZSOQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(346002)(136003)(376002)(396003)(39860400002)(366004)(66946007)(8676002)(86362001)(66476007)(9686003)(66556008)(64756008)(4326008)(76116006)(71200400001)(66446008)(966005)(5660300002)(8936002)(186003)(6506007)(52536014)(55016002)(478600001)(53546011)(7696005)(316002)(26005)(33656002)(107886003)(110136005)(83380400001)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: lvCgkiARSL3wcV9bRRWI6P2km0vzo/giJjISRz6zmltyPfJ4q7gpKk/j860F+09Go/HdfMbbC0iw/JnSvwUYuV8XMJhsK77zRwPi4FTaqcP5BfokKxYvnZsJaXk5k94TjyeX+o4ncDkmsrz8VtM/mlqYicyGM6Jnp7/hcYfZr+pcAiTQCaH8xlmAwiU2JRInjCym+rSSImRFIIj4YN8lMpJSll8vaVTgsuvlAYo7zGbx6wk0yCKAqnhoyegXs2NQ9bQypU7iXKT5WcakkEqjvhLe5U1bHvLW51Y+c1UqaRAoXQL2H6I1+cIdsM6Melb7RjHXyoxP6ugqQPyNryovqulDPO/LNT/AM7TeOQl4jpzOre38cG2JVNk8E1hRJuJjyn2N6dHpMDKYjzoFt4s+mHbzD++133atarF0RgGBirnzPurXERWCVk5wugqBzc0eiuw1m4yf3gaPNN2JXvcQj0YZOA3r2oWBrzZvNUzrhV59JMlEeabBjBI2sUcEgJtL MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0792c353-f656-4b7d-ac2c-08d8279c4b7f X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jul 2020 02:19:10.6435 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CmoxnW8gxDxKQPa+fKt+r8hjWbL7EWe/CjVKuZhko4irQ18YXVLFntb13gFw4UocQycPVcvnDW1ZQsIrC+W+HQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR11MB3620 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Kinney, Michael D > Sent: Friday, July 10, 2020 11:05 AM > To: devel@edk2.groups.io > Cc: Wu, Hao A ; Gao, Liming > Subject: [Patch] MdeModulePkg/Variable/RuntimeDxe: Fix return status from > Reclaim() >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2844 >=20 > Update Reclaim() to return the error status from the reclaim operation an= d > not the status of SynchronizeRuntimeVariableCache() that can be > EFI_SUCCESS even through the status from reclaim is an error. Without th= is > change, the return status from > SetVariable() can be EFI_SUCCESS even though the variable was not actuall= y > set. This occurs if the variable store is full and a Reclaim() is invoke= d to free > up space and even after all possible space is freed, there is still not e= nough > room for the variable being set. This condition should return > EFI_OUT_OF_RESOURCES. >=20 > Cc: Hao A Wu > Cc: Liming Gao > Signed-off-by: Michael D Kinney > --- > .../Universal/Variable/RuntimeDxe/Variable.c | 30 +++++++++++-------- > 1 file changed, 18 insertions(+), 12 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index 1e71fc642c..41f8ff4ceb 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -531,6 +531,7 @@ Reclaim ( > VOID *Point1; > BOOLEAN FoundAdded; > EFI_STATUS Status; > + EFI_STATUS DoneStatus; > UINTN CommonVariableTotalSize; > UINTN CommonUserVariableTotalSize; > UINTN HwErrVariableTotalSize; > @@ -774,25 +775,30 @@ Reclaim ( > } >=20 > Done: > + DoneStatus =3D EFI_SUCCESS; > if (IsVolatile || mVariableModuleGlobal->VariableGlobal.EmuNvMode) { > - Status =3D SynchronizeRuntimeVariableCache ( > - &mVariableModuleGlobal- > >VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCach > e, > - 0, > - VariableStoreHeader->Size > - ); > - ASSERT_EFI_ERROR (Status); > + DoneStatus =3D SynchronizeRuntimeVariableCache ( > + &mVariableModuleGlobal- > >VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCach > e, > + 0, > + VariableStoreHeader->Size > + ); > + ASSERT_EFI_ERROR (DoneStatus); > FreePool (ValidBuffer); > } else { > // > // For NV variable reclaim, we use mNvVariableCache as the buffer, s= o > copy the data back. > // > CopyMem (mNvVariableCache, (UINT8 *) (UINTN) VariableBase, > VariableStoreHeader->Size); > - Status =3D SynchronizeRuntimeVariableCache ( > - &mVariableModuleGlobal- > >VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeNvCache, > - 0, > - VariableStoreHeader->Size > - ); > - ASSERT_EFI_ERROR (Status); > + DoneStatus =3D SynchronizeRuntimeVariableCache ( > + &mVariableModuleGlobal- > >VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeNvCache, > + 0, > + VariableStoreHeader->Size > + ); > + ASSERT_EFI_ERROR (DoneStatus); > + } > + > + if (!EFI_ERROR (Status) && EFI_ERROR (DoneStatus)) { > + Status =3D DoneStatus; > } Reviewed-by: Hao A Wu Best Regards, Hao Wu >=20 > return Status; > -- > 2.21.0.windows.1