public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Stephane Eranian <eranian@google.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Jason Baron <jbaron@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [BUG] lock issue in perf cgroup with jump label enabled
Date: Thu, 03 Mar 2011 16:31:05 +0800	[thread overview]
Message-ID: <4D6F51C9.3020800@cn.fujitsu.com> (raw)

With CONFIG_JUMP_LABEL enabled:

# mount -t cgroup -o perf_event xxx /mnt
# mkdir /mnt/test
# ./perf stat -B -a -e cycles:u -G test -- sleep 1

lockdep warning will be triggered immediately, and the machine
will become unresponsive.

I guess this is the culprit?

In the "perf cgroup support" patch:

@@ -419,6 +781,17 @@ list_add_event(struct perf_event *event, struct perf_event_con
                list_add_tail(&event->group_entry, list);
        }
 
+       if (is_cgroup_event(event)) {
+               ctx->nr_cgroups++;
+               /*
+                * one more event:
+                * - that has cgroup constraint on event->cpu
+                * - that may need work on context switch
+                */
+               atomic_inc(&per_cpu(perf_cgroup_events, event->cpu));
+               jump_label_inc(&perf_sched_events);
+       }

list_add_event() is called with spin lock ctl->lock held,  while
jump_label_inc() will acquire jump_label_mutex..

             reply	other threads:[~2011-03-03  8:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  8:31 Li Zefan [this message]
2011-03-03 10:06 ` [BUG] lock issue in perf cgroup with jump label enabled Peter Zijlstra
2011-03-03 14:17   ` Peter Zijlstra
2011-03-04  2:07     ` Li Zefan

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=4D6F51C9.3020800@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=eranian@google.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /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