From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E0B9921CF25C1 for ; Wed, 9 Aug 2017 18:31:13 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2017 18:33:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,349,1498546800"; d="scan'208";a="138466827" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 09 Aug 2017 18:33:32 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 9 Aug 2017 18:33:32 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 9 Aug 2017 18:33:32 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.183]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.114]) with mapi id 14.03.0319.002; Thu, 10 Aug 2017 09:33:30 +0800 From: "Zeng, Star" To: Andrew Fish , edk2-devel CC: "Zeng, Star" Thread-Topic: [edk2] Does a double Page free report "ConvertPages: Incompatible memory types", maybe we could do better. Thread-Index: AQHTEXSdIFRojfshJEqdsbHScTCNeqJ8zcUw Date: Thu, 10 Aug 2017 01:33:29 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9159A6@shsmsx102.ccr.corp.intel.com> References: <41A7B048-4140-4889-AE7C-36A0ED3B8C1C@apple.com> In-Reply-To: <41A7B048-4140-4889-AE7C-36A0ED3B8C1C@apple.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: Does a double Page free report "ConvertPages: Incompatible memory types", maybe we could do better. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Aug 2017 01:31:14 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Andrew, Another path may hit this DEBUG message is AllocatePages() by AllocateAddre= ss type. I think it is a good suggestion to enhance the DEBUG message. How about the= update like below? - DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memo= ry types\n")); + DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memo= ry types, ")); + if (Entry->Type =3D=3D EfiConventionalMemory) { + DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "the pages to free have been f= reed\n")); + } else { + DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "the pages to allocate have be= en allocated\n")); + } Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Andr= ew Fish Sent: Thursday, August 10, 2017 9:04 AM To: edk2-devel Subject: [edk2] Does a double Page free report "ConvertPages: Incompatible = memory types", maybe we could do better. It looks to me like if you Free pages, after you free pages you hit this DE= BUG message.=20 https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Mem/Pag= e.c#L790 if (!(NewType =3D=3D EfiConventionalMemory ? 1 : 0) ^ (Entry->Type = =3D=3D EfiConventionalMemory ? 1 : 0)) { DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memor= y types\n")); return EFI_NOT_FOUND; } I'm not sure I've thought out all the paths, but would it make more sense i= f you are trying to convert EfiConventionalMemory to EfiConventionalMemory = that you are trying to free pages that are already freed. That is not very = obvious from the above DEBUG print. Could there be an if in the error path= to print a better DEBUG message for a free pages bug?=20 Also to be pedantic the function change names to: CoreConvertPagesEx().=20 Thanks, Andrew Fish _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel