Subject: Re: [PATCHv2 net] usbnet: fix cyclical race on disconnect with work queue

From: Jakub Kicinski <[email-masked]>
Date: Thu, 12 Sep 2024 16:59:19 -0700

On Thu, 12 Sep 2024 11:37:14 +0200 Oliver Neukum wrote:
> > barriers? They make it seem like we're doing something clever
> > with memory ordering, while really we're just depending on normal
> > properties of the tasklet/timer/work APIs.  
> 
> Good question. I added this because they are used in usbnet_defer_kevent()
> which can be used in hard irq context. Are you saying I should check
> whether this is actually needed?

I am slightly bolder, I'm saying that my reading of the code is 
that it is in fact not needed :)
We build our "proof of correctness" on tasklet/timer/work APIs
which already provide all necessary barriers.

> > FTR disable_work_sync() would work nicely here but it'd be
> > a PITA for backports.  
> 
> So should I use it?

Up to you. It'd avoid work rescheduling but the backport would
be a pain, and off top of my head timer doesn't have a disable
so we'd still need the flag.