linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Christoph Hellwig <hch@infradead.org>,
	Jaewon Kim <jaewon31.kim@gmail.com>
Cc: linux-mm@kvack.org, gregkh@linuxfoundation.org,
	Jaewon Kim <jaewon31.kim@samsung.com>,
	m.szyprowski@samsung.com, ytk.lee@samsung.com,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [RFC PATCH] usb: host: xhci: allow __GFP_FS in dma allocation
Date: Mon, 20 May 2019 11:09:25 +0200	[thread overview]
Message-ID: <1558343365.12672.2.camel@suse.com> (raw)
In-Reply-To: <20190520055657.GA31866@infradead.org>

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


  reply	other threads:[~2019-05-20  9:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 16:02 [RFC PATCH] usb: host: xhci: allow __GFP_FS in dma allocation Jaewon Kim
2019-05-17 16:34 ` Matthew Wilcox
2019-05-18  1:53   ` Jaewon Kim
2019-05-20  5:56 ` Christoph Hellwig
2019-05-20  9:09   ` Oliver Neukum [this message]
2019-05-20 10:12     ` Christoph Hellwig
2019-05-20 14:16       ` Alan Stern
2019-05-20 14:23         ` Christoph Hellwig
2019-05-21  8:54           ` Oliver Neukum
2019-05-21 13:27             ` Christoph Hellwig
2019-05-21 13:11         ` Oliver Neukum
2019-05-21 14:00           ` Alan Stern
2019-05-22  6:31             ` Oliver Neukum
2019-05-22 14:56               ` Alan Stern
2019-05-22 20:47                 ` Oliver Neukum
2019-05-23 14:01                   ` Alan Stern
2019-05-28 12:34                     ` Oliver Neukum
2019-05-28 14:25                       ` Alan Stern
2019-05-23 12:32   ` Oliver Neukum
2019-05-23 16:35     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1558343365.12672.2.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=jaewon31.kim@gmail.com \
    --cc=jaewon31.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=ytk.lee@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).