x86: more flexible alignment handling for xen image
v2 cover x86: more flexible alignment handling for xen image
Wei Liu (2):
x86: decouple xen alignment setting from EFI/ELF build x86/pvshim: use 2M alignment
xen/arch/x86/Kconfig | 23 +++++++++++++++++++++++ xen/arch/x86/configs/pvshim_defconfig | 1 + xen/arch/x86/xen.lds.S | 12 ++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-)
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 1/2 x86: decouple xen alignment setting from EFI/ELF build
Introduce a new Kconfig option to pick the alignment for xen binary. To retain original behaviour, the default pick for EFI build is 2M and ELF build 4K.
--- xen/arch/x86/Kconfig | 23 +++++++++++++++++++++++ xen/arch/x86/xen.lds.S | 12 ++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-)
xen/arch/x86/Kconfig +23 -0
@@ -138,6 +138,29 @@ config TBOOT If unsure, say Y. +choice + prompt "Alignment of Xen image" + depends on X86 + default XEN_ALIGN_DEFAULT + ---help--- + Specify alignment for Xen image. + + If unsure, choose "default". + +config XEN_ALIGN_DEFAULT + bool "Default alignment" + ---help--- + Pick alignment according to build variants. + + For EFI build the default alignment is 2M. For ELF build + the default alignment is 4K due to syslinux failing to handle + the increment of image size induced by 2M alignment. + +config XEN_ALIGN_2M + bool "2M alignment" + +endchoice + config XEN_GUEST def_bool n prompt "Xen Guest"
xen/arch/x86/xen.lds.S +10 -2
@@ -12,7 +12,6 @@ #define FORMAT "pei-x86-64" #undef __XEN_VIRT_START #define __XEN_VIRT_START __image_base__ -#define SECTION_ALIGN MB(2) #define DECL_SECTION(x) x : ENTRY(efi_start)
@@ -20,13 +19,22 @@ ENTRY(efi_start) #else /* !EFI */ #define FORMAT "elf64-x86-64" -#define SECTION_ALIGN PAGE_SIZE #define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START) ENTRY(start_pa) #endif /* EFI */ +#ifdef CONFIG_XEN_ALIGN_2M +#define SECTION_ALIGN MB(2) +#else /* Default alignment */ +#ifdef EFI +#define SECTION_ALIGN MB(2) +#else +#define SECTION_ALIGN PAGE_SIZE +#endif +#endif + OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT) OUTPUT_ARCH(i386:x86-64)
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 1/2] x86: decouple xen alignment setting from EFI/ELF build
Quoted 10 lines · Wei Liu
xen/arch/x86/xen.lds.S +0
-1@@ -20,13 +19,22 @@ ENTRY(efi_start) #else /* !EFI */ #define FORMAT "elf64-x86-64" -#define SECTION_ALIGN PAGE_SIZE #define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START) ENTRY(start_pa) #endif /* EFI */
xen/arch/x86/xen.lds.S ENTRY(efi_start) · line 36
Quoted 10 lines
xen/arch/x86/xen.lds.S +9
-0+#ifdef CONFIG_XEN_ALIGN_2M +#define SECTION_ALIGN MB(2) +#else /* Default alignment */ +#ifdef EFI +#define SECTION_ALIGN MB(2) +#else +#define SECTION_ALIGN PAGE_SIZE +#endif +#endif
As a trivial change, can this please be:
#ifdef CONFIG_XEN_ALIGN_2M
# define SECTION_ALIGN MB(2) #else /* Default alignment */ # ifdef EFI # define SECTION_ALIGN MB(2) # else # define SECTION_ALIGN PAGE_SIZE # endif #endif
To help highlight the nesting levels.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Jan Beulich
Reviewed-byRe: [PATCH v2 1/2] x86: decouple xen alignment setting from EFI/ELF build
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:09, <[email protected]> wrote:
Quoted 10 lines · Wei Liu
xen/arch/x86/xen.lds.S +0
-1@@ -20,13 +19,22 @@ ENTRY(efi_start) #else /* !EFI */ #define FORMAT "elf64-x86-64" -#define SECTION_ALIGN PAGE_SIZE #define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START) ENTRY(start_pa) #endif /* EFI */xen/arch/x86/xen.lds.S ENTRY(efi_start) · line 36
Quoted 10 lines
xen/arch/x86/xen.lds.S +9
-0+#ifdef CONFIG_XEN_ALIGN_2M +#define SECTION_ALIGN MB(2) +#else /* Default alignment */ +#ifdef EFI +#define SECTION_ALIGN MB(2) +#else +#define SECTION_ALIGN PAGE_SIZE +#endif +#endifAs a trivial change, can this please be:
#ifdef
CONFIG_XEN_ALIGN_2M# define SECTION_ALIGN MB(2) #else /* Default alignment */ # ifdef EFI # define SECTION_ALIGN MB(2) # else # define SECTION_ALIGN PAGE_SIZE # endif #endif
Quoted 1 line
To help highlight the nesting levels.
#if defined(CONFIG_XEN_ALIGN_2M) || defined(EFI)
# define SECTION_ALIGN MB(2) #else # define SECTION_ALIGN PAGE_SIZE #endif
? Then
(but I can live with Andrew's variant too, if need be)
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 1/2] x86: decouple xen alignment setting from EFI/ELF build
In reply to Andrew CooperQuoted 34 lines · Andrew Cooper
Quoted 10 lines · Wei Liu
xen/arch/x86/xen.lds.S +0
-1@@ -20,13 +19,22 @@ ENTRY(efi_start) #else /* !EFI */ #define FORMAT "elf64-x86-64" -#define SECTION_ALIGN PAGE_SIZE #define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START) ENTRY(start_pa) #endif /* EFI */xen/arch/x86/xen.lds.S ENTRY(efi_start) · line 36
Quoted 10 lines
xen/arch/x86/xen.lds.S +9
-0+#ifdef CONFIG_XEN_ALIGN_2M +#define SECTION_ALIGN MB(2) +#else /* Default alignment */ +#ifdef EFI +#define SECTION_ALIGN MB(2) +#else +#define SECTION_ALIGN PAGE_SIZE +#endif +#endifAs a trivial change, can this please be:
#ifdef
CONFIG_XEN_ALIGN_2M# define SECTION_ALIGN MB(2) #else /* Default alignment */ # ifdef EFI # define SECTION_ALIGN MB(2) # else # define SECTION_ALIGN PAGE_SIZE # endif #endif
Quoted 1 line
To help highlight the nesting levels.
Sure.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 1/2] x86: decouple xen alignment setting from EFI/ELF build
In reply to Wei Liuxen/arch/x86/Kconfig config TBOOT · line 143
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +3
-0@@ -138,6 +138,29 @@ config TBOOT If unsure, say Y. +choice + prompt "Alignment of Xen image" + depends on X86
Sorry, noticed only while looking at patch 2 again: This line seems unnecessary, considering the file we're in. I notice TBOOT has a similar pointless dependency.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 1/2] x86: decouple xen alignment setting from EFI/ELF build
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:05, <[email protected]> wrote:
xen/arch/x86/Kconfig +0
-0@@ -138,6 +138,29 @@ config TBOOT If unsure, say Y.
Quoted 7 lines
xen/arch/x86/Kconfig config TBOOT · line 143
Quoted 3 lines
xen/arch/x86/Kconfig +3
-0+choice + prompt "Alignment of Xen image" + depends on X86Sorry, noticed only while looking at patch 2 again: This line seems unnecessary, considering the file we're in. I notice TBOOT has a similar pointless dependency.
Will fix -- I added this dep after looking at TBOOT. :p
Wei.
Quoted 4 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/2 x86/pvshim: use 2M alignment
In reply to Wei LiuThe pvshim is loaded directly by toolstack. Use 2M alignment for potentially better performance.
--- xen/arch/x86/configs/pvshim_defconfig | 1 + 1 file changed, 1 insertion(+)
xen/arch/x86/configs/pvshim_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_PVH_GUEST=y CONFIG_PV_SHIM=y CONFIG_PV_SHIM_EXCLUSIVE=y CONFIG_NR_CPUS=32 +CONFIG_XEN_ALIGN_2M=y # Disable features not used by the PV shim # CONFIG_SHADOW_PAGING is not set # CONFIG_BIGMEM is not set
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 2/2] x86/pvshim: use 2M alignment
xen/arch/x86/configs/pvshim_defconfig CONFIG_PVH_GUEST=y · line 11
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:05, <[email protected]> wrote:
xen/arch/x86/configs/pvshim_defconfig +1
-0@@ -5,6 +5,7 @@ CONFIG_PVH_GUEST=y CONFIG_PV_SHIM=y CONFIG_PV_SHIM_EXCLUSIVE=y CONFIG_NR_CPUS=32 +CONFIG_XEN_ALIGN_2M=y # Disable features not used by the PV shim # CONFIG_SHADOW_PAGING is not set # CONFIG_BIGMEM is not set
Instead of this, why not add
default XEN_ALIGN_2M if PV_SHIM_EXCLUSIVE
to the config option itself, ahead of the default patch 1 establishes?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 2/2] x86/pvshim: use 2M alignment
Quoted 14 lines · Jan Beulich
xen/arch/x86/configs/pvshim_defconfig CONFIG_PVH_GUEST=y · line 11
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:05, <[email protected]> wrote:
xen/arch/x86/configs/pvshim_defconfig +1
-0@@ -5,6 +5,7 @@ CONFIG_PVH_GUEST=y CONFIG_PV_SHIM=y CONFIG_PV_SHIM_EXCLUSIVE=y CONFIG_NR_CPUS=32 +CONFIG_XEN_ALIGN_2M=y # Disable features not used by the PV shim # CONFIG_SHADOW_PAGING is not set # CONFIG_BIGMEM is not setInstead of this, why not add
Quoted 3 lines
default
XEN_ALIGN_2MifPV_SHIM_EXCLUSIVEto the config option itself, ahead of the default patch 1 establishes?
This seems to work -- I didn't know you can have two default's for the same option.
Wei.
Quoted 9 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 2/2] x86/pvshim: use 2M alignment
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:50, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
xen/arch/x86/configs/pvshim_defconfig CONFIG_PVH_GUEST=y · line 11
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:05, <[email protected]> wrote:
xen/arch/x86/configs/pvshim_defconfig +1
-0@@ -5,6 +5,7 @@ CONFIG_PVH_GUEST=y CONFIG_PV_SHIM=y CONFIG_PV_SHIM_EXCLUSIVE=y CONFIG_NR_CPUS=32 +CONFIG_XEN_ALIGN_2M=y # Disable features not used by the PV shim # CONFIG_SHADOW_PAGING is not set # CONFIG_BIGMEM is not setInstead of this, why not add
Quoted 6 lines
Quoted 3 lines
default
XEN_ALIGN_2MifPV_SHIM_EXCLUSIVEto the config option itself, ahead of the default patch 1 establishes?
This seems to work -- I didn't know you can have two default's for the same option.
The order is important, but beyond that you can have any number of them. The first one the "if" of which matches gets used.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel