25 Jul, 2017

1 commit

  • Other than lockdep support, Tiny RCU has no need for the
    scheduler status. However, Tiny SRCU will need this to control
    boot-time behavior independent of lockdep. Therefore, this commit
    moves rcu_scheduler_starting() from kernel/rcu/tiny_plugin.h to
    kernel/rcu/srcutiny.c. This in turn allows the complete removal of
    kernel/rcu/tiny_plugin.h.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

09 Jun, 2017

3 commits


19 Apr, 2017

1 commit

  • The current use of "RCU_TRACE(statement);" can cause odd bugs, especially
    where "statement" is a local-variable declaration, as it can leave a
    misplaced ";" in the source code. This commit therefore converts these
    to "RCU_TRACE(statement;)", which avoids the misplaced ";".

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

    Paul E. McKenney
     

02 Mar, 2017

1 commit

  • So rcupdate.h is a pretty complex header, in particular it includes
    which includes - creating a
    dependency that includes in ,
    which prevents the isolation of from the derived
    header.

    Solve part of the problem by decoupling rcupdate.h from completions:
    this can be done by separating out the rcu_synchronize types and APIs,
    and updating their usage sites.

    Since this is a mostly RCU-internal types this will not just simplify
    's dependencies, but will make all the hundreds of
    .c files that include rcupdate.h but not completions or wait.h build
    faster.

    ( For rcutiny this means that two dependent APIs have to be uninlined,
    but that shouldn't be much of a problem as they are rare variants. )

    Acked-by: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

24 Jan, 2017

1 commit


15 Jan, 2017

1 commit

  • It is now legal to invoke synchronize_sched() at early boot, which causes
    Tiny RCU's synchronize_sched() to emit spurious splats. This commit
    therefore removes the cond_resched() from Tiny RCU's synchronize_sched().

    Fixes: 8b355e3bc140 ("rcu: Drive expedited grace periods from workqueue")
    Signed-off-by: Paul E. McKenney
    Cc: # 4.9.0-

    Paul E. McKenney
     

11 Oct, 2016

1 commit

  • The __latent_entropy gcc attribute can be used only on functions and
    variables. If it is on a function then the plugin will instrument it for
    gathering control-flow entropy. If the attribute is on a variable then
    the plugin will initialize it with random contents. The variable must
    be an integer, an integer array type or a structure with integer fields.

    These specific functions have been selected because they are init
    functions (to help gather boot-time entropy), are called at unpredictable
    times, or they have variable loops, each of which provide some level of
    latent entropy.

    Signed-off-by: Emese Revfy
    [kees: expanded commit message]
    Signed-off-by: Kees Cook

    Emese Revfy
     

07 Oct, 2015

1 commit

  • As we now have rcu_callback_t typedefs as the type of rcu callbacks, we
    should use it in call_rcu*() and friends as the type of parameters. This
    could save us a few lines of code and make it clear which function
    requires an rcu callbacks rather than other callbacks as its argument.

    Besides, this can also help cscope to generate a better database for
    code reading.

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

    Boqun Feng
     

23 Jul, 2015

1 commit


27 Jun, 2015

1 commit

  • Pull tracing updates from Steven Rostedt:
    "This patch series contains several clean ups and even a new trace
    clock "monitonic raw". Also some enhancements to make the ring buffer
    even faster. But the biggest and most noticeable change is the
    renaming of the ftrace* files, structures and variables that have to
    deal with trace events.

    Over the years I've had several developers tell me about their
    confusion with what ftrace is compared to events. Technically,
    "ftrace" is the infrastructure to do the function hooks, which include
    tracing and also helps with live kernel patching. But the trace
    events are a separate entity altogether, and the files that affect the
    trace events should not be named "ftrace". These include:

    include/trace/ftrace.h -> include/trace/trace_events.h
    include/linux/ftrace_event.h -> include/linux/trace_events.h

    Also, functions that are specific for trace events have also been renamed:

    ftrace_print_*() -> trace_print_*()
    (un)register_ftrace_event() -> (un)register_trace_event()
    ftrace_event_name() -> trace_event_name()
    ftrace_trigger_soft_disabled() -> trace_trigger_soft_disabled()
    ftrace_define_fields_##call() -> trace_define_fields_##call()
    ftrace_get_offsets_##call() -> trace_get_offsets_##call()

    Structures have been renamed:

    ftrace_event_file -> trace_event_file
    ftrace_event_{call,class} -> trace_event_{call,class}
    ftrace_event_buffer -> trace_event_buffer
    ftrace_subsystem_dir -> trace_subsystem_dir
    ftrace_event_raw_##call -> trace_event_raw_##call
    ftrace_event_data_offset_##call-> trace_event_data_offset_##call
    ftrace_event_type_funcs_##call -> trace_event_type_funcs_##call

    And a few various variables and flags have also been updated.

    This has been sitting in linux-next for some time, and I have not
    heard a single complaint about this rename breaking anything. Mostly
    because these functions, variables and structures are mostly internal
    to the tracing system and are seldom (if ever) used by anything
    external to that"

    * tag 'trace-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (33 commits)
    ring_buffer: Allow to exit the ring buffer benchmark immediately
    ring-buffer-benchmark: Fix the wrong type
    ring-buffer-benchmark: Fix the wrong param in module_param
    ring-buffer: Add enum names for the context levels
    ring-buffer: Remove useless unused tracing_off_permanent()
    ring-buffer: Give NMIs a chance to lock the reader_lock
    ring-buffer: Add trace_recursive checks to ring_buffer_write()
    ring-buffer: Allways do the trace_recursive checks
    ring-buffer: Move recursive check to per_cpu descriptor
    ring-buffer: Add unlikelys to make fast path the default
    tracing: Rename ftrace_get_offsets_##call() to trace_event_get_offsets_##call()
    tracing: Rename ftrace_define_fields_##call() to trace_event_define_fields_##call()
    tracing: Rename ftrace_event_type_funcs_##call to trace_event_type_funcs_##call
    tracing: Rename ftrace_data_offset_##call to trace_event_data_offset_##call
    tracing: Rename ftrace_raw_##call event structures to trace_event_raw_##call
    tracing: Rename ftrace_trigger_soft_disabled() to trace_trigger_soft_disabled()
    tracing: Rename FTRACE_EVENT_FL_* flags to EVENT_FILE_FL_*
    tracing: Rename struct ftrace_subsystem_dir to trace_subsystem_dir
    tracing: Rename ftrace_event_name() to trace_event_name()
    tracing: Rename FTRACE_MAX_EVENT to TRACE_EVENT_TYPE_MAX
    ...

    Linus Torvalds
     

28 May, 2015

2 commits

  • If, at the time __rcu_process_callbacks() is invoked, there are callbacks
    in Tiny RCU's callback list, but none of them are ready to be invoked,
    the current list-management code will knit the non-ready callbacks out
    of the list. This can result in hangs and possibly worse. This commit
    therefore inserts a check for there being no callbacks that can be
    invoked immediately.

    This bug is unlikely to occur -- you have to get a new callback between
    the time rcu_sched_qs() or rcu_bh_qs() was called, but before we get to
    __rcu_process_callbacks(). It was detected by the addition of RCU-bh
    testing to rcutorture, which in turn was instigated by Iftekhar Ahmed's
    mutation testing. Although this bug was made much more likely by
    915e8a4fe45e (rcu: Remove fastpath from __rcu_process_callbacks()), this
    did not cause the bug, but rather made it much more probable. That
    said, it takes more than 40 hours of rcutorture testing, on average,
    for this bug to appear, so this fix cannot be considered an emergency.

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

    Paul E. McKenney
     
  • The Tiny RCU counterparts to rcu_idle_enter(), rcu_idle_exit(),
    rcu_irq_enter(), and rcu_irq_exit() are empty functions, but each has
    EXPORT_SYMBOL_GPL(), which needlessly consumes extra memory, especially
    in kernels built with module support. This commit therefore moves these
    functions to static inlines in rcutiny.h, removing the need for exports.

    This won't affect the size of the tiniest kernels, which are likely
    built without module support, but might help semi-tiny kernels that
    might include module support.

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

    Paul E. McKenney
     

14 May, 2015

1 commit


27 Feb, 2015

2 commits


16 Jan, 2015

2 commits


07 Jan, 2015

1 commit

  • For RCU in UP, context-switch = QS = GP, thus we can force a
    context-switch when any call_rcu_[bh|sched]() is happened on idle_task.
    After doing so, rcu_idle/irq_enter/exit() are useless, so we can simply
    make these functions empty.

    More important, this change does not change the functionality logically.
    Note: raise_softirq(RCU_SOFTIRQ)/rcu_sched_qs() in rcu_idle_enter() and
    outmost rcu_irq_exit() will have to wake up the ksoftirqd
    (due to in_interrupt() == 0).

    Before this patch After this patch:
    call_rcu_sched() in idle; call_rcu_sched() in idle
    set resched
    do other stuffs; do other stuffs
    outmost rcu_irq_exit() outmost rcu_irq_exit() (empty function)
    (or rcu_idle_enter()) (or rcu_idle_enter(), also empty function)
    start to resched. (see above)
    rcu_sched_qs() rcu_sched_qs()
    QS,and GP and advance cb QS,and GP and advance cb
    wake up the ksoftirqd wake up the ksoftirqd
    set resched
    resched to ksoftirqd (or other) resched to ksoftirqd (or other)

    These two code patches are almost the same.

    Size changed after patched:

    size kernel/rcu/tiny-old.o kernel/rcu/tiny-patched.o
    text data bss dec hex filename
    3449 206 8 3663 e4f kernel/rcu/tiny-old.o
    2406 144 8 2558 9fe kernel/rcu/tiny-patched.o

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

    Lai Jiangshan
     

31 Dec, 2014

1 commit

  • Let's start assuming that something in the idle loop posts a callback,
    and scheduling-clock interrupt occurs:

    1. The system is idle and stays that way, no runnable tasks.

    2. Scheduling-clock interrupt occurs, rcu_check_callbacks() is called
    as result, which in turn calls rcu_is_cpu_rrupt_from_idle().

    3. rcu_is_cpu_rrupt_from_idle() reports the CPU was interrupted from
    idle, which results in rcu_sched_qs() call, which does a
    raise_softirq(RCU_SOFTIRQ).

    4. Upon return from interrupt, rcu_irq_exit() is invoked, which calls
    rcu_idle_enter_common(), which in turn calls rcu_sched_qs() again,
    which does another raise_softirq(RCU_SOFTIRQ).

    5. The softirq happens shortly and invokes rcu_process_callbacks(),
    which invokes __rcu_process_callbacks().

    6. So now callbacks can be invoked. At least they can be if
    ->donetail has been updated. Which it will have been because
    rcu_sched_qs() invokes rcu_qsctr_help().

    In the described scenario rcu_sched_qs() and raise_softirq(RCU_SOFTIRQ)
    get called twice in steps 3 and 4. This redundancy could be eliminated
    by removing rcu_is_cpu_rrupt_from_idle() function.

    Signed-off-by: Alexander Gordeev
    Cc: Paul E. McKenney
    Signed-off-by: Paul E. McKenney

    Alexander Gordeev
     

14 Nov, 2014

1 commit


04 Nov, 2014

2 commits

  • Add early boot self tests for RCU under CONFIG_PROVE_RCU.

    Currently the only test is adding a dummy callback which increments a counter
    which we then later verify after calling rcu_barrier*().

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

    Pranith Kumar
     
  • The "cpu" argument was kept around on the off-chance that RCU might
    offload scheduler-clock interrupts. However, this offload approach
    has been replaced by NO_HZ_FULL, which offloads -all- RCU processing
    from qualifying CPUs. It is therefore time to remove the "cpu" argument
    to rcu_check_callbacks(), which this commit does.

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

    Paul E. McKenney
     

17 Sep, 2014

1 commit


08 Sep, 2014

4 commits

  • The rcu_bh_qs(), rcu_preempt_qs(), and rcu_sched_qs() functions use
    old-style per-CPU variable access and write to ->passed_quiesce even
    if it is already set. This commit therefore updates to use the new-style
    per-CPU variable access functions and avoids the spurious writes.
    This commit also eliminates the "cpu" argument to these functions because
    they are always invoked on the indicated CPU.

    Reported-by: Peter Zijlstra
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • This commit adds a new RCU-tasks flavor of RCU, which provides
    call_rcu_tasks(). This RCU flavor's quiescent states are voluntary
    context switch (not preemption!) and userspace execution (not the idle
    loop -- use some sort of schedule_on_each_cpu() if you need to handle the
    idle tasks. Note that unlike other RCU flavors, these quiescent states
    occur in tasks, not necessarily CPUs. Includes fixes from Steven Rostedt.

    This RCU flavor is assumed to have very infrequent latency-tolerant
    updaters. This assumption permits significant simplifications, including
    a single global callback list protected by a single global lock, along
    with a single task-private linked list containing all tasks that have not
    yet passed through a quiescent state. If experience shows this assumption
    to be incorrect, the required additional complexity will be added.

    Suggested-by: Steven Rostedt
    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The rcu_idle_enter_common() and rcu_idle_exit_common() functions contain
    error checks that have to the best of my knowledge have never triggered
    over the past several years. These are nevertheless valuable when
    creating new architectures or doing other low-level changes, so the
    checks should not be deleted. This commit instead places these checks
    under #ifdef CONFIG_RCU_TRACE so that they are executed only when
    specifically requested.

    The savings are significant:

    Before:

    text data bss dec hex filename
    1749 39 0 1788 6fc /tmp/b/kernel/rcu/tiny.o
    632 152 0 784 310 /tmp/b/kernel/rcu/update.o
    ----
    2572

    After:

    text data bss dec hex filename
    1281 37 0 1318 526 /tmp/b/kernel/rcu/tiny.o
    632 152 0 784 310 /tmp/b/kernel/rcu/update.o
    ----
    2102

    This amounts to 470 bytes, or 18% of the original.

    Switched from #ifdef to IS_ENABLED() on Josh Triplett's advice.

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

    Paul E. McKenney
     
  • This commit updates the references to rcutree.c which is now rcu/tree.c

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

    Pranith Kumar
     

26 Feb, 2014

1 commit

  • The kbuild test bot uncovered an implicit dependence on the
    trace header being present before rcu.h in ia64 allmodconfig
    that looks like this:

    In file included from kernel/ksysfs.c:22:0:
    kernel/rcu/rcu.h: In function '__rcu_reclaim':
    kernel/rcu/rcu.h:107:3: error: implicit declaration of function 'trace_rcu_invoke_kfree_callback' [-Werror=implicit-function-declaration]
    kernel/rcu/rcu.h:112:3: error: implicit declaration of function 'trace_rcu_invoke_callback' [-Werror=implicit-function-declaration]
    cc1: some warnings being treated as errors

    Looking at other rcu.h users, we can find that they all
    were sourcing the trace header in advance of rcu.h itself,
    as seen in the context of this diff. There were also some
    inconsistencies as to whether it was or wasn't sourced based
    on the parent tracing Kconfig.

    Rather than "fix" it at each use site, and have inconsistent
    use based on whether "#ifdef CONFIG_RCU_TRACE" was used or not,
    lets just source the trace header just once, in the actual consumer
    of it, which is rcu.h itself. We include it unconditionally, as
    build testing shows us that is a hard requirement for some files.

    Reported-by: kbuild test robot
    Signed-off-by: Paul Gortmaker
    Signed-off-by: Paul E. McKenney

    Paul Gortmaker
     

18 Feb, 2014

1 commit

  • All of the RCU source files have the usual GPL header, which contains a
    long-obsolete postal address for FSF. To avoid the need to track the
    FSF office's movements, this commit substitutes the URL where GPL may
    be found.

    Reported-by: Greg KH
    Reported-by: Steven Rostedt
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett

    Paul E. McKenney
     

17 Nov, 2013

1 commit

  • Pull tracing update from Steven Rostedt:
    "This batch of changes is mostly clean ups and small bug fixes. The
    only real feature that was added this release is from Namhyung Kim,
    who introduced "set_graph_notrace" filter that lets you run the
    function graph tracer and not trace particular functions and their
    call chain.

    Tom Zanussi added some updates to the ftrace multibuffer tracing that
    made it more consistent with the top level tracing.

    One of the fixes for perf function tracing required an API change in
    RCU; the addition of "rcu_is_watching()". As Paul McKenney is pushing
    that change in this release too, he gave me a branch that included all
    the changes to get that working, and I pulled that into my tree in
    order to complete the perf function tracing fix"

    * tag 'trace-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    tracing: Add rcu annotation for syscall trace descriptors
    tracing: Do not use signed enums with unsigned long long in fgragh output
    tracing: Remove unused function ftrace_off_permanent()
    tracing: Do not assign filp->private_data to freed memory
    tracing: Add helper function tracing_is_disabled()
    tracing: Open tracer when ftrace_dump_on_oops is used
    tracing: Add support for SOFT_DISABLE to syscall events
    tracing: Make register/unregister_ftrace_command __init
    tracing: Update event filters for multibuffer
    recordmcount.pl: Add support for __fentry__
    ftrace: Have control op function callback only trace when RCU is watching
    rcu: Do not trace rcu_is_watching() functions
    ftrace/x86: skip over the breakpoint for ftrace caller
    trace/trace_stat: use rbtree postorder iteration helper instead of opencoding
    ftrace: Add set_graph_notrace filter
    ftrace: Narrow down the protected area of graph_lock
    ftrace: Introduce struct ftrace_graph_data
    ftrace: Get rid of ftrace_graph_filter_enabled
    tracing: Fix potential out-of-bounds in trace_get_user()
    tracing: Show more exact help information about snapshot

    Linus Torvalds
     

16 Oct, 2013

1 commit