14 Nov, 2014

2 commits


04 Nov, 2014

11 commits

  • Commit 38706bc5a29a (rcutorture: Add callback-flood test) vmalloc()ed
    a bunch of RCU callbacks, but failed to free them. This commit fixes
    that oversight.

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

    Paul E. McKenney
     
  • 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 to rcu_cleanup_after_idle() is always the current
    CPU, so drop it. This moves the smp_processor_id() from the caller to
    rcu_cleanup_after_idle(), saving argument-passing overhead. Again,
    the anticipated cross-CPU uses of these functions has been replaced
    by NO_HZ_FULL.

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

    Paul E. McKenney
     
  • The "cpu" argument to rcu_prepare_for_idle() is always the current
    CPU, so drop it. This in turn allows two of the uses of "cpu" in
    this function to be replaced with a this_cpu_ptr() and the third by
    smp_processor_id(), replacing that of the call to rcu_prepare_for_idle().
    Again, the anticipated cross-CPU uses of these functions has been replaced
    by NO_HZ_FULL.

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

    Paul E. McKenney
     
  • The "cpu" argument to rcu_needs_cpu() is always the current CPU, so drop
    it. This in turn allows the "cpu" argument to rcu_cpu_has_callbacks()
    to be removed, which allows the uses of "cpu" in both functions to be
    replaced with a this_cpu_ptr(). Again, the anticipated cross-CPU uses
    of these functions has been replaced by NO_HZ_FULL.

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

    Paul E. McKenney
     
  • The "cpu" argument to rcu_note_context_switch() is always the current
    CPU, so drop it. This in turn allows the "cpu" argument to
    rcu_preempt_note_context_switch() to be removed, which allows the sole
    use of "cpu" in both functions to be replaced with a this_cpu_ptr().
    Again, the anticipated cross-CPU uses of these functions has been
    replaced by NO_HZ_FULL.

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

    Paul E. McKenney
     
  • Because rcu_preempt_check_callbacks()'s argument is guaranteed to
    always be the current CPU, drop the argument and replace per_cpu()
    with __this_cpu_read().

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

    Paul E. McKenney
     
  • Because rcu_pending()'s argument is guaranteed to always be the current
    CPU, drop the argument and replace per_cpu_ptr() with this_cpu_ptr().

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

    Paul E. McKenney
     
  • 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
     
  • The rcu_data per-CPU variable has a number of fields that are atomically
    manipulated, potentially by any CPU. This situation can result in false
    sharing with per-CPU variables that have the misfortune of being allocated
    adjacent to rcu_data in memory. This commit therefore changes the
    DEFINE_PER_CPU() to DEFINE_PER_CPU_SHARED_ALIGNED() in order to avoid
    this false sharing.

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

    Paul E. McKenney
     
  • For some functions in kernel/rcu/tree* the rdtp parameter is always
    this_cpu_ptr(rdtp). Remove the parameter if constant and calculate the
    pointer in function.

    This will have the advantage that it is obvious that the address are
    all per cpu offsets and thus it will enable the use of this_cpu_ops in
    the future.

    Signed-off-by: Christoph Lameter
    [ paulmck: Forward-ported to rcu/dev, whitespace adjustment. ]
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Pranith Kumar

    Christoph Lameter
     

30 Oct, 2014

