From nobody Tue May 14 04:14:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+111193+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+111193+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1699950268; cv=none; d=zohomail.com; s=zohoarc; b=XMba9bj3oAJ6FNVRFrJurhdGCBmVHm5YTySf9yqcMMGb2BlQHUDccJN5QDDzjN5zAJwOOVTk89MKkQXZ5QsuCwpJaRf3Ahhlk59uQDfcoEsjqpiRHUnxTjeBwqCV5/APVvbdX3fB3ZbRYlozxQHP7nAGoAuGoZ9P1EBfc5wDSjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699950268; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=OERTf/+BgUKqPJHMRskEDS3JFkTfF93KUDpGXGdQ64U=; b=OTKcVuY5iVekGZraDSqpaLHiJgVm8wTl6j8AIEFDZXTG0oSZBsadXjdVGMGkAijUaet9n4eeq7UxN3kh7ReUMBXHxt1bbYv6O8fp98l/TtTPRVOzmqy9PtPHPwJbjLTVIqkk8OYSU7WdmWXUJulKl7NYV+DWMh4iFoKAu3muD2g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+111193+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1699950268720525.5696803438054; Tue, 14 Nov 2023 00:24:28 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=mIIrw+hbKmiw4fP+Pvph1XwgvJRhNIszxUPundE/RD8=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1699950268; v=1; b=WAf+vuavOB3Y8afWXaGVNYBp+p677w2NOBKoLgxWut7iN93xj/l3Cd52q5po9X5znC3HRoXl 1Jd8h2ICPmtt/hDjENVIjZKTHYpIXau+S9Tg7gNoYH+A1+FZVw240LnlHOuOnlODxQq4IQME9Mx RWBXD6SCa/ooAqby1fVZEuYI= X-Received: by 127.0.0.2 with SMTP id HUTNYY1788612xwTfgDXDaU9; Tue, 14 Nov 2023 00:24:28 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.8601.1699950266821232588 for ; Tue, 14 Nov 2023 00:24:27 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10893"; a="454901978" X-IronPort-AV: E=Sophos;i="6.03,301,1694761200"; d="scan'208";a="454901978" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 00:24:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10893"; a="888176889" X-IronPort-AV: E=Sophos;i="6.03,301,1694761200"; d="scan'208";a="888176889" X-Received: from gaocheng-desk.ccr.corp.intel.com ([10.239.154.170]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 00:24:22 -0800 From: "Gao" To: devel@edk2.groups.io Cc: Gao Cheng , Liming Gao , Ray Ni Subject: [edk2-devel] [PATCH] MdeModulePkg/Variable: Merge variable header + data update into one step Date: Tue, 14 Nov 2023 16:23:53 +0800 Message-ID: <475e7d21da7f9a54d4841d1efe78c1e587c6b931.1699949356.git.gao.cheng@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gao.cheng@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ZLKOrJeExJlyTWgjqSqkazuYx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1699950269877100003 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D4597 When creating a new variable, skip marking VAR_HEADER_VALID_ONLY so that variable header + data update can be merged into one flash write. This will greatly reduce the time taken for updating a variable and thus increase performance. Removing VAR_HEADER_VALID_ONLY marking doesn't have any function impact since it's not used by current code to detect variable header + data corruption. Cc: Liming Gao Cc: Ray Ni Signed-off-by: Gao Cheng --- .../Universal/Variable/RuntimeDxe/Variable.c | 45 ++----------------- 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeMod= ulePkg/Universal/Variable/RuntimeDxe/Variable.c index 7a1331255b..3c360481f4 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -2168,11 +2168,9 @@ UpdateVariable ( =20 if (!mVariableModuleGlobal->VariableGlobal.EmuNvMode) { // - // Four steps - // 1. Write variable header - // 2. Set variable state to header valid - // 3. Write variable data - // 4. Set variable state to valid + // Two steps + // 1. Write variable header and data + // 2. Set variable state to valid // // // Step 1: @@ -2183,7 +2181,7 @@ UpdateVariable ( TRUE, Fvb, mVariableModuleGlobal->NonVolatileLastVariableOffset, - (UINT32)GetVariableHeaderSize (AuthFormat), + (UINT32)VarSize, (UINT8 *)NextVariable ); =20 @@ -2194,41 +2192,6 @@ UpdateVariable ( // // Step 2: // - NextVariable->State =3D VAR_HEADER_VALID_ONLY; - Status =3D UpdateVariableStore ( - &mVariableModuleGlobal->VariableGlobal, - FALSE, - TRUE, - Fvb, - mVariableModuleGlobal->NonVolatileLastVariab= leOffset + OFFSET_OF (VARIABLE_HEADER, State), - sizeof (UINT8), - &NextVariable->State - ); - - if (EFI_ERROR (Status)) { - goto Done; - } - - // - // Step 3: - // - Status =3D UpdateVariableStore ( - &mVariableModuleGlobal->VariableGlobal, - FALSE, - TRUE, - Fvb, - mVariableModuleGlobal->NonVolatileLastVariableOffset + Ge= tVariableHeaderSize (AuthFormat), - (UINT32)(VarSize - GetVariableHeaderSize (AuthFormat)), - (UINT8 *)NextVariable + GetVariableHeaderSize (AuthFormat) - ); - - if (EFI_ERROR (Status)) { - goto Done; - } - - // - // Step 4: - // NextVariable->State =3D VAR_ADDED; Status =3D UpdateVariableStore ( &mVariableModuleGlobal->VariableGlobal, --=20 2.42.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111193): https://edk2.groups.io/g/devel/message/111193 Mute This Topic: https://groups.io/mt/102579876/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-