26 Jun, 2018

2 commits

  • This commit adds "#define pr_fmt(fmt) fmt" to the torture-test files
    in order to keep the current dmesg format. Once Joe's commits have
    hit mainline, these definitions will be changed in order to automatically
    generate the dmesg line prefix that the scripts expect. This will have
    the beneficial side-effect of allowing printk() formats to be used more
    widely and of shortening some pr_*() lines.

    Signed-off-by: Paul E. McKenney
    Cc: Joe Perches

    Paul E. McKenney
     
  • Some bugs reproduce quickly only at high CPU-hotplug rates, so the
    rcutorture TREE03 scenario now has only 200 milliseconds spacing between
    CPU-hotplug operations. At this rate, the torture-test pair of console
    messages per operation becomes a bit voluminous. This commit therefore
    converts the torture-test set of "verbose" kernel-boot arguments from
    bool to int, and prints the extra console messages only when verbose=2.
    The default is still verbose=1.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

16 May, 2018

1 commit

  • Commit e31d28b6ab8f ("trace: Eliminate cond_resched_rcu_qs() in favor
    of cond_resched()") substituted cond_resched() for the earlier call
    to cond_resched_rcu_qs(). However, the new-age cond_resched() does
    not do anything to help RCU-tasks grace periods because (1) RCU-tasks
    is only enabled when CONFIG_PREEMPT=y and (2) cond_resched() is a
    complete no-op when preemption is enabled. This situation results
    in hangs when running the trace benchmarks.

    A number of potential fixes were discussed on LKML
    (https://lkml.kernel.org/r/20180224151240.0d63a059@vmware.local.home),
    including making cond_resched() not be a no-op; making cond_resched()
    not be a no-op, but only when running tracing benchmarks; reverting
    the aforementioned commit (which works because cond_resched_rcu_qs()
    does provide an RCU-tasks quiescent state; and adding a call to the
    scheduler/RCU rcu_note_voluntary_context_switch() function. All were
    deemed unsatisfactory, either due to added cond_resched() overhead or
    due to magic functions inviting cargo culting.

    This commit renames cond_resched_rcu_qs() to cond_resched_tasks_rcu_qs(),
    which provides a clear hint as to what this function is doing and
    why and where it should be used, and then replaces the call to
    cond_resched() with cond_resched_tasks_rcu_qs() in the trace benchmark's
    benchmark_event_kthread() function.

    Reported-by: Steven Rostedt
    Signed-off-by: Paul E. McKenney
    Tested-by: Nicholas Piggin

    Paul E. McKenney
     

12 Dec, 2017

3 commits

  • Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The purpose of torture_runnable is to allow rcutorture and locktorture
    to be started and stopped via sysfs when they are built into the kernel
    (as in not compiled as loadable modules). However, the 0444 permissions
    for both instances of torture_runnable prevent this use case from ever
    being put into practice. Given that there have been no complaints
    about this deficiency, it is reasonable to conclude that no one actually
    makes use of this sysfs capability. The perf_runnable module parameter
    for rcuperf is in the same situation.

    This commit therefore removes both torture_runnable instances as well
    as perf_runnable.

    Reported-by: Thomas Gleixner
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The stutter_wait() function repeatedly fetched stutter_pause_test, and
    should really just fetch it once on each pass. The races should be
    harmless, but why have the races? Also, the whole point of the value
    "2" for stutter_pause_test is to get everyone to start at very nearly
    the same time, but the value "2" was the first jiffy of the stutter
    rather than the last jiffy of the stutter.

    This commit rearranges the code to be more sensible.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

29 Nov, 2017

1 commit


26 Jul, 2017

1 commit

  • The torture status line contains a series of values preceded by "onoff:".
    The last value in that line, the one preceding the "HZ=" string, is
    always zero. The reason that it is always zero is that torture_offline()
    was incrementing the sum_offl pointer instead of the value that this
    pointer referenced. This commit therefore makes this increment operate
    on the statistic rather than the pointer to the statistic.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

02 Mar, 2017

1 commit


28 Feb, 2017

1 commit

  • Fix typos and add the following to the scripts/spelling.txt:

    varible||variable

    While we are here, tidy up the comment blocks that fit in a single line
    for drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c and
    net/sctp/transport.c.

    Link: http://lkml.kernel.org/r/1481573103-11329-11-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

23 Aug, 2016

1 commit

  • Upcoming changes to the timer wheel introduce significant inaccuracy
    and possibly also an ultimate limit on timeout duration. This is a
    problem for the current implementation of torture_shutdown() because
    (1) shutdown times are user-specified, and can therefore be quite long,
    and (2) the torture scripting will kill a test instance that runs for
    more than a few minutes longer than scheduled. This commit therefore
    converts the torture_shutdown() timed waits to an hrtimer, thus avoiding
    too-short torture test runs as well as death by scripting.

    Signed-off-by: Paul E. McKenney
    Acked-by: Arnd Bergmann

    Paul E. McKenney
     

15 Jun, 2016

2 commits


22 Apr, 2016

1 commit

  • When running from the scripts, rcutorture is completely headless,
    so there is no way to to manually dump the trace buffer. This commit
    therefore unconditionally dumps the trace buffer upon timed shutdown.
    However, if you are using rmmod to end the test, it is still up to you
    to manually dump the trace buffer.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

01 Apr, 2016

1 commit


07 Oct, 2015

1 commit


28 May, 2015

1 commit


17 Sep, 2014

1 commit

  • When performing module cleanups by calling torture_cleanup() the
    'torture_type' string in nullified However, callers are not necessarily
    done, and might still need to reference the variable. This impacts
    both rcutorture and locktorture, causing printing things like:

    [ 94.226618] (null)-torture: Stopping lock_torture_writer task
    [ 94.226624] (null)-torture: Stopping lock_torture_stats task

    Thus delay this operation until the very end of the cleanup process.
    The consequence (which shouldn't matter for this kid of program) is,
    of course, that we delay the window between rmmod and modprobing,
    for instance in module_torture_begin().

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

    Davidlohr Bueso
     

08 Sep, 2014

1 commit

  • User pr_alert/pr_cont for printing the logs from rcutorture module directly
    instead of writing it to a buffer and then printing it. This allows us from not
    having to allocate such buffers. Also remove a resulting empty function.

    I tested this using the parse-torture.sh script as follows:

    $ dmesg | grep torture > log.txt
    $ bash parse-torture.sh log.txt test
    $

    There were no warnings which means that parsing went fine.

    Signed-off-by: Joe Perches
    Signed-off-by: Pranith Kumar
    Signed-off-by: Paul E. McKenney

    Joe Perches
     

08 Jul, 2014

1 commit

  • Since the torture-test thread creation interface does not include
    format string arguments, this commit makes sure the name can never be
    accidentally processed as a format string.

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

    Kees Cook
     

15 May, 2014

5 commits

  • Loading rcutorture as a module (as opposed to building it directly into
    the kernel) results in the following splat:

    [Wed Apr 16 15:29:33 2014] BUG: unable to handle kernel paging request at ffffffffa0003000
    [Wed Apr 16 15:29:33 2014] IP: [] 0xffffffffa0003000
    [Wed Apr 16 15:29:33 2014] PGD 1c0f067 PUD 1c10063 PMD 378a6067 PTE 0
    [Wed Apr 16 15:29:33 2014] Oops: 0010 [#1] SMP
    [Wed Apr 16 15:29:33 2014] Modules linked in: rcutorture(+) torture
    [Wed Apr 16 15:29:33 2014] CPU: 0 PID: 4257 Comm: modprobe Not tainted 3.15.0-rc1 #10
    [Wed Apr 16 15:29:33 2014] Hardware name: innotek GmbH VirtualBox, BIOS VirtualBox 12/01/2006
    [Wed Apr 16 15:29:33 2014] task: ffff8800db1e88d0 ti: ffff8800db25c000 task.ti: ffff8800db25c000
    [Wed Apr 16 15:29:33 2014] RIP: 0010:[] [] 0xffffffffa0003000
    [Wed Apr 16 15:29:33 2014] RSP: 0018:ffff8800db25dca0 EFLAGS: 00010282
    [Wed Apr 16 15:29:33 2014] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
    [Wed Apr 16 15:29:33 2014] RDX: ffffffffa00090a8 RSI: 0000000000000001 RDI: ffffffffa0008337
    [Wed Apr 16 15:29:33 2014] RBP: ffff8800db25dd50 R08: 0000000000000000 R09: 0000000000000000
    [Wed Apr 16 15:29:33 2014] R10: ffffea000357b680 R11: ffffffff8113257a R12: ffffffffa000d000
    [Wed Apr 16 15:29:33 2014] R13: ffffffffa00094c0 R14: ffffffffa0009510 R15: 0000000000000001
    [Wed Apr 16 15:29:33 2014] FS: 00007fee30ce5700(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
    [Wed Apr 16 15:29:33 2014] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    [Wed Apr 16 15:29:33 2014] CR2: ffffffffa0003000 CR3: 00000000d5eb1000 CR4: 00000000000006f0
    [Wed Apr 16 15:29:33 2014] Stack:
    [Wed Apr 16 15:29:33 2014] ffffffffa000d02c 0000000000000000 ffff88021700d400 0000000000000000
    [Wed Apr 16 15:29:33 2014] ffff8800db25dd40 ffffffff81647951 ffff8802162bd000 ffff88021541846c
    [Wed Apr 16 15:29:33 2014] 0000000000000000 ffffffff817dbe2d ffffffff817dbe2d 0000000000000001
    [Wed Apr 16 15:29:33 2014] Call Trace:
    [Wed Apr 16 15:29:33 2014] [] ? rcu_torture_init+0x2c/0x8b4 [rcutorture]
    [Wed Apr 16 15:29:33 2014] [] ? netlink_broadcast_filtered+0x121/0x3a0
    [Wed Apr 16 15:29:33 2014] [] ? mutex_lock+0xd/0x2a
    [Wed Apr 16 15:29:33 2014] [] ? mutex_lock+0xd/0x2a
    [Wed Apr 16 15:29:33 2014] [] ? trace_module_notify+0x62/0x1d0
    [Wed Apr 16 15:29:33 2014] [] ? 0xffffffffa000cfff
    [Wed Apr 16 15:29:33 2014] [] do_one_initcall+0xfa/0x140
    [Wed Apr 16 15:29:33 2014] [] ? __blocking_notifier_call_chain+0x5e/0x80
    [Wed Apr 16 15:29:33 2014] [] load_module+0x1931/0x21b0
    [Wed Apr 16 15:29:33 2014] [] ? show_initstate+0x50/0x50
    [Wed Apr 16 15:29:33 2014] [] SyS_init_module+0x9e/0xc0
    [Wed Apr 16 15:29:33 2014] [] system_call_fastpath+0x16/0x1b
    [Wed Apr 16 15:29:33 2014] Code: Bad RIP value.
    [Wed Apr 16 15:29:33 2014] RIP [] 0xffffffffa0003000
    [Wed Apr 16 15:29:33 2014] RSP
    [Wed Apr 16 15:29:33 2014] CR2: ffffffffa0003000
    [Wed Apr 16 15:29:33 2014] ---[ end trace 3e88c173037af84b ]---

    This splat is due to the fact that torture_init_begin() and
    torture_init_end() are both marked with __init, despite their use
    at runtime. This commit therefore removes __init from both functions.

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

    Pranith Kumar
     
  • The torture tests are designed to run in isolation, but do not enforce
    this isolation. This commit therefore checks for concurrent torture
    tests, and refuses to start new tests while old tests are running.

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

    Paul E. McKenney
     
  • In torture_shuffle_tasks function, the check if an all-zero mask can
    be passed to set_cpus_allowed_ptr() is redundant after clearing the
    shuffle_idle_cpu bit. If the mask had more than one bit set, after
    clearing a bit it has at least one bit set. If the mask had only
    one bit set, a check is made at the beginning, where the function
    returns, as there is no need to shuffle only one cpu.

    Also, this code is executed inside a critical section, delimited by
    get_online_cpus(), and put_online_cpus(), preventing CPUs from leaving between
    the check of num_online_cpus and the calls to set_cpus_allowed_ptr() function.

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

    Iulia Manda
     
  • Currently, all stuttered kthreads block a jiffy at a time, which can
    result in them starting at different times. (Note: This is not an
    energy-efficiency problem unless you run torture tests in production,
    in which case you have other problems!) This commit increases the
    intensity of the restart event by causing kthreads to spin through the
    last jiffy, restarting when they see the variable change.

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

    Paul E. McKenney
     
  • Currently, torture_kthread_stopping() prints only the name of the
    kthread that is stopping, which can be unedifying. This commit therefore
    adds "Stopping" to make things more evident.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

24 Feb, 2014

15 commits

  • Although most torture tests will have some cleanup hook, it is possible
    that one might not. This commit therefore enables graceful handling of
    a NULL cleanup hook during torture-test shutdown.

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

    Paul E. McKenney
     
  • The specific torture modules (like rcutorture) need to call
    torture_cleanup() in any case, so this commit makes torture_cleanup()
    deal with torture_shutdown_cleanup() and torture_stutter_cleanup() so
    that the specific modules don't have to deal with these details.

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

    Paul E. McKenney
     
  • Stopping of kthreads is not RCU-specific, so this commit abstracts
    out torture_stop_kthread(), saving a few lines of code in the process.

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

    Paul E. McKenney
     
  • Creation of kthreads is not RCU-specific, so this commit abstracts
    out torture_create_kthread(), saving a few tens of lines of code in
    the process.

    This change requires modifying VERBOSE_TOROUT_ERRSTRING() to take a
    non-const string, so that _torture_create_kthread() can avoid an
    open-coded substitute.

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

    Paul E. McKenney
     
  • Not all of the rcutorture kthreads waited for kthread_should_stop()
    before returning from their top-level functions, and none of them
    used torture_shutdown_absorb() properly. These problems can result in
    segfaults and hangs at shutdown time, and some recent changes perturbed
    timing sufficiently to make them much more probable. This commit
    therefore creates a torture_kthread_stopping() function that does the
    proper kthread shutdown dance in one centralized location.

    Accommodate this grouping by making VERBOSE_TOROUT_STRING() capable of
    taking a non-const string as its argument, which allows the new
    torture_kthread_stopping() to pass its "title" argument directly to
    the updated version of VERBOSE_TOROUT_STRING().

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • A few "stealth-start rcutorture kthreads" have accumulated over the years,
    so this commit adds console-log announcements (but only if the torture
    tests are running verbose).

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

    Paul E. McKenney
     
  • Because auto-shutdown of torture testing is not specific to RCU,
    this commit moves the auto-shutdown function to kernel/torture.c.

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

    Paul E. McKenney
     
  • Because the fullstop variable can be accessed while it is being updated,
    this commit avoids any resulting compiler mischief through use of
    ACCESS_ONCE() for non-initialization accesses to this shared variable.

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

    Paul E. McKenney
     
  • Because stuttering the test load (stopping and restarting it) is useful
    for non-RCU testing, this commit moves the load-stuttering functionality
    to kernel/torture.c.

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

    Paul E. McKenney
     
  • Currently, rcutorture can terminate via rmmod, via self-shutdown,
    via something else shutting the system down, or of course the usual
    catastrophic termination. The first two get flagged, so this commit adds
    a message for the third. For the fourth, your warranty is void as always.

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

    Paul E. McKenney
     
  • This commit introduces the torture_must_stop() function in order to
    keep use of the fullstop variable local to kernel/torture.c. There
    is also a torture_must_stop_irq() counterpart for use from RCU callbacks,
    timeout handlers, and the like.

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

    Paul E. McKenney
     
  • Because handling the race between rmmod and system shutdown is not
    specific to RCU, this commit abstracts torture_shutdown_notify(),
    placing this code into kernel/torture.c. This change also allows
    fullstop_mutex to be private to kernel/torture.c.

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

    Paul E. McKenney
     
  • This commit creates a torture_cleanup() that handles the generic
    cleanup actions local to kernel/torture.c.

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

    Paul E. McKenney
     
  • This commit creates torture_init_begin() and torture_init_end() functions
    to abstract locking and allow the torture_type and verbose variables
    in kernel/torture.o to become static. With a bit more abstraction,
    fullstop_mutex will also become static.

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

    Paul E. McKenney
     
  • Because online/offline torturing is not specific to RCU, this commit
    abstracts it into the kernel/torture.c module to allow other torture
    tests to use it.

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

    Paul E. McKenney