15 Jan, 2017

1 commit

  • The current preemptible RCU implementation goes through three phases
    during bootup. In the first phase, there is only one CPU that is running
    with preemption disabled, so that a no-op is a synchronous grace period.
    In the second mid-boot phase, the scheduler is running, but RCU has
    not yet gotten its kthreads spawned (and, for expedited grace periods,
    workqueues are not yet running. During this time, any attempt to do
    a synchronous grace period will hang the system (or complain bitterly,
    depending). In the third and final phase, RCU is fully operational and
    everything works normally.

    This has been OK for some time, but there has recently been some
    synchronous grace periods showing up during the second mid-boot phase.
    This code worked "by accident" for awhile, but started failing as soon
    as expedited RCU grace periods switched over to workqueues in commit
    8b355e3bc140 ("rcu: Drive expedited grace periods from workqueue").
    Note that the code was buggy even before this commit, as it was subject
    to failure on real-time systems that forced all expedited grace periods
    to run as normal grace periods (for example, using the rcu_normal ksysfs
    parameter). The callchain from the failure case is as follows:

    early_amd_iommu_init()
    |-> acpi_put_table(ivrs_base);
    |-> acpi_tb_put_table(table_desc);
    |-> acpi_tb_invalidate_table(table_desc);
    |-> acpi_tb_release_table(...)
    |-> acpi_os_unmap_memory
    |-> acpi_os_unmap_iomem
    |-> acpi_os_map_cleanup
    |-> synchronize_rcu_expedited

    The kernel showing this callchain was built with CONFIG_PREEMPT_RCU=y,
    which caused the code to try using workqueues before they were
    initialized, which did not go well.

    This commit therefore reworks RCU to permit synchronous grace periods
    to proceed during this mid-boot phase. This commit is therefore a
    fix to a regression introduced in v4.9, and is therefore being put
    forward post-merge-window in v4.10.

    This commit sets a flag from the existing rcu_scheduler_starting()
    function which causes all synchronous grace periods to take the expedited
    path. The expedited path now checks this flag, using the requesting task
    to drive the expedited grace period forward during the mid-boot phase.
    Finally, this flag is updated by a core_initcall() function named
    rcu_exp_runtime_mode(), which causes the runtime codepaths to be used.

    Note that this arrangement assumes that tasks are not sent POSIX signals
    (or anything similar) from the time that the first task is spawned
    through core_initcall() time.

    Fixes: 8b355e3bc140 ("rcu: Drive expedited grace periods from workqueue")
    Reported-by: "Zheng, Lv"
    Reported-by: Borislav Petkov
    Signed-off-by: Paul E. McKenney
    Tested-by: Stan Kain
    Tested-by: Ivan
    Tested-by: Emanuel Castelo
    Tested-by: Bruno Pesavento
    Tested-by: Borislav Petkov
    Tested-by: Frederic Bezies
    Cc: # 4.9.0-

    Paul E. McKenney
     

24 Feb, 2016

1 commit

  • The Kconfig currently controlling compilation of this code is:

    init/Kconfig:config TINY_RCU
    init/Kconfig: bool

    ...meaning that it currently is not being built as a module by anyone.

    Lets remove the modular code that is essentially orphaned, so that
    when reading the code there is no doubt it is builtin-only.

    Since module_init translates to device_initcall in the non-modular
    case, the init ordering remains unchanged with this commit. We could
    consider moving this to an earlier initcall (subsys?) if desired.

    We also delete the MODULE_LICENSE tag etc. since all that information
    is already contained at the top of the file in the comments.

    Cc: Josh Triplett
    Cc: Steven Rostedt
    Cc: Mathieu Desnoyers
    Cc: Lai Jiangshan
    Signed-off-by: Paul Gortmaker
    Signed-off-by: Paul E. McKenney

    Paul Gortmaker
     

28 May, 2015

1 commit


16 Jan, 2015

2 commits

  • …rcu.2015.01.06a', 'stall.2015.01.16a' and 'torture.2015.01.11a' into HEAD

    doc.2015.01.07a: Documentation updates.
    fixes.2015.01.15a: Miscellaneous fixes.
    preempt.2015.01.06a: Changes to handling of lists of preempted tasks.
    srcu.2015.01.06a: SRCU updates.
    stall.2015.01.16a: RCU CPU stall-warning updates and fixes.
    torture.2015.01.11a: RCU torture-test updates and fixes.

    Paul E. McKenney
     
  • The tiny RCU CPU stall detection depends on *rcp->curtail not being
    NULL. It is however a tail pointer and thus NULL by definition. Instead we
    should check rcp->rcucblist for the presence of pending callbacks which
    need to be processed. With this fix INFO about the stall is printed and
    jiffies_stall (jiffies at next stall) correctly updated.

    Note that the check for pending callback is necessary to avoid spurious
    warnings if there are no pendings callbacks.

    Signed-off-by: Miroslav Benes
    [ paulmck: Fused identical "if" statements, ported to -rcu. ]
    Signed-off-by: Paul E. McKenney

    Miroslav Benes
     

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
     

29 Apr, 2014

1 commit

  • Some of the accesses to the rcu_state structure's ->jiffies_stall
    field are unprotected. This patch protects them with ACCESS_ONCE().
    The following coccinelle script was used to acheive this:
    /* coccinelle script to protect uses of ->jiffies_stall with ACCESS_ONCE() */
    @@
    identifier a;
    @@
    (
    ACCESS_ONCE(a->jiffies_stall)
    |
    - a->jiffies_stall
    + ACCESS_ONCE(a->jiffies_stall)
    )

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

    Himangi Saraogi
     

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
     

16 Oct, 2013

1 commit