From nobody Mon Feb 9 10:13:12 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+78938+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+78938+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=posteo.de ARC-Seal: i=1; a=rsa-sha256; t=1628502717; cv=none; d=zohomail.com; s=zohoarc; b=Kr6z7mY0QyWgnJgUXacerJsl9lbP86CKUQjZf8tD+I8VBqV1rsQ96IiQ5fuGtnxqSSAlxGPLYt6AbW2B27jul6ipDQ4qRX0ap4EeMXsEbBj93QrQFJZ/RphcrCuNRRi6ilT4LoKkP1drfBgF5hv/Wfz1zmF2DaCALfzqIj8/lpI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628502717; h=Content-Type: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=pNuknaz4Y+a/uBEdyIvQ+9ReMrbpLtKH5ZWFPxe2dL0=; b=Wscx4MxdBKEb1SfCIvY1LjdNrMKOCTf4lrmKZeN2mQkObtQIJlM1UUyJ9l/cufXG6WR0KDga/SqHaltjG1ikKZtmktoy17n6wt8in3+Cu+xFj8NTGmBNwCu1hSoKbaXnfARwoz7d/RZGER6zJVX1nEhj7pVBObGiLaZDV/49rOc= 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+78938+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 1628502717100933.8071096224229; Mon, 9 Aug 2021 02:51:57 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xUzbYY1788612xHtxvV164un; Mon, 09 Aug 2021 02:51:56 -0700 X-Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web10.20760.1628502713758238150 for ; Mon, 09 Aug 2021 02:51:54 -0700 X-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 0DBAF240101 for ; Mon, 9 Aug 2021 11:51:52 +0200 (CEST) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Gjrvq3dM9z6tmF; Mon, 9 Aug 2021 11:51:51 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Liming Gao , Vitaly Cheptsov Subject: [edk2-devel] [PATCH v2 2/7] MdeModulePkg/DxeCore: Fix DebugImageInfoTable size report Date: Mon, 9 Aug 2021 09:51:25 +0000 Message-Id: <5159497b61000dee562cd18b7e6cbc519f00fe8b.1628502345.git.mhaeuser@posteo.de> In-Reply-To: References: 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,mhaeuser@posteo.de X-Gm-Message-State: QM2DqxqmpQMJb0e3e2rzxfFbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628502716; bh=VK4vDIo42INKuilJ05LuCsCJWhzbrXJzaqtoACu3tp4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=s3MoTRhbjCwC1SRQYq+iHcVQkiqDM43jBf7x9ZLrrl88TqYYXId2bgug9nXkKyC9Wq1 CwaqZQ8YFdsbAxIbibCpJAFfWtteXxYJ6044jqvBIIlYcRSzGks7pgFVNN948uYCsWZH2 tqBF1jOvycA9+4Ehj7ypDJQ6HRaf0J6DDIA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628502718613100024 Content-Type: text/plain; charset="utf-8" Separate tracking the used entries from the table's self-reported size. Removing an entry from the table does not necessarily reduce the size of the table as defragmentation is not performed. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Liming Gao Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Cor= e/Dxe/Misc/DebugImageInfo.c index 7bd970115111..cc22e23eb0b3 100644 --- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c +++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c @@ -18,6 +18,8 @@ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = =3D { =20 UINTN mMaxTableEntries =3D 0; =20 +UINTN mUsedTableEntries =3D 0; + EFI_SYSTEM_TABLE_POINTER *mDebugTable =3D NULL; =20 #define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *)) @@ -178,7 +180,7 @@ CoreNewDebugImageInfoEntry ( =20 Table =3D mDebugInfoTableHeader.EfiDebugImageInfoTable; =20 - if (mDebugInfoTableHeader.TableSize < mMaxTableEntries) { + if (mUsedTableEntries < mMaxTableEntries) { // // We still have empty entires in the Table, find the first empty entr= y. // @@ -237,8 +239,17 @@ CoreNewDebugImageInfoEntry ( // increase the number of EFI_DEBUG_IMAGE_INFO elements. // mDebugInfoTableHeader.UpdateStatus |=3D EFI_DEBUG_IMAGE_INFO_TABLE_MOD= IFIED; + mUsedTableEntries++; Table[Index].NormalImage =3D NormalImage; - mDebugInfoTableHeader.TableSize++; + // + // Only increase the amount of elements in the table if the new entry = did + // not take the place of a previously removed entry. + // + if (Index =3D=3D mDebugInfoTableHeader.TableSize) { + mDebugInfoTableHeader.TableSize++; + } + + ASSERT (Index < mDebugInfoTableHeader.TableSize); } mDebugInfoTableHeader.UpdateStatus &=3D ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_= PROGRESS; } @@ -274,9 +285,10 @@ CoreRemoveDebugImageInfoEntry ( mDebugInfoTableHeader.UpdateStatus |=3D EFI_DEBUG_IMAGE_INFO_TABLE_M= ODIFIED; Table[Index].NormalImage =3D NULL; // - // Decrease the number of EFI_DEBUG_IMAGE_INFO elements. + // Do not reduce the amount of elements reported to be in the table = as + // this would only work for the last element without defragmentation. // - mDebugInfoTableHeader.TableSize--; + mUsedTableEntries--; // // Free up the record. // --=20 2.31.1 -=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 (#78938): https://edk2.groups.io/g/devel/message/78938 Mute This Topic: https://groups.io/mt/84764901/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-