[3.19.y-ckt stable] Patch "perf: Fix PERF_EVENT_IOC_PERIOD deadlock" has been added to the 3.19.y-ckt tree

Kamal Mostafa kamal at canonical.com
Wed Jan 20 01:02:23 UTC 2016


This is a note to let you know that I have just added a patch titled

    perf: Fix PERF_EVENT_IOC_PERIOD deadlock

to the linux-3.19.y-queue branch of the 3.19.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.19.y-queue

This patch is scheduled to be released in version 3.19.8-ckt13.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.19.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

---8<------------------------------------------------------------

>From 0c051c22ff8171a3bf2fa1ccbbc17463629c48e8 Mon Sep 17 00:00:00 2001
From: Peter Zijlstra <peterz at infradead.org>
Date: Mon, 30 Nov 2015 12:56:15 +0100
Subject: perf: Fix PERF_EVENT_IOC_PERIOD deadlock

commit 642c2d671ceff40e9453203ea0c66e991e11e249 upstream.

Dmitry reported a fairly silly recursive lock deadlock for
PERF_EVENT_IOC_PERIOD, fix this by explicitly doing the inactive part of
__perf_event_period() instead of calling that function.

Reported-by: Dmitry Vyukov <dvyukov at google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
Cc: Alexander Potapenko <glider at google.com>
Cc: Arnaldo Carvalho de Melo <acme at kernel.org>
Cc: Arnaldo Carvalho de Melo <acme at redhat.com>
Cc: Eric Dumazet <edumazet at google.com>
Cc: Jiri Olsa <jolsa at redhat.com>
Cc: Kostya Serebryany <kcc at google.com>
Cc: Linus Torvalds <torvalds at linux-foundation.org>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Sasha Levin <sasha.levin at oracle.com>
Cc: Stephane Eranian <eranian at google.com>
Cc: Thomas Gleixner <tglx at linutronix.de>
Cc: Vince Weaver <vincent.weaver at maine.edu>
Fixes: c7999c6f3fed ("perf: Fix PERF_EVENT_IOC_PERIOD migration race")
Link: http://lkml.kernel.org/r/20151130115615.GJ17308@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo at kernel.org>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 kernel/events/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index c4535e3..23cd3aa 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3805,7 +3805,14 @@ retry:
 		goto retry;
 	}

-	__perf_event_period(&pe);
+	if (event->attr.freq) {
+		event->attr.sample_freq = value;
+	} else {
+		event->attr.sample_period = value;
+		event->hw.sample_period = value;
+	}
+
+	local64_set(&event->hw.period_left, 0);
 	raw_spin_unlock_irq(&ctx->lock);

 	return 0;
--
1.9.1





More information about the kernel-team mailing list