lkml.org 
[lkml]   [2019]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] usb: host: xhci: allow __GFP_FS in dma allocation
On Tue, 21 May 2019, Oliver Neukum wrote:

> On Mo, 2019-05-20 at 10:16 -0400, Alan Stern wrote:
> > On Mon, 20 May 2019, Christoph Hellwig wrote:
> >
> > > GFP_KERNEL if you can block, GFP_ATOMIC if you can't for a good reason,
> > > that is the allocation is from irq context or under a spinlock. If you
> > > think you have a case where you think you don't want to block, but it
> > > is not because of the above reasons we need to have a chat about the
> > > details.
> >
> > What if the allocation requires the kernel to swap some old pages out
> > to the backing store, but the backing store is on the device that the
> > driver is managing? The swap can't take place until the current I/O
> > operation is complete (assuming the driver can handle only one I/O
> > operation at a time), and the current operation can't complete until
> > the old pages are swapped out. Result: deadlock.
> >
> > Isn't that the whole reason for using GFP_NOIO in the first place?
>
> Hi,
>
> lookig at this it seems to me that we are in danger of a deadlock
>
> - during reset - devices cannot do IO while being reset
> covered by the USB layer in usb_reset_device
> - resume & restore - devices cannot do IO while suspended
> covered by driver core in rpm_callback
> - disconnect - a disconnected device cannot do IO
> is this a theoretical case or should I do something to
> the driver core?
>
> How about changing configurations on USB?

Changing configurations amounts to much the same as disconnecting,
because both operations destroy all the existing interfaces.

Disconnect can arise in two different ways.

Physical hot-unplug: All I/O operations will fail.

Rmmod or unbind: I/O operations will succeed.

The second case is probably okay. The first we can do nothing about.
However, in either case we do need to make sure that memory allocations
do not require any writebacks. This suggests that we need to call
memalloc_noio_save() from within usb_unbind_interface().

Alan Stern

\
 
 \ /
  Last update: 2019-05-21 16:01    [W:0.047 / U:1.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site