From: Peter Zijlstra <peterz@infradead.org>
To: Edward Adam Davis <eadavis@qq.com>
Cc: seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
binbin.wu@linux.intel.com, x86@kernel.org, hpa@zytor.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH next] KVM: VMX: add noinstr for is_td_vcpu and is_td
Date: Tue, 27 May 2025 13:07:06 +0200 [thread overview]
Message-ID: <20250527110706.GA20019@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <tencent_27A451976AF76E66DF1379C3604976A3A505@qq.com>
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@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)
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
>
prev parent reply other threads:[~2025-05-27 11:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 3:45 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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250527110706.GA20019@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=binbin.wu@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=eadavis@qq.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®