On Tue, May 27, 2025 at 11:45:16AM +0800, Edward Adam Davis wrote: > is_td() and is_td_vcpu() run in no instrumentation, so they are need > noinstr. > > [1] > vmlinux.o: error: objtool: vmx_handle_nmi+0x47: > call to is_td_vcpu.isra.0() leaves .noinstr.text section > > Fixes: 7172c753c26a ("KVM: VMX: Move common fields of struct vcpu_{vmx,tdx} to a struct") > Signed-off-by: Edward Adam Davis <eadavis@xxxxxx> > --- > arch/x86/kvm/vmx/common.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/vmx/common.h b/arch/x86/kvm/vmx/common.h > index 8f46a06e2c44..70e0879c58f6 100644 > --- a/arch/x86/kvm/vmx/common.h > +++ b/arch/x86/kvm/vmx/common.h > @@ -59,20 +59,20 @@ struct vcpu_vt { > > #ifdef CONFIG_KVM_INTEL_TDX > > -static __always_inline bool is_td(struct kvm *kvm) > +static noinstr __always_inline bool is_td(struct kvm *kvm) noinstr and __always_inline are not compatible. Specifically noinstr implies noinline. > { > return kvm->arch.vm_type == KVM_X86_TDX_VM; > } > > -static __always_inline bool is_td_vcpu(struct kvm_vcpu *vcpu) > +static noinstr __always_inline bool is_td_vcpu(struct kvm_vcpu *vcpu) > { > return is_td(vcpu->kvm); > } > > #else > > -static inline bool is_td(struct kvm *kvm) { return false; } > -static inline bool is_td_vcpu(struct kvm_vcpu *vcpu) { return false; } > +static noinstr bool is_td(struct kvm *kvm) { return false; } > +static noinstr bool is_td_vcpu(struct kvm_vcpu *vcpu) { return false; } The problem is likely your compiler is silly and managed to out-of-line these; make these __always_inline and try again. > > #endif > > -- > 2.43.0 >