1 // © 2021 Qualcomm Innovation Center, Inc. All rights reserved.
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 // Start a read-side critical section.
6 //
7 // An RCU read-side critical section blocks execution of any update functions
8 // until it is ended by a matching call to rcu_read_finish(). These critical
9 // sections are permitted to nest; each call to this function must be balanced
10 // by exactly one matching call to rcu_read_finish().
11 //
12 // The caller must not assume that this function disables preemption.
13 void
14 rcu_read_start(void) ACQUIRE_RCU_READ;
15 
16 // End a read-side critical section.
17 //
18 // This reverses the effect of the most recent unmatched rcu_read_start() call.
19 // If this ends the outermost nested critical section, then RCU update functions
20 // queued on any CPU after the start of the critical section are permitted to
21 // run.
22 void
23 rcu_read_finish(void) RELEASE_RCU_READ;
24 
25 // Enqueue a write-side update.
26 //
27 // The given update will be processed at the end of the next grace period.
28 //
29 // The update is guaranteed not to run until all currently executing RCU
30 // critical sections have finished. However, there is no guarantee of ordering
31 // of separately enqueued updates with respect to each other. Nor is there a
32 // guarantee that they will run on the CPU that enqueued them.
33 void
34 rcu_enqueue(rcu_entry_t *rcu_entry, rcu_update_class_t rcu_update_class);
35 
36 // Block until the current grace period ends.
37 //
38 // This is typically implemented using rcu_enqueue(), and therefore provides the
39 // same ordering guarantee: any currently executing RCU critical section must
40 // finish before this function can return, but other currently queued updates or
41 // rcu_sync() calls may not have completed.
42 void
43 rcu_sync(void);
44 
45 // Block until the next grace period ends or the caller is killed.
46 //
47 // If this call returns true, it has the same semantics as rcu_sync(). If it
48 // returns false, the caller has been killed, and there are no ordering
49 // guarantees provided by RCU.
50 //
51 // Note that if this returns false, the caller has preemption disabled and may
52 // be running while blocked and/or on a CPU it does not have affinity to.
53 bool
54 rcu_sync_killable(void);
55 
56 // Check for pending updates on the calling CPU.
57 //
58 // If this call returns true, the CPU should not be allowed to enter a low power
59 // state or power itself off.
60 bool
61 rcu_has_pending_updates(void) REQUIRE_PREEMPT_DISABLED;
62