From: Henrik Austad <henrik@austad.us>
To: LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linuxtronix.de>
Cc: Henrik Austad <henrik@austad.us>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
John Stultz <john.stultz@linaro.org>,
Henrik Austad <haustad@cisco.com>
Subject: [PATCH 1/6] Expose do_timer CPU from tick-common
Date: Tue, 25 Feb 2014 13:33:56 +0100 [thread overview]
Message-ID: <1393331641-14016-2-git-send-email-henrik@austad.us> (raw)
In-Reply-To: <1393331641-14016-1-git-send-email-henrik@austad.us>
This allows other parts of the kernel access to the tick_do_timer_cpu
variable in a controlled manner. The values will differ depending on
which mode is compiled in:
* CONFIG_HZ_PERIODIC: One (normally boot-cpu) is responsible for the
time update. This will never change unless the CPU is removed
(hotplugging). You will normally see a 0 returned every time here.
* CONFIG_NO_HZ_IDLE: system will disable periodic timer-interrupts on
the cpu if only the idle-task is running. This means that the timer
cpu will change often.
* CONFIG_NO_HZ_FULL: any CPU running only a single task can have
timer-interrupts disabled. As for NO_HZ_IDLE, timer CPU will change
often.
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>
Signed-off-by: Henrik Austad <haustad@cisco.com>
---
kernel/time/tick-common.c | 12 ++++++++++++
kernel/time/tick-internal.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 20b2fe3..1729b4b 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -348,6 +348,18 @@ void tick_handover_do_timer(int *cpup)
}
/*
+ * Return the current timer-CPU (RO)
+ *
+ * Warning! this value can (and will) change depending on how timer-ticks are
+ * handled, the value returned could be outdated the moment it is read by
+ * userspace.
+ */
+int tick_expose_cpu(void)
+{
+ return tick_do_timer_cpu;
+}
+
+/*
* Shutdown an event device on a given cpu:
*
* This is called on a life CPU, when a CPU is dead. So we cannot
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 8329669..5051dbd 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -154,5 +154,6 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
#endif
+extern int tick_expose_cpu(void);
extern void do_timer(unsigned long ticks);
extern void update_wall_time(void);
--
1.7.9.5
next prev parent reply other threads:[~2014-02-25 12:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-25 12:33 [PATCH 0/6 v2] Expose do_timer CPU as RW to userspace Henrik Austad
2014-02-25 12:33 ` Henrik Austad [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393331641-14016-2-git-send-email-henrik@austad.us \
--to=henrik@austad.us \
--cc=fweisbec@gmail.com \
--cc=haustad@cisco.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tglx@linuxtronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®