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: 7a97cec26b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
@@ -187,12 +187,23 @@ static void ack_flush(void *_completed)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool kvm_kick_many_cpus(const struct cpumask *cpus, bool wait)
|
||||||
|
{
|
||||||
|
if (unlikely(!cpus))
|
||||||
|
cpus = cpu_online_mask;
|
||||||
|
|
||||||
|
if (cpumask_empty(cpus))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
smp_call_function_many(cpus, ack_flush, NULL, wait);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
|
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
|
||||||
{
|
{
|
||||||
int i, cpu, me;
|
int i, cpu, me;
|
||||||
cpumask_var_t cpus;
|
cpumask_var_t cpus;
|
||||||
bool called = true;
|
bool called;
|
||||||
bool wait = req & KVM_REQUEST_WAIT;
|
|
||||||
struct kvm_vcpu *vcpu;
|
struct kvm_vcpu *vcpu;
|
||||||
|
|
||||||
zalloc_cpumask_var(&cpus, GFP_ATOMIC);
|
zalloc_cpumask_var(&cpus, GFP_ATOMIC);
|
||||||
@@ -207,14 +218,9 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
|
|||||||
|
|
||||||
if (cpus != NULL && cpu != -1 && cpu != me &&
|
if (cpus != NULL && cpu != -1 && cpu != me &&
|
||||||
kvm_request_needs_ipi(vcpu, req))
|
kvm_request_needs_ipi(vcpu, req))
|
||||||
cpumask_set_cpu(cpu, cpus);
|
__cpumask_set_cpu(cpu, cpus);
|
||||||
}
|
}
|
||||||
if (unlikely(cpus == NULL))
|
called = kvm_kick_many_cpus(cpus, !!(req & KVM_REQUEST_WAIT));
|
||||||
smp_call_function_many(cpu_online_mask, ack_flush, NULL, wait);
|
|
||||||
else if (!cpumask_empty(cpus))
|
|
||||||
smp_call_function_many(cpus, ack_flush, NULL, wait);
|
|
||||||
else
|
|
||||||
called = false;
|
|
||||||
put_cpu();
|
put_cpu();
|
||||||
free_cpumask_var(cpus);
|
free_cpumask_var(cpus);
|
||||||
return called;
|
return called;
|
||||||
|
|||||||
Reference in New Issue
Block a user