···8888#endif /* CONFIG_SMP */89899090/*9191- * stop_machine "Bogolock": stop the entire machine, disable9292- * interrupts. This is a very heavy lock, which is equivalent to9393- * grabbing every spinlock (and more). So the "read" side to such a9494- * lock is anything which disables preemption.9191+ * stop_machine "Bogolock": stop the entire machine, disable interrupts.9292+ * This is a very heavy lock, which is equivalent to grabbing every raw9393+ * spinlock (and more). So the "read" side to such a lock is anything9494+ * which disables preemption.9595 */9696#if defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU)97979898/**9999 * stop_machine: freeze the machine on all CPUs and run this function100100 * @fn: the function to run101101- * @data: the data ptr for the @fn()102102- * @cpus: the cpus to run the @fn() on (NULL = any online cpu)101101+ * @data: the data ptr to pass to @fn()102102+ * @cpus: the cpus to run @fn() on (NULL = run on each online CPU)103103 *104104- * Description: This causes a thread to be scheduled on every cpu,105105- * each of which disables interrupts. The result is that no one is106106- * holding a spinlock or inside any other preempt-disabled region when107107- * @fn() runs.104104+ * Description: This causes a thread to be scheduled on every CPU, which105105+ * will run with interrupts disabled. Each CPU specified by @cpus will106106+ * run @fn. While @fn is executing, there will no other CPUs holding107107+ * a raw spinlock or running within any other type of preempt-disabled108108+ * region of code.108109 *109109- * This can be thought of as a very heavy write lock, equivalent to110110- * grabbing every spinlock in the kernel.110110+ * When @cpus specifies only a single CPU, this can be thought of as111111+ * a reader-writer lock where readers disable preemption (for example,112112+ * by holding a raw spinlock) and where the insanely heavy writers run113113+ * @fn while also preventing any other CPU from doing any useful work.114114+ * These writers can also be thought of as having implicitly grabbed every115115+ * raw spinlock in the kernel.111116 *112112- * Protects against CPU hotplug.117117+ * When @fn is a no-op, this can be thought of as an RCU implementation118118+ * where readers again disable preemption and writers use stop_machine()119119+ * in place of synchronize_rcu(), albeit with orders of magnitude more120120+ * disruption than even that of synchronize_rcu_expedited().121121+ *122122+ * Although only one stop_machine() operation can proceed at a time,123123+ * the possibility of blocking in cpus_read_lock() means that the caller124124+ * cannot usefully rely on this serialization.125125+ *126126+ * Return: 0 if all invocations of @fn return zero. Otherwise, the127127+ * value returned by an arbitrarily chosen member of the set of calls to128128+ * @fn that returned non-zero.113129 */114130int stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus);115131116132/**117133 * stop_machine_cpuslocked: freeze the machine on all CPUs and run this function118134 * @fn: the function to run119119- * @data: the data ptr for the @fn()120120- * @cpus: the cpus to run the @fn() on (NULL = any online cpu)135135+ * @data: the data ptr to pass to @fn()136136+ * @cpus: the cpus to run @fn() on (NULL = run on each online CPU)121137 *122122- * Same as above. Must be called from with in a cpus_read_lock() protected123123- * region. Avoids nested calls to cpus_read_lock().138138+ * Same as above. Avoids nested calls to cpus_read_lock().139139+ *140140+ * Context: Must be called from within a cpus_read_lock() protected region.124141 */125142int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus);126143127144/**128145 * stop_core_cpuslocked: - stop all threads on just one core129146 * @cpu: any cpu in the targeted core130130- * @fn: the function to run131131- * @data: the data ptr for @fn()147147+ * @fn: the function to run on each CPU in the core containing @cpu148148+ * @data: the data ptr to pass to @fn()132149 *133133- * Same as above, but instead of every CPU, only the logical CPUs of a134134- * single core are affected.150150+ * Same as above, but instead of every CPU, only the logical CPUs of the151151+ * single core containing @cpu are affected.135152 *136153 * Context: Must be called from within a cpus_read_lock() protected region.137154 *138138- * Return: 0 if all executions of @fn returned 0, any non zero return139139- * value if any returned non zero.155155+ * Return: 0 if all invocations of @fn return zero. Otherwise, the156156+ * value returned by an arbitrarily chosen member of the set of calls to157157+ * @fn that returned non-zero.140158 */141159int stop_core_cpuslocked(unsigned int cpu, cpu_stop_fn_t fn, void *data);142160