Re: [GIT pull] Timer core updates for 4.16

From: Ingo Molnar
Date: Tue Jan 30 2018 - 01:30:14 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Mon, Jan 29, 2018 at 12:48 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> >
> > - A rather large rework of the hrtimer infrastructure which introduces
> > softirq based hrtimers to replace the spread of hrtimer/tasklet combos
> > which force the actual callback execution into softirq context.
>
> I really would have liked to see more of the rationale for this - now
> I'm left with just two example drivers, and a "you'll see the cleanups
> this allows in future driver pulls".
>
> But pulled, since the code doesn't look disgusting.

Sorry, this is my fault: from Anna-Maria's original, full softirq-hrtimers series
I didn't apply many of the usecases, because we didn't get any review feedback
from the networking folks:

can/bcm: Replace hrtimer_tasklet with softirq based hrtimer

net/can/bcm.c | 156 ++++++++++++++++++++--------------------------------------
1 file changed, 52 insertions(+), 104 deletions(-)

mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer

drivers/net/wireless/mac80211_hwsim.c | 44 ++++++++++++++++-------------------
1 file changed, 20 insertions(+), 24 deletions(-)

xfrm: Replace hrtimer tasklet with softirq hrtimer

include/net/xfrm.h | 2 +-
net/xfrm/xfrm_state.c | 30 ++++++++++++++++++------------
2 files changed, 19 insertions(+), 13 deletions(-)

net/mvpp2: Replace tasklet with softirq hrtimer

drivers/net/ethernet/marvell/mvpp2.c | 62 +++++++++++++++---------------------
1 file changed, 25 insertions(+), 37 deletions(-)

And I felt uneasy about applying this in one go, so we decided to apply it in two
phases.

These are in cases significant driver simplifications, but they also enable the
real deal, the elimination of the hrtimer tasklet:

softirq: Remove tasklet_hrtimer

include/linux/interrupt.h | 25 -----------------------
kernel/softirq.c | 51 -----------------------------------------------
2 files changed, 76 deletions(-)

... which is a pretty nice thing in itself even without the driver
simplifications!

Plus the _real_ secret motivation behind it all is the -rt kernel and
CONFIG_PREEMPT_RT=y and the ability to push most of the hrtimer processing into
softirq context - while it still keeps the main hrtimer machinery capable to run
in hard-RT hardirq domain. Turns out it was possible to implement this duality via
the softirq-hrtimers, with a good chunk of benefits to non-rt upstream as well.

Thanks,

Ingo