public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] arm64: Default to 4K translation granule
@ 2024-05-02  7:41 Oliver Upton
  2024-05-02  7:58 ` Thomas Huth
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Oliver Upton @ 2024-05-02  7:41 UTC (permalink / raw)
  To: Andrew Jones
  Cc: Alexandru Elisei, Eric Auger, kvmarm, kvm, Paolo Bonzini,
	Thomas Huth, Oliver Upton

Some arm64 implementations in the wild, like the Apple parts, do not
support the 64K translation granule. This can be a bit annoying when
running with the defaults on such hardware, as every test fails
before getting the MMU turned on.

Switch the default page size to 4K with the intention of having the
default setting be the most widely applicable one.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
 configure | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 49f047cb2d7d..4ac2ff3e6106 100755
--- a/configure
+++ b/configure
@@ -75,7 +75,7 @@ usage() {
 	                           (s390x only)
 	    --page-size=PAGE_SIZE
 	                           Specify the page size (translation granule) (4k, 16k or
-	                           64k, default is 64k, arm64 only)
+	                           64k, default is 4k, arm64 only)
 	    --earlycon=EARLYCON
 	                           Specify the UART name, type and address (optional, arm and
 	                           arm64 only). The specified address will overwrite the UART
@@ -243,11 +243,7 @@ if [ "$efi" ] && [ "$arch" = "riscv64" ] && [ -z "$efi_direct" ]; then
 fi
 
 if [ -z "$page_size" ]; then
-    if [ "$efi" = 'y' ] && [ "$arch" = "arm64" ]; then
-        page_size="4096"
-    elif [ "$arch" = "arm64" ]; then
-        page_size="65536"
-    elif [ "$arch" = "arm" ]; then
+    if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
         page_size="4096"
     fi
 else
-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


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

* Re: [kvm-unit-tests PATCH] arm64: Default to 4K translation granule
  2024-05-02  7:41 [kvm-unit-tests PATCH] arm64: Default to 4K translation granule Oliver Upton
@ 2024-05-02  7:58 ` Thomas Huth
  2024-05-02  8:53   ` Alexandru Elisei
  2024-05-02  9:05 ` Andrew Jones
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Thomas Huth @ 2024-05-02  7:58 UTC (permalink / raw)
  To: Oliver Upton, Andrew Jones
  Cc: Alexandru Elisei, Eric Auger, kvmarm, kvm, Paolo Bonzini

On 02/05/2024 09.41, Oliver Upton wrote:
> Some arm64 implementations in the wild, like the Apple parts, do not
> support the 64K translation granule. This can be a bit annoying when
> running with the defaults on such hardware, as every test fails
> before getting the MMU turned on.
> 
> Switch the default page size to 4K with the intention of having the
> default setting be the most widely applicable one.

What about using "getconf PAGESIZE" to get the page size of the host 
environment? Would that work, too?

  Thomas



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

* Re: [kvm-unit-tests PATCH] arm64: Default to 4K translation granule
  2024-05-02  7:58 ` Thomas Huth
@ 2024-05-02  8:53   ` Alexandru Elisei
  0 siblings, 0 replies; 7+ messages in thread
From: Alexandru Elisei @ 2024-05-02  8:53 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Oliver Upton, Andrew Jones, Eric Auger, kvmarm, kvm,
	Paolo Bonzini

Hi,

On Thu, May 02, 2024 at 09:58:39AM +0200, Thomas Huth wrote:
> On 02/05/2024 09.41, Oliver Upton wrote:
> > Some arm64 implementations in the wild, like the Apple parts, do not
> > support the 64K translation granule. This can be a bit annoying when
> > running with the defaults on such hardware, as every test fails
> > before getting the MMU turned on.
> > 
> > Switch the default page size to 4K with the intention of having the
> > default setting be the most widely applicable one.
> 
> What about using "getconf PAGESIZE" to get the page size of the host
> environment? Would that work, too?

That would definitely make the tests run,  but I'm worried about
reproducibility. If you want to re-run a failed test on a different
machine, this introduces a new variable, the host's page size, which might
be different between the machines. Or, if you want to look it another way,
another configuration knob that the user has to be aware of and control.

