From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754630AbdEQQAV (ORCPT ); Wed, 17 May 2017 12:00:21 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47512 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753672AbdEQQAU (ORCPT ); Wed, 17 May 2017 12:00:20 -0400 Date: Wed, 17 May 2017 09:00:15 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: LKML Subject: Re: [PATCH] tracing: Move postpone selftests to core from early_initcall Reply-To: paulmck@linux.vnet.ibm.com References: <20170517111435.7388c033@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170517111435.7388c033@gandalf.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17051716-2213-0000-0000-000001BBA241 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007078; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00861803; UDB=6.00427479; IPR=6.00641463; BA=6.00005355; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015491; XFM=3.00000015; UTC=2017-05-17 16:00:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051716-2214-0000-0000-00005626548F Message-Id: <20170517160015.GJ3956@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-17_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705170121 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 17, 2017 at 11:14:35AM -0400, Steven Rostedt wrote: > > I hit the following lockdep splat when booting with ftrace selftests > enabled, as well as CONFIG_PREEMPT and LOCKDEP. > > Testing dynamic ftrace ops #1: > (1 0 1 0 0) > (1 1 2 0 0) > (2 1 3 0 169) > (2 2 4 0 50066) > ------------[ cut here ]------------ > WARNING: CPU: 0 PID: 13 at kernel/rcu/srcutree.c:202 check_init_srcu_struct+0x60/0x70 > Modules linked in: > CPU: 0 PID: 13 Comm: rcu_tasks_kthre Not tainted 4.12.0-rc1-test+ #587 > Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v02.05 05/07/2012 > task: ffff880119628040 task.stack: ffffc900006a4000 > RIP: 0010:check_init_srcu_struct+0x60/0x70 > RSP: 0000:ffffc900006a7d98 EFLAGS: 00010246 > RAX: 0000000000000246 RBX: 0000000000000000 RCX: 0000000000000000 > RDX: ffff880119628040 RSI: 00000000ffffffff RDI: ffffffff81e5fb40 > RBP: ffffc900006a7e20 R08: 00000023b403c000 R09: 0000000000000001 > R10: ffffc900006a7e40 R11: 0000000000000000 R12: ffffffff81e5fb40 > R13: 0000000000000286 R14: ffff880119628040 R15: ffffc900006a7e98 > FS: 0000000000000000(0000) GS:ffff88011ea00000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: ffff88011edff000 CR3: 0000000001e0f000 CR4: 00000000001406f0 > Call Trace: > ? __synchronize_srcu+0x6e/0x140 > ? lock_acquire+0xdc/0x1d0 > ? ktime_get_mono_fast_ns+0x5d/0xb0 > synchronize_srcu+0x6f/0x110 > ? synchronize_srcu+0x6f/0x110 > rcu_tasks_kthread+0x20a/0x540 > kthread+0x114/0x150 > ? __rcu_read_unlock+0x70/0x70 > ? kthread_create_on_node+0x40/0x40 > ret_from_fork+0x2e/0x40 > Code: f6 83 70 06 00 00 03 49 89 c5 74 0d be 01 00 00 00 48 89 df e8 42 fa ff ff 4c 89 ee 4c 89 e7 e8 b7 42 75 00 5b 41 5c 41 5d 5d c3 <0f> ff eb aa 66 90 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 > ---[ end trace 5c3f4206ce50f6ac ]--- > > What happens is that the selftests include a creating of a dynamically > allocated ftrace_ops, which requires the use of synchronize_rcu_tasks() > which uses srcu, and triggers the above warning. > > It appears that synchronize_rcu_tasks() is not set up at early_initcall(), > but it is at core_initcall(). By moving the tests down to that location > works out properly. > > Cc: "Paul E. McKenney" > Signed-off-by: Steven Rostedt (VMware) Acked-by: "Paul E. McKenney" But it looks like I need to raise the priority of making SRCU safe throughout boot, including the "mid-boot dead zone"... Thanx, Paul > --- > kernel/trace/trace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 3f2aed4..fcc9a2d 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -1558,7 +1558,7 @@ static __init int init_trace_selftests(void) > > return 0; > } > -early_initcall(init_trace_selftests); > +core_initcall(init_trace_selftests); > #else > static inline int run_tracer_selftest(struct tracer *type) > { > -- > 2.9.3 >