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

From: Jakub Kicinski
Date: Thu Sep 12 2024 - 19:59:35 EST


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.