Unless there's a system out there that doesn't support 4K pages, I'm in
favour of having 4K the default.

Thanks,
Alex

> 
>  Thomas
> 
> 

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

* Re: [kvm-unit-tests PATCH] arm64: Default to 4K translation granule
  2024-05-02  7:41 [kvm-unit-tests PATCH] arm64: Default to 4K translation granule Oliver Upton
  2024-05-02  7:58 ` Thomas Huth
@ 2024-05-02  9:05 ` Andrew Jones
  2024-05-02 16:08   ` Oliver Upton
  2024-05-02 10:10 ` Zenghui Yu
  2024-05-02 15:29 ` Andrew Jones
  3 siblings, 1 reply; 7+ messages in thread
From: Andrew Jones @ 2024-05-02  9:05 UTC (permalink / raw)
  To: Oliver Upton
  Cc: Alexandru Elisei, Eric Auger, kvmarm, kvm, Paolo Bonzini,
	Thomas Huth

On Thu, May 02, 2024 at 07:41:56AM GMT, Oliver Upton wrote:
> Some arm64 implementations in the wild, like the Apple parts, do not
> support the 64K translation granule. This can be a bit annoying when
> running with the defaults on such hardware, as every test fails
> before getting the MMU turned on.
> 
> Switch the default page size to 4K with the intention of having the
> default setting be the most widely applicable one.

Yeah, this makes sense. The original 64k default didn't have any real
justification. I only selected it since I had been drinking the "64k
pages will rule the world" Kool-Aid for too long. The effects of that
Kool-Aid have already long worn off though, so I'll get this merged.

Thanks,
drew

> 
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
>  configure | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/configure b/configure
> index 49f047cb2d7d..4ac2ff3e6106 100755
> --- a/configure
> +++ b/configure
> @@ -75,7 +75,7 @@ usage() {
>  	                           (s390x only)
>  	    --page-size=PAGE_SIZE
>  	                           Specify the page size (translation granule) (4k, 16k or
> -	                           64k, default is 64k, arm64 only)
> +	                           64k, default is 4k, arm64 only)
>  	    --earlycon=EARLYCON
>  	                           Specify the UART name, type and address (optional, arm and
>  	                           arm64 only). The specified address will overwrite the UART
> @@ -243,11 +243,7 @@ if [ "$efi" ] && [ "$arch" = "riscv64" ] && [ -z "$efi_direct" ]; then
>  fi
>  
>  if [ -z "$page_size" ]; then
> -    if [ "$efi" = 'y' ] && [ "$arch" = "arm64" ]; then
> -        page_size="4096"
> -    elif [ "$arch" = "arm64" ]; then
> -        page_size="65536"
> -    elif [ "$arch" = "arm" ]; then
> +    if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
>          page_size="4096"
>      fi
>  else
> -- 
> 2.45.0.rc1.225.g2a3ae87e7f-goog
> 

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

* Re: [kvm-unit-tests PATCH] arm64: Default to 4K translation granule
  2024-05-02  7:41 [kvm-unit-tests PATCH] arm64: Default to 4K translation granule Oliver Upton
  2024-05-02  7:58 ` Thomas Huth
  2024-05-02  9:05 ` Andrew Jones
@ 2024-05-02 10:10 ` Zenghui Yu
  2024-05-02 15:29 ` Andrew Jones
  3 siblings, 0 replies; 7+ messages in thread
From: Zenghui Yu @ 2024-05-02 10:10 UTC (permalink / raw)
  To: Oliver Upton
  Cc: Andrew Jones, Alexandru Elisei, Eric Auger, kvmarm, kvm,
	Paolo Bonzini, Thomas Huth

On 2024/5/2 15:41, Oliver Upton wrote:
> Some arm64 implementations in the wild, like the Apple parts, do not
> support the 64K translation granule. This can be a bit annoying when
> running with the defaults on such hardware, as every test fails
> before getting the MMU turned on.

Yup, I had to manually specify the translation granule before building
(and running) these tests on M1.

./configure --arch=aarch64 --page-size={4k,16k} --cross-prefix=aarch64-elf-

> Switch the default page size to 4K with the intention of having the
> default setting be the most widely applicable one.
> 
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>

Acked-by: Zenghui Yu <zenghui.yu@linux.dev>

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

* Re: [kvm-unit-tests PATCH] arm64: Default to 4K translation granule
  2024-05-02  7:41 [kvm-unit-tests PATCH] arm64: Default to 4K translation granule Oliver Upton
                   ` (2 preceding siblings ...)
  2024-05-02 10:10 ` Zenghui Yu
@ 2024-05-02 15:29 ` Andrew Jones
  3 siblings, 0 replies; 7+ messages in thread
