Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752956Ab2JBLm5 (ORCPT ); Tue, 2 Oct 2012 07:42:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48131 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752304Ab2JBLmz (ORCPT ); Tue, 2 Oct 2012 07:42:55 -0400 Date: Tue, 2 Oct 2012 13:42:18 +0200 From: Jiri Olsa To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Frederic Weisbecker , Ingo Molnar , Paul Mackerras , Arnaldo Carvalho de Melo , Jiri Olsa , Stephane Eranian Subject: [PATCH] perf cgroups: Fix perf_cgroup_switch schedule in warning Message-ID: <20121002114218.GA5891@krava.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3290 Lines: 91 forgot to CC Stephane jirka --- hi, I'm getting following warning when running basic cgroup perf stuff: (perf stat -a -e faults -G krava -- sleep 10) WARNING: at kernel/events/core.c:397 perf_cgroup_switch+0x1c6/0x1e0() Hardware name: Montevina platform Modules linked in: Pid: 1173, comm: bash Not tainted 3.6.0+ #129 Call Trace: [] warn_slowpath_common+0x7f/0xc0 [] ? perf_ctx_lock+0x15/0x30 [] warn_slowpath_null+0x1a/0x20 [] perf_cgroup_switch+0x1c6/0x1e0 [] ? perf_event_context_sched_in+0xc0/0xc0 [] __perf_event_task_sched_in+0xa9/0x200 [] ? lock_release_holdtime.part.3+0xc7/0x160 [] finish_task_switch+0xb8/0xf0 [] __schedule+0x2eb/0x930 [] ? _raw_spin_unlock_irq+0x30/0x60 [] ? trace_hardirqs_on_caller+0x105/0x190 [] ? trace_hardirqs_on+0xd/0x10 [] ? _raw_spin_unlock_irq+0x3b/0x60 [] ? start_flush_work+0x108/0x180 [] schedule+0x29/0x70 [] schedule_timeout+0x1c5/0x210 [] ? add_wait_queue+0x4d/0x60 [] ? _raw_spin_unlock_irqrestore+0x65/0x80 [] ? trace_hardirqs_on_caller+0x105/0x190 [] ? trace_hardirqs_on+0xd/0x10 [] ? _raw_spin_unlock_irqrestore+0x42/0x80 [] n_tty_read+0x461/0x8b0 [] ? try_to_wake_up+0x310/0x310 [] tty_read+0x99/0xf0 [] vfs_read+0xaf/0x180 [] sys_read+0x4d/0x90 [] system_call_fastpath+0x16/0x1b Looking at the code the cpuctx->cgrp condition seems legal, and need just some adjustment. However, I don't fully understand that code and could be wrong.. just want to get rid of probably wrong warning.. ;) thanks, jirka --- Changing WARN_ON_ONCE condition for PERF_CGROUP_SWIN leg. It's legal to have cpuctx->cgrp already defined, but it's not legal not to have events active at the same time. Cc: Peter Zijlstra Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra CC: Arnaldo Carvalho de Melo Signed-off-by: Jiri Olsa --- kernel/events/core.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 7b9df35..733f794 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -394,7 +394,8 @@ void perf_cgroup_switch(struct task_struct *task, int mode) } if (mode & PERF_CGROUP_SWIN) { - WARN_ON_ONCE(cpuctx->cgrp); + WARN_ON_ONCE(cpuctx->cgrp && !cpuctx->ctx.is_active); + /* set cgrp before ctxsw in to * allow event_filter_match() to not * have to pass task around -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/