x86/kexec: Separate code and data by at least 1 cacheline
PATCH 1/1 x86/kexec: Separate code and data by at least 1 cacheline
No functional change, but it performs a bit better.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
v2:
* Rebase over metadata changes.
--- xen/arch/x86/x86_64/kexec_reloc.S | 4 ++++ 1 file changed, 4 insertions(+)
xen/arch/x86/x86_64/kexec_reloc.S +4 -0
@@ -19,6 +19,7 @@ #include <xen/kimage.h> #include <asm/asm_defns.h> +#include <asm/cache.h> #include <asm/msr-index.h> #include <asm/page.h> #include <asm/machine_kexec.h>
@@ -174,6 +175,9 @@ FUNC_LOCAL(compatibility_mode) ud2 END(compatibility_mode) + /* Separate code and data into into different cache lines */ + .balign L1_CACHE_BYTES + DATA_LOCAL(compat_mode_gdt_desc, 4) .word .Lcompat_mode_gdt_end - compat_mode_gdt -1 .quad 0x0000000000000000 /* set in call_32_bit above */
Signature · 1 line
2.39.5
Quoted 3 lines · Andrew Cooper
No functional change, but it performs a bit better.
Signed-off-by Andrew Cooper <[email protected]>
A question nevertheless:
Quoted 11 lines
xen/arch/x86/x86_64/kexec_reloc.S +1
-0@@ -19,6 +19,7 @@ #include <xen/kimage.h> #include <asm/asm_defns.h> +#include <asm/cache.h> #include <asm/msr-index.h> #include <asm/page.h> #include <asm/machine_kexec.h>
xen/arch/x86/x86_64/kexec_reloc.S FUNC_LOCAL(compatibility_mode) · line 183
Quoted 9 lines
xen/arch/x86/x86_64/kexec_reloc.S +3
-0@@ -174,6 +175,9 @@ FUNC_LOCAL(compatibility_mode) ud2 END(compatibility_mode) + /* Separate code and data into into different cache lines */ + .balign L1_CACHE_BYTES + DATA_LOCAL(compat_mode_gdt_desc, 4) .word .Lcompat_mode_gdt_end - compat_mode_gdt -1 .quad 0x0000000000000000 /* set in call_32_bit above */
Because of L1_CACHE_BYTES being 128, you indeed put at least 1 cache line in between. Is that necessary, though? Just starting data on the next cache line ought to be enough? IOW if and when we adjust L1_CACHE_BYTES, we won't need to touch this again, just that the title here then would end up slightly misleading.
Jan
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Andrew Cooper
No functional change, but it performs a bit better.
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Thanks.
Quoted 17 lines
A question nevertheless:
Quoted 14 lines
xen/arch/x86/x86_64/kexec_reloc.S +1
-0@@ -19,6 +19,7 @@ #include <xen/kimage.h> #include <asm/asm_defns.h> +#include <asm/cache.h> #include <asm/msr-index.h> #include <asm/page.h> #include <asm/machine_kexec.h>@@ -174,6 +175,9 @@ FUNC_LOCAL(compatibility_mode) ud2 END(compatibility_mode)
Quoted 9 lines
xen/arch/x86/x86_64/kexec_reloc.S FUNC_LOCAL(compatibility_mode) · line 183
Quoted 6 lines
xen/arch/x86/x86_64/kexec_reloc.S +3
-0+ /* Separate code and data into into different cache lines */ + .balign L1_CACHE_BYTES + DATA_LOCAL(compat_mode_gdt_desc, 4) .word .Lcompat_mode_gdt_end - compat_mode_gdt -1 .quad 0x0000000000000000 /* set in call_32_bit above */Because of
L1_CACHE_BYTESbeing 128, you indeed put at least 1 cache line in between. Is that necessary, though? Just starting data on the next cache line ought to be enough?
Correct. Specifically, we want the write into compat_mode_gdt_desc not hitting a line in L1i.
Quoted 3 lines
IOW if and when we adjust
L1_CACHE_BYTES, we won't need
to touch this again, just that the title here then would end up slightly misleading.
Oh - I'll just copy the comment and say "different". That is slightly poor grammar.
~Andrew