From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web11.25313.1685602603860810378 for ; Wed, 31 May 2023 23:56:44 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: loongson.cn, ip: 114.242.206.163, mailfrom: lixianglai@loongson.cn) Received: from loongson.cn (unknown [10.20.42.32]) by gateway (Coremail) with SMTP id _____8Ax3OonQXhkJTQDAA--.2654S3; Thu, 01 Jun 2023 14:56:39 +0800 (CST) Received: from [10.20.42.32] (unknown [10.20.42.32]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxHuQnQXhkUMaDAA--.18241S3; Thu, 01 Jun 2023 14:56:39 +0800 (CST) Subject: Re: [edk2-devel] [edk2-platforms][PATCH V2 1/1] Platform/Loongson: Set Dxe common page size to 16k From: "xianglai" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Bibo Mao , Chao Li , Leif Lindholm , Liming Gao , Michael D Kinney Reply-To: devel@edk2.groups.io, lixianglai@loongson.cn References: <175E4526EDF648E7.27409@groups.io> Message-ID: <32fc0480-020f-f5f4-f626-2ba6a1713e6f@loongson.cn> Date: Thu, 1 Jun 2023 14:56:39 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <175E4526EDF648E7.27409@groups.io> X-CM-TRANSID: AQAAf8BxHuQnQXhkUMaDAA--.18241S3 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7uF47uFWUWw13Aw47uFy3Jwb_yoW5Jr43pF 1fCa4xKr18JrsrZw1kAa4jkrWav345GrZ8JFsrKw4fCasxZ3W09a4Yva1Fya45GryFya4D ZrWI9w4Uua1UZrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bI8YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCYjI0SjxkI62AI1cAE67vIY487Mx AIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_ Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwI xGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8 JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcV C2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxU25EfUUUUU Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US There has been no response for a long time, welcome to give me some suggestions for this patch. On 5/12/23 10:42 AM, xianglai wrote: > The loongarch qemu tcg code section is 16K aligned by default. > When UEFI keep 4K alignment, the code section and data section > of UEFI are loaded into the same page by qemu, and when the data > is written to the page containing the code section, it will cause > qemu to refresh TB, resulting in qemu running slowly.Therefore, > setting Dxe to 16K alignment can ensure that the code section is > loaded into a page separately, avoid qemu repeatedly refreshing TB, > and speed up the execution speed of qemu. > > The following shows the impact of Dxe 4K alignment and 16K alignment > on image size: > > DXE 4k alignment: > DXEFV.FV 7.2M > After compression: > FVMAIN_COMPACT.Fv 3.4M > QEMU_EFI.fd 3.7M > > DXE 16k alignment: > DXEFV.FV 9.5M > After compression: > FVMAIN_COMPACT.Fv 3.4M > QEMU_EFI.fd 3.7M > > Cc: Ard Biesheuvel > Cc: Bibo Mao > Cc: Chao Li > Cc: Leif Lindholm > Cc: Liming Gao > Cc: Michael D Kinney > Signed-off-by: xianglai li > --- > Platform/Loongson/LoongArchQemuPkg/Loongson.dsc | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc > index 6875e39cc6..13b27d84b8 100644 > --- a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc > +++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc > @@ -61,8 +61,13 @@ > [BuildOptions.LOONGARCH64.EDKII.SEC] > *_*_*_CC_FLAGS = > > +# > +# default page size is 16K for loongarch qemu tcg > +# code section separated with data section with 16K page alignment, else data > +# write operation in the same page with code section will cause qemu TB flush > +# > [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION] > - GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 > + GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x4000 > > [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] > GCC:*_*_LOONGARCH64_DLINK_FLAGS = -z common-page-size=0x10000