4 commits

  • Commit 35ce7f29a44a (rcu: Create rcuo kthreads only for onlined CPUs)
    contains checks for the case where CPUs are brought online out of
    order, re-wiring the rcuo leader-follower relationships as needed.
    Unfortunately, this rewiring was broken. This apparently went undetected
    due to the tendency of systems to bring CPUs online in order. This commit
    nevertheless fixes the rewiring.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • If a no-CBs CPU were to post an RCU callback with interrupts disabled
    after it entered the idle loop for the last time, there might be no
    deferred wakeup for the corresponding rcuo kthreads. This commit
    therefore adds a set of calls to do_nocb_deferred_wakeup() after the
    CPU has gone completely offline.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • PREEMPT_RCU and TREE_PREEMPT_RCU serve the same function after
    TINY_PREEMPT_RCU has been removed. This patch removes TREE_PREEMPT_RCU
    and uses PREEMPT_RCU config option in its place.

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

    Pranith Kumar
     
  • Rename CONFIG_RCU_BOOST_PRIO to CONFIG_RCU_KTHREAD_PRIO and use this
    value for both the per-CPU kthreads (rcuc/N) and the rcu boosting
    threads (rcub/n).

    Also, create the module_parameter rcutree.kthread_prio to be used on
    the kernel command line at boot to set a new value (rcutree.kthread_prio=N).

    Signed-off-by: Clark Williams
    [ paulmck: Ported to rcu/dev, applied Paul Bolle and Peter Zijlstra feedback. ]
    Signed-off-by: Paul E. McKenney

    Clark Williams
     

29 Oct, 2014

4 commits

  • Currently, synchronize_sched_expedited() sends IPIs to all online CPUs,
    even those that are idle or executing in nohz_full= userspace. Because
    idle CPUs and nohz_full= userspace CPUs are in extended quiescent states,
    there is no need to IPI them in the first place. This commit therefore
    avoids IPIing CPUs that are already in extended quiescent states.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • There are some RCU_BOOST-specific per-CPU variable declarations that
    are needlessly defined under #ifdef in kernel/rcu/tree.c. This commit
    therefore moves these declarations into a pre-existing #ifdef in
    kernel/rcu/tree_plugin.h.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • The CONFIG_RCU_CPU_STALL_VERBOSE Kconfig parameter causes preemptible
    RCU's CPU stall warnings to dump out any preempted tasks that are blocking
    the current RCU grace period. This information is useful, and the default
    has been CONFIG_RCU_CPU_STALL_VERBOSE=y for some years. It is therefore
    time for this commit to remove this Kconfig parameter, so that future
    kernel builds will always act as if CONFIG_RCU_CPU_STALL_VERBOSE=y.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • Commit 35ce7f29a44a (rcu: Create rcuo kthreads only for onlined CPUs)
    avoids creating rcuo kthreads for CPUs that never come online. This
    fixes a bug in many instances of firmware: Instead of lying about their
    age, these systems instead lie about the number of CPUs that they have.
    Before commit 35ce7f29a44a, this could result in huge numbers of useless
    rcuo kthreads being created.

    It appears that experience indicates that I should have told the
    people suffering from this problem to fix their broken firmware, but
    I instead produced what turned out to be a partial fix. The missing
    piece supplied by this commit makes sure that rcu_barrier() knows not to
    post callbacks for no-CBs CPUs that have not yet come online, because
    otherwise rcu_barrier() will hang on systems having firmware that lies
    about the number of CPUs.

    It is tempting to simply have rcu_barrier() refuse to post a callback on
    any no-CBs CPU that does not have an rcuo kthread. This unfortunately
    does not work because rcu_barrier() is required to wait for all pending
    callbacks. It is therefore required to wait even for those callbacks
    that cannot possibly be invoked. Even if doing so hangs the system.

    Given that posting a callback to a no-CBs CPU that does not yet have an
    rcuo kthread can hang rcu_barrier(), It is tempting to report an error
    in this case. Unfortunately, this will result in false positives at
    boot time, when it is perfectly legal to post callbacks to the boot CPU
    before the scheduler has started, in other words, before it is legal
    to invoke rcu_barrier().

    So this commit instead has rcu_barrier() avoid posting callbacks to
    CPUs having neither rcuo kthread nor pending callbacks, and has it
    complain bitterly if it finds CPUs having no rcuo kthread but some
    pending callbacks. And when rcu_barrier() does find CPUs having no rcuo
    kthread but pending callbacks, as noted earlier, it has no choice but
    to hang indefinitely.

    Reported-by: Yanko Kaneti
    Reported-by: Jay Vosburgh
    Reported-by: Meelis Roos
    Reported-by: Eric B Munson
    Signed-off-by: Paul E. McKenney
    Tested-by: Eric B Munson
    Tested-by: Jay Vosburgh
    Tested-by: Yanko Kaneti
    Tested-by: Kevin Fenzi
    Tested-by: Meelis Roos

    Paul E. McKenney
     

