KVM: VMX: make read-only const array vmx_uret_msrs_list static
Subsystems (4)
PATCH 1/1 KVM: VMX: make read-only const array vmx_uret_msrs_list static
Don't populate the read-only array vmx_uret_msrs_list on the stack but instead make it static. Also makes the object code a little smaller.
--- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/vmx.c +1 -1
@@ -7871,7 +7871,7 @@ static __init void vmx_setup_user_return_msrs(void)* but is never loaded into hardware. MSR_CSTAR is also never loaded * into hardware and is here purely for emulation purposes. */ - const u32 vmx_uret_msrs_list[] = { +static const u32 vmx_uret_msrs_list[] = { #ifdef CONFIG_X86_64MSR_SYSCALL_MASK ,MSR_LSTAR ,MSR_CSTAR , #endif
Signature · 1 line
2.35.1
Sean Christopherson
maintainerQuoted 2 lines · Colin Ian King
Don't populate the read-only array
vmx_uret_msrs_liston the stack but instead make it static. Also makes the object code a little smaller.
Why not put it on the stack? It's an __init function, i.e. called once in the lifetime of kvm-intel.ko, isn't all that big, and is certainly not performance critical. And making it static begs the question of whether or not the data gets thrown away after init, i.e. this might consume _more_ memory once KVM has reached steady state.
Quoted 21 lines
Signed-off-by Colin Ian King <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kvm/vmx/vmx.c +1
-1@@ -7871,7 +7871,7 @@ static __init void vmx_setup_user_return_msrs(void)* but is never loaded into hardware. MSR_CSTAR is also never loaded * into hardware and is here purely for emulation purposes. */ - const u32 vmx_uret_msrs_list[] = { +static const u32 vmx_uret_msrs_list[] = { #ifdef CONFIG_X86_64MSR_SYSCALL_MASK ,MSR_LSTAR ,MSR_CSTAR , #endifSignature · 1 line
2.35.1
Quoted 9 lines · Sean Christopherson
Quoted 2 lines · Colin Ian King
Don't populate the read-only array
vmx_uret_msrs_liston the stack but instead make it static. Also makes the object code a little smaller.Why not put it on the stack? It's an
__initfunction, i.e. called once in the lifetime of kvm-intel.ko, isn't all that big, and is certainly not performance critical. And making it static begs the question of whether or not the data gets thrown away after init, i.e. this might consume _more_ memory once KVM has reached steady state.
Doh, my bad, I forgot to check that it was an __init function. Please discard this patch.
Colin
Quoted 22 lines
Quoted 22 lines
Signed-off-by Colin Ian King <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kvm/vmx/vmx.c +1
-1@@ -7871,7 +7871,7 @@ static __init void vmx_setup_user_return_msrs(void)* but is never loaded into hardware. MSR_CSTAR is also never loaded * into hardware and is here purely for emulation purposes. */ - const u32 vmx_uret_msrs_list[] = { +static const u32 vmx_uret_msrs_list[] = { #ifdef CONFIG_X86_64MSR_SYSCALL_MASK ,MSR_LSTAR ,MSR_CSTAR , #endifSignature · 1 line
2.35.1