public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH V2 1/1] Platform/Loongson: Set Dxe common page size to 16k
       [not found] <cover.1683859255.git.lixianglai@loongson.cn>
@ 2023-05-12  2:42 ` xianglai
       [not found] ` <175E4526EDF648E7.27409@groups.io>
  1 sibling, 0 replies; 4+ messages in thread
From: xianglai @ 2023-05-12  2:42 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Bibo Mao, Chao Li, Leif Lindholm, Liming Gao,
	Michael D Kinney

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 <ardb+tianocore@kernel.org>
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Chao Li <lichao@loongson.cn>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: xianglai li <lixianglai@loongson.cn>
---
 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
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH V2 1/1] Platform/Loongson: Set Dxe common page size to 16k
       [not found] ` <175E4526EDF648E7.27409@groups.io>
@ 2023-06-01  6:56   ` xianglai
  2023-06-01  8:08     ` Chao Li
  0 siblings, 1 reply; 4+ messages in thread
From: xianglai @ 2023-06-01  6:56 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Bibo Mao, Chao Li, Leif Lindholm, Liming Gao,
	Michael D Kinney

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 <ardb+tianocore@kernel.org>
> Cc: Bibo Mao <maobibo@loongson.cn>
> Cc: Chao Li <lichao@loongson.cn>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Signed-off-by: xianglai li <lixianglai@loongson.cn>
> ---
>   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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH V2 1/1] Platform/Loongson: Set Dxe common page size to 16k
  2023-06-01  6:56   ` [edk2-devel] " xianglai
@ 2023-06-01  8:08     ` Chao Li
  2023-06-01  9:10       ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Li @ 2023-06-01  8:08 UTC (permalink / raw)
  To: devel, lixianglai
  Cc: Ard Biesheuvel, Bibo Mao, Leif Lindholm, Liming Gao,
	Michael D Kinney

[-- Attachment #1: Type: text/plain, Size: 2579 bytes --]

Reviewed-by: Chao Li <lichao@loongson.cn>


Thanks,
Chao
在 2023/6/1 14:56, xianglai 写道:
> 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 <ardb+tianocore@kernel.org>
>> Cc: Bibo Mao <maobibo@loongson.cn>
>> Cc: Chao Li <lichao@loongson.cn>
>> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Signed-off-by: xianglai li <lixianglai@loongson.cn>
>> ---
>>   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
>
>
>
>
> 
>

[-- Attachment #2: Type: text/html, Size: 4925 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH V2 1/1] Platform/Loongson: Set Dxe common page size to 16k
  2023-06-01  8:08     ` Chao Li
@ 2023-06-01  9:10       ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2023-06-01  9:10 UTC (permalink / raw)
  To: Chao Li
  Cc: devel, lixianglai, Ard Biesheuvel, Bibo Mao, Leif Lindholm,
	Liming Gao, Michael D Kinney

On Thu, 1 Jun 2023 at 10:08, Chao Li <lichao@loongson.cn> wrote:
>
> Reviewed-by: Chao Li <lichao@loongson.cn>
>

Pushed as 406291d3dfa7..eaaf3edafa66


>
> Thanks,
> Chao
> 在 2023/6/1 14:56, xianglai 写道:
>
> 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 <ardb+tianocore@kernel.org>
> Cc: Bibo Mao <maobibo@loongson.cn>
> Cc: Chao Li <lichao@loongson.cn>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Signed-off-by: xianglai li <lixianglai@loongson.cn>
> ---
>   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
>
>
>
>
>
> 
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-01  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1683859255.git.lixianglai@loongson.cn>
2023-05-12  2:42 ` [edk2-platforms][PATCH V2 1/1] Platform/Loongson: Set Dxe common page size to 16k xianglai
     [not found] ` <175E4526EDF648E7.27409@groups.io>
2023-06-01  6:56   ` [edk2-devel] " xianglai
2023-06-01  8:08     ` Chao Li
2023-06-01  9:10       ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox