From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.1.76; helo=eur01-ve1-obe.outbound.protection.outlook.com; envelope-from=wasim.khan@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0076.outbound.protection.outlook.com [104.47.1.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5BA5F222EDCFC for ; Fri, 5 Jan 2018 01:54:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=z/Y4N16ITF6db6LdT2GsMH/XN8RFXmn69RFgNEvExHk=; b=Y7E3aSVK95mg8zO3Skihxdu7HyHo+k/CPKLpnAQflEx8EuElNW2wWsx6KaoM28+u0625970KeNmvSlvaPPtxnzTP1QAIGN9FD40ppqeMqkwsLEh3pqVjdzPu5KBBJB0UnsKMQ+ccIIo7ccu6LLlo4cx8r3nmdsetZPQJVobJwvk= Received: from DB6PR0401MB2342.eurprd04.prod.outlook.com (10.168.54.155) by DB6PR0401MB2341.eurprd04.prod.outlook.com (10.168.54.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Fri, 5 Jan 2018 09:59:18 +0000 Received: from DB6PR0401MB2342.eurprd04.prod.outlook.com ([fe80::fd7b:6470:427c:aea8]) by DB6PR0401MB2342.eurprd04.prod.outlook.com ([fe80::fd7b:6470:427c:aea8%17]) with mapi id 15.20.0366.011; Fri, 5 Jan 2018 09:59:18 +0000 From: Wasim Khan To: "edk2-devel@lists.01.org" Thread-Topic: Memory space entry is not removed after calling FreeMemorySpace and RemoveMemorySpace Thread-Index: AdOGC9ELVQ4yvX0oRxySz+o11ogX7A== Date: Fri, 5 Jan 2018 09:59:17 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=wasim.khan@nxp.com; x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0401MB2341; 7:qYjGMDtJy2aWE70SDdvPY0UTk0Vb+sRWnLfooqev+GeujLakBBsWBwABoLRqQvaKAvEVM7RlbcQqRovaj/Qkrbh2cAKZUK9lguFtC+9CiBp9kVOXQQqPU+dj61s29l776J6u5EiC540v+wyiM+G7fQDDFtYayT2YQP7rEp01MX3FdOq5EmjSI2hMMzsTNMOXxM6Q7l69v4GUXgquqc5xBgbf3iHxzZTvHjLWU0cZdfJBy+a5wC/Cs94io7Q6GTCf x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: e50f7ab8-bb0a-4d8d-56df-08d55422fc45 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060); SRVR:DB6PR0401MB2341; x-ms-traffictypediagnostic: DB6PR0401MB2341: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(21748063052155); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(944501075)(6055026)(6041268)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:DB6PR0401MB2341; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB6PR0401MB2341; x-forefront-prvs: 05437568AA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(39380400002)(376002)(346002)(396003)(57704003)(199004)(189003)(53754006)(2351001)(25786009)(106356001)(66066001)(105586002)(3280700002)(97736004)(7696005)(5250100002)(2501003)(8936002)(99286004)(81166006)(790700001)(2906002)(6116002)(3846002)(53936002)(3660700001)(6436002)(5640700003)(33656002)(5660300001)(55016002)(6916009)(9686003)(54896002)(6306002)(7736002)(74316002)(68736007)(8676002)(81156014)(86362001)(575784001)(59450400001)(6506007)(102836004)(478600001)(316002)(2900100001)(14454004)(9326002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0401MB2341; H:DB6PR0401MB2342.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: x4If62i/7AxPdSuvRtWwphOcRRDszhxGm6tcGK2JGN1MfUAqc1JPAB1rCe6x28p/khjKWlobdXkac9sKFQzz6A== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e50f7ab8-bb0a-4d8d-56df-08d55422fc45 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2018 09:59:17.9410 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2341 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: Memory space entry is not removed after calling FreeMemorySpace and RemoveMemorySpace X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jan 2018 09:54:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi All, I am facing a problem that if a add a memory space using 'gDS->AddMemorySpa= ce' and then remove it using 'gDS->FreeMemorySpace' followed by 'gDS->Remo= veMemorySpace'. I can still see the entry of added memory space in the table shown by 'memm= ap' command. I enabled DEBUG_GCD and as per logs , the entry is removed from GcdMemorySp= aceMap , but when I run 'memmap' command which gets the memory map using 'g= BS->GetMemoryMap', I can see that entry for the added memory space is still= present. Steps and Logs are below for reference Do I need to perform any other steps in order to cleanly remove the memory = space entry ? Regards, Wasim Below are the steps and GCD debug logs. Steps 1 : Add a memory space . We can see that an entry from system memory = is added. Status =3D gDS->AddMemorySpace ( EfiGcdMemoryTypeSystemMemory, FixedPcdGet64(PcdSystemMemoryEx= Base), SystemMemoryExSize, EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB ); Logs: GCD:AddMemorySpace(Base=3D0000008080000000,Le= ngth=3D0000000380000000) GcdMemoryType =3D SystemMem Capabilities =3D 000000000000000E CoreConvertSpace 774 Status =3D Success GCDMemType Range Capabilities Attributes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D NonExist 0000000000000000-000000009FFFFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000A0000000-00000000DFFFFFFF 800000000000000E 0000000000000= 008* NonExist 00000000E0000000-00000000E01BFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000E01C0000-00000000FFFFFFFF 800000000000000E 0000000000000= 008* NonExist 0000000100000000-000000807FFFFFFF 0000000000000000 0000000000000= 000 SystemMem 0000008080000000-00000083FFFFFFFF 800000000000000E 0000000000000= 000 NonExist 0000008400000000-0000FFFFFFFFFFFF 0000000000000000 0000000000000= 000 GCD:AllocateMemorySpace(Base=3D0000008080000000,Length=3D0000000380000000) GcdAllocateType =3D AtAddress GcdMemoryType =3D SystemMem Alignment =3D 0000000000001000 ImageHandle =3D FED1FF98 DeviceHandle =3D 0 Status =3D Success (BaseAddress =3D 0000008080000000) GCDMemType Range Capabilities Attributes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D NonExist 0000000000000000-000000009FFFFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000A0000000-00000000DFFFFFFF 800000000000000E 0000000000000= 008* NonExist 00000000E0000000-00000000E01BFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000E01C0000-00000000FFFFFFFF 800000000000000E 0000000000000= 008* NonExist 0000000100000000-000000807FFFFFFF 0000000000000000 0000000000000= 000 SystemMem 0000008080000000-00000083FFFFFFFF 800000000000000E 0000000000000= 000* NonExist 0000008400000000-0000FFFFFFFFFFFF 0000000000000000 0000000000000= 000 Step2: Free the memory space Status =3D gDS->FreeMemorySpace ( FixedPcdGet64(PcdSystemMemoryExBase), SystemMemoryExSize ); Logs: GCD:FreeMemorySpace(Base=3D0000008080000000,L= ength=3D0000000380000000) Status =3D Success GCDMemType Range Capabilities Attributes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D NonExist 0000000000000000-000000009FFFFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000A0000000-00000000DFFFFFFF 800000000000000E 0000000000000= 008* NonExist 00000000E0000000-00000000E01BFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000E01C0000-00000000FFFFFFFF 800000000000000E 0000000000000= 008* NonExist 0000000100000000-000000807FFFFFFF 0000000000000000 0000000000000= 000 SystemMem 0000008080000000-00000083FFFFFFFF 800000000000000E 0000000000000= 000 NonExist 0000008400000000-0000FFFFFFFFFFFF 0000000000000000 0000000000000= 000 Step3: Remove the memory space , As we can see that entry 'SystemMem 00000= 08080000000-00000083FFFFFFFF' is removed. Status =3D gDS->RemoveMemorySpace ( FixedPcdGet64(PcdSystemMemoryExBase), SystemMemoryExSize ); Logs: GCD:RemoveMemorySpace(Base=3D0000008080000000= ,Length=3D0000000380000000) Status =3D Success GCDMemType Range Capabilities Attributes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D NonExist 0000000000000000-000000009FFFFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000A0000000-00000000DFFFFFFF 800000000000000E 0000000000000= 008* NonExist 00000000E0000000-00000000E01BFFFF 0000000000000000 0000000000000= 000 SystemMem 00000000E01C0000-00000000FFFFFFFF 800000000000000E 0000000000000= 008* NonExist 0000000100000000-0000FFFFFFFFFFFF 0000000000000000 0000000000000= 000 Step4 : Run the 'memmap' command. As we can see that entry is still present= . Shell> memmap Type Start End # Pages Attributes Available 00000000A0000000-00000000DFFFFFFF 0000000000040000 0000000000000= 00E Available 00000000E01C0000-00000000E53C0FFF 0000000000005201 0000000000000= 00E BS_Data 00000000E53C1000-00000000E5D99FFF 00000000000009D9 0000000000000= 00E ... Available 0000008080000000-00000083FFFFFFFF 0000000000380000 0000000000000= 00E ...