From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dor Laor Subject: Re: [PATCH] kvm uses smp_call_function_mask() inkvm_flush_remote_tlbs() Date: Mon, 22 Oct 2007 16:57:36 +0200 Message-ID: <471CBA60.2030402@qumranet.com> References: <11930635871488-git-send-email-Laurent.Vivier@bull.net> Reply-To: dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Laurent Vivier Return-path: In-Reply-To: <11930635871488-git-send-email-Laurent.Vivier-6ktuUTfB/bM@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Laurent Vivier wrote: > > This patches can be applied only on kvm-updates-2.6.24 and > kvm-updates-2.6.25 > as it needs smp_call_function_mask(). > > In kvm_flush_remote_tlbs(), it replaces a loop using > smp_call_function_single() > by a single call to smp_call_function_mask(). > Would you be kind enough to copy the implementation of smp_call_function_mask into external_module_compat.h so older kernel's will still work after this commited. Thanks, Dor. > > Signed-off-by: Laurent Vivier > --- > drivers/kvm/kvm_main.c | 26 +++----------------------- > 1 files changed, 3 insertions(+), 23 deletions(-) > > diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c > index bf6a86c..6f7b31e 100644 > --- a/drivers/kvm/kvm_main.c > +++ b/drivers/kvm/kvm_main.c > @@ -200,21 +200,15 @@ void vcpu_put(struct kvm_vcpu *vcpu) > > static void ack_flush(void *_completed) > { > - atomic_t *completed = _completed; > - > - atomic_inc(completed); > } > > void kvm_flush_remote_tlbs(struct kvm *kvm) > { > - int i, cpu, needed; > + int i, cpu; > cpumask_t cpus; > struct kvm_vcpu *vcpu; > - atomic_t completed; > > - atomic_set(&completed, 0); > cpus_clear(cpus); > - needed = 0; > for (i = 0; i < KVM_MAX_VCPUS; ++i) { > vcpu = kvm->vcpus[i]; > if (!vcpu) > @@ -223,23 +217,9 @@ void kvm_flush_remote_tlbs(struct kvm *kvm) > continue; > cpu = vcpu->cpu; > if (cpu != -1 && cpu != raw_smp_processor_id()) > - if (!cpu_isset(cpu, cpus)) { > - cpu_set(cpu, cpus); > - ++needed; > - } > - } > - > - /* > - * We really want smp_call_function_mask() here. But that's not > - * available, so ipi all cpus in parallel and wait for them > - * to complete. > - */ > - for (cpu = first_cpu(cpus); cpu != NR_CPUS; cpu = > next_cpu(cpu, cpus)) > - smp_call_function_single(cpu, ack_flush, &completed, > 1, 0); > - while (atomic_read(&completed) != needed) { > - cpu_relax(); > - barrier(); > + cpu_set(cpu, cpus); > } > + smp_call_function_mask(cpus, ack_flush, NULL, 1); > } > > int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) > -- > 1.5.2.4 > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > kvm-devel mailing list > kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/kvm-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/