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


Groups > linux.kernel > #1681458

[PATCH] kvm: avoid unused variable warning for UP builds

Path csiph.com!news.mixmin.net!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] kvm: avoid unused variable warning for UP builds
Date Wed, 05 Jul 2017 12:40:03 +0200
Message-ID <tZPSX-537-45@gated-at.bofh.it> (permalink)
X-Original-To linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=BSyMaGvinAgwqEaXEHt4dZ51ILu0wY+uHv3IjjnGzxU=; b=G81K1MZPxzqTGFZlVjcQ3K2SQIgDZs0l7egAKIvIE6mnVFGZiGJfcWXhk3eRuR5cSK taLifEfWka67BihzoheXuBkbLGSud5trMznVJ0NJitdUPjmjklDk7g3x7Kj/irOmt5wW AZ1OKCfInaojeIFNjLj0P9OUDJbIvtKU2+SLjHnWAjzyasVUeR2JbHDbKtkDRkyju0t5 i0QLvyXAfVP+S0bfl2JS1lh5r6hvQrgt042R4DhFY4omeuy3RBWyM0wzUvmAhiUsNbdB rFGfgDIeLVb+CR02LN8hKgENnCm/cgzWatQC5wqUpweEgaVEbNXjpu4R1WZTDjzB0uBp 6F+g==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=BSyMaGvinAgwqEaXEHt4dZ51ILu0wY+uHv3IjjnGzxU=; b=q4ymJ8/zk2l2PPpxLCoocCB7+1MoXWORGHhILpx+vkUkYcFSd2ltBLujjl0kAJzqZm +WNuljCTWKw4y+9EQ+C2YFiFU7vYFi4kYePhvEvKcdMVxzgS2mk+oe3NYC5VTxV179EO Jni1YXJsnMQBURz307LGxNnJGCmVpTTxCU+oc7+/Dli94uZk4ZDCCgtDzkgO2wLyiTG8 SHuNqpVj08l//BkXI28Y7OM6RP8uMmtZHsiLzjaOKJm13c6xbKwYg243Nv5vJbuNcZEp Vcgq+yew8EmwgTwDrDeDaYykHc0zvirzCDcDpaRUYlUqr9L2UMcNGxKcsNaFxktlU8wt F3wA==
X-Gm-Message-State AKS2vOwF+7zMeCwsmNONUbNG1/kKfS6CfIGe4WIFUx6gt64CbLmUbuPV VAupX/LIkMDrRhdRBn8=
X-Received by 10.223.162.150 with SMTP id s22mr32979664wra.181.1499250934317; Wed, 05 Jul 2017 03:35:34 -0700 (PDT)
X-Mailer git-send-email 1.8.3.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 65
Organization linux.* mail to news gateway
X-Original-Cc paulus@ozlabs.org, stable@vger.kernel.org
X-Original-Date Wed, 5 Jul 2017 12:35:30 +0200
X-Original-Message-ID <1499250930-34010-1-git-send-email-pbonzini@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1681458

Show key headers only | View raw


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>
---
 virt/kvm/kvm_main.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f0fe9d02f6bb..09368501d9cf 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -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)
 {
 	int i, cpu, me;
 	cpumask_var_t cpus;
-	bool called = true;
-	bool wait = req & KVM_REQUEST_WAIT;
+	bool called;
 	struct kvm_vcpu *vcpu;
 
 	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 &&
 		    kvm_request_needs_ipi(vcpu, req))
-			cpumask_set_cpu(cpu, cpus);
+			__cpumask_set_cpu(cpu, cpus);
 	}
-	if (unlikely(cpus == NULL))
-		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;
+	called = kvm_kick_many_cpus(cpus, !!(req & KVM_REQUEST_WAIT));
 	put_cpu();
 	free_cpumask_var(cpus);
 	return called;
-- 
1.8.3.1

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] kvm: avoid unused variable warning for UP builds Paolo Bonzini <pbonzini@redhat.com> - 2017-07-05 12:40 +0200
  Re: [PATCH] kvm: avoid unused variable warning for UP builds David Hildenbrand <david@redhat.com> - 2017-07-05 14:30 +0200
  Re: [PATCH] kvm: avoid unused variable warning for UP builds Paolo Bonzini <pbonzini@redhat.com> - 2017-07-05 14:30 +0200
  Re: [PATCH] kvm: avoid unused variable warning for UP builds David Hildenbrand <david@redhat.com> - 2017-07-05 14:30 +0200

csiph-web