2017-12-01 02:06:30

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [RFC] bpf: offload: report device information for offloaded programs

Hi Kirill,

On Thu, 30 Nov 2017 16:19:13 +0300, Kirill Tkhai wrote:
> > @@ -164,6 +166,38 @@ int bpf_prog_offload_compile(struct bpf_prog *prog)
> > return bpf_prog_offload_translate(prog);
> > }
> >
> > +int bpf_prog_offload_info_fill(struct bpf_prog_info *info,
> > + struct bpf_prog *prog)
> > +{
> > + struct bpf_dev_offload *offload = prog->aux->offload;
> > + struct inode *ns_inode;
> > + struct path ns_path;
> > + struct net *net;
> > + int ret = 0;
> > + void *ptr;
> > +
> > + info->dev_bound = 1;
> > +
> > + rtnl_lock();
>
> rtnl_lock() is too big lock and it is already overused in kernel.
> Can't we use smaller lock in this driver to protect bpf_prog_offload_devs?
> I suppose rwlock would be appropriate for that.
>
> (Then, we may completely remove rtnl_lock() from bpf_prog_offload_init()
> and use readlocked dev_base_lock for __dev_get_by_index() instead and
> the new small_rwlock to link in the list.
>
> Not sure about bpf_prog_offload_verifier_prep() and bpf_prog_offload_translate()
> and which context expect net_device_ops->ndo_bpf users. Either they need rtnl
> or not).

Thanks for the comments, removing the use of rtnl_lock is definitely on
my todo list!

From 1585497267871643141@xxx Thu Nov 30 13:20:23 +0000 2017
X-GM-THRID: 1585448462384013049
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread