Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757258AbbDPOMN (ORCPT ); Thu, 16 Apr 2015 10:12:13 -0400 Received: from smtprelay0160.hostedemail.com ([216.40.44.160]:36269 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754664AbbDPOMK (ORCPT ); Thu, 16 Apr 2015 10:12:10 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2910:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:3874:4362:5007:6261:6691:7875:7901:7903:9707:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12296:12438:12517:12519:12555:12663:12740:13069:13311:13357:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: smile26_4be1578babd5d X-Filterd-Recvd-Size: 2490 Date: Thu, 16 Apr 2015 10:12:00 -0400 From: Steven Rostedt To: Jan Kiszka Cc: Sebastian Andrzej Siewior , RT , Linux Kernel Mailing List Subject: Re: [PATCH RT 3.18] ring-buffer: Mark irq_work as HARD_IRQ to prevent deadlocks Message-ID: <20150416101200.0633e93d@gandalf.local.home> In-Reply-To: <552FC1FE.4020406@siemens.com> References: <552FC1FE.4020406@siemens.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1788 Lines: 49 On Thu, 16 Apr 2015 16:06:54 +0200 Jan Kiszka wrote: > ftrace may trigger rb_wakeups while holding pi_lock which will also be > requested via trace_...->...->ring_buffer_unlock_commit->...-> > irq_work_queue->raise_softirq->try_to_wake_up. This quickly causes > deadlocks when trying to use ftrace under -rt. > > Resolve this by marking the ring buffer's irq_work as HARD_IRQ. Hmm, I could have sworn I wrote a patch like this not too long ago. I'll have to check that out. Thanks, -- Steve > > Signed-off-by: Jan Kiszka > --- > > I'm not yet sure if this doesn't push work into hard-irq context that > is better not done there on -rt. > > I'm also not sure if there aren't more such cases, given that -rt turns > the default irq_work wakeup policy around. But maybe we are lucky. > > kernel/trace/ring_buffer.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c > index f4fbbfc..6a1939e 100644 > --- a/kernel/trace/ring_buffer.c > +++ b/kernel/trace/ring_buffer.c > @@ -1252,6 +1252,7 @@ rb_allocate_cpu_buffer(struct ring_buffer *buffer, int nr_pages, int cpu) > init_irq_work(&cpu_buffer->irq_work.work, rb_wake_up_waiters); > init_waitqueue_head(&cpu_buffer->irq_work.waiters); > init_waitqueue_head(&cpu_buffer->irq_work.full_waiters); > + cpu_buffer->irq_work.work.flags = IRQ_WORK_HARD_IRQ; > > bpage = kzalloc_node(ALIGN(sizeof(*bpage), cache_line_size()), > GFP_KERNEL, cpu_to_node(cpu)); -- 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/