public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6 v2] Expose do_timer CPU as RW to userspace
@ 2014-02-25 12:33 Henrik Austad
  2014-02-25 12:33 ` [PATCH 1/6] Expose do_timer CPU from tick-common Henrik Austad
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Henrik Austad @ 2014-02-25 12:33 UTC (permalink / raw)
  To: LKML, Thomas Gleixner
  Cc: Henrik Austad, Thomas Gleixner, Peter Zijlstra,
	Frederic Weisbecker, John Stultz, Paul E. McKenney

From: Henrik Austad <haustad@cisco.com>

Hi!

This is a rework of the preiovus patch based on the feedback gathered
from the last round. I've split it up a bit, mostly to make it easier to
single out the parts that require more attention (#4 comes to mind).

Being able to read (and possible force a specific CPU to handle all
do_timer() updates) can be very handy when debugging a system and tuning
for performance. It is not always easy to route interrupts to a specific
core (or away from one, for that matter).

These patches therefore enables userspace to explicitly set which core
to handle do_timer(), regardless of NO_HZ_FULL or NO_HZ_IDLE.


Tested on x86_64 (in a VM with 8 emulated cores). Dumping the cores
every 100ms using

for i in $(seq 1 300); do
    cat /sys/kernel/timekeeping/current_cpu ;
    sleep 0.1;
done|sort -n|uniq -c

* CONFIG_NO_HZ_FULL:

Forced timer disabled
     38 -1
      6 0
     12 1
      9 2
      4 3
      5 4
    176 5
      4 6
     46 7

sysctl -w kernel.forced_timer_cpu=3
    300 3

* CONFIG_NO_HZ_FULL_ALL:

Forced timer disabled
    300 0
sysctl -w kernel.forced_timer_cpu=2
    300 2



* CONFIG_NO_HZ_IDLE

Forced timer disabled
     38 -1
     35 0
     20 1
     23 2
     69 3
     30 4
     39 5
     22 6
     24 7
sysctl -w kernel.forced_timer_cpu=4
    300 4

* CONFIG_HZ_PERIODIC

Forced timer disabled
    300 0

sysctl -w kernel.forced_timer_cpu=5
    300 5


I also took the liberty of adding paulmck as RCU is testing for
tick_do_timer_cpu in tree_plugin.h I don't expect RCU to blow up, but
better safe than sorry and all.

The series include
Patch 1:
  Make tick_do_timer_cpu readable from other parts of the kernel

Patch 2:
  Based on #1, add a simple sysfs interface for reading it from
  userspace. This also lays the foundation for #6.

Patch 3:
  Add sysctl-hook for exposing tick_do_timer_cpu to userspace.

Patch 4:
  Add support for forcing a specific core to handle all do_timer()
  updates. This is probably the patch that requires the most careful
  review.

Patch 5:
  Allow for setting/getting forced_cpu via sysctl

Patch 6:
  Allow for setting/getting forced_cpu via sysfs

Series is based on Linus' current upstream head 7472e0.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: John Stultz <john.stultz@linaro.org>
CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>


Henrik Austad (6):
  Expose do_timer CPU from tick-common
  Add sysfs RO interface to tick_do_timer_cpu
  Expose do_timer CPU as RO variable to userspace via sysctl
  Force a specific CPU to handle all do_timer() events.
  Expose the forced_timer_cpu to userspace via sysctl as R/W
  Expose tick_set_forced_cpu() via sysfs

 include/linux/clocksource.h |   19 +++++++
 kernel/sysctl.c             |   15 ++++++
 kernel/time/tick-common.c   |  115 +++++++++++++++++++++++++++++++++++++++++++
 kernel/time/tick-internal.h |    5 ++
 kernel/time/tick-sched.c    |   14 +++++-
 kernel/time/timekeeping.c   |  110 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 277 insertions(+), 1 deletion(-)

-- 
1.7.9.5


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

end of thread, other threads:[~2014-03-03 10:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-25 12:33 [PATCH 0/6 v2] Expose do_timer CPU as RW to userspace Henrik Austad
2014-02-25 12:33 ` [PATCH 1/6] Expose do_timer CPU from tick-common Henrik Austad
2014-02-25 12:33 ` [PATCH 2/6] Add sysfs RO interface to tick_do_timer_cpu Henrik Austad
2014-02-25 12:33 ` [PATCH 3/6] Expose do_timer CPU as RO variable to userspace via sysctl Henrik Austad
2014-02-25 12:33 ` [PATCH 4/6] Force a specific CPU to handle all do_timer() events Henrik Austad
2014-02-25 12:34 ` [PATCH 5/6] Expose the forced_timer_cpu to userspace via sysctl as R/W Henrik Austad
2014-02-25 12:34 ` [PATCH 6/6] Expose tick_set_forced_cpu() via sysfs Henrik Austad
2014-02-25 14:19 ` [PATCH 0/6 v2] Expose do_timer CPU as RW to userspace Frederic Weisbecker
2014-02-26  8:16   ` Henrik Austad
2014-02-26 13:02     ` Frederic Weisbecker
2014-02-27  8:37       ` Henrik Austad
2014-02-27 13:56         ` Frederic Weisbecker
2014-02-28  9:40           ` Henrik Austad
2014-02-28 23:08             ` Frederic Weisbecker
2014-03-03 10:42               ` Henrik Austad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox