30 Jun, 2020

2 commits

  • The following changes are introduced:

    1. Rename rcu_invoke_kfree_callback() to rcu_invoke_kvfree_callback(),
    as well as the associated trace events, so the rcu_kfree_callback(),
    becomes rcu_kvfree_callback(). The reason is to be aligned with kvfree()
    notation.

    2. Rename __is_kfree_rcu_offset to __is_kvfree_rcu_offset. All RCU
    paths use kvfree() now instead of kfree(), thus rename it.

    3. Rename kfree_call_rcu() to the kvfree_call_rcu(). The reason is,
    it is capable of freeing vmalloc() memory now. Do the same with
    __kfree_rcu() macro, it becomes __kvfree_rcu(), the goal is the
    same.

    Reviewed-by: Joel Fernandes (Google)
    Co-developed-by: Joel Fernandes (Google)
    Signed-off-by: Joel Fernandes (Google)
    Signed-off-by: Uladzislau Rezki (Sony)
    Signed-off-by: Paul E. McKenney

    Uladzislau Rezki (Sony)
     
  • Replace kfree() with kvfree() in rcu_reclaim_tiny().
    This makes it possible to release either SLAB or vmalloc
    objects after a GP.

    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Uladzislau Rezki (Sony)
    Signed-off-by: Paul E. McKenney

    Uladzislau Rezki (Sony)
     

25 Jan, 2020

1 commit

  • This commit removes kfree_rcu() special-casing and the lazy-callback
    handling from Tree RCU. It moves some of this special casing to Tiny RCU,
    the removal of which will be the subject of later commits.

    This results in a nice negative delta.

    Suggested-by: Paul E. McKenney
    Signed-off-by: Joel Fernandes (Google)
    [ paulmck: Add slab.h #include, thanks to kbuild test robot . ]
    Signed-off-by: Paul E. McKenney

    Joel Fernandes (Google)
     

27 Mar, 2019

1 commit


10 Feb, 2019

2 commits


26 Jan, 2019

1 commit

  • The name rcu_check_callbacks() arguably made sense back in the early
    2000s when RCU was quite a bit simpler than it is today, but it has
    become quite misleading, especially with the advent of dyntick-idle
    and NO_HZ_FULL. The rcu_check_callbacks() function is RCU's hook into
    the scheduling-clock interrupt, and is now but one of many ways that
    callbacks get promoted to invocable state.

    This commit therefore changes the name to rcu_sched_clock_irq(),
    which is the same number of characters and clearly indicates this
    function's relation to the rest of the Linux kernel. In addition, for
    the sake of consistency, rcu_flavor_check_callbacks() is also renamed
    to rcu_flavor_sched_clock_irq().

    While in the area, the header comments for both functions are reworked.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

31 Aug, 2018

6 commits

  • … 'torture.2018.08.29a' into HEAD

    doc.2018.08.30a: Documentation updates
    dynticks.2018.08.30b: RCU flavor consolidation updates and cleanups
    srcu.2018.08.30b: SRCU updates
    torture.2018.08.29a: Torture-test updates

    Paul E. McKenney
     
  • Event tracing is moving to SRCU in order to take advantage of the fact
    that SRCU may be safely used from idle and even offline CPUs. However,
    event tracing can invoke call_srcu() very early in the boot process,
    even before workqueue_init_early() is invoked (let alone rcu_init()).
    Therefore, call_srcu()'s attempts to queue work fail miserably.

    This commit therefore detects this situation, and refrains from attempting
    to queue work before rcu_init() time, but does everything else that it
    would have done, and in addition, adds the srcu_struct to a global list.
    The rcu_init() function now invokes a new srcu_init() function, which
    is empty if CONFIG_SRCU=n. Otherwise, srcu_init() queues work for
    each srcu_struct on the list. This all happens early enough in boot
    that there is but a single CPU with interrupts disabled, which allows
    synchronization to be dispensed with.

    Of course, the queued work won't actually be invoked until after
    workqueue_init() is invoked, which happens shortly after the scheduler
    is up and running. This means that although call_srcu() may be invoked
    any time after per-CPU variables have been set up, there is still a very
    narrow window when synchronize_srcu() won't work, and this window
    extends from the time that the scheduler starts until the time that
    workqueue_init() returns. This can be fixed in a manner similar to
    the fix for synchronize_rcu_expedited() and friends, but until someone
    actually needs to use synchronize_srcu() during this window, this fix
    is added churn for no benefit.

    Finally, note that Tree SRCU's new srcu_init() function invokes
    queue_work() rather than the queue_delayed_work() function that is
    invoked post-boot. The reason is that queue_delayed_work() will (as you
    would expect) post a timer, and timers have not yet been initialized.
    So use of queue_work() avoids the complaints about use of uninitialized
    spinlocks that would otherwise result. Besides, some delay is already
    provide by the aforementioned fact that the queued work won't actually
    be invoked until after the scheduler is up and running.

    Requested-by: Steven Rostedt
    Signed-off-by: Paul E. McKenney
    Tested-by: Steven Rostedt (VMware)

    Paul E. McKenney
     
  • If a long-running CPU-bound in-kernel task invokes call_rcu(), the
    callback won't be invoked until the next context switch. If there are
    no other runnable tasks (which is not an uncommon situation on deep
    embedded systems), the callback might never be invoked.

    This commit therefore causes rcu_check_callbacks() to ask the scheduler
    for a context switch if there are callbacks posted that are still waiting
    for a grace period.

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

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

    Paul E. McKenney
     
  • This commit renames Tiny RCU functions so that the lowest level of
    functionality is RCU (e.g., synchronize_rcu()) rather than RCU-sched
    (e.g., synchronize_sched()). This provides greater naming compatibility
    with Tree RCU, which will in turn permit more LoC removal once
    the RCU-sched and RCU-bh update-side API is removed.

    Signed-off-by: Paul E. McKenney
    [ paulmck: Fix Tiny call_rcu()'s EXPORT_SYMBOL() in response to a bug
    report from kbuild test robot. ]

    Paul E. McKenney
     
  • Now that the main RCU API knows about softirq disabling and softirq's
    quiescent states, the RCU-bh update code can be dispensed with.
    This commit therefore removes the RCU-bh update-side implementation and
    defines RCU-bh's update-side API in terms of that of either RCU-preempt or
    RCU-sched, depending on the setting of the CONFIG_PREEMPT Kconfig option.

    In kernels built with CONFIG_RCU_NOCB_CPU=y this has the knock-on effect
    of reducing by one the number of rcuo kthreads per CPU.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     

13 Jul, 2018

1 commit

  • We expect a quiescent state of TASKS_RCU when cond_resched_tasks_rcu_qs()
    is called, no matter whether it actually be scheduled or not. However,
    it currently doesn't report the quiescent state when the task enters
    into __schedule() as it's called with preempt = true. So make it report
    the quiescent state unconditionally when cond_resched_tasks_rcu_qs() is
    called.

    And in TINY_RCU, even though the quiescent state of rcu_bh also should
    be reported when the tick interrupt comes from user, it doesn't. So make
    it reported.

    Lastly in TREE_RCU, rcu_note_voluntary_context_switch() should be
    reported when the tick interrupt comes from not only user but also idle,
    as an extended quiescent state.

    Signed-off-by: Byungchul Park
    Signed-off-by: Paul E. McKenney
    [ paulmck: Simplify rcutiny portion given no RCU-tasks for !PREEMPT. ]

    Byungchul Park
     

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

1 commit

  • 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