On 2022/04/19 23:48, Rafael J. Wysocki wrote: > On Tue, Apr 19, 2022 at 3:57 PM Tetsuo Handa > <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote: >> >> Flushing system-wide workqueues is dangerous and will be forbidden. >> Replace system_wq with local acpi_wq. >> >> Link: https://lkml.kernel.org/r/49925af7-78a8-a3dd-bce6-cfc02e1a9236@xxxxxxxxxxxxxxxxxxx >> Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> >> --- >> This patch blindly converts schedule_{,rcu_}work() into queue_{,rcu_}work() >> within drivers/acpi/ directory, based on an assumption that none of work items >> outside of drivers/acpi/ directory needs to be handled by acpi_wq. >> Also, I kept sharing acpi_wq between acpi/ and acpi/apei, based on assumption >> that sharing is safe and correct behavior. Did I convert correctly? > > Please don't do it this way. > > There is not much sense in sharing a dedicated workqueue between the > different pieces of code below. > > I guess that there is a need to switch over to dedicated workqueues in > all cases when the workqueue needs to be flushed directly. If so, > please let me look at what can be done. > Since system_wq is shared throughout the kernel, calling flush_scheduled_work() might cause deadlock. In order to avoid possibility of deadlock, there is a need to use a dedicated workqueue in all cases when some work is subjected to flush_workqueue(). This is one of patches for avoiding flush_scheduled_work() usage, but I'm not familiar with ACPI code. Thus, please introduce a dedicated workqueue in a way you think makes sense.