23 Sep, 2012

4 commits

  • When you do something like "t = kthread_run(...)", it is possible that
    the kthread will start running before the assignment to "t" happens.
    If the child kthread expects to find a pointer to its task_struct in "t",
    it will then be fatally disappointed. This commit therefore switches
    such cases to kthread_create() followed by wake_up_process(), guaranteeing
    that the assignment happens before the child kthread starts running.

    Reported-by: Fengguang Wu
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Drop a few characters by switching kernel/rcutorture.c from
    "printk(KERN_ALERT" to "pr_alert(".

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Many rcutorture runs include CPU-hotplug operations in their stress
    testing. This commit accumulates statistics on the durations of these
    operations in deference to the recent concern about the overhead and
    latency of these operations.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     
  • A number of new features have been added to rcutorture over the years, but
    the defaults have not been updated to include them. This commit therefore
    turns on a couple of them that have proven helpful and trustworthy, namely
    periodic progress reports and testing of NO_HZ.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     

06 Jul, 2012

2 commits

  • Although the C language allows you to break strings across lines, doing
    this makes it hard for people to find the Linux kernel code corresponding
    to a given console message. This commit therefore fixes broken strings
    throughout RCU's source code.

    Suggested-by: Josh Triplett
    Suggested-by: Ingo Molnar
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The Linux kernel coding style says that single-statement blocks should
    omit curly braces unless the other leg of the "if" statement has
    multiple statements, in which case the curly braces should be included.
    This commit fixes RCU's violations of this rule.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     

03 Jul, 2012

5 commits

  • The current rcutorture rcu_barrier() testing never intentionally runs
    more than one instance of rcu_barrier() at a given time. This fails
    to test the the shiny new concurrency features of rcu_barrier(). This
    commit therefore modifies the rcutorture fakewriter kthread to randomly
    invoke rcu_barrier() rather than the usual synchronize_rcu().

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The rcu_torture_barrier() function has a copy-and-paste typo in the
    string passed to rcutorture_shutdown_absorb(), which this commit fixes.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     
  • The child threads in the rcu_torture_barrier_cbs() are improperly
    synchronized, which can cause the rcu_barrier() tests to hang. The
    failure mode is as follows:

    1. CPU 0 running in rcu_torture_barrier() sets barrier_cbs_count
    to n_barrier_cbs.

    2. CPU 1 running in rcu_torture_barrier_cbs() wakes up, posts
    its RCU callback, and atomically decrements barrier_cbs_count.
    Because barrier_cbs_count is not zero, it does not do the wake_up().

    3. CPU 2 running in rcu_torture_barrier_cbs() wakes up, but
    finds that barrier_cbs_count is not equal to n_barrier_cbs,
    and so returns to sleep.

    4. The value of barrier_cbs_count therefore never reaches zero,
    which causes the test to hang.

    This commit therefore uses a phase variable to coordinate the test,
    preventing this scenario from occurring.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • SRCU now has a call_srcu() and an srcu_barrier(), but rcutorture does not
    test them. This commit adds the machinery to allow rcutorture's existing
    tests for call_rcu() and rcu_barrier() to apply to the SRCU equivalents.

    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     
  • Move the raw SRCU interfaces out of the middle of the normal SRCU
    interfaces.

    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     

01 May, 2012

