LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Jaewon Kim <jaewon31.kim@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
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: Tue, 28 May 2019 14:34:46 +0200 [thread overview]
Message-ID: <1559046886.13873.2.camel@suse.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1905231001100.1553-100000@iolanthe.rowland.org>
[-- Attachment #1: Type: text/plain, Size: 777 bytes --]
Am Donnerstag, den 23.05.2019, 10:01 -0400 schrieb Alan Stern:
> On Wed, 22 May 2019, Oliver Neukum wrote:
>
> > On Mi, 2019-05-22 at 10:56 -0400, Alan Stern wrote:
> > > On Wed, 22 May 2019, Oliver Neukum wrote:
> > >
> > > > I agree with the problem, but I fail to see why this issue would be
> > > > specific to USB. Shouldn't this be done in the device core layer?
> > >
> > > Only for drivers that are on the block-device writeback path. The
> > > device core doesn't know which drivers these are.
> >
> > Neither does USB know. It is very hard to predict or even tell which
> > devices are block device drivers. I think we must assume that
> > any device may be affected.
>
> All right. Would you like to submit a patch?
Do you like this one?
Regards
Oliver
[-- Attachment #2: 0001-base-force-NOIO-allocations-during-unplug.patch --]
[-- Type: text/x-patch, Size: 1522 bytes --]
From 0dc9c7dfe994fc9c28a63ba283e4442c237f6989 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Tue, 28 May 2019 11:43:02 +0200
Subject: [PATCH] base: force NOIO allocations during unplug
There is one overlooked situation under which a driver
must not do IO to allocate memory. You cannot do that
while disconnecting a device. A device being disconnected
is no longer functional in most cases, yet IO may fail
only when the handler runs.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/base/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index fd7511e04e62..a7f5f45bd761 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2229,6 +2229,7 @@ void device_del(struct device *dev)
struct device *parent = dev->parent;
struct kobject *glue_dir = NULL;
struct class_interface *class_intf;
+ unsigned int noio_flag;
/*
* Hold the device lock and set the "dead" flag to guarantee that
@@ -2256,6 +2257,7 @@ void device_del(struct device *dev)
device_remove_sys_dev_entry(dev);
device_remove_file(dev, &dev_attr_dev);
}
+ noio_flag = memalloc_noio_save();
if (dev->class) {
device_remove_class_symlinks(dev);
@@ -2277,6 +2279,8 @@ void device_del(struct device *dev)
device_platform_notify(dev, KOBJ_REMOVE);
device_remove_properties(dev);
device_links_purge(dev);
+ memalloc_noio_restore(noio_flag);
+
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
--
2.16.4
next prev parent reply other threads:[~2019-05-28 12:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 16:02 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
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 [this message]
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=1559046886.13873.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=stern@rowland.harvard.edu \
--cc=ytk.lee@samsung.com \
--subject='Re: [RFC PATCH] usb: host: xhci: allow __GFP_FS in dma allocation' \
/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
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).