09 Jul, 2019

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The irq departement provides the usual mixed bag:

    Core:

    - Further improvements to the irq timings code which aims to predict
    the next interrupt for power state selection to achieve better
    latency/power balance

    - Add interrupt statistics to the core NMI handlers

    - The usual small fixes and cleanups

    Drivers:

    - Support for Renesas RZ/A1, Annapurna Labs FIC, Meson-G12A SoC and
    Amazon Gravition AMR/GIC interrupt controllers.

    - Rework of the Renesas INTC controller driver

    - ACPI support for Socionext SoCs

    - Enhancements to the CSKY interrupt controller

    - The usual small fixes and cleanups"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (39 commits)
    irq/irqdomain: Fix comment typo
    genirq: Update irq stats from NMI handlers
    irqchip/gic-pm: Remove PM_CLK dependency
    irqchip/al-fic: Introduce Amazon's Annapurna Labs Fabric Interrupt Controller Driver
    dt-bindings: interrupt-controller: Add Amazon's Annapurna Labs FIC
    softirq: Use __this_cpu_write() in takeover_tasklets()
    irqchip/mbigen: Stop printing kernel addresses
    irqchip/gic: Add dependency for ARM_GIC_MAX_NR
    genirq/affinity: Remove unused argument from [__]irq_build_affinity_masks()
    genirq/timings: Add selftest for next event computation
    genirq/timings: Add selftest for irqs circular buffer
    genirq/timings: Add selftest for circular array
    genirq/timings: Encapsulate storing function
    genirq/timings: Encapsulate timings push
    genirq/timings: Optimize the period detection speed
    genirq/timings: Fix timings buffer inspection
    genirq/timings: Fix next event index function
    irqchip/qcom: Use struct_size() in devm_kzalloc()
    irqchip/irq-csky-mpintc: Remove unnecessary loop in interrupt handler
    dt-bindings: interrupt-controller: Update csky mpintc
    ...

    Linus Torvalds
     

24 Jun, 2019

1 commit

  • The code is executed with interrupts disabled, so it's safe to use
    __this_cpu_write().

    [ tglx: Massaged changelog ]

    Signed-off-by: Muchun Song
    Signed-off-by: Thomas Gleixner
    Cc: joel@joelfernandes.org
    Cc: rostedt@goodmis.org
    Cc: frederic@kernel.org
    Cc: paulmck@linux.vnet.ibm.com
    Cc: alexander.levin@verizon.com
    Cc: peterz@infradead.org
    Link: https://lkml.kernel.org/r/20190618143305.2038-1-smuchun@gmail.com

    Muchun Song
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    distribute under gplv2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 8 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Armijn Hemel
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190531190114.475576622@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

22 Mar, 2019

1 commit

  • There are no more users of this interface.
    Remove it.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Anna-Maria Gleixner
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Acked-by: David S. Miller
    Cc: netdev@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190301224821.29843-4-bigeasy@linutronix.de

    Thomas Gleixner
     

11 Feb, 2019

1 commit

  • When a CPU is unplugged the kernel threads of this CPU are parked (see
    smpboot_park_threads()). kthread_park() is used to mark each thread as
    parked and wake it up, so it can complete the process of parking itselfs
    (see smpboot_thread_fn()).

    If local softirqs are pending on interrupt exit invoke_softirq() is called
    to process the softirqs, however it skips processing when the softirq
    kernel thread of the local CPU is scheduled to run. The softirq kthread is
    one of the threads that is parked when a CPU is unplugged. Parking the
    kthread wakes it up, however only to complete the parking process, not to
    process the pending softirqs. Hence processing of softirqs at the end of an
    interrupt is skipped, but not done elsewhere, which can result in warnings
    about pending softirqs when a CPU is unplugged:

    /sys/devices/system/cpu # echo 0 > cpu4/online
    [ ... ] NOHZ: local_softirq_pending 02
    [ ... ] NOHZ: local_softirq_pending 202
    [ ... ] CPU4: shutdown
    [ ... ] psci: CPU4 killed.

    Don't skip processing of softirqs at the end of an interrupt when the
    softirq thread of the CPU is parking.

    Signed-off-by: Matthias Kaehlcke
    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: "Paul E . McKenney"
    Cc: Sebastian Andrzej Siewior
    Cc: Douglas Anderson
    Cc: Stephen Boyd
    Link: https://lkml.kernel.org/r/20190128234625.78241-3-mka@chromium.org

    Matthias Kaehlcke
     

