lkml.org 
[lkml]   [2014]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/6 v2] Expose do_timer CPU as RW to userspace
Date
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



\
 
 \ /
  Last update: 2014-02-25 14:21    [W:0.092 / U:122.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site