2019-01-17 10:34:35 -08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2009-10-25 19:03:50 -07:00
|
|
|
/*
|
|
|
|
|
* Read-Copy Update mechanism for mutual exclusion, the Bloatwatch edition.
|
|
|
|
|
*
|
|
|
|
|
* Copyright IBM Corporation, 2008
|
|
|
|
|
*
|
2019-01-17 10:34:35 -08:00
|
|
|
* Author: Paul E. McKenney <paulmck@linux.ibm.com>
|
2009-10-25 19:03:50 -07:00
|
|
|
*
|
|
|
|
|
* For detailed explanation of Read-Copy Update mechanism see -
|
2009-10-26 07:55:55 +01:00
|
|
|
* Documentation/RCU
|
2009-10-25 19:03:50 -07:00
|
|
|
*/
|
|
|
|
|
#ifndef __LINUX_TINY_H
|
|
|
|
|
#define __LINUX_TINY_H
|
|
|
|
|
|
2019-08-22 10:53:43 +09:00
|
|
|
#include <asm/param.h> /* for HZ */
|
2009-10-25 19:03:50 -07:00
|
|
|
|
2022-07-28 15:37:05 -07:00
|
|
|
struct rcu_gp_oldstate {
|
|
|
|
|
unsigned long rgos_norm;
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-24 15:39:09 -07:00
|
|
|
// Maximum number of rcu_gp_oldstate values corresponding to
|
|
|
|
|
// not-yet-completed RCU grace periods.
|
|
|
|
|
#define NUM_ACTIVE_RCU_POLL_FULL_OLDSTATE 2
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Are the two oldstate values the same? See the Tree RCU version for
|
|
|
|
|
* docbook header.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool same_state_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp1,
|
|
|
|
|
struct rcu_gp_oldstate *rgosp2)
|
|
|
|
|
{
|
|
|
|
|
return rgosp1->rgos_norm == rgosp2->rgos_norm;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-25 17:36:06 -08:00
|
|
|
unsigned long get_state_synchronize_rcu(void);
|
2022-07-28 19:58:13 -07:00
|
|
|
|
|
|
|
|
static inline void get_state_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp)
|
|
|
|
|
{
|
|
|
|
|
rgosp->rgos_norm = get_state_synchronize_rcu();
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-25 17:36:06 -08:00
|
|
|
unsigned long start_poll_synchronize_rcu(void);
|
2022-08-02 17:04:54 -07:00
|
|
|
|
|
|
|
|
static inline void start_poll_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp)
|
|
|
|
|
{
|
|
|
|
|
rgosp->rgos_norm = start_poll_synchronize_rcu();
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-25 17:36:06 -08:00
|
|
|
bool poll_state_synchronize_rcu(unsigned long oldstate);
|
2014-03-14 16:37:08 -07:00
|
|
|
|
2022-07-28 15:37:05 -07:00
|
|
|
static inline bool poll_state_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp)
|
|
|
|
|
{
|
|
|
|
|
return poll_state_synchronize_rcu(rgosp->rgos_norm);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-14 16:37:08 -07:00
|
|
|
static inline void cond_synchronize_rcu(unsigned long oldstate)
|
|
|
|
|
{
|
|
|
|
|
might_sleep();
|
2022-08-04 13:46:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void cond_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp)
|
|
|
|
|
{
|
|
|
|
|
cond_synchronize_rcu(rgosp->rgos_norm);
|
2014-03-14 16:37:08 -07:00
|
|
|
}
|
|
|
|
|
|
2022-04-15 10:55:42 -07:00
|
|
|
static inline unsigned long start_poll_synchronize_rcu_expedited(void)
|
|
|
|
|
{
|
|
|
|
|
return start_poll_synchronize_rcu();
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-03 12:38:51 -07:00
|
|
|
static inline void start_poll_synchronize_rcu_expedited_full(struct rcu_gp_oldstate *rgosp)
|
|
|
|
|
{
|
|
|
|
|
rgosp->rgos_norm = start_poll_synchronize_rcu_expedited();
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-15 10:55:42 -07:00
|
|
|
static inline void cond_synchronize_rcu_expedited(unsigned long oldstate)
|
|
|
|
|
{
|
|
|
|
|
cond_synchronize_rcu(oldstate);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-04 15:23:26 -07:00
|
|
|
static inline void cond_synchronize_rcu_expedited_full(struct rcu_gp_oldstate *rgosp)
|
|
|
|
|
{
|
|
|
|
|
cond_synchronize_rcu_expedited(rgosp->rgos_norm);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-03 10:44:44 -07:00
|
|
|
extern void rcu_barrier(void);
|
2011-05-26 22:14:36 -07:00
|
|
|
|
2010-06-29 16:49:16 -07:00
|
|
|
static inline void synchronize_rcu_expedited(void)
|
|
|
|
|
{
|
2018-07-06 11:46:47 -07:00
|
|
|
synchronize_rcu();
|
2010-06-29 16:49:16 -07:00
|
|
|
}
|
|
|
|
|
|
2018-07-03 10:44:44 -07:00
|
|
|
void rcu_qs(void);
|
2018-07-02 14:30:37 -07:00
|
|
|
|
2018-06-28 14:45:25 -07:00
|
|
|
static inline void rcu_softirq_qs(void)
|
|
|
|
|
{
|
2018-07-03 10:44:44 -07:00
|
|
|
rcu_qs();
|
2018-06-28 14:45:25 -07:00
|
|
|
}
|
|
|
|
|
|
2017-04-11 15:50:41 -07:00
|
|
|
#define rcu_note_context_switch(preempt) \
|
|
|
|
|
do { \
|
2018-07-03 10:44:44 -07:00
|
|
|
rcu_qs(); \
|
2020-03-16 20:38:29 -07:00
|
|
|
rcu_tasks_qs(current, (preempt)); \
|
2017-04-11 15:50:41 -07:00
|
|
|
} while (0)
|
2010-06-29 16:49:16 -07:00
|
|
|
|
2022-02-08 17:16:33 +01:00
|
|
|
static inline int rcu_needs_cpu(void)
|
2017-05-03 15:24:25 -07:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-05 20:34:43 -07:00
|
|
|
static inline void rcu_request_urgent_qs_task(struct task_struct *t) { }
|
|
|
|
|
|
2011-05-04 16:31:03 +03:00
|
|
|
/*
|
|
|
|
|
* Take advantage of the fact that there is only one CPU, which
|
|
|
|
|
* allows us to ignore virtualization-based context switches.
|
|
|
|
|
*/
|
2022-09-15 16:38:24 +08:00
|
|
|
static inline void rcu_virt_note_context_switch(void) { }
|
2017-05-03 13:51:42 -07:00
|
|
|
static inline void rcu_cpu_stall_reset(void) { }
|
2018-07-18 14:32:31 -07:00
|
|
|
static inline int rcu_jiffies_till_stall_check(void) { return 21 * HZ; }
|
2020-05-21 22:05:16 +02:00
|
|
|
static inline void rcu_irq_exit_check_preempt(void) { }
|
2017-05-03 13:51:42 -07:00
|
|
|
static inline void exit_rcu(void) { }
|
2018-06-21 12:50:01 -07:00
|
|
|
static inline bool rcu_preempt_need_deferred_qs(struct task_struct *t)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
static inline void rcu_preempt_deferred_qs(struct task_struct *t) { }
|
2013-11-11 17:11:23 +02:00
|
|
|
void rcu_scheduler_starting(void);
|
2017-05-11 12:01:50 -07:00
|
|
|
static inline void rcu_end_inkernel_boot(void) { }
|
2019-11-28 18:54:06 -08:00
|
|
|
static inline bool rcu_inkernel_boot_has_ended(void) { return true; }
|
2017-05-03 13:51:42 -07:00
|
|
|
static inline bool rcu_is_watching(void) { return true; }
|
2024-04-29 16:43:36 +02:00
|
|
|
static inline void rcu_momentary_eqs(void) { }
|
2013-09-13 17:20:11 -07:00
|
|
|
|
2017-05-03 13:51:42 -07:00
|
|
|
/* Avoid RCU read-side critical sections leaking across. */
|
|
|
|
|
static inline void rcu_all_qs(void) { barrier(); }
|
2014-12-13 20:32:04 -08:00
|
|
|
|
2016-07-13 17:17:03 +00:00
|
|
|
/* RCUtree hotplug events */
|
|
|
|
|
#define rcutree_prepare_cpu NULL
|
|
|
|
|
#define rcutree_online_cpu NULL
|
|
|
|
|
#define rcutree_offline_cpu NULL
|
|
|
|
|
#define rcutree_dead_cpu NULL
|
|
|
|
|
#define rcutree_dying_cpu NULL
|
2023-09-08 22:36:01 +02:00
|
|
|
static inline void rcutree_report_cpu_starting(unsigned int cpu) { }
|
2016-07-13 17:17:03 +00:00
|
|
|
|
2009-10-25 19:03:50 -07:00
|
|
|
#endif /* __LINUX_RCUTINY_H */
|