26 Oct, 2018

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The interrupt brigade came up with the following updates:

    - Driver for the Marvell System Error Interrupt machinery

    - Overhaul of the GIC-V3 ITS driver

    - Small updates and fixes all over the place"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits)
    genirq: Fix race on spurious interrupt detection
    softirq: Fix typo in __do_softirq() comments
    genirq: Fix grammar s/an /a /
    irqchip/gic: Unify GIC priority definitions
    irqchip/gic-v3: Remove acknowledge loop
    dt-bindings/interrupt-controller: Add documentation for Marvell SEI controller
    dt-bindings/interrupt-controller: Update Marvell ICU bindings
    irqchip/irq-mvebu-icu: Add support for System Error Interrupts (SEI)
    arm64: marvell: Enable SEI driver
    irqchip/irq-mvebu-sei: Add new driver for Marvell SEI
    irqchip/irq-mvebu-icu: Support ICU subnodes
    irqchip/irq-mvebu-icu: Disociate ICU and NSR
    irqchip/irq-mvebu-icu: Clarify the reset operation of configured interrupts
    irqchip/irq-mvebu-icu: Fix wrong private data retrieval
    dt-bindings/interrupt-controller: Fix Marvell ICU length in the example
    genirq/msi: Allow creation of a tree-based irqdomain for platform-msi
    dt-bindings: irqchip: renesas-irqc: Document r8a7744 support
    dt-bindings: irqchip: renesas-irqc: Document R-Car E3 support
    irqchip/pdc: Setup all edge interrupts as rising edge at GIC
    irqchip/gic-v3-its: Allow use of LPI tables in reserved memory
    ...

    Linus Torvalds
     

19 Oct, 2018

1 commit

  • s/s/as

    [ mingo: Also add a missing 'the', add proper punctuation and clarify what 'swap' means here. ]

    Signed-off-by: Yangtao Li
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: alexander.levin@verizon.com
    Cc: frederic@kernel.org
    Cc: joel@joelfernandes.org
    Cc: paulmck@linux.vnet.ibm.com
    Cc: rostedt@goodmis.org
    Link: http://lkml.kernel.org/r/20181018142133.12341-1-tiny.windzz@gmail.com
    Signed-off-by: Ingo Molnar

    Yangtao Li
     

31 Aug, 2018

2 commits

  • 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
     
  • One necessary step towards consolidating the three flavors of RCU is to
    make sure that the resulting consolidated "one flavor to rule them all"
    correctly handles networking denial-of-service attacks. One thing that
    allows RCU-bh to do so is that __do_softirq() invokes rcu_bh_qs() every
    so often, and so something similar has to happen for consolidated RCU.

    This must be done carefully. For example, if a preemption-disabled
    region of code takes an interrupt which does softirq processing before
    returning, consolidated RCU must ignore the resulting rcu_bh_qs()
    invocations -- preemption is still disabled, and that means an RCU
    reader for the consolidated flavor.

    This commit therefore creates a new rcu_softirq_qs() that is called only
    from the ksoftirqd task, thus avoiding the interrupted-a-preempted-region
    problem. This new rcu_softirq_qs() function invokes rcu_sched_qs(),
    rcu_preempt_qs(), and rcu_preempt_deferred_qs(). The latter call handles
    any deferred quiescent states.

    Note that __do_softirq() still invokes rcu_bh_qs(). It will continue to
    do so until a later stage of cleanup when the RCU-bh flavor is removed.

    Signed-off-by: Paul E. McKenney
    [ paulmck: Fix !SMP issue located by kbuild test robot. ]

    Paul E. McKenney
     

03 Aug, 2018

