WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] stop_machine: Allow specified function to

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] stop_machine: Allow specified function to run on all CPUs.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2011 08:00:33 -0800
Delivery-date: Mon, 17 Jan 2011 08:20:21 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1295014564 0
# Node ID 2d4fe1a048cd8ae4c8aa0a50f65d0211c8ecf4d2
# Parent  6c9bcfb0fb84c18dd65e2304309f4d857a1ca4d3
stop_machine: Allow specified function to run on all CPUs.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/common/stop_machine.c      |   15 ++++++++++++---
 xen/include/xen/stop_machine.h |    2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff -r 6c9bcfb0fb84 -r 2d4fe1a048cd xen/common/stop_machine.c
--- a/xen/common/stop_machine.c Fri Jan 14 14:07:39 2011 +0000
+++ b/xen/common/stop_machine.c Fri Jan 14 14:16:04 2011 +0000
@@ -61,6 +61,10 @@ static void stopmachine_set_state(enum s
     atomic_set(&stopmachine_data.done, 0);
     smp_wmb();
     stopmachine_data.state = state;
+}
+
+static void stopmachine_wait_state(void)
+{
     while ( atomic_read(&stopmachine_data.done) != stopmachine_data.nr_cpus )
         cpu_relax();
 }
@@ -101,16 +105,20 @@ int stop_machine_run(int (*fn)(void *), 
         tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i);
 
     stopmachine_set_state(STOPMACHINE_PREPARE);
+    stopmachine_wait_state();
 
     local_irq_disable();
     stopmachine_set_state(STOPMACHINE_DISABLE_IRQ);
+    stopmachine_wait_state();
 
-    if ( cpu == smp_processor_id() )
+    stopmachine_set_state(STOPMACHINE_INVOKE);
+    if ( (cpu == smp_processor_id()) || (cpu == NR_CPUS) )
         stopmachine_data.fn_result = (*fn)(data);
-    stopmachine_set_state(STOPMACHINE_INVOKE);
+    stopmachine_wait_state();
     ret = stopmachine_data.fn_result;
 
     stopmachine_set_state(STOPMACHINE_EXIT);
+    stopmachine_wait_state();
     local_irq_enable();
 
     spin_unlock(&stopmachine_lock);
@@ -140,7 +148,8 @@ static void stopmachine_action(unsigned 
             local_irq_disable();
             break;
         case STOPMACHINE_INVOKE:
-            if ( stopmachine_data.fn_cpu == smp_processor_id() )
+            if ( (stopmachine_data.fn_cpu == smp_processor_id()) ||
+                 (stopmachine_data.fn_cpu == NR_CPUS) )
                 stopmachine_data.fn_result =
                     stopmachine_data.fn(stopmachine_data.fn_data);
             break;
diff -r 6c9bcfb0fb84 -r 2d4fe1a048cd xen/include/xen/stop_machine.h
--- a/xen/include/xen/stop_machine.h    Fri Jan 14 14:07:39 2011 +0000
+++ b/xen/include/xen/stop_machine.h    Fri Jan 14 14:16:04 2011 +0000
@@ -5,7 +5,7 @@
  * stop_machine_run: freeze the machine on all CPUs and run this function
  * @fn: the function to run
  * @data: the data ptr for the @fn()
- * @cpu: the cpu to run @fn() on (or any, if @cpu == NR_CPUS).
+ * @cpu: the cpu to run @fn() on (or all, if @cpu == NR_CPUS).
  *
  * Description: This causes every other cpu to enter a safe point, with
  * each of which disables interrupts, and finally interrupts are disabled

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] stop_machine: Allow specified function to run on all CPUs., Xen patchbot-unstable <=