Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639227 > unrolled thread

Re: [PATCH] KVM: Eliminate unused variable warning on uniprocessor configs

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2017-05-11 09:50 +0200
Last post2017-05-12 08:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] KVM: Eliminate unused variable warning on uniprocessor  configs Paolo Bonzini <pbonzini@redhat.com> - 2017-05-11 09:50 +0200
    Re: [PATCH] KVM: Eliminate unused variable warning on uniprocessor  configs Paul Mackerras <paulus@ozlabs.org> - 2017-05-12 08:20 +0200

#1639227 — Re: [PATCH] KVM: Eliminate unused variable warning on uniprocessor configs

FromPaolo Bonzini <pbonzini@redhat.com>
Date2017-05-11 09:50 +0200
SubjectRe: [PATCH] KVM: Eliminate unused variable warning on uniprocessor configs
Message-ID<tFR1g-3sb-11@gated-at.bofh.it>

On 11/05/2017 05:40, Paul Mackerras wrote:
> When the
> kernel is compiled with CONFIG_SMP=n, smp_call_function_many() turns
> into a macro which doesn't use the 'wait' argument, leading to a
> warning about the variable 'wait' being unused:
> 
> /home/paulus/kernel/kvm/arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function ‘kvm_make_all_cpus_request’:
> /home/paulus/kernel/kvm/arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:195:7: error: unused variable ‘wait’ [-Werror=unused-variable]
>   bool wait = req & KVM_REQUEST_WAIT;

Maybe the macro should not be a macro:

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 8e0cb7a0f836..899c72f0933f 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -128,17 +128,18 @@ static inline void smp_send_stop(void) { }
  *	These macros fold the SMP functionality into a single CPU system
  */
 #define raw_smp_processor_id()			0
-static inline int up_smp_call_function(smp_call_func_t func, void *info)
+static inline void smp_call_function_many(const struct cpumask *mask,
+					  smp_call_func_t func, void *info,
+					  bool wait);
 {
-	return 0;
+}
+
+static inline void smp_call_function(smp_call_func_t func, void *info, bool wait);
+{
 }
-#define smp_call_function(func, info, wait) \
-			(up_smp_call_function(func, info))
 
 static inline void smp_send_reschedule(int cpu) { }
 #define smp_prepare_boot_cpu()			do {} while (0)
-#define smp_call_function_many(mask, func, info, wait) \
-			(up_smp_call_function(func, info))
 static inline void call_function_init(void) { }
 
 static inline int


Paolo

[toc] | [next] | [standalone]


#1640220

FromPaul Mackerras <paulus@ozlabs.org>
Date2017-05-12 08:20 +0200
Message-ID<tGc5H-jh-3@gated-at.bofh.it>
In reply to#1639227
On Thu, May 11, 2017 at 09:44:06AM +0200, Paolo Bonzini wrote:
> 
> 
> On 11/05/2017 05:40, Paul Mackerras wrote:
> > When the
> > kernel is compiled with CONFIG_SMP=n, smp_call_function_many() turns
> > into a macro which doesn't use the 'wait' argument, leading to a
> > warning about the variable 'wait' being unused:
> > 
> > /home/paulus/kernel/kvm/arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function ‘kvm_make_all_cpus_request’:
> > /home/paulus/kernel/kvm/arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:195:7: error: unused variable ‘wait’ [-Werror=unused-variable]
> >   bool wait = req & KVM_REQUEST_WAIT;
> 
> Maybe the macro should not be a macro:

Sounds fair, and with a couple of semicolons removed, it works and
fixes the problem.  Do you want to send it to the appropriate
maintainer(s) or will I?

> diff --git a/include/linux/smp.h b/include/linux/smp.h
> index 8e0cb7a0f836..899c72f0933f 100644
> --- a/include/linux/smp.h
> +++ b/include/linux/smp.h
> @@ -128,17 +128,18 @@ static inline void smp_send_stop(void) { }
>   *	These macros fold the SMP functionality into a single CPU system
>   */
>  #define raw_smp_processor_id()			0
> -static inline int up_smp_call_function(smp_call_func_t func, void *info)
> +static inline void smp_call_function_many(const struct cpumask *mask,
> +					  smp_call_func_t func, void *info,
> +					  bool wait);

No semicolon on the end of this line...

>  {
> -	return 0;
> +}
> +
> +static inline void smp_call_function(smp_call_func_t func, void *info, bool wait);

or this one.

Paul.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web