1 commit

  • The full nohz tick is reprogrammed in irq_exit() only if the exit is not in
    a nesting interrupt. This stands as an optimization: whether a hardirq or a
    softirq is interrupted, the tick is going to be reprogrammed when necessary
    at the end of the inner interrupt, with even potential new updates on the
    timer queue.

    When soft interrupts are interrupted, it's assumed that they are executing
    on the tail of an interrupt return. In that case tick_nohz_irq_exit() is
    called after softirq processing to take care of the tick reprogramming.

    But the assumption is wrong: softirqs can be processed inline as well, ie:
    outside of an interrupt, like in a call to local_bh_enable() or from
    ksoftirqd.

    Inline softirqs don't reprogram the tick once they are done, as opposed to
    interrupt tail softirq processing. So if a tick interrupts an inline
    softirq processing, the next timer will neither be reprogrammed from the
    interrupting tick's irq_exit() nor after the interrupted softirq
    processing. This situation may leave the tick unprogrammed while timers are
    armed.

    To fix this, simply keep reprogramming the tick even if a softirq has been
    interrupted. That can be optimized further, but for now correctness is more
    important.

    Note that new timers enqueued in nohz_full mode after a softirq gets
    interrupted will still be handled just fine through self-IPIs triggered by
    the timer code.

    Reported-by: Anna-Maria Gleixner
    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Thomas Gleixner
    Tested-by: Anna-Maria Gleixner
    Cc: stable@vger.kernel.org # 4.14+
    Link: https://lkml.kernel.org/r/1533303094-15855-1-git-send-email-frederic@kernel.org

    Frederic Weisbecker
     

18 Jul, 2018

