lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Dec 2017 11:41:29 +0100
From:   Anna-Maria Gleixner <anna-maria@...utronix.de>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, keescook@...omium.org,
        Christoph Hellwig <hch@....de>,
        John Stultz <john.stultz@...aro.org>
Subject: [PATCH v4 00/36] hrtimer: Provide softirq context hrtimers

There are quite some places in the kernel which use a combination of
hrtimers and tasklets to make use of the precise expiry of hrtimers, which
schedule a tasklet to bring the actual function into softirq context.

This was introduced when the previous hrtimer softirq code was
removed. That code was implemented by expiring the timer in hard irq
context and then deferring the execution of the callback into softirq
context. That caused a lot of pointless shuffling between the rbtree and a
linked list.

In recent discussions it turned out that more potential users of hrtimers
in softirq context might come up. Aside of that the RT patches need this
functionality as well to defer hrtimers into softirq context if their
callbacks are not interrupt safe on RT.

This series implements a new approach by adding SOFT hrtimer mode and
instead of doing the list shuffle, timers started with this mode are put
into separate soft expiry hrtimer queues. These queues are evaluated only
when the hardirq context detects that the first expiring timer in the
softirq queues has expired. That makes the overhead in the hardirq context
minimal.

The series reworks the code to reuse as much as possible from the existing
facilities for the new softirq hrtimers and integrates them with all
flavours of hrtimers (HIGH_RES=y/n - NOHZ=y/n).

To achieve this quite some of the conditionals in the existing code are
removed for the price of adding some pointless data and state tracking to
the HIGH_RES=n case. That's minimal, but well worth it as it increases the
readability and maintainability of the code.

The first part of the series implements the new functionality and the
second part converts the hrtimer/tasklet users to make use of it and
removes struct hrtimer_tasklet and the surrounding helper functions.

This series is available from git as well:

	git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.timers

Thanks,

        Anna-Maria

---
v3..v4:

  - [PATCH 10/36] "hrtimer: Switch for loop to _ffs() evaluation": Add
    Joe Perches' annotation
    
  - [PATCH 28/36] "hrtimer: Implement support for softirq based
    hrtimers":
     - WARN_ON_ONCE() on non equality of HRTIMER_MODE_SOFT bit and
       hrtimer.is_soft at the begin of hrtimer_start_range_ns() and
       without holding hrtimer base lock to prevent a deadlock
     - Fold fix for remote soft hrtimer enqueue: Bug was reported-by
       Bert Schulze and fixed by Sebastian Siewior:
       https://lkml.kernel.org/r/20171214104755.7bnfwfv6mer2toe2@breakpoint.cc
     - Ensure to update softirq expires next after migrating hrtimer
       lists
     - Add bh_disable/enable() with a comment in hrtimers_dead_cpu():
       https://lkml.kernel.org/r/20171219085843.l55fasrfdqdyta5z@breakpoint.cc
     - Fix comment before __hrtimer_get_next_event(): use
       HRTIMER_ACTIVE_ALL instead of HRTIMER_ACTIVE

v2..v3:

  - Use static keys for migrate_enable and nohz_active
  - fix missing struct documentation
  - integrate Sebastian Siewiors suggestions and fix bug he mentioned:
    https://lkml.kernel.org/r/20171110124224.ykr6n4z7zgypojnb@breakpoint.cc


v1..v2:

  - integration of Peter Zijlstras patch:
    https://lkml.kernel.org/r/20170927164025.GI17526@worktop.programming.kicks-ass.net
  - using hrtimer_mode instead of additional hrtimer clock bases
  - folding the fix for updating the base offsets:
    https://lkml.kernel.org/r/20171006102820.ou4wpm56ed6m3ewr@linutronix.de
  - rework of 08/25 - 10/25 (all of those patches are facing reduction of
    conditional code) and make hrtimer_force_reprogram() unconditional as well
  - integration of new versions of "ALSA/dummy: Replace tasklet with
    softirq hrtimer" and "net/cdc_ncm: Replace tasklet with softirq
    hrtimer"
  - additional hrtimer/tasklet user conversion: "net/mvpp2: Replace tasklet
    with softirq hrtimer"
  - additional fixes of several wrong comments
  - update hrtimer tracing (mode and clock bases)


 drivers/net/ethernet/marvell/mvpp2.c  |   62 +--
 drivers/net/wireless/mac80211_hwsim.c |   44 +-
 drivers/usb/gadget/function/f_ncm.c   |   30 -
 include/linux/hrtimer.h               |  113 +++--
 include/linux/interrupt.h             |   25 -
 include/net/xfrm.h                    |    2 
 include/trace/events/timer.h          |   37 +
 kernel/softirq.c                      |   51 --
 kernel/time/hrtimer.c                 |  650 +++++++++++++++++++++-------------
 kernel/time/tick-internal.h           |   13 
 kernel/time/tick-sched.c              |    2 
 kernel/time/timer.c                   |   98 ++---
 net/can/bcm.c                         |  156 ++------
 net/xfrm/xfrm_state.c                 |   30 -
 sound/drivers/dummy.c                 |   27 -
 15 files changed, 709 insertions(+), 631 deletions(-)


Powered by blists - more mailing lists