Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\rcu\rcutorture.c Create Date:2022-07-28 10:21:48
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Do one read-side critical section, returning false if there was* no data to read. Can be invoked both from process context and* from a timer handler.

Proto:static bool rcu_torture_one_read(struct torture_random_state *trsp)

Type:bool

Parameter:

TypeParameterName
struct torture_random_state *trsp
1269  readstate = 0
1270  struct rt_read_seg rtseg[10] = {{0}}
1271  rtrsp = rtseg[0]
1275  newstate = Return a random protection state mask, but with at least one bit set.
1276  Do one extension of an RCU read-side critical section using the* current reader state in readstate (set to zero for initial entry* to extended critical section), set the new state as specified by* newstate (set to zero for final exit from extended
1277  started = get_gp_seq()
1278  ts = rcu_trace_clock_local()
1279  p = cu_dereference_check() - rcu_dereference with debug checking*@p: The pointer to read, prior to dereferencing*@c: The conditions under which the dereference will take place* Do an rcu_dereference(), but check that the conditions under which the(rcu_torture_current, _read_lock_bh_held() - might we be in RCU-bh read-side critical section?* Check for bottom half being disabled, which covers both the* CONFIG_PROVE_RCU and not cases || rcu_read_lock_sched_held() || srcu_read_lock_held - might we be in SRCU read-side critical section?*@ssp: The srcu_struct structure to check* If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU* read-side critical section || torturing_tasks())
1284  If (p == NULL) Then
1286  Do one extension of an RCU read-side critical section using the* current reader state in readstate (set to zero for initial entry* to extended critical section), set the new state as specified by* newstate (set to zero for final exit from extended
1287  Return false
1289  If rtort_mbtest == 0 Then atomic_inc( & n_rcu_torture_mberror)
1291  rtrsp = Do a randomly selected number of extensions of an existing RCU read-side* critical section.
1292  Even if we don't have any preemption, we need preempt disable/enable* to be barriers, so that we don't have things like get_user/put_user* that can cause faults and scheduling migrate into our preempt-protected* region.()
1293  pipe_count = rtort_pipe_count
1294  If pipe_count > RCU_TORTURE_PIPE_LEN Then
1296  pipe_count = RCU_TORTURE_PIPE_LEN
1298  completed = get_gp_seq()
1299  If pipe_count > 1 Then
1300  do_trace_rcu_torture_read(name, & rtort_rcu, ts, started, completed)
1302  Dump the ftrace buffer, but only one time per callsite per boot.(DUMP_ALL)
1304  __this_cpu_inc(rcu_torture_count[pipe_count])
1305  completed = rcutorture_seq_diff(completed, started)
1306  If completed > RCU_TORTURE_PIPE_LEN Then
1308  completed = RCU_TORTURE_PIPE_LEN
1310  __this_cpu_inc(rcu_torture_batch[completed])
1311  preempt_enable()
1312  Do one extension of an RCU read-side critical section using the* current reader state in readstate (set to zero for initial entry* to extended critical section), set the new state as specified by* newstate (set to zero for final exit from extended
1313  WARN_ON_ONCE(readstate & RCUTORTURE_RDR_MASK)
1316  If ( pipe_count > 1 || completed > 1 ) && Not xchg( & err_segs_recorded, 1) Then
1317  i = 0
1318  When rtrsp1 < rtrsp cycle err_segs[i++] = rtrsp1
1320  rt_read_nsegs = i
1323  Return true
Caller
NameDescribe
rcu_torture_timerRCU torture reader from timer handler. Dereferences rcu_torture_current,* incrementing the corresponding element of the pipeline array. The* counter in the element should never be greater than 1, otherwise, the* RCU implementation is broken.
rcu_torture_readerRCU torture reader kthread. Repeatedly dereferences rcu_torture_current,* incrementing the corresponding element of the pipeline array. The* counter in the element should never be greater than 1, otherwise, the* RCU implementation is broken.