Skip to contentSkip to conversation

KVM: SVM: hyper-v: placate modpost section mismatch error

PATCH Superseded Randy Dunlap 2 participants 3 messages Feb 22, 2023

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: SVM: hyper-v: placate modpost section mismatch error

modpost reports section mismatch errors/warnings:
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)

Marking svm_hv_hardware_setup() as __init fixes the warnings.

I don't know why this should be needed -- it seems like a compiler problem to me since the calling function is marked as __init.

This "(unknown) (section: .init.data)" all refer to svm_x86_ops.

Fixes 1e0c7d40758b ("KVM: SVM: hyper-v: Remote TLB flush for SVM")
Cc Vineeth Pillai <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Vitaly Kuznetsov <[email protected]>
Cc Sean Christopherson <[email protected]>
---
 arch/x86/kvm/svm/svm_onhyperv.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm_onhyperv.h +1 -1
diff -- a/arch/x86/kvm/svm/svm_onhyperv.h b/arch/x86/kvm/svm/svm_onhyperv.h
@@ -30,7 +30,7 @@ static inline void svm_hv_init_vmcb(stru
 		hve->hv_enlightenments_control.msr_bitmap = 1;
 }
 
-static inline void svm_hv_hardware_setup(void)
+static inline __init void svm_hv_hardware_setup(void)
 {
 	if (npt_enabled &&
 	    ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) {
maintainer
#1 lore raw
Quoted 28 lines · Randy Dunlap

modpost reports section mismatch errors/warnings:
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)

Marking svm_hv_hardware_setup() as __init fixes the warnings.

I don't know why this should be needed -- it seems like a compiler problem to me since the calling function is marked as __init.

This "(unknown) (section: .init.data)" all refer to svm_x86_ops.

Fixes 1e0c7d40758b ("KVM: SVM: hyper-v: Remote TLB flush for SVM")
Cc Vineeth Pillai <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Vitaly Kuznetsov <[email protected]>
Cc Sean Christopherson <[email protected]>
---
 arch/x86/kvm/svm/svm_onhyperv.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -- a/arch/x86/kvm/svm/svm_onhyperv.h b/arch/x86/kvm/svm/svm_onhyperv.h

arch/x86/kvm/svm/svm_onhyperv.h static inline void svm_hv_init_vmcb(stru · line 36

Quoted 8 lines
arch/x86/kvm/svm/svm_onhyperv.h +1 -1
@@ -30,7 +30,7 @@ static inline void svm_hv_init_vmcb(stru
 		hve->hv_enlightenments_control.msr_bitmap = 1;
 }
 
-static inline void svm_hv_hardware_setup(void)
+static inline __init void svm_hv_hardware_setup(void)
 {
 	if (npt_enabled &&
 	    ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) {

There's a second empty svm_hv_hardware_setup() implementation 50 lines below in the same file for !if IS_ENABLED(CONFIG_HYPERV) case and I think it needs to be marked as '__init' as well.

Signature · 1 line
Vitaly
#2 lore raw
Quoted 32 lines · Vitaly Kuznetsov
Quoted 30 lines · Randy Dunlap

modpost reports section mismatch errors/warnings:
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)
WARNING: modpost: vmlinux.o: section mismatch in reference: svm_hv_hardware_setup (section: .text) -> (unknown) (section: .init.data)

Marking svm_hv_hardware_setup() as __init fixes the warnings.

I don't know why this should be needed -- it seems like a compiler problem to me since the calling function is marked as __init.

This "(unknown) (section: .init.data)" all refer to svm_x86_ops.

Fixes 1e0c7d40758b ("KVM: SVM: hyper-v: Remote TLB flush for SVM")
Cc Vineeth Pillai <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Vitaly Kuznetsov <[email protected]>
Cc Sean Christopherson <[email protected]>
---
 arch/x86/kvm/svm/svm_onhyperv.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -- a/arch/x86/kvm/svm/svm_onhyperv.h b/arch/x86/kvm/svm/svm_onhyperv.h

arch/x86/kvm/svm/svm_onhyperv.h +0 -0
@@ -30,7 +30,7 @@ static inline void svm_hv_init_vmcb(stru
 		hve->hv_enlightenments_control.msr_bitmap = 1;
 }
 
Quoted 11 lines

arch/x86/kvm/svm/svm_onhyperv.h static inline void svm_hv_init_vmcb(stru · line 36

Quoted 6 lines
arch/x86/kvm/svm/svm_onhyperv.h +1 -1
-static inline void svm_hv_hardware_setup(void)
+static inline __init void svm_hv_hardware_setup(void)
 {
 	if (npt_enabled &&
 	    ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) {

There's a second empty svm_hv_hardware_setup() implementation 50 lines below in the same file for !if IS_ENABLED(CONFIG_HYPERV) case and I think it needs to be marked as '__init' as well.

I saw that. I can make that change also. I was optimistic that since it is empty, gcc would not be fooled by it.

v2 later today.

thanks.

Signature · 1 line
~Randy