lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Feb 2014 13:33:56 +0100
From:	Henrik Austad <henrik@...tad.us>
To:	LKML <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...uxtronix.de>
Cc:	Henrik Austad <henrik@...tad.us>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	John Stultz <john.stultz@...aro.org>,
	Henrik Austad <haustad@...co.com>
Subject: [PATCH 1/6] Expose do_timer CPU from tick-common

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@...utronix.de>
CC: Peter Zijlstra <peterz@...radead.org>
CC: Frederic Weisbecker <fweisbec@...il.com>
CC: John Stultz <john.stultz@...aro.org>
Signed-off-by: Henrik Austad <haustad@...co.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