[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1558343365.12672.2.camel@suse.com>
Date: Mon, 20 May 2019 11:09:25 +0200
From: Oliver Neukum <oneukum@...e.com>
To: Christoph Hellwig <hch@...radead.org>,
Jaewon Kim <jaewon31.kim@...il.com>
Cc: linux-mm@...ck.org, gregkh@...uxfoundation.org,
Jaewon Kim <jaewon31.kim@...sung.com>,
m.szyprowski@...sung.com, ytk.lee@...sung.com,
linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [RFC PATCH] usb: host: xhci: allow __GFP_FS in dma allocation
On So, 2019-05-19 at 22:56 -0700, Christoph Hellwig wrote:
> Folks, you can't just pass arbitary GFP_ flags to dma allocation
> routines, beause very often they are not just wrappers around
> the page allocator.
>
> So no, you can't just fine grained control the flags, but the
> existing code is just as buggy.
>
> Please switch to use memalloc_noio_save() instead.
>
Hi,
we actually do. It is just higher up in the calling path:
int usb_reset_device(struct usb_device *udev)
{
int ret;
int i;
unsigned int noio_flag;
struct usb_port *port_dev;
struct usb_host_config *config = udev->actconfig;
struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent);
if (udev->state == USB_STATE_NOTATTACHED ||
udev->state == USB_STATE_SUSPENDED) {
dev_dbg(&udev->dev, "device reset not allowed in state %d\n",
udev->state);
return -EINVAL;
}
if (!udev->parent) {
/* this requires hcd-specific logic; see ohci_restart() */
dev_dbg(&udev->dev, "%s for root hub!\n", __func__);
return -EISDIR;
}
port_dev = hub->ports[udev->portnum - 1];
/*
* Don't allocate memory with GFP_KERNEL in current
* context to avoid possible deadlock if usb mass
* storage interface or usbnet interface(iSCSI case)
* is included in current configuration. The easist
* approach is to do it for every device reset,
* because the device 'memalloc_noio' flag may have
* not been set before reseting the usb device.
*/
noio_flag = memalloc_noio_save();
So, do we need to audit the mem_flags again?
What are we supposed to use? GFP_KERNEL?
Regards
Oliver
Powered by blists - more mailing lists