Skip to content

Commit 95be33a

Browse files
committed
Revert "device core: Remove deprecated create_singlethread_workqueue"
This reverts commit 2c507e4 ("device core: Remove deprecated create_singlethread_workqueue"). This is a temporary fix for qemu-arm hangs on the following command that schedule_work() triggers (?) dead-lock that nanosleep on hello->main() never returns. $ qemu-system-arm -M versatilepb -m 512M -nographic -serial null \ -semihosting -kernel rumpobj/tests/hello This should be fixed in a transparent way in a future. Signed-off-by: Hajime Tazaki <[email protected]>
1 parent f82b294 commit 95be33a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/base/dd.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
static DEFINE_MUTEX(deferred_probe_mutex);
5252
static LIST_HEAD(deferred_probe_pending_list);
5353
static LIST_HEAD(deferred_probe_active_list);
54+
static struct workqueue_struct *deferred_wq;
5455
static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
5556

5657
/*
@@ -174,7 +175,7 @@ static void driver_deferred_probe_trigger(void)
174175
* Kick the re-probe thread. It may already be scheduled, but it is
175176
* safe to kick it again.
176177
*/
177-
schedule_work(&deferred_probe_work);
178+
queue_work(deferred_wq, &deferred_probe_work);
178179
}
179180

180181
/**
@@ -210,10 +211,14 @@ void device_unblock_probing(void)
210211
*/
211212
static int deferred_probe_initcall(void)
212213
{
214+
deferred_wq = create_singlethread_workqueue("deferwq");
215+
if (WARN_ON(!deferred_wq))
216+
return -ENOMEM;
217+
213218
driver_deferred_probe_enable = true;
214219
driver_deferred_probe_trigger();
215220
/* Sort as many dependencies as possible before exiting initcalls */
216-
flush_work(&deferred_probe_work);
221+
flush_workqueue(deferred_wq);
217222
return 0;
218223
}
219224
late_initcall(deferred_probe_initcall);
@@ -477,7 +482,8 @@ int driver_probe_done(void)
477482
void wait_for_device_probe(void)
478483
{
479484
/* wait for the deferred probe workqueue to finish */
480-
flush_work(&deferred_probe_work);
485+
if (driver_deferred_probe_enable)
486+
flush_workqueue(deferred_wq);
481487

482488
/* wait for the known devices to complete their probing */
483489
wait_event(probe_waitqueue, atomic_read(&probe_count) == 0);

0 commit comments

Comments
 (0)