Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:rcu_torture_init

Proto:static int __init rcu_torture_init(void)

Type:int

Parameter:Nothing

2346  firsterr = 0
2347  static struct rcu_torture_ops * torture_ops[] = { & rcu_ops, & rcu_busted_ops, & srcu_ops, & As above, but dynamically allocated. , & As above, but broken due to inappropriate reader extension. , & tasks_ops, & trivial_ops, }
2352  If Not Initialize torture module Then Return -EBUSY
2356  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(torture_ops) cycle
2357  cur_ops = torture_ops[i]
2358  If strcmp(torture_type, name) == 0 Then Break
2361  If i == ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(torture_ops) Then
2362  pr_alert("rcu-torture: invalid torture type: \"%s\"\n", torture_type)
2364  pr_alert("rcu-torture types:")
2365  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(torture_ops) cycle Like KERN_CONT, pr_cont() should only be used when continuing* a line with no newline ('\n') enclosed. Otherwise it defaults* back to KERN_DEFAULT.(" %s", name)
2367  Like KERN_CONT, pr_cont() should only be used when continuing* a line with no newline ('\n') enclosed. Otherwise it defaults* back to KERN_DEFAULT.("\n")
2368  WARN_ON(!IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0* otherwise.(CONFIG_RCU_TORTURE_TEST))
2369  firsterr = -EINVAL
2370  cur_ops = NULL
2371  Go to unwind
2373  If fqs == NULL && fqs_duration != 0 Then
2374  pr_alert("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n")
2375  fqs_duration = 0
2377  If init Then init()
2380  If nreaders >= 0 Then
2381  nrealreaders = nreaders
2382  Else
2383  nrealreaders = num_online_cpus() - 2 - nreaders
2384  If nrealreaders <= 0 Then nrealreaders = 1
2387  rcu_torture_print_module_parms(cur_ops, "Start of test")
2391  Initialization list head
2392  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(rcu_tortures) cycle
2393  rtort_mbtest = 0
2394  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
2400  rcu_torture_current = NULL
2401  rcu_torture_current_version = 0
2402  atomic_set( & n_rcu_torture_alloc, 0)
2403  atomic_set( & n_rcu_torture_alloc_fail, 0)
2404  atomic_set( & n_rcu_torture_free, 0)
2405  atomic_set( & n_rcu_torture_mberror, 0)
2406  atomic_set( & n_rcu_torture_error, 0)
2407  n_rcu_torture_barrier_error = 0
2408  n_rcu_torture_boost_ktrerror = 0
2409  n_rcu_torture_boost_rterror = 0
2410  n_rcu_torture_boost_failure = 0
2411  n_rcu_torture_boosts = 0
2412  When i < RCU_TORTURE_PIPE_LEN + 1 cycle atomic_set( & rcu_torture_wcount[i], 0)
2414  for_each_possible_cpu(cpu)
2415  When i < RCU_TORTURE_PIPE_LEN + 1 cycle
2416  per_cpu(rcu_torture_count, cpu)[i] = 0
2417  per_cpu(rcu_torture_batch, cpu)[i] = 0
2420  err_segs_recorded = 0
2421  rt_read_nsegs = 0
2425  firsterr = torture_create_kthread(RCU torture writer kthread. Repeatedly substitutes a new structure* for that pointed to by rcu_torture_current, freeing the old structure* after a series of grace periods (the "pipeline")., NULL, writer_task)
2427  If firsterr Then Go to unwind
2429  If nfakewriters > 0 Then
2430  fakewriter_tasks = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
2433  If (fakewriter_tasks == NULL) Then
2434  VERBOSE_TOROUT_ERRSTRING("out of memory")
2435  firsterr = -ENOMEM
2436  Go to unwind
2439  When i < nfakewriters cycle
2440  firsterr = torture_create_kthread(RCU torture fake writer kthread. Repeatedly calls sync, with a random* delay between calls., NULL, fakewriter_tasks[i])
2442  If firsterr Then Go to unwind
2445  reader_tasks = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
2447  If (reader_tasks == NULL) Then
2448  VERBOSE_TOROUT_ERRSTRING("out of memory")
2449  firsterr = -ENOMEM
2450  Go to unwind
2452  When i < nrealreaders cycle
2453  firsterr = torture_create_kthread(RCU 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., (void * )i, reader_tasks[i])
2455  If firsterr Then Go to unwind
2458  If stat_interval > 0 Then
2459  firsterr = torture_create_kthread(Periodically prints torture statistics, if periodic statistics printing* was specified via the stat_interval module parameter., NULL, stats_task)
2461  If firsterr Then Go to unwind
2464  If test_no_idle_hz && shuffle_interval > 0 Then
2465  firsterr = torture_shuffle_init(shuffle_interval * HZ)
2466  If firsterr Then Go to unwind
2469  If stutter < 0 Then stutter = 0
2471  If stutter Then
2474  t = If stall_dur Then stall_dur() Else stutter * HZ
2475  firsterr = torture_stutter_init(stutter * HZ, t)
2476  If firsterr Then Go to unwind
2479  If fqs_duration < 0 Then fqs_duration = 0
2481  If fqs_duration Then
2483  firsterr = torture_create_kthread(RCU torture force-quiescent-state kthread. Repeatedly induces* bursts of calls to force_quiescent_state(), increasing the probability* of occurrence of some important types of race conditions., NULL, fqs_task)
2485  If firsterr Then Go to unwind
2488  If test_boost_interval < 1 Then test_boost_interval = 1
2490  If test_boost_duration < 2 Then test_boost_duration = 2
2492  If rcu_torture_can_boost() Then
2494  jiffies of next boost test start. = jiffies + test_boost_interval * HZ
2496  firsterr = puhp_setup_state - Setup hotplug state callbacks with calling the callbacks*@state: The state for which the calls are installed*@name: Name of the callback (will be used in debug output)*@startup: startup callback function*@teardown: teardown callback
2499  If firsterr < 0 Then Go to unwind
2501  rcutor_hp = firsterr
2503  shutdown_jiffies = jiffies + shutdown_secs * HZ
2504  firsterr = torture_shutdown_init(shutdown_secs, rcu_torture_cleanup)
2505  If firsterr Then Go to unwind
2507  firsterr = torture_onoff_init(onoff_holdoff * HZ, onoff_interval, rcutorture_sync)
2509  If firsterr Then Go to unwind
2511  firsterr = Spawn CPU-stall kthread, if stall_cpu specified.
2512  If firsterr Then Go to unwind
2514  firsterr = If forward-progress checking is requested and feasible, spawn the thread.
2515  If firsterr Then Go to unwind
2517  firsterr = Initialize RCU barrier testing.
2518  If firsterr Then Go to unwind
2520  If object_debug Then Verify that double-free causes debug-objects to complain, but only* if CONFIG_DEBUG_OBJECTS_RCU_HEAD=y. Otherwise, say that the test* cannot be carried out.
2522  Tell the torture module that initialization is complete.
2523  Return 0
2525  unwind :
2526  Tell the torture module that initialization is complete.
2527  rcu_torture_cleanup()
2528  Return firsterr