Re: [PATCH] usb: yurex: Rearrange code not to need GFP_ATOMIC

From: Oliver Neukum
Date: Mon Sep 21 2020 - 09:00:35 EST


Am Montag, den 21.09.2020, 14:52 +0200 schrieb Pavel Machek:
> Hi!

> >
> > Task goes to TASK_INTERRUPTIBLE
> >
> > > if (retval >= 0)
> > > timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
> >
> > Task turns into Sleeping Beauty until timeout
>
> Is there way to do the allocations for submit_urb before the

No. In theory you do not even know which HC will get the URB.
Preallocating resources is impossible. I do consider this a
design bug in the usbcore API.

> prepare_to_wait? GFP_ATOMIC would be nice to avoid... and doing
> GFP_ATOMIC from normal process context just because of task_state
> seems ... wrong.

Well, then you will need to change the rest of the logic
and use a struct completion. Give the age and practical
relevance of the driver I would recommend against making
such drastic changes and let it just be in its awkward
but correct state.

Regards
Oliver