public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm uses smp_call_function_mask() in kvm_flush_remote_tlbs()
@ 2007-10-22 14:33 Laurent Vivier
       [not found] ` <11930635871488-git-send-email-Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Laurent Vivier @ 2007-10-22 14:33 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: Laurent Vivier

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().

Signed-off-by: Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
---
 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/

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-10-23 11:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-22 14:33 [PATCH] kvm uses smp_call_function_mask() in kvm_flush_remote_tlbs() Laurent Vivier
     [not found] ` <11930635871488-git-send-email-Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
2007-10-22 14:57   ` [PATCH] kvm uses smp_call_function_mask() inkvm_flush_remote_tlbs() Dor Laor
     [not found]     ` <471CBA60.2030402-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-22 15:02       ` Laurent Vivier
     [not found]         ` <471CBB70.5050109-6ktuUTfB/bM@public.gmane.org>
2007-10-22 15:11           ` Avi Kivity
2007-10-22 15:24   ` [PATCH] kvm uses smp_call_function_mask() in kvm_flush_remote_tlbs() Avi Kivity
2007-10-22 16:24   ` Carsten Otte
     [not found]     ` <471CCEC8.9060200-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-10-22 17:05       ` Avi Kivity
     [not found]         ` <471CD876.5020404-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-22 18:36           ` Avi Kivity
2007-10-23 11:50           ` Carsten Otte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox