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:	Fri,  4 Apr 2014 14:05:32 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	tglx@...utronix.de, fweisbec@...il.com, peterz@...radead.org,
	mingo@...nel.org, tj@...nel.org, lizefan@...wei.com
Cc:	linaro-kernel@...ts.linaro.org, linaro-networking@...aro.org,
	Arvind.Chauhan@....com, linux-kernel@...r.kernel.org,
	cgroups@...r.kernel.org, Viresh Kumar <viresh.kumar@...aro.org>
Subject: [PATCH V2 5/8] hrtimer: don't migrate pinned timers

migrate_hrtimer() is called when a CPU goes down and its timers are required to
be migrated to some other CPU. Its the responsibility of the users of the
hrtimer to remove it before control reaches to migrate_hrtimer().

As these were the pinned hrtimers, the best we can do is: don't migrate these
and report to the user as well.

That's all this patch does.

Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 kernel/hrtimer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index c5a4bf4..853dd8c 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1640,6 +1640,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
 {
 	struct hrtimer *timer;
 	struct timerqueue_node *node;
+	int is_pinned;
 
 	while ((node = timerqueue_getnext(&old_base->active))) {
 		timer = container_of(node, struct hrtimer, node);
@@ -1652,6 +1653,15 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
 		 * under us on another CPU
 		 */
 		__remove_hrtimer(timer, HRTIMER_STATE_MIGRATE, 0);
+
+		is_pinned = timer->state & HRTIMER_STATE_PINNED;
+
+		/* Check if CPU still has pinned timers */
+		if (unlikely(WARN(is_pinned,
+				  "%s: can't migrate pinned timer: %p, deactivating it\n",
+				  __func__, timer)))
+			continue;
+
 		timer->base = new_base;
 		/*
 		 * Enqueue the timers on the new cpu. This does not
-- 
1.7.12.rc2.18.g61b472e

--
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