/* Use __aligned() to avoid to use 2 cache lines for 1 csd */ typedefstruct __call_single_data call_single_data_t
__aligned(sizeof(struct __call_single_data));
#define INIT_CSD(_csd, _func, _info) \ do { \
*(_csd) = CSD_INIT((_func), (_info)); \
} while (0)
/* * Enqueue a llist_node on the call_single_queue; be very careful, read * flush_smp_call_function_queue() in detail.
*/ externvoid __smp_call_single_queue(int cpu, struct llist_node *node);
/* total number of cpus in this system (may exceed NR_CPUS) */ externunsignedint total_cpus;
int smp_call_function_single(int cpuid, smp_call_func_t func, void *info, int wait);
int smp_call_function_single_async(int cpu, call_single_data_t *csd);
/* * Cpus stopping functions in panic. All have default weak definitions. * Architecture-dependent code may override them.
*/ void __noreturn panic_smp_self_stop(void); void __noreturn nmi_panic_self_stop(struct pt_regs *regs); void crash_smp_send_stop(void);
/* * Call a function on all processors
*/ staticinlinevoid on_each_cpu(smp_call_func_t func, void *info, int wait)
{
on_each_cpu_cond_mask(NULL, func, info, wait, cpu_online_mask);
}
/** * on_each_cpu_mask(): Run a function on processors specified by * cpumask, which may include the local processor. * @mask: The set of cpus to run on (only runs on online subset). * @func: The function to run. This must be fast and non-blocking. * @info: An arbitrary pointer to pass to the function. * @wait: If true, wait (atomically) until function has completed * on other CPUs. * * If @wait is true, then returns once @func has returned. * * You must not call this function with disabled interrupts or from a * hardware interrupt handler or from a bottom half handler. The * exception is that it may be used during early boot while * early_boot_irqs_disabled is set.
*/ staticinlinevoid on_each_cpu_mask(conststruct cpumask *mask,
smp_call_func_t func, void *info, bool wait)
{
on_each_cpu_cond_mask(NULL, func, info, wait, mask);
}
/* * Call a function on each processor for which the supplied function * cond_func returns a positive value. This may include the local * processor. May be used during early boot while early_boot_irqs_disabled is * set. Use local_irq_save/restore() instead of local_irq_disable/enable().
*/ staticinlinevoid on_each_cpu_cond(smp_cond_func_t cond_func,
smp_call_func_t func, void *info, bool wait)
{
on_each_cpu_cond_mask(cond_func, func, info, wait, cpu_online_mask);
}
/* * Architecture specific boot CPU setup. Defined as empty weak function in * init/main.c. Architectures can override it.
*/ void __init smp_prepare_boot_cpu(void);
/* * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. * (defined in asm header):
*/
/* * stops all CPUs but the current one:
*/ externvoid smp_send_stop(void);
/* * sends a 'reschedule' event to another CPU:
*/ externvoid arch_smp_send_reschedule(int cpu); /* * scheduler_ipi() is inline so can't be passed as callback reason, but the * callsite IP should be sufficient for root-causing IPIs sent from here.
*/ #define smp_send_reschedule(cpu) ({ \
trace_ipi_send_cpu(cpu, _RET_IP_, NULL); \
arch_smp_send_reschedule(cpu); \
})
/* * Prepare machine for booting other CPUs.
*/ externvoid smp_prepare_cpus(unsignedint max_cpus);
/* * Bring a CPU up
*/ externint __cpu_up(unsignedint cpunum, struct task_struct *tidle);
/* * Final polishing of CPUs
*/ externvoid smp_cpus_done(unsignedint max_cpus);
/* * Call a function on all other processors
*/ void smp_call_function(smp_call_func_t func, void *info, int wait); void smp_call_function_many(conststruct cpumask *mask,
smp_call_func_t func, void *info, bool wait);
int smp_call_function_any(conststruct cpumask *mask,
smp_call_func_t func, void *info, int wait);
/* * These macros fold the SMP functionality into a single CPU system
*/ #define raw_smp_processor_id() 0 staticinlinevoid up_smp_call_function(smp_call_func_t func, void *info)
{
} #define smp_call_function(func, info, wait) \
(up_smp_call_function(func, info))
/** * raw_smp_processor_id() - get the current (unstable) CPU id * * For then you know what you are doing and need an unstable * CPU id.
*/
/** * smp_processor_id() - get the current (stable) CPU id * * This is the normal accessor to the CPU id and should be used * whenever possible. * * The CPU id is stable when: * * - IRQs are disabled; * - preemption is disabled; * - the task is CPU affine. * * When CONFIG_DEBUG_PREEMPT; we verify these assumption and WARN * when smp_processor_id() is used when the CPU id is not stable.
*/
/* * Allow the architecture to differentiate between a stable and unstable read. * For example, x86 uses an IRQ-safe asm-volatile read for the unstable but a * regular asm read for the stable.
*/ #ifndef __smp_processor_id #define __smp_processor_id() raw_smp_processor_id() #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.