Re: [PATCH RFC] pci: report surprise removal events

From: Michael S. Tsirkin
Date: Mon Jun 30 2025 - 13:26:32 EST


On Mon, Jun 30, 2025 at 10:57:35AM -0600, Keith Busch wrote:
> On Mon, Jun 30, 2025 at 01:52:26PM +0000, Parav Pandit wrote:
> > >
> > > But I didn't suggest calling error_detected from report_error_detected.
> > > Just call it directly without device_lock. It's not very feasible to enforce a non-
> > > blocking callback, though, if speed is really a concern here.
> > Yeah, it would better to either always call a callback with or without the lock.
> > In some flows with lock and in some flows without lock would likely be
> > very bad as one cannot establish a sane locking order.
>
> On closer look, my suggestion without the device_lock may be racy, but
> using the device_lock prevents the notification that needs to happen.
> Hm, not as easy as I thought. :(

I think I will just add a work_struct and a flag that the driver can set
to schedule it on surprise removal then. Hmm?

--
MST