* [PATCH v2] smp_call_function: use inline helpers instead of macros
@ 2017-07-26 13:32 Arnd Bergmann
2017-07-26 14:42 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-07-26 13:32 UTC (permalink / raw)
To: Andrew Morton
Cc: Arnd Bergmann, Paolo Bonzini, Ralf Baechle, James Hogan,
Paul Burton, Peter Zijlstra, Juergen Gross, Ingo Molnar,
Thomas Gleixner, linux-mips, linux-kernel
A new caller of smp_call_function() passes a local variable as the 'wait'
argument, and that variable is otherwise unused, so we get a warning
in non-SMP configurations:
virt/kvm/kvm_main.c: In function 'kvm_make_all_cpus_request':
virt/kvm/kvm_main.c:195:7: error: unused variable 'wait' [-Werror=unused-variable]
bool wait = req & KVM_REQUEST_WAIT;
This addresses the warning by changing the two macros into inline functions.
As reported by the 0day build bot, a small change is required in the MIPS
r4k code for this, which then gets a warning about a missing variable.
Fixes: 7a97cec26b94 ("KVM: mark requests that need synchronization")
Cc: Paolo Bonzini <pbonzini@redhat.com>
Link: https://patchwork.kernel.org/patch/9722063/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: - fix MIPS build error reported by kbuild test robot
- remove up_smp_call_function()
---
arch/mips/mm/c-r4k.c | 2 ++
include/linux/smp.h | 12 +++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 81d6a15c93d0..f353bf5f24f1 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -97,9 +97,11 @@ static inline void r4k_on_each_cpu(unsigned int type,
void (*func)(void *info), void *info)
{
preempt_disable();
+#ifdef CONFIG_SMP
if (r4k_op_needs_ipi(type))
smp_call_function_many(&cpu_foreign_map[smp_processor_id()],
func, info, 1);
+#endif
func(info);
preempt_enable();
}
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 68123c1fe549..ea24e2d3504c 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -135,17 +135,19 @@ 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 int smp_call_function(smp_call_func_t func, void *info, int wait)
{
return 0;
}
-#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 smp_call_function_many(const struct cpumask *mask,
+ smp_call_func_t func, void *info, bool wait)
+{
+}
+
static inline void call_function_init(void) { }
static inline int
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] smp_call_function: use inline helpers instead of macros
2017-07-26 13:32 [PATCH v2] smp_call_function: use inline helpers instead of macros Arnd Bergmann
@ 2017-07-26 14:42 ` Paolo Bonzini
2017-07-26 14:50 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2017-07-26 14:42 UTC (permalink / raw)
To: Arnd Bergmann, Andrew Morton
Cc: Ralf Baechle, James Hogan, Paul Burton, Peter Zijlstra,
Juergen Gross, Ingo Molnar, Thomas Gleixner, linux-mips,
linux-kernel
On 26/07/2017 15:32, Arnd Bergmann wrote:
> A new caller of smp_call_function() passes a local variable as the 'wait'
> argument, and that variable is otherwise unused, so we get a warning
> in non-SMP configurations:
>
> virt/kvm/kvm_main.c: In function 'kvm_make_all_cpus_request':
> virt/kvm/kvm_main.c:195:7: error: unused variable 'wait' [-Werror=unused-variable]
> bool wait = req & KVM_REQUEST_WAIT;
>
> This addresses the warning by changing the two macros into inline functions.
> As reported by the 0day build bot, a small change is required in the MIPS
> r4k code for this, which then gets a warning about a missing variable.
>
> Fixes: 7a97cec26b94 ("KVM: mark requests that need synchronization")
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Link: https://patchwork.kernel.org/patch/9722063/
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This is not needed anymore, I've fixed it in KVM:
commit b49defe83659cefbb1763d541e779da32594ab10
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: Fri Jun 30 13:25:45 2017 +0200
kvm: avoid unused variable warning for UP builds
The uniprocessor version of smp_call_function_many does not evaluate
all of its argument, and the compiler emits a warning about "wait"
being unused. This breaks the build on architectures for which
"-Werror" is enabled by default.
Work around it by moving the invocation of smp_call_function_many to
its own inline function.
Reported-by: Paul Mackerras <paulus@ozlabs.org>
Cc: stable@vger.kernel.org
Fixes: 7a97cec26b94c909f4cbad2dc3186af3e457a522
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] smp_call_function: use inline helpers instead of macros
2017-07-26 14:42 ` Paolo Bonzini
@ 2017-07-26 14:50 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-07-26 14:50 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Andrew Morton, Ralf Baechle, James Hogan, Paul Burton,
Peter Zijlstra, Juergen Gross, Ingo Molnar, Thomas Gleixner,
open list:RALINK MIPS ARCHITECTURE, Linux Kernel Mailing List
On Wed, Jul 26, 2017 at 4:42 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 26/07/2017 15:32, Arnd Bergmann wrote:
>> A new caller of smp_call_function() passes a local variable as the 'wait'
>> argument, and that variable is otherwise unused, so we get a warning
>> in non-SMP configurations:
>>
>> virt/kvm/kvm_main.c: In function 'kvm_make_all_cpus_request':
>> virt/kvm/kvm_main.c:195:7: error: unused variable 'wait' [-Werror=unused-variable]
>> bool wait = req & KVM_REQUEST_WAIT;
>>
>> This addresses the warning by changing the two macros into inline functions.
>> As reported by the 0day build bot, a small change is required in the MIPS
>> r4k code for this, which then gets a warning about a missing variable.
>>
>> Fixes: 7a97cec26b94 ("KVM: mark requests that need synchronization")
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Link: https://patchwork.kernel.org/patch/9722063/
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> This is not needed anymore, I've fixed it in KVM:
>
> commit b49defe83659cefbb1763d541e779da32594ab10
> Author: Paolo Bonzini <pbonzini@redhat.com>
> Date: Fri Jun 30 13:25:45 2017 +0200
>
> kvm: avoid unused variable warning for UP builds
Ok, that seems sufficient, thanks!
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-26 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 13:32 [PATCH v2] smp_call_function: use inline helpers instead of macros Arnd Bergmann
2017-07-26 14:42 ` Paolo Bonzini
2017-07-26 14:50 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).