From nobody Tue Feb 10 05:18:29 2026 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+105366+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+105366+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1685355451; cv=none; d=zohomail.com; s=zohoarc; b=X2F6OMFOsnkeEP+i9PWFKbEJ3X5Zyoc2idjPDlf8TjhAqiaFSdkKGMqCmSIQWUrkIjHE4AuHyk+mykWROg8OZS1oWOPv7EVwexXqZ6dP25TXm/06VOWt7CK099MH5cLRqq9MOpq1/EuCTRxS+h90IULlxUR5EscaupqV0+/mLdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685355451; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ZVtP6E8cbXADhUUDc6Ep5INsIhxXWfVqTq5FISwsxlg=; b=gHYdVP76Tbw72Lv13zjIt6kMiMu0/li+R6aqg/504KSMJWuRCU1FimddFYwUKnwPpFpMXUpSIyarcUn+puf3Ppulk2RuK2SW5sln5iaH29FMU1v+f3zxFbaOa+qIFb41cBrJawkeVaGmKWiaLqoZL0Mn/4aEyqGggumfk2KZ0GU= 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+105366+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 168535545107754.67106556980889; Mon, 29 May 2023 03:17:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Q1RtYY1788612xYbwk86fu5C; Mon, 29 May 2023 03:17:30 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.46505.1685355450083660571 for ; Mon, 29 May 2023 03:17:30 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 900C661362; Mon, 29 May 2023 10:17:29 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94F91C4339E; Mon, 29 May 2023 10:17:26 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Ray Ni , Jiewen Yao , Gerd Hoffmann , Taylor Beebe , Oliver Smith-Denny , Dandan Bi , Liming Gao , "Kinney, Michael D" , Leif Lindholm , Michael Kubacki Subject: [edk2-devel] [RFC PATCH 04/11] MdeModulePkg/DxeCore: Avoid caching memory mapped FFS files Date: Mon, 29 May 2023 12:16:58 +0200 Message-Id: <20230529101705.2476949-5-ardb@kernel.org> In-Reply-To: <20230529101705.2476949-1-ardb@kernel.org> References: <20230529101705.2476949-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ardb@kernel.org X-Gm-Message-State: nG1lJM2ZVxpG0N2neyHZ4vwgx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1685355450; bh=rsiFWIbLVVvMMNmbYfeLahouxJSNugnMy9ueafYcvRk=; h=Cc:Date:From:Reply-To:Subject:To; b=wDiz2zWwAeSobsRAbaNOvGM5MMPg+5/0nvWs2WSZzFHbNjLNcaWnr4YjjIuchk/ibRP b62Xwlsmhs+p3XlGHLdUIlWEzTEywI7S0GKd0BS/37StwTjIvHUZ6IQc7UAf8GRtVeV2d ffXpjOUZ7bhAwaKXtDXcJz6HC4s+vuE3/GM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1685355451841100013 Content-Type: text/plain; charset="utf-8" If a firmware volume is memory mapped, it means we can access it contents directly, and so caching serves little purpose beyond potentially a minor performance improvement. However, given that most files are read only a single time, and dispatched from a decompressed firmware volume in DRAM, we can just avoid the redundant caching here. Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c | 22 -------------------- 1 file changed, 22 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c b/MdeModulePkg/Core/Dx= e/FwVol/FwVolRead.c index 2ff22c93aad48d7e..69df96685d680868 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c @@ -284,7 +284,6 @@ FvReadFile ( UINT8 *SrcPtr; EFI_FFS_FILE_HEADER *FfsHeader; UINTN InputBufferSize; - UINTN WholeFileSize; =20 if (NameGuid =3D=3D NULL) { return EFI_INVALID_PARAMETER; @@ -316,27 +315,6 @@ FvReadFile ( // Get a pointer to the header // FfsHeader =3D FvDevice->LastKey->FfsHeader; - if (FvDevice->IsMemoryMapped) { - // - // Memory mapped FV has not been cached, so here is to cache by file. - // - if (!FvDevice->LastKey->FileCached) { - // - // Cache FFS file to memory buffer. - // - WholeFileSize =3D IS_FFS_FILE2 (FfsHeader) ? FFS_FILE2_SIZE (FfsHead= er) : FFS_FILE_SIZE (FfsHeader); - FfsHeader =3D AllocateCopyPool (WholeFileSize, FfsHeader); - if (FfsHeader =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Let FfsHeader in FfsFileEntry point to the cached file buffer. - // - FvDevice->LastKey->FfsHeader =3D FfsHeader; - FvDevice->LastKey->FileCached =3D TRUE; - } - } =20 // // Remember callers buffer size --=20 2.39.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 (#105366): https://edk2.groups.io/g/devel/message/105366 Mute This Topic: https://groups.io/mt/99197136/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-