From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752622AbcLGNDC (ORCPT ); Wed, 7 Dec 2016 08:03:02 -0500 Received: from smtprelay0217.hostedemail.com ([216.40.44.217]:52972 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752160AbcLGNDB (ORCPT ); Wed, 7 Dec 2016 08:03:01 -0500 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:2194:2199:2393:2553:2559:2562:2693:2897:2904:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:3872:3873:3874:4250:4321:4605:5007:6261:7875:7903:8660:8700:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12114:12438:12740:12760:13069:13148:13230:13311:13357:13439:14037:14096:14097:14181:14659:14721:21063:21080:21324:30012:30054:30090:30091,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,LFtime:2,LUA_SUMMARY:none X-HE-Tag: place15_1e418036ce339 X-Filterd-Recvd-Size: 2699 Date: Wed, 7 Dec 2016 07:53:26 -0500 From: Steven Rostedt To: Sebastian Andrzej Siewior Cc: LKML , linux-rt-users , Thomas Gleixner , Clark Williams , "Luis Claudio R. Goncalves" , John Kacur Subject: Re: [PATCH RT] net: Have __napi_schedule_irqoff() disable interrupts on RT Message-ID: <20161207075326.1ac592f3@gandalf.local.home> In-Reply-To: <20161207091040.qnx3znzpffobli7c@linutronix.de> References: <20161206175030.636989f0@gandalf.local.home> <20161207091040.qnx3znzpffobli7c@linutronix.de> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; 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 On Wed, 7 Dec 2016 10:10:40 +0100 Sebastian Andrzej Siewior wrote: > On 2016-12-06 17:50:30 [-0500], Steven Rostedt wrote: > > A customer hit a crash where the napi sd->poll_list became corrupted. > > The customer had the bnx2x driver, which does a > > __napi_schedule_irqoff() in its interrupt handler. Unfortunately, when > > running with CONFIG_PREEMPT_RT_FULL, this interrupt handler is run as a > > thread and is preemptable. The call to ____napi_schedule() must be done > > with interrupts disabled to protect the per cpu softnet_data's > > poll_list, which is protected by disabling interrupts (disabling > > preemption is enough when all interrupts are threaded and > > local_bh_disable() can't preempt). > > > > As bnx2x isn't the only driver that does this, the safest thing to do > > is to make __napi_schedule_irqoff() call __napi_schedule() instead when > > CONFIG_PREEMPT_RT_FULL is enabled, which will call local_irq_save() > > before calling ____napi_schedule(). > > It would work RT wise. But don't have the same problem if you boot the > kernel with threadirqs ? > I thought the same at first, but looking into the code for forced threaded interrupts, I saw this: local_bh_disable(); ret = action->thread_fn(action->irq, action->dev_id); irq_finalize_oneshot(desc, action); local_bh_enable(); Where without CONFIG_PREEMPT_RT_FULL, local_bh_disable() also disables preemption. Then all the handlers still can not be preempted by another handler. So it appears to be safe as well. -- Steve