From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423991AbcBQWkK (ORCPT ); Wed, 17 Feb 2016 17:40:10 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:38016 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423442AbcBQWkH (ORCPT ); Wed, 17 Feb 2016 17:40:07 -0500 Subject: Re: [RFC][PATCH 12/12] perf: Collapse and fix event_function_call() users To: Peter Zijlstra , mingo@kernel.org, alexander.shishkin@linux.intel.com, eranian@google.com References: <20160111162458.427203780@infradead.org> <20160111163229.411314288@infradead.org> Cc: linux-kernel@vger.kernel.org, vince@deater.net, dvyukov@google.com, andi@firstfloor.org, jolsa@redhat.com From: Sasha Levin Message-ID: <56C4F673.40600@oracle.com> Date: Wed, 17 Feb 2016 17:38:43 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20160111163229.411314288@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/11/2016 11:25 AM, Peter Zijlstra wrote: > There is one common bug left in all the event_function_call() users, > between loading ctx->task and getting to the remote_function(), > ctx->task can already have been changed. > > Therefore we need to double check and retry if ctx->task != current. > > Insert another trampoline specific to event_function_call() that > checks for this and further validates state. This also allows getting > rid of the active/inactive functions. > > > Note: Stephane, can you please look at __perf_event_enable()? > > Cc: Stephane Eranian > Signed-off-by: Peter Zijlstra (Intel) Hey Peter, I seem to be hitting a warning added by this patch: [ 258.890172] WARNING: CPU: 5 PID: 14801 at kernel/events/core.c:226 event_function+0x3a7/0x550() [ 258.891356] Modules linked in:[ 258.892440] CPU: 5 PID: 14801 Comm: syz-executor Not tainted 4.5.0-rc4-next-20160217-sasha-00024-g888c008-dirty #2976 [ 258.893818] 1ffff1006c57bf07 ffff880362bdf8c0 ffffffffa43d511d ffffffff00000005 [ 258.895071] fffffbfff60265b8 0000000041b58ab3 ffffffffafb1d490 ffffffffa43d4f85 [ 258.896127] ffffffffa25984c0 0000000000000038 0000000000000282 ffff880362bdf898 [ 258.897182] Call Trace: [ 258.897559] [] dump_stack+0x198/0x21b [ 258.898258] [] ? arch_local_irq_restore+0x5f/0x5f [ 258.899099] [] ? is_module_text_address+0x20/0x20 [ 258.899934] [] warn_slowpath_common+0xe1/0x160 [ 258.900723] [] ? event_function+0x3a7/0x550 [ 258.901473] [] warn_slowpath_null+0x29/0x30 [ 258.902186] [] event_function+0x3a7/0x550 [ 258.902913] [] ? perf_event_read_event+0x3c0/0x3c0 [ 258.906328] [] ? free_ctx+0x70/0x70 [ 258.907633] [] remote_function+0x14a/0x200 [ 258.908776] [] generic_exec_single+0x2e8/0x5a0 [ 258.913186] [] smp_call_function_single+0x1dd/0x350 [ 258.917536] [] task_function_call+0x123/0x160 [ 258.938733] [] event_function_call+0x23b/0x440 [ 258.949427] [] _perf_event_enable+0xbf/0x100 [ 258.952368] [] _perf_event_refresh+0x8c/0xd0 [ 258.953776] [] perf_ioctl+0x2af/0x870 [ 258.963056] [] do_vfs_ioctl+0x1b0/0x1250 [ 258.975817] [] SyS_ioctl+0x8f/0xc0 [ 258.976277] [] entry_SYSCALL_64_fastpath+0x23/0xc1 Thanks, Sasha