3 commits

  • Add srcu_torture_deferred_free() for srcu_ops so as to test the new
    call_srcu(). Rename the original srcu_ops to srcu_sync_ops.

    Signed-off-by: Lai Jiangshan
    Signed-off-by: Paul E. McKenney

    Lai Jiangshan
     
  • The current implementation of synchronize_srcu_expedited() can cause
    severe OS jitter due to its use of synchronize_sched(), which in turn
    invokes try_stop_cpus(), which causes each CPU to be sent an IPI.
    This can result in severe performance degradation for real-time workloads
    and especially for short-interation-length HPC workloads. Furthermore,
    because only one instance of try_stop_cpus() can be making forward progress
    at a given time, only one instance of synchronize_srcu_expedited() can
    make forward progress at a time, even if they are all operating on
    distinct srcu_struct structures.

    This commit, inspired by an earlier implementation by Peter Zijlstra
    (https://lkml.org/lkml/2012/1/31/211) and by further offline discussions,
    takes a strictly algorithmic bits-in-memory approach. This has the
    disadvantage of requiring one explicit memory-barrier instruction in
    each of srcu_read_lock() and srcu_read_unlock(), but on the other hand
    completely dispenses with OS jitter and furthermore allows SRCU to be
    used freely by CPUs that RCU believes to be idle or offline.

    The update-side implementation handles the single read-side memory
    barrier by rechecking the per-CPU counters after summing them and
    by running through the update-side state machine twice.

    This implementation has passed moderate rcutorture testing on both
    x86 and Power. Also updated to use this_cpu_ptr() instead of per_cpu_ptr(),
    as suggested by Peter Zijlstra.

    Reported-by: Peter Zijlstra
    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Acked-by: Peter Zijlstra
    Reviewed-by: Lai Jiangshan

    Paul E. McKenney
     
  • Although rcutorture does invoke rcu_barrier() and friends, it cannot
    really be called a torture test given that it invokes them only once
    at the end of the test. This commit therefore introduces heavy-duty
    rcutorture testing for rcu_barrier(), which may be carried out
    concurrently with normal rcutorture testing.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

25 Apr, 2012

1 commit

  • The rcutorture initialization code ignored the error returns from
    rcu_torture_onoff_init() and rcu_torture_stall_init(). The rcutorture
    cleanup code failed to NULL out a number of pointers. These bugs will
    normally have no effect, but this commit fixes them nevertheless.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

22 Feb, 2012

5 commits


17 Jan, 2012

2 commits

  • "rcu: Add rcutorture CPU-hotplug capability" adds cpu hotplug operations
    to the rcutorture code but produces a false positive warning about section
    mismatches:

    WARNING: vmlinux.o(.text+0x1e420c): Section mismatch in reference from the
    function rcu_torture_onoff() to the function .cpuinit.text:cpu_up()
    The function rcu_torture_onoff() references
    the function __cpuinit cpu_up().
    This is often because rcu_torture_onoff lacks a __cpuinit
    annotation or the annotation of cpu_up is wrong.

    This commit therefore adds a __cpuinit annotation so the warning goes away.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Paul E. McKenney

    Heiko Carstens
     
  • module_param(bool) used to counter-intuitively take an int. In
    fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
    trick.

    It's time to remove the int/unsigned int option. For this version
    it'll simply give a warning, but it'll break next kernel version.
    This commit makes this change to rcutorture.

    Signed-off-by: Rusty Russell
    Signed-off-by: Paul E. McKenney

    Rusty Russell
     

12 Dec, 2011

6 commits

  • This commit adds simple rcutorture tests for srcu_read_lock_raw() and
    srcu_read_unlock_raw(). It does not test doing srcu_read_lock_raw()
    in an exception handler and releasing it in the corresponding process
    context.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The rcutorture test now can automatically exercise CPU hotplug and
    collect success statistics, which can be correlated with other rcutorture
    activity. This permits rcutorture to completely exercise RCU regardless
    of what sort of userspace and filesystem layout is in use. Unfortunately,
    rcutorture is happy to attempt to offline CPUs that cannot be offlined,
    for example, CPU 0 in both the x86 and ARM architectures. Although this
    allows rcutorture testing to proceed normally, it confounds attempts at
    error analysis due to the resulting flood of spurious CPU-hotplug errors.

    Therefore, this commit uses the new cpu_is_hotpluggable() function to
    avoid attempting to offline CPUs that are not hotpluggable, which in
    turn avoids spurious CPU-hotplug errors.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Running CPU-hotplug operations concurrently with rcutorture has
    historically been a good way to find bugs in both RCU and CPU hotplug.
    This commit therefore adds an rcutorture module parameter called
    "onoff_interval" that causes a randomly selected CPU-hotplug operation to
    be executed at the specified interval, in seconds. The default value of
    "onoff_interval" is zero, which disables rcutorture-instigated CPU-hotplug
    operations.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Currently, if rcutorture is built into the kernel, it must be manually
    started or started from an init script. This is inconvenient for
    automated KVM testing, where it is good to be able to fully control
    rcutorture execution from the kernel parameters. This patch therefore
    adds a module parameter named "rcutorture_runnable" that defaults
    to zero ("don't start automatically"), but which can be set to one
    to cause rcutorture to start up immediately during boot.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Although it is easy to run rcutorture tests under KVM, there is currently
    no nice way to run such a test for a fixed time period, collect all of
    the rcutorture data, and then shut the system down cleanly. This commit
    therefore adds an rcutorture module parameter named "shutdown_secs" that
    specified the run duration in seconds, after which rcutorture terminates
    the test and powers the system down. The default value for "shutdown_secs"
    is zero, which disables shutdown.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Trace the rcutorture RCU accesses and dump the trace buffer when the
    first failure is detected.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     

29 Sep, 2011

6 commits

  • One of the loops in rcu_torture_boost() fails to check kthread_should_stop(),
    and thus might be slowing or even stopping completion of rcutorture tests
    at rmmod time. This commit adds the kthread_should_stop() check to the
    offending loop.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The rcu_torture_fqs() function can prevent the rcutorture tests from
    completing, resulting in a hang. This commit therefore ensures that
    rcu_torture_fqs() will exit its inner loops at the end of the test,
    and also applies the newish ULONG_CMP_LT() macro to time comparisons.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • When rcutorture is compiled directly into the kernel
    (instead of separately as a module), it is necessary to specify
    rcutorture.stat_interval as a kernel command-line parameter, otherwise,
    the rcu_torture_stats kthread is never started. However, when working
    with the system after it has booted, it is convenient to be able to
    change the time between statistic printing, particularly when logged
    into the console.

    This commit therefore allows the stat_interval parameter to be changed
    at runtime.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The rcu_torture_boost() cleanup code destroyed debug-objects state before
    waiting for the last RCU callback to be invoked, resulting in rare but
    very real debug-objects warnings. Move the destruction to after the
    waiting to fix this problem.

    Signed-off-by: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Now that the RCU API contains synchronize_rcu_bh(), synchronize_sched(),
    call_rcu_sched(), and rcu_bh_expedited()...

    Make rcutorture test synchronize_rcu_bh(), getting rid of the old
    rcu_bh_torture_synchronize() workaround. Similarly, make rcutorture test
    synchronize_sched(), getting rid of the old sched_torture_synchronize()
    workaround. Make rcutorture test call_rcu_sched() instead of wrappering
    synchronize_sched(). Also add testing of rcu_bh_expedited().

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Commit a26ac2455ffc (move TREE_RCU from softirq to kthread) added
    per-CPU kthreads. However, kthread creation uses kthread_create(), which
    can put the kthread's stack and task struct on the wrong NUMA node.
    Therefore, use kthread_create_on_node() instead of kthread_create()
    so that the stacks and task structs are placed on the correct NUMA node.

    A similar change was carried out in commit 94dcf29a11b3 (kthread:
    use kthread_create_on_node()).

    Also change rcutorture's priority-boost-test kthread creation.

    Signed-off-by: Eric Dumazet
    CC: Tejun Heo
    CC: Rusty Russell
    CC: Andrew Morton
    CC: Andi Kleen
    CC: Ingo Molnar
    Signed-off-by: Paul E. McKenney

    Eric Dumazet
     

27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

09 Jul, 2011

1 commit


06 May, 2011

4 commits