From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 1151321A6F108 for ; Fri, 31 Mar 2017 02:10:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BCD17FD42; Fri, 31 Mar 2017 09:10:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7BCD17FD42 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7BCD17FD42 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-31.phx2.redhat.com [10.3.116.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99B4B78DF3; Fri, 31 Mar 2017 09:10:57 +0000 (UTC) To: Ruiyu Ni , edk2-devel@lists.01.org References: <20170329030346.249872-1-ruiyu.ni@intel.com> From: Laszlo Ersek Message-ID: <4f11fb54-c607-6afe-9f14-15f3255b26d6@redhat.com> Date: Fri, 31 Mar 2017 11:10:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170329030346.249872-1-ruiyu.ni@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 31 Mar 2017 09:10:58 +0000 (UTC) Subject: Re: [PATCH 00/10] Use a better algorithm to calculate MTRR 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: Fri, 31 Mar 2017 09:10:59 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 03/29/17 05:03, Ruiyu Ni wrote: > The new algorithm finds out the more optimal MTRR solution for > current memory type settings. > Compare against the original algorithm, the new one guarantees > to find the correct MTRR solution, but doesn't guarantee to > find the most optimal MTRR solution. > > Ruiyu Ni (10): > UefiCpuPkg/MtrrLib: Correct typo in comments and remove TABs > UefiCpuPkg/MtrrLib: Add CacheInvalid enum type to MtrrLib.h > UefiCpuPkg/MtrrLib: IsMtrrSupported uses definitions in Msr.h > UefiCpuPkg/MtrrLib: GetVariableMtrrCountWorker uses definitions in > Msr.h > UefiCpuPkg/MtrrLib: Add MtrrLib prefix to ProgramFixedMtrr > UefiCpuPkg/MtrrLib: Add MtrrLib prefix to several internal functions > UefiCpuPkg/MtrrLib: MtrrLibInitializeMtrrMask() uses definitions in > CpuId.h > UefiCpuPkg/MtrrLib: Use a better algorithm to calculate MTRR > UefiCpuPkg/MtrrLib: Refine MtrrGetMemoryAttributeByAddressWorker > UefiCpuPkg/MtrrLib: All functions use definitions in Msr.h > > UefiCpuPkg/Include/Library/MtrrLib.h | 17 +- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 1838 ++++++++++++++++++++-------------- > 2 files changed, 1068 insertions(+), 787 deletions(-) > This series seems to trigger a number of build failures with GCC: UefiCpuPkg/Library/MtrrLib/MtrrLib.c: In function 'MtrrSetMemoryAttributeWorker': UefiCpuPkg/Library/MtrrLib/MtrrLib.c:2051:90: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses] VariableSettings->Mtrr[Index].Mask = (~(OriginalVariableMtrr[Index].Length - 1)) & MtrrValidAddressMask | BIT11; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ UefiCpuPkg/Library/MtrrLib/MtrrLib.c: In function 'MtrrLibGetMtrrNumber': UefiCpuPkg/Library/MtrrLib/MtrrLib.c:945:24: error: 'Length' may be used uninitialized in this function [-Werror=maybe-uninitialized] LeastRightMtrrNumber = MtrrLibGetPositiveMtrrNumber (BaseAddress, Length, Alignment0); ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ UefiCpuPkg/Library/MtrrLib/MtrrLib.c:927:17: error: 'BaseAddress' may be used uninitialized in this function [-Werror=maybe-uninitialized] BaseAddress += BaseAlignment; ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ UefiCpuPkg/Library/MtrrLib/MtrrLib.c: In function 'MtrrLibSetMemoryType': UefiCpuPkg/Library/MtrrLib/MtrrLib.c:1430:6: error: 'LengthRight' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (LengthRight == 0) { ^ UefiCpuPkg/Library/MtrrLib/MtrrLib.c:1444:31: error: 'LengthLeft' may be used uninitialized in this function [-Werror=maybe-uninitialized] Ranges[StartIndex].Length = LengthLeft; ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~ UefiCpuPkg/Library/MtrrLib/MtrrLib.c: In function 'MtrrSetMemoryAttributeWorker': UefiCpuPkg/Library/MtrrLib/MtrrLib.c:2085:3: error: 'OriginalVariableMtrrCount' may be used uninitialized in this function [-Werror=maybe-uninitialized] for (Index = 0; Index < OriginalVariableMtrrCount; Index++) { ^~~ UefiCpuPkg/Library/MtrrLib/MtrrLib.c:1833:30: error: 'VariableSettings' may be used uninitialized in this function [-Werror=maybe-uninitialized] MTRR_VARIABLE_SETTINGS *VariableSettings; ^~~~~~~~~~~~~~~~ UefiCpuPkg/Library/MtrrLib/MtrrLib.c:2105:10: error: 'Status' may be used uninitialized in this function [-Werror=maybe-uninitialized] return Status; ^~~~~~ cc1: all warnings being treated as errors GNUmakefile:328: recipe for target 'Build/OvmfIa32/DEBUG_GCC49/IA32/UefiCpuPkg/Library/MtrrLib/MtrrLib/OUTPUT/MtrrLib.obj' failed make: *** [Build/OvmfIa32/DEBUG_GCC49/IA32/UefiCpuPkg/Library/MtrrLib/MtrrLib/OUTPUT/MtrrLib.obj] Error 1 Thanks Laszlo