mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] x86/kvm: Fix compilation warning in non-x86_64 builds
@ 2022-02-18  3:41 Leonardo Bras
  2022-02-18  8:36 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Leonardo Bras @ 2022-02-18  3:41 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
  Cc: Leonardo Bras, kvm, linux-kernel, kernel test robot

On non-x86_64 builds, the helper gtod_is_based_on_tsc() is defined but
never used, which results in an warning with -Wunused-function, and
becomes an error if -Werror is present.

Add #ifdef so gtod_is_based_on_tsc() is only defined in x86_64 builds.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
 arch/x86/kvm/x86.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ca0fae020961..b389517aa6ed 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2363,10 +2363,12 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns)
 	return tsc;
 }
 
+#ifdef CONFIG_X86_64
 static inline int gtod_is_based_on_tsc(int mode)
 {
 	return mode == VDSO_CLOCKMODE_TSC || mode == VDSO_CLOCKMODE_HVCLOCK;
 }
+#endif
 
 static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
 {
-- 
2.35.1


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

* Re: [PATCH v1 1/1] x86/kvm: Fix compilation warning in non-x86_64 builds
  2022-02-18  3:41 [PATCH v1 1/1] x86/kvm: Fix compilation warning in non-x86_64 builds Leonardo Bras
@ 2022-02-18  8:36 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-02-18  8:36 UTC (permalink / raw)
  To: Leonardo Bras, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
  Cc: kvm, linux-kernel, kernel test robot

On 2/18/22 04:41, Leonardo Bras wrote:
> On non-x86_64 builds, the helper gtod_is_based_on_tsc() is defined but
> never used, which results in an warning with -Wunused-function, and
> becomes an error if -Werror is present.
> 
> Add #ifdef so gtod_is_based_on_tsc() is only defined in x86_64 builds.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Leonardo Bras <leobras@redhat.com>
> ---
>   arch/x86/kvm/x86.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index ca0fae020961..b389517aa6ed 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2363,10 +2363,12 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns)
>   	return tsc;
>   }
>   
> +#ifdef CONFIG_X86_64
>   static inline int gtod_is_based_on_tsc(int mode)
>   {
>   	return mode == VDSO_CLOCKMODE_TSC || mode == VDSO_CLOCKMODE_HVCLOCK;
>   }
> +#endif
>   
>   static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
>   {

More precisely, this is an "inline" in a .c (main compilation unit) 
file.  clang warns on them even though it doesn't do that on a .h 
(included) file.

I tend not to rewind kvm/master and kvm/next unless absolutely 
necessary, so I pushed an incremental fix for kvm_guest_supported_xfd() 
as well.

Paolo


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

end of thread, other threads:[~2022-02-18  8:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18  3:41 [PATCH v1 1/1] x86/kvm: Fix compilation warning in non-x86_64 builds Leonardo Bras
2022-02-18  8:36 ` Paolo Bonzini

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®