All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch V3 0/3] posix-cpu-timers: Move expiry into task work context
@ 2020-07-30 10:14 Thomas Gleixner
  2020-07-30 10:14 ` [patch V3 1/3] posix-cpu-timers: Split run_posix_cpu_timers() Thomas Gleixner
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Thomas Gleixner @ 2020-07-30 10:14 UTC (permalink / raw)
  To: LKML
  Cc: x86, Oleg Nesterov, Eric W. Biederman, Frederic Weisbecker,
	John Stultz, Paolo Bonzini

This is the 3rd installment of the series to move posix timer expiry heavy
lifting out of hard interrupt context.

Running posix CPU timers in hard interrupt context has a few downsides:

 - For PREEMPT_RT it cannot work as the expiry code needs to take
   sighand lock, which is a 'sleeping spinlock' in RT. The original RT
   approach of offloading the posix CPU timer handling into a high
   priority thread was clumsy and provided no real benefit in general.

 - For fine grained accounting it's just wrong to run this in context of
   the timer interrupt because that way a process specific cpu time is
   accounted to the timer interrupt.

 - Long running timer interrupts caused by a large amount of expiring
   timers which can be created and armed by unpriviledged user space.

There is no hard requirement to expire them in interrupt context.

If the signal is targeted at the task itself then it won't be delivered
before the task returns to user space anyway. If the signal is targeted at
a supervisor process then it might be slightly delayed, but posix CPU
timers are inaccurate anyway due to the fact that they are tied to the
tick.

This series has no code dependency on the entry/KVM work, but a functional
dependency vs. KVM handling task work before going into guest mode exists.
It applies on mainline and passes all tests - except when KVM is active and
timers are armed on the KVM threads. This particular issue is solved when
the entry changes are applied as well. See below.

The previous version can be found here:

    https://lore.kernel.org/r/20200716201923.228696399@linutronix.de

The changes versus V2 are:

    - Address the ordering issues vs. RT (Peter)
    - Move task work head into task struct (Oleg)
    - Drop the last patch which is an optimization and needs more thought
      now with the reworked state handling.

The series is standalone except for the fact that KVM does not handle task
work before entering a guest. The necessary changes for this are in

    git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/entry

and the whole lot (entry + posix CPU timers) is available from:

    git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git timers/posixtimer

Thanks,

	tglx

---
 arch/x86/Kconfig               |    1 
 include/linux/posix-timers.h   |   17 +++
 include/linux/sched.h          |    4 
 include/linux/seccomp.h        |    3 
 kernel/entry/common.c          |    4 
 kernel/time/Kconfig            |    9 +
 kernel/time/posix-cpu-timers.c |  216 ++++++++++++++++++++++++++++++++++++-----
 kernel/time/timer.c            |    1 
 8 files changed, 227 insertions(+), 28 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-08-06 17:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 10:14 [patch V3 0/3] posix-cpu-timers: Move expiry into task work context Thomas Gleixner
2020-07-30 10:14 ` [patch V3 1/3] posix-cpu-timers: Split run_posix_cpu_timers() Thomas Gleixner
2020-08-06 17:09   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-07-30 10:14 ` [patch V3 2/3] posix-cpu-timers: Provide mechanisms to defer timer handling to task_work Thomas Gleixner
2020-08-06 17:09   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-07-30 10:14 ` [patch V3 3/3] x86: Select POSIX_CPU_TIMERS_TASK_WORK Thomas Gleixner
2020-08-06 17:09   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-07-31 12:39 ` [patch V3 0/3] posix-cpu-timers: Move expiry into task work context Oleg Nesterov
2020-08-04 13:20 ` peterz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.