From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753700AbbJaNrm (ORCPT ); Sat, 31 Oct 2015 09:47:42 -0400 Received: from smtprelay0141.hostedemail.com ([216.40.44.141]:58376 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752440AbbJaNrl (ORCPT ); Sat, 31 Oct 2015 09:47:41 -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:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:6119:6261:7514:7875:7903:8660:9163:10004:10400:10450:10455:10462:10464:10848:10967:11026:11232:11658:11914:12043:12295:12296:12517:12519:12555:12740:13069:13148:13156:13161:13228:13229:13230:13311:13357:14040:14096:14097:19904:19999:21060:21080:30003:30029: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:5,LUA_SUMMARY:none X-HE-Tag: corn83_25a78164b2238 X-Filterd-Recvd-Size: 2349 Date: Sat, 31 Oct 2015 09:47:36 -0400 From: Steven Rostedt To: Alexei Starovoitov Cc: Yang Shi , ast@kernel.org, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, netdev@vger.kernel.org, linaro-kernel@lists.linaro.org Subject: Re: [PATCH] bpf: convert hashtab lock to raw lock Message-ID: <20151031094736.494427d7@grimm.local.home> In-Reply-To: <20151031000356.GA28070@Alexeis-MacBook-Pro.local> References: <1446243386-26582-1-git-send-email-yang.shi@linaro.org> <20151031000356.GA28070@Alexeis-MacBook-Pro.local> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; 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 Fri, 30 Oct 2015 17:03:58 -0700 Alexei Starovoitov wrote: > On Fri, Oct 30, 2015 at 03:16:26PM -0700, Yang Shi wrote: > > When running bpf samples on rt kernel, it reports the below warning: > > > > BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:917 > > in_atomic(): 1, irqs_disabled(): 128, pid: 477, name: ping > > Preemption disabled at:[] kprobe_perf_func+0x30/0x228 > ... > > diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c > > index 83c209d..972b76b 100644 > > --- a/kernel/bpf/hashtab.c > > +++ b/kernel/bpf/hashtab.c > > @@ -17,7 +17,7 @@ > > struct bpf_htab { > > struct bpf_map map; > > struct hlist_head *buckets; > > - spinlock_t lock; > > + raw_spinlock_t lock; > > How do we address such things in general? > I bet there are tons of places around the kernel that > call spin_lock from atomic. > I'd hate to lose the benefits of lockdep of non-raw spin_lock > just to make rt happy. You wont lose any benefits of lockdep. Lockdep still checks raw_spin_lock(). The only difference between raw_spin_lock and spin_lock is that in -rt spin_lock turns into an rt_mutex() and raw_spin_lock stays a spin lock. The error is that in -rt, you called a mutex and not a spin lock while atomic. -- Steve