[PATCH 5/5] um: Add 4 level page table support

Tiwei Bie tiwei.btw at antgroup.com
Wed May 29 20:07:11 PDT 2024


On 5/28/24 4:54 PM, benjamin at sipsolutions.net wrote:
[...]
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index 93a5a8999b07..5d111fc8ccb7 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -208,6 +208,7 @@ config MMAPPER
>  
>  config PGTABLE_LEVELS
>  	int
> +	default 4 if 4_LEVEL_PGTABLES
>  	default 3 if 3_LEVEL_PGTABLES
>  	default 2
>  
[...]
> diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
> index 186f13268401..72dc7b0b3a33 100644
> --- a/arch/x86/um/Kconfig
> +++ b/arch/x86/um/Kconfig
> @@ -28,16 +28,34 @@ config X86_64
>  	def_bool 64BIT
>  	select MODULES_USE_ELF_RELA
>  
> -config 3_LEVEL_PGTABLES
> -	bool "Three-level pagetables" if !64BIT
> -	default 64BIT
> -	help
> -	  Three-level pagetables will let UML have more than 4G of physical
> -	  memory.  All the memory that can't be mapped directly will be treated
> -	  as high memory.
> -
> -	  However, this it experimental on 32-bit architectures, so if unsure say
> -	  N (on x86-64 it's automatically enabled, instead, as it's safe there).
> +choice
> +	prompt "Pagetable levels" if EXPERT
> +	default 2_LEVEL_PGTABLES if !64BIT
> +	default 4_LEVEL_PGTABLES if 64BIT
> +
> +	config 2_LEVEL_PGTABLES
> +		bool "Three-level pagetables" if !64BIT

Nit: s/Three-level/Two-level/

> +		depends on !64BIT
> +		help
> +		  Two-level page table for 32-bit architectures.
> +
> +	config 3_LEVEL_PGTABLES
> +		bool "Three-level pagetables" if 64BIT
> +		help
> +		  Three-level pagetables will let UML have more than 4G of physical
> +		  memory.  All the memory that can't be mapped directly will be treated
> +		  as high memory.
> +
> +		  However, this it experimental on 32-bit architectures, so if unsure say
> +		  N (on x86-64 it's automatically enabled, instead, as it's safe there).
> +
> +	config 4_LEVEL_PGTABLES
> +		bool "Four-level pagetables" if 64BIT
> +		depends on 64BIT
> +		help
> +		  Four-level pagetables, gives a bigger address space which can be
> +		  useful for some applications (e.g. ASAN).

On 64bit, it appears that 4_LEVEL_PGTABLES won't be selected by running
"make ARCH=um defconfig", and PGTABLE_LEVELS will be 2.

I got the following search result in "make ARCH=um menuconfig":

  │ Symbol: 4_LEVEL_PGTABLES [=n]
  │ Type  : bool
  │ Defined at arch/x86/um/Kconfig:51
  │   Prompt: Four-level pagetables
  │   Depends on: <choice> && 64BIT [=y]
  │   Location:
  │ (1) -> UML-specific options
  │       -> Pagetable levels (<choice> [=n])
  │         -> Four-level pagetables (4_LEVEL_PGTABLES [=n])

And 4_LEVEL_PGTABLES will be selected if I turn on EXPERT manually.

Regards,
Tiwei

> +endchoice
>  
>  config ARCH_HAS_SC_SIGNALS
>  	def_bool !64BIT




More information about the linux-um mailing list