All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Yang Shi <yang.shi@linaro.org>,
	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
Date: Sun, 1 Nov 2015 14:56:22 -0800	[thread overview]
Message-ID: <20151101225620.GA28272@Alexeis-MacBook-Pro.local> (raw)
In-Reply-To: <20151031094736.494427d7@grimm.local.home>

On Sat, Oct 31, 2015 at 09:47:36AM -0400, Steven Rostedt wrote:
> On Fri, 30 Oct 2015 17:03:58 -0700
> Alexei Starovoitov <alexei.starovoitov@gmail.com> 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:[<ffff80000017db58>] 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.

I see. The patch makes sense then.
Would be good to document this peculiarity of spin_lock.

  parent reply	other threads:[~2015-11-01 22:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 22:16 [PATCH] bpf: convert hashtab lock to raw lock Yang Shi
2015-10-31  0:03 ` Alexei Starovoitov
2015-10-31 13:47   ` Steven Rostedt
2015-10-31 18:37     ` Daniel Borkmann
2015-11-02 17:12       ` Shi, Yang
2015-11-02 17:24         ` Steven Rostedt
2015-11-02 17:31           ` Shi, Yang
2015-11-02 17:28         ` Daniel Borkmann
2015-11-01 22:56     ` Alexei Starovoitov [this message]
2015-11-02  8:59       ` Thomas Gleixner
2015-11-02 17:09         ` Shi, Yang
2015-11-02 20:47 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151101225620.GA28272@Alexeis-MacBook-Pro.local \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=yang.shi@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.