[xen stable-4.10] allow cpu_down() to be called earlier

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.10] allow cpu_down() to be called earlier

patchbot
commit 498716e25364caa753bf15a70013c9778e2f5b07
Author:     Jan Beulich <[hidden email]>
AuthorDate: Mon Jul 30 11:37:24 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Mon Jul 30 11:37:24 2018 +0200

    allow cpu_down() to be called earlier
   
    The function's use of the stop-machine logic has so far prevented its
    use ahead of the processing of the "ordinary" initcalls. Since at this
    early time we're in a controlled environment anyway, there's no need for
    such a heavy tool. Additionally this ought to have less of a performance
    impact especially on large systems, compared to the alternative of
    making stop-machine functionality available earlier.
   
    Signed-off-by: Jan Beulich <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    Reviewed-by: Andrew Cooper <[hidden email]>
    master commit: 5894c0a2da66243a89088d309c7e1ea212ab28d6
    master date: 2018-07-16 15:15:12 +0200
---
 xen/common/cpu.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/cpu.c b/xen/common/cpu.c
index 6350f150bd..653a56b840 100644
--- a/xen/common/cpu.c
+++ b/xen/common/cpu.c
@@ -67,12 +67,17 @@ void __init register_cpu_notifier(struct notifier_block *nb)
     spin_unlock(&cpu_add_remove_lock);
 }
 
-static int take_cpu_down(void *unused)
+static void _take_cpu_down(void *unused)
 {
     void *hcpu = (void *)(long)smp_processor_id();
     int notifier_rc = notifier_call_chain(&cpu_chain, CPU_DYING, hcpu, NULL);
     BUG_ON(notifier_rc != NOTIFY_DONE);
     __cpu_disable();
+}
+
+static int take_cpu_down(void *arg)
+{
+    _take_cpu_down(arg);
     return 0;
 }
 
@@ -98,7 +103,9 @@ int cpu_down(unsigned int cpu)
         goto fail;
     }
 
-    if ( (err = stop_machine_run(take_cpu_down, NULL, cpu)) < 0 )
+    if ( unlikely(system_state < SYS_STATE_active) )
+        on_selected_cpus(cpumask_of(cpu), _take_cpu_down, NULL, true);
+    else if ( (err = stop_machine_run(take_cpu_down, NULL, cpu)) < 0 )
         goto fail;
 
     __cpu_die(cpu);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog