* [PATCH] request_firmware() private workqueue (was: Re: Using firmware_class with recent 2.6 kernels)
[not found] <3F1BD157.4090509@convergence.de>
@ 2003-07-26 10:18 ` Manuel Estrada Sainz
2003-07-26 15:59 ` Manuel Estrada Sainz
0 siblings, 1 reply; 4+ messages in thread
From: Manuel Estrada Sainz @ 2003-07-26 10:18 UTC (permalink / raw)
To: Michael Hunold; +Cc: LKML, Greg KH
On Mon, Jul 21, 2003 at 01:41:11PM +0200, Michael Hunold wrote:
[snip]
> To get a start, I took your sample driver and compiled it as a module.
> I commented out all firmware load methods, except the async
> notification I'm most interested in.
>
> When I load the module, it prints the debug message and goes to sleep --
> ok. But now the system is completely frozen (no keyboard or mouse
> interaction possible) until the timeout is reached and the async
> notification function is called, which of course says that the firmware
> could not been loaded.
Using a private workqueue fixes the issue, sleeping for many seconds
from the common workqueue was not nice.
Note that the problem only happens when appropriate firmware hotplug
support is not available and request_firmware_work_func() has to wait
until the timeout.
About the attached patch:
- use a private workqueue so we can sleep without interfering
with other subsystems.
Have a nice day
Manuel
--
--- Manuel Estrada Sainz <ranty@debian.org>
<ranty@bigfoot.com>
<ranty@users.sourceforge.net>
------------------------ <manuel.estrada@hispalinux.es> -------------------
Let us have the serenity to accept the things we cannot change, courage to
change the things we can, and wisdom to know the difference.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] request_firmware() private workqueue (was: Re: Using firmware_class with recent 2.6 kernels)
2003-07-26 10:18 ` [PATCH] request_firmware() private workqueue (was: Re: Using firmware_class with recent 2.6 kernels) Manuel Estrada Sainz
@ 2003-07-26 15:59 ` Manuel Estrada Sainz
2003-07-29 15:02 ` [PATCH] request_firmware() private workqueue Michael Hunold
0 siblings, 1 reply; 4+ messages in thread
From: Manuel Estrada Sainz @ 2003-07-26 15:59 UTC (permalink / raw)
To: Michael Hunold; +Cc: LKML, Greg KH, John Alvord
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
On Sat, Jul 26, 2003 at 12:18:18PM +0200, Manuel Estrada Sainz wrote:
> On Mon, Jul 21, 2003 at 01:41:11PM +0200, Michael Hunold wrote:
[snip]
> About the attached patch:
>
> - use a private workqueue so we can sleep without interfering
> with other subsystems.
Oops, as usuall I forgot to attach the patch, It is attached now.
Sorry
Manuel
--
--- Manuel Estrada Sainz <ranty@debian.org>
<ranty@bigfoot.com>
<ranty@users.sourceforge.net>
------------------------ <manuel.estrada@hispalinux.es> -------------------
Let us have the serenity to accept the things we cannot change, courage to
change the things we can, and wisdom to know the difference.
[-- Attachment #2: request_firmware_own-workqueue.diff --]
[-- Type: text/plain, Size: 1243 bytes --]
Index: firmware_class.c
===================================================================
RCS file: /home/cvs/linux-2.5/drivers/base/firmware_class.c,v
retrieving revision 1.3
diff -u -r1.3 firmware_class.c
--- firmware_class.c 4 Jul 2003 02:21:18 -0000 1.3
+++ firmware_class.c 26 Jul 2003 08:38:07 -0000
@@ -22,6 +22,8 @@
MODULE_LICENSE("GPL");
static int loading_timeout = 10; /* In seconds */
+static struct workqueue_struct *firmware_wq;
+
struct firmware_priv {
char fw_id[FIRMWARE_NAME_MAX];
@@ -467,7 +469,7 @@
};
INIT_WORK(&fw_work->work, request_firmware_work_func, fw_work);
- schedule_work(&fw_work->work);
+ queue_work(firmware_wq, &fw_work->work);
return 0;
}
@@ -485,12 +487,20 @@
__FUNCTION__);
class_unregister(&firmware_class);
}
+ firmware_wq = create_workqueue("firmware");
+ if (!firmware_wq) {
+ printk(KERN_ERR "%s: create_workqueue failed\n", __FUNCTION__);
+ class_remove_file(&firmware_class, &class_attr_timeout);
+ class_unregister(&firmware_class);
+ error = -EIO;
+ }
return error;
}
static void __exit
firmware_class_exit(void)
{
+ destroy_workqueue(firmware_wq);
class_remove_file(&firmware_class, &class_attr_timeout);
class_unregister(&firmware_class);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] request_firmware() private workqueue
2003-07-26 15:59 ` Manuel Estrada Sainz
@ 2003-07-29 15:02 ` Michael Hunold
2003-08-01 19:15 ` [PATCH] " Manuel Estrada Sainz
0 siblings, 1 reply; 4+ messages in thread
From: Michael Hunold @ 2003-07-29 15:02 UTC (permalink / raw)
To: ranty; +Cc: Linux Kernel Mailing List, Linus Torvalds, Alan Cox
Hello Manuel,
I've applied your patches
- request_firmware_own-workqueue.diff
- sysfs-bin-unbreak.diff
and it's working very well for the av7110 DVB driver.
I hope that these patches are applied to the mainline kernel soon, so
the other DVB drivers which need binary firmware blobs (namely
dvb-ttusb-dec, dvb-ttusb-budget and one frontend driver) can be ported.
This will get rid of the av7110 firmware in the kernel and the ugly
config hacks to get the other drivers working.
CU
Michael.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Re: request_firmware() private workqueue
2003-07-29 15:02 ` [PATCH] request_firmware() private workqueue Michael Hunold
@ 2003-08-01 19:15 ` Manuel Estrada Sainz
0 siblings, 0 replies; 4+ messages in thread
From: Manuel Estrada Sainz @ 2003-08-01 19:15 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel Mailing List, Linus Torvalds, Michael Hunold
[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]
On Tue, Jul 29, 2003 at 05:02:28PM +0200, Michael Hunold wrote:
> Hello Manuel,
>
> I've applied your patches
> - request_firmware_own-workqueue.diff
> - sysfs-bin-unbreak.diff
>
> and it's working very well for the av7110 DVB driver.
>
> I hope that these patches are applied to the mainline kernel soon, so
> the other DVB drivers which need binary firmware blobs (namely
> dvb-ttusb-dec, dvb-ttusb-budget and one frontend driver) can be ported.
>
> This will get rid of the av7110 firmware in the kernel and the ugly
> config hacks to get the other drivers working.
In it's current form request_firmware_async() sleeps way too long on
the system's shared workqueue, which make it unresponsive until the
firmware load finishes or gets canceled.
The attached patch makes it use it's own workqueue, please apply.
Have a nice day
Manuel
PS: the sysfs issue is handled in a separate email.
--
--- Manuel Estrada Sainz <ranty@debian.org>
<ranty@bigfoot.com>
<ranty@users.sourceforge.net>
------------------------ <manuel.estrada@hispalinux.es> -------------------
Let us have the serenity to accept the things we cannot change, courage to
change the things we can, and wisdom to know the difference.
[-- Attachment #2: request_firmware_own-workqueue.diff --]
[-- Type: text/plain, Size: 1295 bytes --]
Index: drivers/base/firmware_class.c
===================================================================
RCS file: /home/cvs/linux-2.5/drivers/base/firmware_class.c,v
retrieving revision 1.3
diff -u -r1.3 drivers/base/firmware_class.c
--- drivers/base/firmware_class.c 4 Jul 2003 02:21:18 -0000 1.3
+++ drivers/base/firmware_class.c 26 Jul 2003 08:38:07 -0000
@@ -22,6 +22,8 @@
MODULE_LICENSE("GPL");
static int loading_timeout = 10; /* In seconds */
+static struct workqueue_struct *firmware_wq;
+
struct firmware_priv {
char fw_id[FIRMWARE_NAME_MAX];
@@ -467,7 +469,7 @@
};
INIT_WORK(&fw_work->work, request_firmware_work_func, fw_work);
- schedule_work(&fw_work->work);
+ queue_work(firmware_wq, &fw_work->work);
return 0;
}
@@ -485,12 +487,20 @@
__FUNCTION__);
class_unregister(&firmware_class);
}
+ firmware_wq = create_workqueue("firmware");
+ if (!firmware_wq) {
+ printk(KERN_ERR "%s: create_workqueue failed\n", __FUNCTION__);
+ class_remove_file(&firmware_class, &class_attr_timeout);
+ class_unregister(&firmware_class);
+ error = -EIO;
+ }
return error;
}
static void __exit
firmware_class_exit(void)
{
+ destroy_workqueue(firmware_wq);
class_remove_file(&firmware_class, &class_attr_timeout);
class_unregister(&firmware_class);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-08-01 19:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <3F1BD157.4090509@convergence.de>
2003-07-26 10:18 ` [PATCH] request_firmware() private workqueue (was: Re: Using firmware_class with recent 2.6 kernels) Manuel Estrada Sainz
2003-07-26 15:59 ` Manuel Estrada Sainz
2003-07-29 15:02 ` [PATCH] request_firmware() private workqueue Michael Hunold
2003-08-01 19:15 ` [PATCH] " Manuel Estrada Sainz
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).