19 Sep, 2014

1 commit

  • Currently, the expedited grace-period primitives do get_online_cpus().
    This greatly simplifies their implementation, but means that calls
    to them holding locks that are acquired by CPU-hotplug notifiers (to
    say nothing of calls to these primitives from CPU-hotplug notifiers)
    can deadlock. But this is starting to become inconvenient, as can be
    seen here: https://lkml.org/lkml/2014/8/5/754. The problem in this
    case is that some developers need to acquire a mutex from a CPU-hotplug
    notifier, but also need to hold it across a synchronize_rcu_expedited().
    As noted above, this currently results in deadlock.

    This commit avoids the deadlock and retains the simplicity by creating
    a try_get_online_cpus(), which returns false if the get_online_cpus()
    reference count could not immediately be incremented. If a call to
    try_get_online_cpus() returns true, the expedited primitives operate as
    before. If a call returns false, the expedited primitives fall back to
    normal grace-period operations. This falling back of course results in
    increased grace-period latency, but only during times when CPU hotplug
    operations are actually in flight. The effect should therefore be
    negligible during normal operation.

    Signed-off-by: Paul E. McKenney
    Cc: Josh Triplett
    Cc: "Rafael J. Wysocki"
    Tested-by: Lan Tianyu

    Paul E. McKenney
     

17 Sep, 2014

