Re: [PATCH] af_packet: TPACKET_V3: replace busy-wait loop

From: Jakub Kicinski
Date: Wed Jul 15 2020 - 20:22:56 EST


On Wed, 15 Jul 2020 18:35:00 -0400 Willem de Bruijn wrote:
> On Wed, Jul 15, 2020 at 4:21 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
> >
> > On Tue, 7 Jul 2020 17:28:04 +0206 John Ogness wrote:
> > > A busy-wait loop is used to implement waiting for bits to be copied
> > > from the skb to the kernel buffer before retiring a block. This is
> > > a problem on PREEMPT_RT because the copying task could be preempted
> > > by the busy-waiting task and thus live lock in the busy-wait loop.
> > >
> > > Replace the busy-wait logic with an rwlock_t. This provides lockdep
> > > coverage and makes the code RT ready.
> > >
> > > Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
> >
> > Is taking a lock and immediately releasing it better than a completion?
> > Seems like the lock is guaranteed to dirty a cache line, which would
> > otherwise be avoided here.
> >
> > Willem, would you be able to take a look as well? Is this path
> > performance sensitive in real life?
>
> No objections from me.
>
> I guess this resolves the issue on preempt_rt, because the spinlocks act as
> mutexes. It will still spin on write_lock otherwise, no huge difference from
> existing logic.

Thanks!

If no one else objects I'm putting this in net-next.

Seems a little late for 5.8.