From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web11.14755.1603809179006300556 for ; Tue, 27 Oct 2020 07:32:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QkW4tokg; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603809178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K0MypgxWotoPmvjRimv3pwVnI1RwoW8c4n3GL4hkQ18=; b=QkW4tokg+3tDaMWfASGEZjSAU8hHATnaUdfNmYkx124BHQj1XPAWZcmdX7hNsbUdlpXkxe 7xK/4LFrUTFWZWPAeFuqSOGJHZjvOi//8il5+dsm2Sj0Zp61H0RNB1f/G+eXzNeAhSE9Ee 4mKREkuLI2M0lwZvnEcMMo8oTT/Uilc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-29-5DtfUWPCMAqwqVoOFuBBLQ-1; Tue, 27 Oct 2020 10:32:54 -0400 X-MC-Unique: 5DtfUWPCMAqwqVoOFuBBLQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD4C8809DE8; Tue, 27 Oct 2020 14:32:49 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-132.ams2.redhat.com [10.36.114.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6640760C11; Tue, 27 Oct 2020 14:32:48 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Adjust level paging type for Internal CR3 To: devel@edk2.groups.io, jiewen.yao@intel.com, "Ni, Ray" , "Sheng, W" References: <20201023033153.21360-1-w.sheng@intel.com> <12075.1603762037777912272@groups.io> From: "Laszlo Ersek" Message-ID: <64071b93-cc7b-a6f4-7fcd-b858893e2c7a@redhat.com> Date: Tue, 27 Oct 2020 15:32:47 +0100 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 10/27/20 11:00, Yao, Jiewen wrote: > Hi Sheng W > Just a reminder, please make sure your update can work on pure EDKII platform both IA32 and X64. > > I recommend you validate the OVMF with SMM both IA32 and X64 to ensure there is no impact to the existing platform. I have nothing to add: Ray and Jiewen have covered all the points I had in mind (and more). Only sending this notice to confirm that those points are indeed important, to me as well. Thanks! Laszlo > From: devel@edk2.groups.io On Behalf Of Ni, Ray > Sent: Tuesday, October 27, 2020 5:44 PM > To: Sheng, W ; devel@edk2.groups.io > Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Adjust level paging type for Internal CR3 > > No. You cannot extern a variable defined only for x64. You may meet build failure in IA32 build. > > From: Sheng, W > > Sent: Tuesday, October 27, 2020 3:54 PM > To: devel@edk2.groups.io; Ni, Ray > > Subject: RE: [edk2-devel] [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Adjust level paging type for Internal CR3 > > Hi Ray, > Thank you for the review. > > 1. Can you please separate the patch to two patches? One is to correct the Cr3 typo, the other is to fix the bug. > > Sure. I will update the patch. > > 1. Can you please add comments in Is5LevelPageTableBase() to explain why directly checking CR4 doesn't work sometimes? And when (For example, when the function is called from entrypoint and the CR3/CR4 haven't been written)? > > Sure. I will update the patch. > > 1. "When mInternalCr3 is used, get paging level type by a variable which is set when mInternalCr3 is generated." This commit message isn't so meaningful. It just translates the C logic to plain text. Better to explain the case when the functions called from entrypoint the page table is set to mInternalCr3, gSmmFeatureEnable5LevelPaging reflects the page table type pointed by mInternalCr3. > > Sure. I will update the commit message. > > 1. I cannot find below variable. Did you miss some code change in the patch? // // Variables from Protected Mode SMI Entry Template // extern BOOLEAN gSmmFeatureEnable5LevelPaging; > > gSmmFeatureEnable5LevelPaging is in platform smiEntry.nasm. > > Yes, It is not a good variable here. > > Do you think it is better to use extern “BOOLEAN m5LevelPagingNeeded;” in file Edk2/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c ? > > Thank you. > > BR > > Sheng Wei > > > From: devel@edk2.groups.io > On Behalf Of Ni, Ray > Sent: 2020年10月27日 9:27 > To: Sheng, W >; devel@edk2.groups.io > Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Adjust level paging type for Internal CR3 > > > The overall logic looks good to me and I agree to add an internal function like the patch. > > Some minor comments: > > 1. Can you please separate the patch to two patches? One is to correct the Cr3 typo, the other is to fix the bug. > 2. Can you please add comments in Is5LevelPageTableBase() to explain why directly checking CR4 doesn't work sometimes? And when (For example, when the function is called from entrypoint and the CR3/CR4 haven't been written)? > 3. "When mInternalCr3 is used, get paging level type by a variable which is set when mInternalCr3 is generated." This commit message isn't so meaningful. It just translates the C logic to plain text. Better to explain the case when the functions called from entrypoint the page table is set to mInternalCr3, gSmmFeatureEnable5LevelPaging reflects the page table type pointed by mInternalCr3. > 4. I cannot find below variable. Did you miss some code change in the patch? // // Variables from Protected Mode SMI Entry Template // extern BOOLEAN gSmmFeatureEnable5LevelPaging; > > > > > >