18 commits

  • This commit changes rcutorture_runnable to torture_runnable, which is
    consistent with the names of the other parameters and is a bit shorter
    as well.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • 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
     
  • rcu-tasks.2014.09.10a: Add RCU-tasks flavor of RCU.

    Paul E. McKenney
     
  • …nd 'torture.2014.09.07a' into HEAD

    doc.2014.09.07a: Documentation updates.
    fixes.2014.09.10a: Miscellaneous fixes.
    nocb-nohz.2014.09.16b: No-CBs CPUs and NO_HZ_FULL updates.
    torture.2014.09.07a: Torture-test updates.

    Paul E. McKenney
     
  • The NOCB follower wakeup ordering depends on the store to the tail
    pointer happening before the wakeup. However, because atomic_long_add()
    does not return a value, it does not provide ordering guarantees, and
    the locking in wake_up() only guarantees that the store will happen
    before the unlock, which might be too late. Even though this is only a
    theoretical issue, this commit adds a smp_mb__after_atomic() after the
    final atomic_long_add() to provide the needed ordering guarantee.

    Reported-by: Amit Shah
    Signed-off-by: Paul E. McKenney
    Tested-by: Paul Gortmaker

    Paul E. McKenney
     
  • If an RCU callback is queued on a no-CBs CPU from idle code with irqs
    disabled, and if that CPU stays idle forever after, the callback will
    never be invoked. This commit therefore adds a check for this situation
    in ____call_rcu_nocb(), invoking the RCU core solely for the purpose
    of the ensuing return-to-idle transition. (If the CPU doesn't return
    to idle, the next scheduling-clock interrupt will fix things up.)

    Reported-by: Amit Shah
    Signed-off-by: Paul E. McKenney
    Tested-by: Paul Gortmaker

    Paul E. McKenney
     
  • The NOCB leader wakeup ordering depends on the store to the header
    happening before the check for the leader already being awake. However,
    because atomic_long_add() does not return a value, it does not provide
    ordering guarantees, the incorrect comment in wake_nocb_leader()
    notwithstanding. This commit therefore adds a smp_mb__after_atomic()
    after the final atomic_long_add() to provide the needed ordering
    guarantee.

    Reported-by: Amit Shah
    Signed-off-by: Paul E. McKenney
    Tested-by: Paul Gortmaker

    Paul E. McKenney
     
  • If there are no nohz_full= CPUs, then there is currently no reason to
    track sysidle state. This commit therefore short-circuits this state
    tracking if !tick_nohz_full_enabled().

    Note that these checks will need to be revisited if nohz_full= state
    can ever be changed at runtime.

    Signed-off-by: Paul E. McKenney
    Acked-by: Frederic Weisbecker
    Tested-by: Paul Gortmaker

    Paul E. McKenney
     
  • Now that we have rcu_state_p, which references rcu_preempt_state for
    TREE_PREEMPT_RCU and rcu_sched_state for TREE_RCU, we don't need a
    separate rcu_sysidle_state variable. This commit therefore eliminates
    rcu_preempt_state in favor of rcu_state_p.

    Signed-off-by: Paul E. McKenney
    Reviewed-by: Pranith Kumar
    Acked-by: Frederic Weisbecker
    Tested-by: Paul Gortmaker

    Paul E. McKenney
     
  • If we configure a kernel with CONFIG_NOCB_CPU=y, CONFIG_RCU_NOCB_CPU_NONE=y and
    CONFIG_CPUMASK_OFFSTACK=n and do not pass in a rcu_nocb= boot parameter, the
    cpumask rcu_nocb_mask can be garbage instead of NULL.

    Hence this commit replaces checks for rcu_nocb_mask == NULL with a check for
    have_rcu_nocb_mask.

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

    Pranith Kumar
     
  • RCU currently uses for_each_possible_cpu() to spawn rcuo kthreads,
    which can result in more rcuo kthreads than one would expect, for
    example, derRichard reported 64 CPUs worth of rcuo kthreads on an
    8-CPU image. This commit therefore creates rcuo kthreads only for
    those CPUs that actually come online.

    This was reported by derRichard on the OFTC IRC network.

    Reported-by: Richard Weinberger
    Signed-off-by: Paul E. McKenney
    Reviewed-by: Josh Triplett
    Tested-by: Paul Gortmaker

    Paul E. McKenney
     
  • Currently, RCU spawns kthreads from several different early_initcall()
    functions. Although this has served RCU well for quite some time,
    as more kthreads are added a more deterministic approach is required.
    This commit therefore causes all of RCU's early-boot kthreads to be
    spawned from a single early_initcall() function.

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

    Paul E. McKenney
     
  • Return false instead of 0 in rcu_nocb_adopt_orphan_cbs() as this has
    bool as return type.

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

    Pranith Kumar
     
  • Return false instead of 0 in __call_rcu_nocb() as this has bool as
    return type.

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

    Pranith Kumar
     
  • Return true/false in rcu_nocb_adopt_orphan_cbs() instead of 0/1 as
    this function has return type of bool.

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

    Pranith Kumar
     
  • Return true/false instead of 0/1 in __call_rcu_nocb() as this returns a
    bool type.

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

    Pranith Kumar
     
  • This commit checks the return value of the zalloc_cpumask_var() used for
    allocating cpumask for rcu_nocb_mask.

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

    Pranith Kumar
     
  • Commit b58cc46c5f6b (rcu: Don't offload callbacks unless specifically
    requested) failed to adjust the callback lists of the CPUs that are
    known to be no-CBs CPUs only because they are also nohz_full= CPUs.
    This failure can result in callbacks that are posted during early boot
    getting stranded on nxtlist for CPUs whose no-CBs property becomes
    apparent late, and there can also be spurious warnings about offline
    CPUs posting callbacks.

    This commit fixes these problems by adding an early-boot rcu_init_nohz()
    that properly initializes the no-CBs CPUs.

    Note that kernels built with CONFIG_RCU_NOCB_CPU_ALL=y or with
    CONFIG_RCU_NOCB_CPU=n do not exhibit this bug. Neither do kernels
    booted without the nohz_full= boot parameter.

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

    Paul E. McKenney