All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] KVM: VMX: add noinstr for is_td_vcpu and is_td
@ 2025-05-27  3:45 Edward Adam Davis
  2025-05-27  5:31 ` Binbin Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Edward Adam Davis @ 2025-05-27  3:45 UTC (permalink / raw)
  To: seanjc
  Cc: pbonzini, tglx, mingo, bp, dave.hansen, binbin.wu, x86, hpa, kvm,
	linux-kernel

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@qq.com>
---
 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)
 {
 	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; }
 
 #endif
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-05-28  0:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27  3:45 [PATCH next] KVM: VMX: add noinstr for is_td_vcpu and is_td Edward Adam Davis
2025-05-27  5:31 ` Binbin Wu
2025-05-27  5:39   ` Edward Adam Davis
2025-05-27  8:44   ` [PATCH next V2] KVM: VMX: use __always_inline " Edward Adam Davis
2025-05-27 11:07     ` Peter Zijlstra
2025-05-27 12:34       ` Huang, Kai
2025-05-27 13:47         ` Peter Zijlstra
2025-05-27 21:47           ` Huang, Kai
2025-05-27 17:53     ` Edgecombe, Rick P
2025-05-27 21:48       ` Huang, Kai
2025-05-28  0:28         ` Binbin Wu
2025-05-27  8:28 ` [PATCH next] KVM: VMX: add noinstr " kernel test robot
2025-05-27 11:07 ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.