blob: 735601ac27d3950f8118f200c3e8125bef1fbd80 [file] [log] [blame]
Paul E. McKenneya9b73432019-01-17 10:36:27 -08001/* SPDX-License-Identifier: GPL-2.0+ */
Paul E. McKenney64db4cf2008-12-18 21:55:32 +01002/*
3 * Read-Copy Update mechanism for mutual exclusion (tree-based version)
4 *
Paul E. McKenney64db4cf2008-12-18 21:55:32 +01005 * Copyright IBM Corporation, 2008
6 *
7 * Author: Dipankar Sarma <dipankar@in.ibm.com>
Paul E. McKenneya9b73432019-01-17 10:36:27 -08008 * Paul E. McKenney <paulmck@linux.ibm.com> Hierarchical algorithm
Paul E. McKenney64db4cf2008-12-18 21:55:32 +01009 *
Paul E. McKenneya9b73432019-01-17 10:36:27 -080010 * Based on the original work by Paul McKenney <paulmck@linux.ibm.com>
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010011 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
12 *
13 * For detailed explanation of Read-Copy Update mechanism see -
Paul E. McKenneya71fca52009-09-18 10:28:19 -070014 * Documentation/RCU
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010015 */
16
17#ifndef __LINUX_RCUTREE_H
18#define __LINUX_RCUTREE_H
19
Paul E. McKenneyd28139c2018-06-28 14:45:25 -070020void rcu_softirq_qs(void);
Paul E. McKenneybcbfdd02017-04-11 15:50:41 -070021void rcu_note_context_switch(bool preempt);
Thomas Gleixnerc1ad3482015-04-14 21:08:58 +000022int rcu_needs_cpu(u64 basem, u64 *nextevt);
Teodora Baluta584dc4c2013-11-11 17:11:23 +020023void rcu_cpu_stall_reset(void);
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010024
Gleb Natapov29ce8312011-05-04 16:31:03 +030025/*
26 * Note a virtualization-based context switch. This is simply a
27 * wrapper around rcu_note_context_switch(), which allows TINY_RCU
Paul E. McKenney46a5d162015-10-07 09:10:48 -070028 * to save a few bytes. The caller must have disabled interrupts.
Gleb Natapov29ce8312011-05-04 16:31:03 +030029 */
30static inline void rcu_virt_note_context_switch(int cpu)
31{
Paul E. McKenneybcbfdd02017-04-11 15:50:41 -070032 rcu_note_context_switch(false);
Gleb Natapov29ce8312011-05-04 16:31:03 +030033}
34
Teodora Baluta584dc4c2013-11-11 17:11:23 +020035void synchronize_rcu_expedited(void);
Boqun Fengb6a4ae72015-07-29 13:29:38 +080036void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
Paul E. McKenney486e2592012-01-06 14:11:30 -080037
Teodora Baluta584dc4c2013-11-11 17:11:23 +020038void rcu_barrier(void);
Yury Norov17672482018-03-25 20:50:03 +030039bool rcu_eqs_special_set(int cpu);
Paul E. McKenney765a3f42014-03-14 16:37:08 -070040unsigned long get_state_synchronize_rcu(void);
41void cond_synchronize_rcu(unsigned long oldstate);
Paul E. McKenneya57eb942010-06-29 16:49:16 -070042
Paul E. McKenney51952bc632015-04-21 11:15:30 -070043void rcu_idle_enter(void);
44void rcu_idle_exit(void);
45void rcu_irq_enter(void);
46void rcu_irq_exit(void);
Paul E. McKenney7c9906c2015-10-31 00:59:01 -070047void rcu_irq_enter_irqson(void);
48void rcu_irq_exit_irqson(void);
Paul E. McKenney51952bc632015-04-21 11:15:30 -070049
Teodora Baluta584dc4c2013-11-11 17:11:23 +020050void exit_rcu(void);
Paul E. McKenney2439b692013-04-11 10:15:52 -070051
Teodora Baluta584dc4c2013-11-11 17:11:23 +020052void rcu_scheduler_starting(void);
Paul E. McKenneybbad9372010-04-02 16:17:17 -070053extern int rcu_scheduler_active __read_mostly;
Paul E. McKenneyd2b16542017-05-11 12:01:50 -070054void rcu_end_inkernel_boot(void);
Teodora Baluta584dc4c2013-11-11 17:11:23 +020055bool rcu_is_watching(void);
Paul E. McKenney395a2f02018-07-10 14:00:14 -070056#ifndef CONFIG_PREEMPT
Paul E. McKenney5cd37192014-12-13 20:32:04 -080057void rcu_all_qs(void);
Paul E. McKenney395a2f02018-07-10 14:00:14 -070058#endif
Paul E. McKenney5cd37192014-12-13 20:32:04 -080059
Thomas Gleixner4df83742016-07-13 17:17:03 +000060/* RCUtree hotplug events */
61int rcutree_prepare_cpu(unsigned int cpu);
62int rcutree_online_cpu(unsigned int cpu);
63int rcutree_offline_cpu(unsigned int cpu);
64int rcutree_dead_cpu(unsigned int cpu);
65int rcutree_dying_cpu(unsigned int cpu);
Peter Zijlstraf64c6012018-05-22 09:50:53 -070066void rcu_cpu_starting(unsigned int cpu);
Thomas Gleixner4df83742016-07-13 17:17:03 +000067
Paul E. McKenney64db4cf2008-12-18 21:55:32 +010068#endif /* __LINUX_RCUTREE_H */