stop_machine.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. /*
  2. * kernel/stop_machine.c
  3. *
  4. * Copyright (C) 2008, 2005 IBM Corporation.
  5. * Copyright (C) 2008, 2005 Rusty Russell rusty@rustcorp.com.au
  6. * Copyright (C) 2010 SUSE Linux Products GmbH
  7. * Copyright (C) 2010 Tejun Heo <tj@kernel.org>
  8. *
  9. * This file is released under the GPLv2 and any later version.
  10. */
  11. #include <linux/completion.h>
  12. #include <linux/cpu.h>
  13. #include <linux/init.h>
  14. #include <linux/kthread.h>
  15. #include <linux/export.h>
  16. #include <linux/percpu.h>
  17. #include <linux/sched.h>
  18. #include <linux/stop_machine.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/kallsyms.h>
  21. #include <linux/smpboot.h>
  22. #include <linux/atomic.h>
  23. #include <linux/lglock.h>
  24. /*
  25. * Structure to determine completion condition and record errors. May
  26. * be shared by works on different cpus.
  27. */
  28. struct cpu_stop_done {
  29. atomic_t nr_todo; /* nr left to execute */
  30. bool executed; /* actually executed? */
  31. int ret; /* collected return value */
  32. struct completion completion; /* fired if nr_todo reaches 0 */
  33. };
  34. /* the actual stopper, one per every possible cpu, enabled on online cpus */
  35. struct cpu_stopper {
  36. spinlock_t lock;
  37. bool enabled; /* is this stopper enabled? */
  38. struct list_head works; /* list of pending works */
  39. };
  40. static DEFINE_PER_CPU(struct cpu_stopper, cpu_stopper);
  41. static DEFINE_PER_CPU(struct task_struct *, cpu_stopper_task);
  42. static bool stop_machine_initialized = false;
  43. /*
  44. * Avoids a race between stop_two_cpus and global stop_cpus, where
  45. * the stoppers could get queued up in reverse order, leading to
  46. * system deadlock. Using an lglock means stop_two_cpus remains
  47. * relatively cheap.
  48. */
  49. DEFINE_STATIC_LGLOCK(stop_cpus_lock);
  50. static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
  51. {
  52. memset(done, 0, sizeof(*done));
  53. atomic_set(&done->nr_todo, nr_todo);
  54. init_completion(&done->completion);
  55. }
  56. /* signal completion unless @done is NULL */
  57. static void cpu_stop_signal_done(struct cpu_stop_done *done, bool executed)
  58. {
  59. if (done) {
  60. if (executed)
  61. done->executed = true;
  62. if (atomic_dec_and_test(&done->nr_todo))
  63. complete(&done->completion);
  64. }
  65. }
  66. /* queue @work to @stopper. if offline, @work is completed immediately */
  67. static void cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work)
  68. {
  69. struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu);
  70. struct task_struct *p = per_cpu(cpu_stopper_task, cpu);
  71. unsigned long flags;
  72. spin_lock_irqsave(&stopper->lock, flags);
  73. if (stopper->enabled) {
  74. list_add_tail(&work->list, &stopper->works);
  75. wake_up_process(p);
  76. } else
  77. cpu_stop_signal_done(work->done, false);
  78. spin_unlock_irqrestore(&stopper->lock, flags);
  79. }
  80. /**
  81. * stop_one_cpu - stop a cpu
  82. * @cpu: cpu to stop
  83. * @fn: function to execute
  84. * @arg: argument to @fn
  85. *
  86. * Execute @fn(@arg) on @cpu. @fn is run in a process context with
  87. * the highest priority preempting any task on the cpu and
  88. * monopolizing it. This function returns after the execution is
  89. * complete.
  90. *
  91. * This function doesn't guarantee @cpu stays online till @fn
  92. * completes. If @cpu goes down in the middle, execution may happen
  93. * partially or fully on different cpus. @fn should either be ready
  94. * for that or the caller should ensure that @cpu stays online until
  95. * this function completes.
  96. *
  97. * CONTEXT:
  98. * Might sleep.
  99. *
  100. * RETURNS:
  101. * -ENOENT if @fn(@arg) was not executed because @cpu was offline;
  102. * otherwise, the return value of @fn.
  103. */
  104. int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
  105. {
  106. struct cpu_stop_done done;
  107. struct cpu_stop_work work = { .fn = fn, .arg = arg, .done = &done };
  108. cpu_stop_init_done(&done, 1);
  109. cpu_stop_queue_work(cpu, &work);
  110. wait_for_completion(&done.completion);
  111. return done.executed ? done.ret : -ENOENT;
  112. }
  113. /* This controls the threads on each CPU. */
  114. enum multi_stop_state {
  115. /* Dummy starting state for thread. */
  116. MULTI_STOP_NONE,
  117. /* Awaiting everyone to be scheduled. */
  118. MULTI_STOP_PREPARE,
  119. /* Disable interrupts. */
  120. MULTI_STOP_DISABLE_IRQ,
  121. /* Run the function */
  122. MULTI_STOP_RUN,
  123. /* Exit */
  124. MULTI_STOP_EXIT,
  125. };
  126. struct multi_stop_data {
  127. int (*fn)(void *);
  128. void *data;
  129. /* Like num_online_cpus(), but hotplug cpu uses us, so we need this. */
  130. unsigned int num_threads;
  131. const struct cpumask *active_cpus;
  132. enum multi_stop_state state;
  133. atomic_t thread_ack;
  134. };
  135. static void set_state(struct multi_stop_data *msdata,
  136. enum multi_stop_state newstate)
  137. {
  138. /* Reset ack counter. */
  139. atomic_set(&msdata->thread_ack, msdata->num_threads);
  140. smp_wmb();
  141. msdata->state = newstate;
  142. }
  143. /* Last one to ack a state moves to the next state. */
  144. static void ack_state(struct multi_stop_data *msdata)
  145. {
  146. if (atomic_dec_and_test(&msdata->thread_ack))
  147. set_state(msdata, msdata->state + 1);
  148. }
  149. /* This is the cpu_stop function which stops the CPU. */
  150. static int multi_cpu_stop(void *data)
  151. {
  152. struct multi_stop_data *msdata = data;
  153. enum multi_stop_state curstate = MULTI_STOP_NONE;
  154. int cpu = smp_processor_id(), err = 0;
  155. unsigned long flags;
  156. bool is_active;
  157. /*
  158. * When called from stop_machine_from_inactive_cpu(), irq might
  159. * already be disabled. Save the state and restore it on exit.
  160. */
  161. local_save_flags(flags);
  162. if (!msdata->active_cpus)
  163. is_active = cpu == cpumask_first(cpu_online_mask);
  164. else
  165. is_active = cpumask_test_cpu(cpu, msdata->active_cpus);
  166. /* Simple state machine */
  167. do {
  168. /* Chill out and ensure we re-read multi_stop_state. */
  169. cpu_relax();
  170. if (msdata->state != curstate) {
  171. curstate = msdata->state;
  172. switch (curstate) {
  173. case MULTI_STOP_DISABLE_IRQ:
  174. local_irq_disable();
  175. hard_irq_disable();
  176. break;
  177. case MULTI_STOP_RUN:
  178. if (is_active)
  179. err = msdata->fn(msdata->data);
  180. break;
  181. default:
  182. break;
  183. }
  184. ack_state(msdata);
  185. }
  186. } while (curstate != MULTI_STOP_EXIT);
  187. local_irq_restore(flags);
  188. return err;
  189. }
  190. struct irq_cpu_stop_queue_work_info {
  191. int cpu1;
  192. int cpu2;
  193. struct cpu_stop_work *work1;
  194. struct cpu_stop_work *work2;
  195. };
  196. /*
  197. * This function is always run with irqs and preemption disabled.
  198. * This guarantees that both work1 and work2 get queued, before
  199. * our local migrate thread gets the chance to preempt us.
  200. */
  201. static void irq_cpu_stop_queue_work(void *arg)
  202. {
  203. struct irq_cpu_stop_queue_work_info *info = arg;
  204. cpu_stop_queue_work(info->cpu1, info->work1);
  205. cpu_stop_queue_work(info->cpu2, info->work2);
  206. }
  207. /**
  208. * stop_two_cpus - stops two cpus
  209. * @cpu1: the cpu to stop
  210. * @cpu2: the other cpu to stop
  211. * @fn: function to execute
  212. * @arg: argument to @fn
  213. *
  214. * Stops both the current and specified CPU and runs @fn on one of them.
  215. *
  216. * returns when both are completed.
  217. */
  218. int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *arg)
  219. {
  220. struct cpu_stop_done done;
  221. struct cpu_stop_work work1, work2;
  222. struct irq_cpu_stop_queue_work_info call_args;
  223. struct multi_stop_data msdata;
  224. preempt_disable();
  225. msdata = (struct multi_stop_data){
  226. .fn = fn,
  227. .data = arg,
  228. .num_threads = 2,
  229. .active_cpus = cpumask_of(cpu1),
  230. };
  231. work1 = work2 = (struct cpu_stop_work){
  232. .fn = multi_cpu_stop,
  233. .arg = &msdata,
  234. .done = &done
  235. };
  236. call_args = (struct irq_cpu_stop_queue_work_info){
  237. .cpu1 = cpu1,
  238. .cpu2 = cpu2,
  239. .work1 = &work1,
  240. .work2 = &work2,
  241. };
  242. cpu_stop_init_done(&done, 2);
  243. set_state(&msdata, MULTI_STOP_PREPARE);
  244. /*
  245. * If we observe both CPUs active we know _cpu_down() cannot yet have
  246. * queued its stop_machine works and therefore ours will get executed
  247. * first. Or its not either one of our CPUs that's getting unplugged,
  248. * in which case we don't care.
  249. *
  250. * This relies on the stopper workqueues to be FIFO.
  251. */
  252. if (!cpu_active(cpu1) || !cpu_active(cpu2)) {
  253. preempt_enable();
  254. return -ENOENT;
  255. }
  256. lg_local_lock(&stop_cpus_lock);
  257. /*
  258. * Queuing needs to be done by the lowest numbered CPU, to ensure
  259. * that works are always queued in the same order on every CPU.
  260. * This prevents deadlocks.
  261. */
  262. smp_call_function_single(min(cpu1, cpu2),
  263. &irq_cpu_stop_queue_work,
  264. &call_args, 0);
  265. lg_local_unlock(&stop_cpus_lock);
  266. preempt_enable();
  267. wait_for_completion(&done.completion);
  268. return done.executed ? done.ret : -ENOENT;
  269. }
  270. /**
  271. * stop_one_cpu_nowait - stop a cpu but don't wait for completion
  272. * @cpu: cpu to stop
  273. * @fn: function to execute
  274. * @arg: argument to @fn
  275. *
  276. * Similar to stop_one_cpu() but doesn't wait for completion. The
  277. * caller is responsible for ensuring @work_buf is currently unused
  278. * and will remain untouched until stopper starts executing @fn.
  279. *
  280. * CONTEXT:
  281. * Don't care.
  282. */
  283. void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
  284. struct cpu_stop_work *work_buf)
  285. {
  286. *work_buf = (struct cpu_stop_work){ .fn = fn, .arg = arg, };
  287. cpu_stop_queue_work(cpu, work_buf);
  288. }
  289. /* static data for stop_cpus */
  290. static DEFINE_MUTEX(stop_cpus_mutex);
  291. static DEFINE_PER_CPU(struct cpu_stop_work, stop_cpus_work);
  292. static void queue_stop_cpus_work(const struct cpumask *cpumask,
  293. cpu_stop_fn_t fn, void *arg,
  294. struct cpu_stop_done *done)
  295. {
  296. struct cpu_stop_work *work;
  297. unsigned int cpu;
  298. /* initialize works and done */
  299. for_each_cpu(cpu, cpumask) {
  300. work = &per_cpu(stop_cpus_work, cpu);
  301. work->fn = fn;
  302. work->arg = arg;
  303. work->done = done;
  304. }
  305. /*
  306. * Disable preemption while queueing to avoid getting
  307. * preempted by a stopper which might wait for other stoppers
  308. * to enter @fn which can lead to deadlock.
  309. */
  310. lg_global_lock(&stop_cpus_lock);
  311. for_each_cpu(cpu, cpumask)
  312. cpu_stop_queue_work(cpu, &per_cpu(stop_cpus_work, cpu));
  313. lg_global_unlock(&stop_cpus_lock);
  314. }
  315. static int __stop_cpus(const struct cpumask *cpumask,
  316. cpu_stop_fn_t fn, void *arg)
  317. {
  318. struct cpu_stop_done done;
  319. cpu_stop_init_done(&done, cpumask_weight(cpumask));
  320. queue_stop_cpus_work(cpumask, fn, arg, &done);
  321. wait_for_completion(&done.completion);
  322. return done.executed ? done.ret : -ENOENT;
  323. }
  324. /**
  325. * stop_cpus - stop multiple cpus
  326. * @cpumask: cpus to stop
  327. * @fn: function to execute
  328. * @arg: argument to @fn
  329. *
  330. * Execute @fn(@arg) on online cpus in @cpumask. On each target cpu,
  331. * @fn is run in a process context with the highest priority
  332. * preempting any task on the cpu and monopolizing it. This function
  333. * returns after all executions are complete.
  334. *
  335. * This function doesn't guarantee the cpus in @cpumask stay online
  336. * till @fn completes. If some cpus go down in the middle, execution
  337. * on the cpu may happen partially or fully on different cpus. @fn
  338. * should either be ready for that or the caller should ensure that
  339. * the cpus stay online until this function completes.
  340. *
  341. * All stop_cpus() calls are serialized making it safe for @fn to wait
  342. * for all cpus to start executing it.
  343. *
  344. * CONTEXT:
  345. * Might sleep.
  346. *
  347. * RETURNS:
  348. * -ENOENT if @fn(@arg) was not executed at all because all cpus in
  349. * @cpumask were offline; otherwise, 0 if all executions of @fn
  350. * returned 0, any non zero return value if any returned non zero.
  351. */
  352. int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg)
  353. {
  354. int ret;
  355. /* static works are used, process one request at a time */
  356. mutex_lock(&stop_cpus_mutex);
  357. ret = __stop_cpus(cpumask, fn, arg);
  358. mutex_unlock(&stop_cpus_mutex);
  359. return ret;
  360. }
  361. /**
  362. * try_stop_cpus - try to stop multiple cpus
  363. * @cpumask: cpus to stop
  364. * @fn: function to execute
  365. * @arg: argument to @fn
  366. *
  367. * Identical to stop_cpus() except that it fails with -EAGAIN if
  368. * someone else is already using the facility.
  369. *
  370. * CONTEXT:
  371. * Might sleep.
  372. *
  373. * RETURNS:
  374. * -EAGAIN if someone else is already stopping cpus, -ENOENT if
  375. * @fn(@arg) was not executed at all because all cpus in @cpumask were
  376. * offline; otherwise, 0 if all executions of @fn returned 0, any non
  377. * zero return value if any returned non zero.
  378. */
  379. int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg)
  380. {
  381. int ret;
  382. /* static works are used, process one request at a time */
  383. if (!mutex_trylock(&stop_cpus_mutex))
  384. return -EAGAIN;
  385. ret = __stop_cpus(cpumask, fn, arg);
  386. mutex_unlock(&stop_cpus_mutex);
  387. return ret;
  388. }
  389. static int cpu_stop_should_run(unsigned int cpu)
  390. {
  391. struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu);
  392. unsigned long flags;
  393. int run;
  394. spin_lock_irqsave(&stopper->lock, flags);
  395. run = !list_empty(&stopper->works);
  396. spin_unlock_irqrestore(&stopper->lock, flags);
  397. return run;
  398. }
  399. static void cpu_stopper_thread(unsigned int cpu)
  400. {
  401. struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu);
  402. struct cpu_stop_work *work;
  403. int ret;
  404. repeat:
  405. work = NULL;
  406. spin_lock_irq(&stopper->lock);
  407. if (!list_empty(&stopper->works)) {
  408. work = list_first_entry(&stopper->works,
  409. struct cpu_stop_work, list);
  410. list_del_init(&work->list);
  411. }
  412. spin_unlock_irq(&stopper->lock);
  413. if (work) {
  414. cpu_stop_fn_t fn = work->fn;
  415. void *arg = work->arg;
  416. struct cpu_stop_done *done = work->done;
  417. char ksym_buf[KSYM_NAME_LEN] __maybe_unused;
  418. /* cpu stop callbacks are not allowed to sleep */
  419. preempt_disable();
  420. ret = fn(arg);
  421. if (ret)
  422. done->ret = ret;
  423. /* restore preemption and check it's still balanced */
  424. preempt_enable();
  425. WARN_ONCE(preempt_count(),
  426. "cpu_stop: %s(%p) leaked preempt count\n",
  427. kallsyms_lookup((unsigned long)fn, NULL, NULL, NULL,
  428. ksym_buf), arg);
  429. cpu_stop_signal_done(done, true);
  430. goto repeat;
  431. }
  432. }
  433. extern void sched_set_stop_task(int cpu, struct task_struct *stop);
  434. static void cpu_stop_create(unsigned int cpu)
  435. {
  436. sched_set_stop_task(cpu, per_cpu(cpu_stopper_task, cpu));
  437. }
  438. static void cpu_stop_park(unsigned int cpu)
  439. {
  440. struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu);
  441. struct cpu_stop_work *work;
  442. unsigned long flags;
  443. /* drain remaining works */
  444. spin_lock_irqsave(&stopper->lock, flags);
  445. list_for_each_entry(work, &stopper->works, list)
  446. cpu_stop_signal_done(work->done, false);
  447. stopper->enabled = false;
  448. spin_unlock_irqrestore(&stopper->lock, flags);
  449. }
  450. static void cpu_stop_unpark(unsigned int cpu)
  451. {
  452. struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu);
  453. spin_lock_irq(&stopper->lock);
  454. stopper->enabled = true;
  455. spin_unlock_irq(&stopper->lock);
  456. }
  457. static struct smp_hotplug_thread cpu_stop_threads = {
  458. .store = &cpu_stopper_task,
  459. .thread_should_run = cpu_stop_should_run,
  460. .thread_fn = cpu_stopper_thread,
  461. .thread_comm = "migration/%u",
  462. .create = cpu_stop_create,
  463. .setup = cpu_stop_unpark,
  464. .park = cpu_stop_park,
  465. .pre_unpark = cpu_stop_unpark,
  466. .selfparking = true,
  467. };
  468. static int __init cpu_stop_init(void)
  469. {
  470. unsigned int cpu;
  471. for_each_possible_cpu(cpu) {
  472. struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu);
  473. spin_lock_init(&stopper->lock);
  474. INIT_LIST_HEAD(&stopper->works);
  475. }
  476. BUG_ON(smpboot_register_percpu_thread(&cpu_stop_threads));
  477. stop_machine_initialized = true;
  478. return 0;
  479. }
  480. early_initcall(cpu_stop_init);
  481. #ifdef CONFIG_STOP_MACHINE
  482. int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
  483. {
  484. struct multi_stop_data msdata = {
  485. .fn = fn,
  486. .data = data,
  487. .num_threads = num_online_cpus(),
  488. .active_cpus = cpus,
  489. };
  490. if (!stop_machine_initialized) {
  491. /*
  492. * Handle the case where stop_machine() is called
  493. * early in boot before stop_machine() has been
  494. * initialized.
  495. */
  496. unsigned long flags;
  497. int ret;
  498. WARN_ON_ONCE(msdata.num_threads != 1);
  499. local_irq_save(flags);
  500. hard_irq_disable();
  501. ret = (*fn)(data);
  502. local_irq_restore(flags);
  503. return ret;
  504. }
  505. /* Set the initial state and stop all online cpus. */
  506. set_state(&msdata, MULTI_STOP_PREPARE);
  507. return stop_cpus(cpu_online_mask, multi_cpu_stop, &msdata);
  508. }
  509. int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
  510. {
  511. int ret;
  512. /* No CPUs can come up or down during this. */
  513. get_online_cpus();
  514. ret = __stop_machine(fn, data, cpus);
  515. put_online_cpus();
  516. return ret;
  517. }
  518. EXPORT_SYMBOL_GPL(stop_machine);
  519. /**
  520. * stop_machine_from_inactive_cpu - stop_machine() from inactive CPU
  521. * @fn: the function to run
  522. * @data: the data ptr for the @fn()
  523. * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
  524. *
  525. * This is identical to stop_machine() but can be called from a CPU which
  526. * is not active. The local CPU is in the process of hotplug (so no other
  527. * CPU hotplug can start) and not marked active and doesn't have enough
  528. * context to sleep.
  529. *
  530. * This function provides stop_machine() functionality for such state by
  531. * using busy-wait for synchronization and executing @fn directly for local
  532. * CPU.
  533. *
  534. * CONTEXT:
  535. * Local CPU is inactive. Temporarily stops all active CPUs.
  536. *
  537. * RETURNS:
  538. * 0 if all executions of @fn returned 0, any non zero return value if any
  539. * returned non zero.
  540. */
  541. int stop_machine_from_inactive_cpu(int (*fn)(void *), void *data,
  542. const struct cpumask *cpus)
  543. {
  544. struct multi_stop_data msdata = { .fn = fn, .data = data,
  545. .active_cpus = cpus };
  546. struct cpu_stop_done done;
  547. int ret;
  548. /* Local CPU must be inactive and CPU hotplug in progress. */
  549. BUG_ON(cpu_active(raw_smp_processor_id()));
  550. msdata.num_threads = num_active_cpus() + 1; /* +1 for local */
  551. /* No proper task established and can't sleep - busy wait for lock. */
  552. while (!mutex_trylock(&stop_cpus_mutex))
  553. cpu_relax();
  554. /* Schedule work on other CPUs and execute directly for local CPU */
  555. set_state(&msdata, MULTI_STOP_PREPARE);
  556. cpu_stop_init_done(&done, num_active_cpus());
  557. queue_stop_cpus_work(cpu_active_mask, multi_cpu_stop, &msdata,
  558. &done);
  559. ret = multi_cpu_stop(&msdata);
  560. /* Busy wait for completion. */
  561. while (!completion_done(&done.completion))
  562. cpu_relax();
  563. mutex_unlock(&stop_cpus_mutex);
  564. return ret ?: done.ret;
  565. }
  566. #endif /* CONFIG_STOP_MACHINE */