Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1267994 > unrolled thread
| Started by | Shuah Khan <shuahkh@osg.samsung.com> |
|---|---|
| First post | 2015-11-12 15:50 +0100 |
| Last post | 2015-11-16 00:10 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] media: fix kernel hang in media_device_unregister() during device removal Shuah Khan <shuahkh@osg.samsung.com> - 2015-11-12 15:50 +0100
Re: [PATCH] media: fix kernel hang in media_device_unregister() during device removal Shuah Khan <shuahkh@osg.samsung.com> - 2015-11-12 17:20 +0100
Re: [PATCH] media: fix kernel hang in media_device_unregister() during device removal Sakari Ailus <sakari.ailus@iki.fi> - 2015-11-16 00:10 +0100
| From | Shuah Khan <shuahkh@osg.samsung.com> |
|---|---|
| Date | 2015-11-12 15:50 +0100 |
| Subject | [PATCH] media: fix kernel hang in media_device_unregister() during device removal |
| Message-ID | <qu1mi-1Ij-7@gated-at.bofh.it> |
Media core drivers (dvb, v4l2, bridge driver) unregister
their entities calling media_device_unregister_entity()
during device removal from their unregister paths. In
addition media_device_unregister() tries to unregister
entity calling media_device_unregister_entity() for each
one of them. This adds lot of contention on mdev->lock in
device removal sequence. Fix to not unregister entities
from media_device_unregister(), and let drivers take care
of it. Drivers need to unregister to cover the case of
module removal. This patch fixes the problem by deleting
the entity list walk to call media_device_unregister_entity()
for each entity. With this fix there is no kernel hang after
a sequence of device insertions followed by removal.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
drivers/media/media-device.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 1312e93..c7ab7c9 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -577,8 +577,6 @@ EXPORT_SYMBOL_GPL(__media_device_register);
*/
void media_device_unregister(struct media_device *mdev)
{
- struct media_entity *entity;
- struct media_entity *next;
struct media_link *link, *tmp_link;
struct media_interface *intf, *tmp_intf;
@@ -596,9 +594,6 @@ void media_device_unregister(struct media_device *mdev)
kfree(intf);
}
- list_for_each_entry_safe(entity, next, &mdev->entities, graph_obj.list)
- media_device_unregister_entity(entity);
-
device_remove_file(&mdev->devnode.dev, &dev_attr_model);
media_devnode_unregister(&mdev->devnode);
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Shuah Khan <shuahkh@osg.samsung.com> |
|---|---|
| Date | 2015-11-12 17:20 +0100 |
| Subject | Re: [PATCH] media: fix kernel hang in media_device_unregister() during device removal |
| Message-ID | <qu2Ln-2J4-3@gated-at.bofh.it> |
| In reply to | #1267994 |
On 11/12/2015 07:41 AM, Shuah Khan wrote:
> Media core drivers (dvb, v4l2, bridge driver) unregister
> their entities calling media_device_unregister_entity()
> during device removal from their unregister paths. In
> addition media_device_unregister() tries to unregister
> entity calling media_device_unregister_entity() for each
> one of them. This adds lot of contention on mdev->lock in
> device removal sequence. Fix to not unregister entities
> from media_device_unregister(), and let drivers take care
> of it. Drivers need to unregister to cover the case of
> module removal. This patch fixes the problem by deleting
> the entity list walk to call media_device_unregister_entity()
> for each entity. With this fix there is no kernel hang after
> a sequence of device insertions followed by removal.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
This is MC Next Gen patch mc_next_gen.v8.4 branch
Sorry I forgot to tag it
-- Shuah
> ---
> drivers/media/media-device.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 1312e93..c7ab7c9 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -577,8 +577,6 @@ EXPORT_SYMBOL_GPL(__media_device_register);
> */
> void media_device_unregister(struct media_device *mdev)
> {
> - struct media_entity *entity;
> - struct media_entity *next;
> struct media_link *link, *tmp_link;
> struct media_interface *intf, *tmp_intf;
>
> @@ -596,9 +594,6 @@ void media_device_unregister(struct media_device *mdev)
> kfree(intf);
> }
>
> - list_for_each_entry_safe(entity, next, &mdev->entities, graph_obj.list)
> - media_device_unregister_entity(entity);
> -
> device_remove_file(&mdev->devnode.dev, &dev_attr_model);
> media_devnode_unregister(&mdev->devnode);
>
>
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Sakari Ailus <sakari.ailus@iki.fi> |
|---|---|
| Date | 2015-11-16 00:10 +0100 |
| Subject | Re: [PATCH] media: fix kernel hang in media_device_unregister() during device removal |
| Message-ID | <qveAO-7Qs-13@gated-at.bofh.it> |
| In reply to | #1267994 |
Hi Shuah,
On Thu, Nov 12, 2015 at 07:41:47AM -0700, Shuah Khan wrote:
> Media core drivers (dvb, v4l2, bridge driver) unregister
> their entities calling media_device_unregister_entity()
> during device removal from their unregister paths. In
> addition media_device_unregister() tries to unregister
> entity calling media_device_unregister_entity() for each
> one of them. This adds lot of contention on mdev->lock in
> device removal sequence. Fix to not unregister entities
> from media_device_unregister(), and let drivers take care
> of it. Drivers need to unregister to cover the case of
> module removal. This patch fixes the problem by deleting
> the entity list walk to call media_device_unregister_entity()
> for each entity. With this fix there is no kernel hang after
> a sequence of device insertions followed by removal.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
> drivers/media/media-device.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 1312e93..c7ab7c9 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -577,8 +577,6 @@ EXPORT_SYMBOL_GPL(__media_device_register);
> */
> void media_device_unregister(struct media_device *mdev)
> {
> - struct media_entity *entity;
> - struct media_entity *next;
> struct media_link *link, *tmp_link;
> struct media_interface *intf, *tmp_intf;
>
> @@ -596,9 +594,6 @@ void media_device_unregister(struct media_device *mdev)
> kfree(intf);
> }
>
> - list_for_each_entry_safe(entity, next, &mdev->entities, graph_obj.list)
> - media_device_unregister_entity(entity);
> -
> device_remove_file(&mdev->devnode.dev, &dev_attr_model);
> media_devnode_unregister(&mdev->devnode);
>
media_device_unregister() is expected to clean up all the entities still
registered with it (as it does to links and interfaces). Could you share
details of the problems you saw in case you haven't found the actual
underlying issue causing them?
--
Kind regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web