From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: [PATCH] KVM: use modern cpumask primitives, no cpumask_t on stack Date: Thu, 11 Dec 2008 10:51:24 -0600 Message-ID: <1229014284.26586.9.camel@localhost.localdomain> References: <20081208160945.7535A25006E@cleopatra.tlv.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm-devel , Rusty Russell To: Avi Kivity Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:32848 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757877AbYLKQvj (ORCPT ); Thu, 11 Dec 2008 11:51:39 -0500 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by e5.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id mBBGowAp027244 for ; Thu, 11 Dec 2008 11:50:58 -0500 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mBBGpOQJ2207832 for ; Thu, 11 Dec 2008 11:51:24 -0500 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mBBGpN76028826 for ; Thu, 11 Dec 2008 09:51:23 -0700 In-Reply-To: <20081208160945.7535A25006E@cleopatra.tlv.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 2008-12-08 at 16:09 +0000, Avi Kivity wrote: > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index ba4275d..2d6ca79 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -568,14 +570,17 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) > if (test_and_set_bit(req, &vcpu->requests)) > continue; > cpu = vcpu->cpu; > - if (cpu != -1 && cpu != me) > - cpu_set(cpu, cpus); > - } > - if (!cpus_empty(cpus)) { > - smp_call_function_mask(cpus, ack_flush, NULL, 1); > - called = true; > + if (cpus != NULL && cpu != -1 && cpu != me) > + cpumask_set_cpu(cpu, cpus); > } > + if (unlikely(cpus == NULL)) > + smp_call_function_many(cpu_online_mask, ack_flush, NULL, 1); > + else if (!cpumask_empty(cpus)) > + smp_call_function_many(cpus, ack_flush, NULL, 1); > + else > + called = false; > put_cpu(); > + free_cpumask_var(cpus); > return called; > } This patch breaks uniprocessor builds, because smp_call_function_many() is only defined for CONFIG_SMP. Avi, I think you should be able to build a PowerPC KVM kernel at this point? That would have caught this error. Rusty, could you ack the following: cpumask: define smp_call_function_many() for non-SMP builds Signed-off-by: Hollis Blanchard diff --git a/include/linux/smp.h b/include/linux/smp.h --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -67,13 +67,6 @@ int smp_call_function(void(*func)(void * /* Deprecated: use smp_call_function_many() which uses a cpumask ptr. */ int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, int wait); - -static inline void smp_call_function_many(const struct cpumask *mask, - void (*func)(void *info), void *info, - int wait) -{ - smp_call_function_mask(*mask, func, info, wait); -} int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, int wait); @@ -151,6 +144,13 @@ static inline void init_call_single_data } #endif /* !SMP */ +static inline void smp_call_function_many(const struct cpumask *mask, + void (*func)(void *info), void *info, + int wait) +{ + smp_call_function_mask(*mask, func, info, wait); +} + /* * smp_processor_id(): get the current CPU ID. * -- Hollis Blanchard IBM Linux Technology Center