git: 5775048272df - main - acpi: Tasks: Ensure taskqueue is running before allowing to drain
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Nov 2026 13:26:35 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=5775048272dfabf614c1107058c226165ccfe366
commit 5775048272dfabf614c1107058c226165ccfe366
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-11-25 13:23:38 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-25 13:25:04 +0000
acpi: Tasks: Ensure taskqueue is running before allowing to drain
In AcpiOsWaitEventsComplete(), fix the test controlling whether to call
taskqueue_drain_all(): That must happen only if threads to process the
taskqueue have been created.
In the initial code, there is a very small window where
'acpi_boot_tasks_nb' could be 0 but some task was concurrently enqueued
(e.g., by an interrupt), leading to a call to taskqueue_drain_all()
which would wait forever in the absence of threads processing the
taskqueue.
Reported by: llm-postcr
Sponsored by: The FreeBSD Foundation
---
sys/dev/acpica/Osd/OsdSchedule.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index f05ed7bfd2d7..989616a1eb03 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -239,15 +239,12 @@ AcpiOsWaitEventsComplete(void)
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
- if (!atomic_load_int(&acpi_taskq_started) &&
- atomic_load_int(&acpi_boot_tasks_nb) > 0) {
- if (!warning_printed) {
- warning_printed = true;
- printf("%s: Task processing not started, ignoring request\n",
- __func__);
- }
- } else
+ if (atomic_load_int(&acpi_taskq_started))
taskqueue_drain_all(acpi_taskq);
+ else if (!warning_printed && atomic_load_int(&acpi_boot_tasks_nb) > 0) {
+ warning_printed = true;
+ printf("%s: Task processing not started, ignoring request\n", __func__);
+ }
return_VOID;
}