From: Andrew Jones @ 2024-05-02 15:29 UTC (permalink / raw)
  To: Oliver Upton
  Cc: Alexandru Elisei, Eric Auger, kvmarm, kvm, Paolo Bonzini,
	Thomas Huth

On Thu, May 02, 2024 at 07:41:56AM GMT, Oliver Upton wrote:
> Some arm64 implementations in the wild, like the Apple parts, do not
> support the 64K translation granule. This can be a bit annoying when
> running with the defaults on such hardware, as every test fails
> before getting the MMU turned on.
> 
> Switch the default page size to 4K with the intention of having the
> default setting be the most widely applicable one.
> 
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
>  configure | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/configure b/configure
> index 49f047cb2d7d..4ac2ff3e6106 100755
> --- a/configure
> +++ b/configure
> @@ -75,7 +75,7 @@ usage() {
>  	                           (s390x only)
>  	    --page-size=PAGE_SIZE
>  	                           Specify the page size (translation granule) (4k, 16k or
> -	                           64k, default is 64k, arm64 only)
> +	                           64k, default is 4k, arm64 only)
>  	    --earlycon=EARLYCON
>  	                           Specify the UART name, type and address (optional, arm and
>  	                           arm64 only). The specified address will overwrite the UART
> @@ -243,11 +243,7 @@ if [ "$efi" ] && [ "$arch" = "riscv64" ] && [ -z "$efi_direct" ]; then
>  fi
>  
>  if [ -z "$page_size" ]; then
> -    if [ "$efi" = 'y' ] && [ "$arch" = "arm64" ]; then
> -        page_size="4096"
> -    elif [ "$arch" = "arm64" ]; then
> -        page_size="65536"
> -    elif [ "$arch" = "arm" ]; then
> +    if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
>          page_size="4096"
>      fi
>  else
> -- 
> 2.45.0.rc1.225.g2a3ae87e7f-goog
>

Merged.

Thanks,
drew

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

* Re: [kvm-unit-tests PATCH] arm64: Default to 4K translation granule
  2024-05-02  9:05 ` Andrew Jones
@ 2024-05-02 16:08   ` Oliver Upton
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Upton @ 2024-05-02 16:08 UTC (permalink / raw)
  To: Andrew Jones
  Cc: Alexandru Elisei, Eric Auger, kvmarm, kvm, Paolo Bonzini,
	Thomas Huth

On Thu, May 02, 2024 at 11:05:51AM +0200, Andrew Jones wrote:
> On Thu, May 02, 2024 at 07:41:56AM GMT, Oliver Upton wrote:
> > Some arm64 implementations in the wild, like the Apple parts, do not
> > support the 64K translation granule. This can be a bit annoying when
> > running with the defaults on such hardware, as every test fails
> > before getting the MMU turned on.
> > 
> > Switch the default page size to 4K with the intention of having the
> > default setting be the most widely applicable one.
> 
> I had been drinking the "64k pages will rule the world" Kool-Aid for
> too long.

Hey, your words not mine! :-)

> Kool-Aid have already long worn off though, so I'll get this merged.

Thanks drew.

-- 
Best,
Oliver

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

end of thread, other threads:[~2024-05-02 16:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-02  7:41 [kvm-unit-tests PATCH] arm64: Default to 4K translation granule Oliver Upton
2024-05-02  7:58 ` Thomas Huth
2024-05-02  8:53   ` Alexandru Elisei
2024-05-02  9:05 ` Andrew Jones
2024-05-02 16:08   ` Oliver Upton
2024-05-02 10:10 ` Zenghui Yu
2024-05-02 15:29 ` Andrew Jones

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