Re: [PATCH v1 2/3] async: Introduce async_schedule_dev_nocall()

From: Stanislaw Gruszka
Date: Fri Dec 29 2023 - 09:54:25 EST


On Fri, Dec 29, 2023 at 02:37:36PM +0100, Rafael J. Wysocki wrote:
> > > +bool async_schedule_dev_nocall(async_func_t func, struct device *dev)
> > > +{
> > > + struct async_entry *entry;
> > > +
> > > + entry = kzalloc(sizeof(struct async_entry), GFP_KERNEL);
> >
> > Is GFP_KERNEL intended here ?
>
> Yes, it is.
>
> PM will be the only user of this, at least for now, and it all runs in
> process context.
>
> > I think it's not safe since will
> > be called from device_resume_noirq() .
>
> device_resume_noirq() runs in process context too.
>
> The name is somewhat confusing (sorry about that) and it means that
> hardirq handlers (for the majority of IRQs) don't run in that resume
> phase, but interrupts are enabled locally on all CPUs (this is
> required for wakeup handling, among other things).

Then my concern would be: if among devices with disabled IRQs are
disk devices? Seems there are disk devices as well, and because
GFP_KERNEL can start reclaiming memory by doing disk IO (write
dirty pages for example), with disk driver interrupts disabled
reclaiming process can not finish.

I do not see how such possible infinite waiting for disk IO
scenario is prevented here, did I miss something?

Regards
Stanislaw