]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Oct 2014 20:16:06 +0000 (13:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Oct 2014 20:16:06 +0000 (13:16 -0700)
added patches:
perf-fix-a-race-condition-in-perf_remove_from_context.patch
perf-kmem-make-it-work-again-on-non-numa-machines.patch

queue-3.10/perf-fix-a-race-condition-in-perf_remove_from_context.patch [new file with mode: 0644]
queue-3.10/perf-kmem-make-it-work-again-on-non-numa-machines.patch [new file with mode: 0644]
queue-3.10/series

diff --git a/queue-3.10/perf-fix-a-race-condition-in-perf_remove_from_context.patch b/queue-3.10/perf-fix-a-race-condition-in-perf_remove_from_context.patch
new file mode 100644 (file)
index 0000000..12d856b
--- /dev/null
@@ -0,0 +1,63 @@
+From 3577af70a2ce4853d58e57d832e687d739281479 Mon Sep 17 00:00:00 2001
+From: Cong Wang <cwang@twopensource.com>
+Date: Tue, 2 Sep 2014 15:27:20 -0700
+Subject: perf: Fix a race condition in perf_remove_from_context()
+
+From: Cong Wang <cwang@twopensource.com>
+
+commit 3577af70a2ce4853d58e57d832e687d739281479 upstream.
+
+We saw a kernel soft lockup in perf_remove_from_context(),
+it looks like the `perf` process, when exiting, could not go
+out of the retry loop. Meanwhile, the target process was forking
+a child. So either the target process should execute the smp
+function call to deactive the event (if it was running) or it should
+do a context switch which deactives the event.
+
+It seems we optimize out a context switch in perf_event_context_sched_out(),
+and what's more important, we still test an obsolete task pointer when
+retrying, so no one actually would deactive that event in this situation.
+Fix it directly by reloading the task pointer in perf_remove_from_context().
+
+This should cure the above soft lockup.
+
+Signed-off-by: Cong Wang <cwang@twopensource.com>
+Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
+Signed-off-by: Peter Zijlstra <peterz@infradead.org>
+Cc: Paul Mackerras <paulus@samba.org>
+Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Link: http://lkml.kernel.org/r/1409696840-843-1-git-send-email-xiyou.wangcong@gmail.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/events/core.c |   10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -1398,6 +1398,11 @@ retry:
+        */
+       if (ctx->is_active) {
+               raw_spin_unlock_irq(&ctx->lock);
++              /*
++               * Reload the task pointer, it might have been changed by
++               * a concurrent perf_event_context_sched_out().
++               */
++              task = ctx->task;
+               goto retry;
+       }
+@@ -1829,6 +1834,11 @@ retry:
+        */
+       if (ctx->is_active) {
+               raw_spin_unlock_irq(&ctx->lock);
++              /*
++               * Reload the task pointer, it might have been changed by
++               * a concurrent perf_event_context_sched_out().
++               */
++              task = ctx->task;
+               goto retry;
+       }
diff --git a/queue-3.10/perf-kmem-make-it-work-again-on-non-numa-machines.patch b/queue-3.10/perf-kmem-make-it-work-again-on-non-numa-machines.patch
new file mode 100644 (file)
index 0000000..0b7a3cb
--- /dev/null
@@ -0,0 +1,42 @@
+From 4921e320244e099bdf237fd10428594ce5f5b87d Mon Sep 17 00:00:00 2001
+From: Jiri Olsa <jolsa@redhat.com>
+Date: Thu, 12 Sep 2013 18:39:36 +0200
+Subject: perf kmem: Make it work again on non NUMA machines
+
+From: Jiri Olsa <jolsa@redhat.com>
+
+commit 4921e320244e099bdf237fd10428594ce5f5b87d upstream.
+
+The commit '2814eb0 perf kmem: Remove die() calls' disabled 'perf kmem'
+command for machines without numa support. It made the command fail if
+'/sys/devices/system/node' dir wasn't found.
+
+Skipping the numa based initialization in case the directory is not
+found and continue execution.
+
+Signed-off-by: Jiri Olsa <jolsa@redhat.com>
+Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
+Cc: Frederic Weisbecker <fweisbec@gmail.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Paul Mackerras <paulus@samba.org>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Link: http://lkml.kernel.org/r/1379003976-5839-5-git-send-email-jolsa@redhat.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: zhangzhiqiang <zhangzhiqiang.zhang@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/builtin-kmem.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/perf/builtin-kmem.c
++++ b/tools/perf/builtin-kmem.c
+@@ -101,7 +101,7 @@ static int setup_cpunode_map(void)
+       dir1 = opendir(PATH_SYS_NODE);
+       if (!dir1)
+-              return -1;
++              return 0;
+       while ((dent1 = readdir(dir1)) != NULL) {
+               if (dent1->d_type != DT_DIR ||
index bb9e4eac3a0635862eb2fd54b8d6acae94c6cad6..664124d9ffa46786aa5934a976910d5539080589 100644 (file)
@@ -120,3 +120,5 @@ powerpc-perf-fix-abiv2-kernel-backtraces.patch
 parisc-only-use-mfast-indirect-calls-option-for-32-bit-kernel-builds.patch
 alarmtimer-do-not-signal-sigev_none-timers.patch
 alarmtimer-lock-k_itimer-during-timer-callback.patch
+perf-fix-a-race-condition-in-perf_remove_from_context.patch
+perf-kmem-make-it-work-again-on-non-numa-machines.patch