1 commit

  • Way back in 4.9, we committed 4cd13c21b207 ("softirq: Let ksoftirqd do
    its job"), and ever since we've had small nagging issues with it. For
    example, we've had:

    1ff688209e2e ("watchdog: core: make sure the watchdog_worker is not deferred")
    8d5755b3f77b ("watchdog: softdog: fire watchdog even if softirqs do not get to run")
    217f69743681 ("net: busy-poll: allow preemption in sk_busy_loop()")

    all of which worked around some of the effects of that commit.

    The DVB people have also complained that the commit causes excessive USB
    URB latencies, which seems to be due to the USB code using tasklets to
    schedule USB traffic. This seems to be an issue mainly when already
    living on the edge, but waiting for ksoftirqd to handle it really does
    seem to cause excessive latencies.

    Now Hanna Hawa reports that this issue isn't just limited to USB URB and
    DVB, but also causes timeout problems for the Marvell SoC team:

    "I'm facing kernel panic issue while running raid 5 on sata disks
    connected to Macchiatobin (Marvell community board with Armada-8040
    SoC with 4 ARMv8 cores of CA72) Raid 5 built with Marvell DMA engine
    and async_tx mechanism (ASYNC_TX_DMA [=y]); the DMA driver (mv_xor_v2)
    uses a tasklet to clean the done descriptors from the queue"

    The latency problem causes a panic:

    mv_xor_v2 f0400000.xor: dma_sync_wait: timeout!
    Kernel panic - not syncing: async_tx_quiesce: DMA error waiting for transaction

    We've discussed simply just reverting the original commit entirely, and
    also much more involved solutions (with per-softirq threads etc). This
    patch is intentionally stupid and fairly limited, because the issue
    still remains, and the other solutions either got sidetracked or had
    other issues.

    We should probably also consider the timer softirqs to be synchronous
    and not be delayed to ksoftirqd (since they were the issue with the
    earlier watchdog problems), but that should be done as a separate patch.
    This does only the tasklet cases.

    Reported-and-tested-by: Hanna Hawa
    Reported-and-tested-by: Josef Griebichler
    Reported-by: Mauro Carvalho Chehab
    Cc: Alan Stern
    Cc: Greg Kroah-Hartman
    Cc: Eric Dumazet
    Cc: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

22 Jun, 2018

1 commit

  • I'm able to reproduce a lockdep splat with config options:
    CONFIG_PROVE_LOCKING=y,
    CONFIG_DEBUG_LOCK_ALLOC=y and
    CONFIG_PREEMPTIRQ_EVENTS=y

    $ echo 1 > /d/tracing/events/preemptirq/preempt_enable/enable

    [ 26.112609] DEBUG_LOCKS_WARN_ON(current->softirqs_enabled)
    [ 26.112636] WARNING: CPU: 0 PID: 118 at kernel/locking/lockdep.c:3854
    [...]
    [ 26.144229] Call Trace:
    [ 26.144926]
    [ 26.145506] lock_acquire+0x55/0x1b0
    [ 26.146499] ? __do_softirq+0x46f/0x4d9
    [ 26.147571] ? __do_softirq+0x46f/0x4d9
    [ 26.148646] trace_preempt_on+0x8f/0x240
    [ 26.149744] ? trace_preempt_on+0x4d/0x240
    [ 26.150862] ? __do_softirq+0x46f/0x4d9
    [ 26.151930] preempt_count_sub+0x18a/0x1a0
    [ 26.152985] __do_softirq+0x46f/0x4d9
    [ 26.153937] irq_exit+0x68/0xe0
    [ 26.154755] smp_apic_timer_interrupt+0x271/0x280
    [ 26.156056] apic_timer_interrupt+0xf/0x20
    [ 26.157105]

    The issue was this:

    preempt_count = 1 << SOFTIRQ_SHIFT

    __local_bh_enable(cnt = 1 << SOFTIRQ_SHIFT) {
    if (softirq_count() == (cnt && SOFTIRQ_MASK)) {
    trace_softirqs_on() {
    current->softirqs_enabled = 1;
    }
    }
    preempt_count_sub(cnt) {
    trace_preempt_on() {
    tracepoint() {
    rcu_read_lock_sched() {
    // jumps into lockdep

    Where preempt_count still has softirqs disabled, but
    current->softirqs_enabled is true, and we get a splat.

    Link: http://lkml.kernel.org/r/20180607201143.247775-1-joel@joelfernandes.org

    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Linus Torvalds
    Cc: Mathieu Desnoyers
    Cc: Tom Zanussi
    Cc: Namhyung Kim
    Cc: Thomas Glexiner
    Cc: Boqun Feng
    Cc: Paul McKenney
    Cc: Masami Hiramatsu
    Cc: Todd Kjos
    Cc: Erick Reyes
    Cc: Julia Cartwright
    Cc: Byungchul Park
    Cc: stable@vger.kernel.org
    Reviewed-by: Steven Rostedt (VMware)
    Fixes: d59158162e032 ("tracing: Add support for preempt and irq enable/disable events")
    Signed-off-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Joel Fernandes (Google)
     

05 Jun, 2018

1 commit

  • Pull irq updates from Thomas Gleixner:

    - Consolidation of softirq pending:

    The softirq mask and its accessors/mutators have many implementations
    scattered around many architectures. Most do the same things
    consisting in a field in a per-cpu struct (often irq_cpustat_t)
    accessed through per-cpu ops. We can provide instead a generic
    efficient version that most of them can use. In fact s390 is the only
    exception because the field is stored in lowcore.

    - Support for level!?! triggered MSI (ARM)

    Over the past couple of years, we've seen some SoCs coming up with
    ways of signalling level interrupts using a new flavor of MSIs, where
    the MSI controller uses two distinct messages: one that raises a
    virtual line, and one that lowers it. The target MSI controller is in
    charge of maintaining the state of the line.

    This allows for a much simplified HW signal routing (no need to have
    hundreds of discrete lines to signal level interrupts if you already
    have a memory bus), but results in a departure from the current idea
    the kernel has of MSIs.

    - Support for Meson-AXG GPIO irqchip

    - Large stm32 irqchip rework (suspend/resume, hierarchical domains)

    - More SPDX conversions

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    ARM: dts: stm32: Add exti support to stm32mp157 pinctrl
    ARM: dts: stm32: Add exti support for stm32mp157c
    pinctrl/stm32: Add irq_eoi for stm32gpio irqchip
    irqchip/stm32: Add suspend/resume support for hierarchy domain
    irqchip/stm32: Add stm32mp1 support with hierarchy domain
    irqchip/stm32: Prepare common functions
    irqchip/stm32: Add host and driver data structures
    irqchip/stm32: Add suspend support
    irqchip/stm32: Add falling pending register support
    irqchip/stm32: Checkpatch fix
    irqchip/stm32: Optimizes and cleans up stm32-exti irq_domain
    irqchip/meson-gpio: Add support for Meson-AXG SoCs
    dt-bindings: interrupt-controller: New binding for Meson-AXG SoC
    dt-bindings: interrupt-controller: Fix the double quotes
    softirq/s390: Move default mutators of overwritten softirq mask to s390
    softirq/x86: Switch to generic local_softirq_pending() implementation
    softirq/sparc: Switch to generic local_softirq_pending() implementation
    softirq/powerpc: Switch to generic local_softirq_pending() implementation
    softirq/parisc: Switch to generic local_softirq_pending() implementation
    softirq/ia64: Switch to generic local_softirq_pending() implementation
    ...

    Linus Torvalds
     

16 May, 2018

1 commit


14 May, 2018

1 commit

  • In order to optimize and consolidate softirq mask accesses, let's
    convert the default irq_cpustat_t implementation to per-CPU standard API.

    Signed-off-by: Frederic Weisbecker
    Acked-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Cc: Benjamin Herrenschmidt
    Cc: David S. Miller
    Cc: Fenghua Yu
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: James E.J. Bottomley
    Cc: Linus Torvalds
    Cc: Martin Schwidefsky
    Cc: Michael Ellerman
    Cc: Paul Mackerras
    Cc: Rich Felker
    Cc: Sebastian Andrzej Siewior
    Cc: Tony Luck
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/1525786706-22846-5-git-send-email-frederic@kernel.org
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

09 Mar, 2018

2 commits

  • tasklet_action() + tasklet_hi_action() are almost identical. Move the
    common code from both function into __tasklet_action_common() and let
    both functions invoke it with different arguments.

    [ bigeasy: Splitted out from RT's "tasklet: Prevent tasklets from going
    into infinite spin in RT" and added commit message]

    Signed-off-by: Ingo Molnar
    Signed-off-by: Steven Rostedt
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Sebastian Andrzej Siewior
    Cc: Julia Cartwright
    Link: https://lkml.kernel.org/r/20180227164808.10093-3-bigeasy@linutronix.de

    Ingo Molnar
     
  • __tasklet_schedule() and __tasklet_hi_schedule() are almost identical.
    Move the common code from both function into __tasklet_schedule_common()
    and let both functions invoke it with different arguments.

    [ bigeasy: Splitted out from RT's "tasklet: Prevent tasklets from going
    into infinite spin in RT" and added commit message. Use
    this_cpu_ptr(headp) in __tasklet_schedule_common() as suggested
    by Julia Cartwright ]

    Signed-off-by: Ingo Molnar
    Signed-off-by: Steven Rostedt
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Sebastian Andrzej Siewior
    Cc: Julia Cartwright
    Link: https://lkml.kernel.org/r/20180227164808.10093-2-bigeasy@linutronix.de

    Ingo Molnar
     

05 Dec, 2017

1 commit


16 Nov, 2017

1 commit

  • Fix up makefiles, remove references, and git rm kmemcheck.

    Link: http://lkml.kernel.org/r/20171007030159.22241-4-alexander.levin@verizon.com
    Signed-off-by: Sasha Levin
    Cc: Steven Rostedt
    Cc: Vegard Nossum
    Cc: Pekka Enberg
    Cc: Michal Hocko
    Cc: Eric W. Biederman
    Cc: Alexander Potapenko
    Cc: Tim Hansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Levin, Alexander (Sasha Levin)
     

08 Nov, 2017

1 commit

  • Use lockdep to check that IRQs are enabled or disabled as expected. This
    way the sanity check only shows overhead when concurrency correctness
    debug code is enabled.

    Signed-off-by: Frederic Weisbecker
    Acked-by: Thomas Gleixner
    Cc: David S . Miller
    Cc: Lai Jiangshan
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Tejun Heo
    Link: http://lkml.kernel.org/r/1509980490-4285-3-git-send-email-frederic@kernel.org
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

11 Apr, 2017

1 commit

  • It is not safe for one thread to modify the ->flags
    of another thread as there is no locking that can protect
    the update.

    So tsk_restore_flags(), which takes a task pointer and modifies
    the flags, is an invitation to do the wrong thing.

    All current users pass "current" as the task, so no developers have
    accepted that invitation. It would be best to ensure it remains
    that way.

    So rename tsk_restore_flags() to current_restore_flags() and don't
    pass in a task_struct pointer. Always operate on current->flags.

    Signed-off-by: NeilBrown
    Cc: Linus Torvalds
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    NeilBrown
     

22 Oct, 2016

1 commit


16 Oct, 2016

1 commit

  • Pull gcc plugins update from Kees Cook:
    "This adds a new gcc plugin named "latent_entropy". It is designed to
    extract as much possible uncertainty from a running system at boot
    time as possible, hoping to capitalize on any possible variation in
    CPU operation (due to runtime data differences, hardware differences,
    SMP ordering, thermal timing variation, cache behavior, etc).

    At the very least, this plugin is a much more comprehensive example
    for how to manipulate kernel code using the gcc plugin internals"

    * tag 'gcc-plugins-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    latent_entropy: Mark functions with __latent_entropy
    gcc-plugins: Add latent_entropy plugin

    Linus Torvalds
     

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
     

04 Oct, 2016

1 commit

  • Pull CPU hotplug updates from Thomas Gleixner:
    "Yet another batch of cpu hotplug core updates and conversions:

    - Provide core infrastructure for multi instance drivers so the
    drivers do not have to keep custom lists.

    - Convert custom lists to the new infrastructure. The block-mq custom
    list conversion comes through the block tree and makes the diffstat
    tip over to more lines removed than added.

    - Handle unbalanced hotplug enable/disable calls more gracefully.

    - Remove the obsolete CPU_STARTING/DYING notifier support.

    - Convert another batch of notifier users.

    The relayfs changes which conflicted with the conversion have been
    shipped to me by Andrew.

    The remaining lot is targeted for 4.10 so that we finally can remove
    the rest of the notifiers"

    * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
    cpufreq: Fix up conversion to hotplug state machine
    blk/mq: Reserve hotplug states for block multiqueue
    x86/apic/uv: Convert to hotplug state machine
    s390/mm/pfault: Convert to hotplug state machine
    mips/loongson/smp: Convert to hotplug state machine
    mips/octeon/smp: Convert to hotplug state machine
    fault-injection/cpu: Convert to hotplug state machine
    padata: Convert to hotplug state machine
    cpufreq: Convert to hotplug state machine
    ACPI/processor: Convert to hotplug state machine
    virtio scsi: Convert to hotplug state machine
    oprofile/timer: Convert to hotplug state machine
    block/softirq: Convert to hotplug state machine
    lib/irq_poll: Convert to hotplug state machine
    x86/microcode: Convert to hotplug state machine
    sh/SH-X3 SMP: Convert to hotplug state machine
    ia64/mca: Convert to hotplug state machine
    ARM/OMAP/wakeupgen: Convert to hotplug state machine
    ARM/shmobile: Convert to hotplug state machine
    arm64/FP/SIMD: Convert to hotplug state machine
    ...

    Linus Torvalds
     

30 Sep, 2016

1 commit

  • A while back, Paolo and Hannes sent an RFC patch adding threaded-able
    napi poll loop support : (https://patchwork.ozlabs.org/patch/620657/)

    The problem seems to be that softirqs are very aggressive and are often
    handled by the current process, even if we are under stress and that
    ksoftirqd was scheduled, so that innocent threads would have more chance
    to make progress.

    This patch makes sure that if ksoftirq is running, we let it
    perform the softirq work.

    Jonathan Corbet summarized the issue in https://lwn.net/Articles/687617/

    Tested:

    - NIC receiving traffic handled by CPU 0
    - UDP receiver running on CPU 0, using a single UDP socket.
    - Incoming flood of UDP packets targeting the UDP socket.

    Before the patch, the UDP receiver could almost never get CPU cycles and
    could only receive ~2,000 packets per second.

    After the patch, CPU cycles are split 50/50 between user application and
    ksoftirqd/0, and we can effectively read ~900,000 packets per second,
    a huge improvement in DOS situation. (Note that more packets are now
    dropped by the NIC itself, since the BH handlers get less CPU cycles to
    drain RX ring buffer)

    Since the load runs in well identified threads context, an admin can
    more easily tune process scheduling parameters if needed.

    Reported-by: Paolo Abeni
    Reported-by: Hannes Frederic Sowa
    Signed-off-by: Eric Dumazet
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: David Miller
    Cc: Hannes Frederic Sowa
    Cc: Jesper Dangaard Brouer
    Cc: Jonathan Corbet
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Rik van Riel
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1472665349.14381.356.camel@edumazet-glaptop3.roam.corp.google.com
    Signed-off-by: Ingo Molnar

    Eric Dumazet
     

07 Sep, 2016

1 commit


26 Mar, 2016

1 commit

  • KASAN needs to know whether the allocation happens in an IRQ handler.
    This lets us strip everything below the IRQ entry point to reduce the
    number of unique stack traces needed to be stored.

    Move the definition of __irq_entry to so that the
    users don't need to pull in . Also introduce the
    __softirq_entry macro which is similar to __irq_entry, but puts the
    corresponding functions to the .softirqentry.text section.

    Signed-off-by: Alexander Potapenko
    Acked-by: Steven Rostedt
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Cc: Andrey Konovalov
    Cc: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: Konstantin Serebryany
    Cc: Dmitry Chernenkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Potapenko
     

29 Feb, 2016

1 commit

  • The preempt_disable() invokes preempt_count_add() which saves the caller
    in ->preempt_disable_ip. It uses CALLER_ADDR1 which does not look for
    its caller but for the parent of the caller. Which means we get the correct
    caller for something like spin_lock() unless the architectures inlines
    those invocations. It is always wrong for preempt_disable() or
    local_bh_disable().

    This patch makes the function get_lock_parent_ip() which tries
    CALLER_ADDR0,1,2 if the former is a locking function.
    This seems to record the preempt_disable() caller properly for
    preempt_disable() itself as well as for get_cpu_var() or
    local_bh_disable().

    Steven asked for the get_parent_ip() -> get_lock_parent_ip() rename.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20160226135456.GB18244@linutronix.de
    Signed-off-by: Ingo Molnar

    Sebastian Andrzej Siewior
     

10 Feb, 2015

1 commit

  • Pull core locking updates from Ingo Molnar:
    "The main changes are:

    - mutex, completions and rtmutex micro-optimizations
    - lock debugging fix
    - various cleanups in the MCS and the futex code"

    * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    locking/rtmutex: Optimize setting task running after being blocked
    locking/rwsem: Use task->state helpers
    sched/completion: Add lock-free checking of the blocking case
    sched/completion: Remove unnecessary ->wait.lock serialization when reading completion state
    locking/mutex: Explicitly mark task as running after wakeup
    futex: Fix argument handling in futex_lock_pi() calls
    doc: Fix misnamed FUTEX_CMP_REQUEUE_PI op constants
    locking/Documentation: Update code path
    softirq/preempt: Add missing current->preempt_disable_ip update
    locking/osq: No need for load/acquire when acquire-polling
    locking/mcs: Better differentiate between MCS variants
    locking/mutex: Introduce ww_mutex_set_context_slowpath()
    locking/mutex: Move MCS related comments to proper location
    locking/mutex: Checking the stamp is WW only

    Linus Torvalds
     

15 Jan, 2015

2 commits

  • Simplify run_ksoftirqd() by using the new cond_resched_rcu_qs() function
    that conditionally reschedules, but unconditionally supplies an RCU
    quiescent state. This commit is separate from the previous commit by
    Calvin Owens because Calvin's approach can be backported, while this
    commit cannot be. The reason that this commit cannot be backported is
    that cond_resched_rcu_qs() does not always provide the needed quiescent
    state in earlier kernels.

    Signed-off-by: Paul E. McKenney

    Paul E. McKenney
     
  • While debugging an issue with excessive softirq usage, I encountered the
    following note in commit 3e339b5dae24a706 ("softirq: Use hotplug thread
    infrastructure"):

    [ paulmck: Call rcu_note_context_switch() with interrupts enabled. ]

    ...but despite this note, the patch still calls RCU with IRQs disabled.

    This seemingly innocuous change caused a significant regression in softirq
    CPU usage on the sending side of a large TCP transfer (~1 GB/s): when
    introducing 0.01% packet loss, the softirq usage would jump to around 25%,
    spiking as high as 50%. Before the change, the usage would never exceed 5%.

    Moving the call to rcu_note_context_switch() after the cond_sched() call,
    as it was originally before the hotplug patch, completely eliminated this
    problem.

    Signed-off-by: Calvin Owens
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul E. McKenney

    Calvin Owens
     

14 Jan, 2015

1 commit

  • While debugging some "sleeping function called from invalid context" bug I
    realized that the debugging message "Preemption disabled at:" pointed to
    an incorrect function.

    In particular if the last function/action that disabled preemption was
    spin_lock_bh() then current->preempt_disable_ip won't be updated.

    The reason for this is that __local_bh_disable_ip() will increase
    preempt_count manually instead of calling preempt_count_add(), which
    would handle the update correctly.

    It look like the manual handling was done to work around some lockdep issue.

    So add the missing update of current->preempt_disable_ip to
    __local_bh_disable_ip() as well.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Paul E. McKenney
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Link: http://lkml.kernel.org/r/20150107090441.GC4365@osiris
    Signed-off-by: Ingo Molnar

    Heiko Carstens
     

04 Nov, 2014

1 commit

  • 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
     

15 Oct, 2014

1 commit

  • Pull percpu consistent-ops changes from Tejun Heo:
    "Way back, before the current percpu allocator was implemented, static
    and dynamic percpu memory areas were allocated and handled separately
    and had their own accessors. The distinction has been gone for many
    years now; however, the now duplicate two sets of accessors remained
    with the pointer based ones - this_cpu_*() - evolving various other
    operations over time. During the process, we also accumulated other
    inconsistent operations.

    This pull request contains Christoph's patches to clean up the
    duplicate accessor situation. __get_cpu_var() uses are replaced with
    with this_cpu_ptr() and __this_cpu_ptr() with raw_cpu_ptr().

    Unfortunately, the former sometimes is tricky thanks to C being a bit
    messy with the distinction between lvalues and pointers, which led to
    a rather ugly solution for cpumask_var_t involving the introduction of
    this_cpu_cpumask_var_ptr().

    This converts most of the uses but not all. Christoph will follow up
    with the remaining conversions in this merge window and hopefully
    remove the obsolete accessors"

    * 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (38 commits)
    irqchip: Properly fetch the per cpu offset
    percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t -fix
    ia64: sn_nodepda cannot be assigned to after this_cpu conversion. Use __this_cpu_write.
    percpu: Resolve ambiguities in __get_cpu_var/cpumask_var_t
    Revert "powerpc: Replace __get_cpu_var uses"
    percpu: Remove __this_cpu_ptr
    clocksource: Replace __this_cpu_ptr with raw_cpu_ptr
    sparc: Replace __get_cpu_var uses
    avr32: Replace __get_cpu_var with __this_cpu_write
    blackfin: Replace __get_cpu_var uses
    tile: Use this_cpu_ptr() for hardware counters
    tile: Replace __get_cpu_var uses
    powerpc: Replace __get_cpu_var uses
    alpha: Replace __get_cpu_var
    ia64: Replace __get_cpu_var uses
    s390: cio driver &__get_cpu_var replacements
    s390: Replace __get_cpu_var uses
    mips: Replace __get_cpu_var uses
    MIPS: Replace __get_cpu_var uses in FPU emulator.
    arm: Replace __this_cpu_ptr with raw_cpu_ptr
    ...

    Linus Torvalds
     

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
     

27 Aug, 2014

1 commit

  • Convert uses of __get_cpu_var for creating a address from a percpu
    offset to this_cpu_ptr.

    The two cases where get_cpu_var is used to actually access a percpu
    variable are changed to use this_cpu_read/raw_cpu_read.

    Reviewed-by: Thomas Gleixner
    Signed-off-by: Christoph Lameter
    Signed-off-by: Tejun Heo

    Christoph Lameter
     

22 May, 2014

1 commit

  • …/linux-rcu into core/rcu

    Pull RCU updates from Paul E. McKenney:

    " 1. Update RCU documentation. These were posted to LKML at
    https://lkml.org/lkml/2014/4/28/634.

    2. Miscellaneous fixes. These were posted to LKML at
    https://lkml.org/lkml/2014/4/28/645.

    3. Torture-test changes. These were posted to LKML at
    https://lkml.org/lkml/2014/4/28/667.

    4. Variable-name renaming cleanup, sent separately due to conflicts.
    This was posted to LKML at https://lkml.org/lkml/2014/5/13/854.

    5. Patch to suppress RCU stall warnings while sysrq requests are
    being processed. This patch is the RCU portions of the patch
    that Rik posted to LKML at https://lkml.org/lkml/2014/4/29/457.
    The reason for pushing this patch ahead instead of waiting until
    3.17 is that the NMI-based stack traces are messing up sysrq
    output, and in some cases also messing up the system as well."

    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

06 May, 2014

1 commit


29 Apr, 2014

1 commit

  • Calling rcu_bh_qs() after every softirq action is not really needed.
    What RCU needs is at least one rcu_bh_qs() per softirq round to note a
    quiescent state was passed for rcu_bh.

    Note for Paul and myself : this could be inlined as a single instruction
    and avoid smp_processor_id()
    (sone this_cpu_write(rcu_bh_data.passed_quiesce, 1))

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

    Eric Dumazet