Date: Tue, 29 Apr 2025 18:30:39 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 207e58ce8a6d - stable/14 - sdhci: Use bus_topo_lock and taskqueue_bus for hotplug events Message-ID: <202504291830.53TIUdXc022626@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=207e58ce8a6dfdce44f4d5e1607dc98551d15eaa commit 207e58ce8a6dfdce44f4d5e1607dc98551d15eaa Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2025-03-10 17:33:49 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2025-04-29 14:42:44 +0000 sdhci: Use bus_topo_lock and taskqueue_bus for hotplug events Drop SDHCI_LOCK and instead acquire bus_topo_lock when adding and removing new-bus devices. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D49271 (cherry picked from commit aaf0a7302d10912e62dcd8e047798b4a2aefa039) --- sys/dev/sdhci/sdhci.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 3dc8fb617820..161783483e0e 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -701,12 +701,14 @@ sdhci_card_task(void *arg, int pending __unused) mmccam_start_discovery(slot->sim); SDHCI_UNLOCK(slot); #else - d = slot->dev = device_add_child(slot->bus, "mmc", -1); SDHCI_UNLOCK(slot); + bus_topo_lock(); + d = slot->dev = device_add_child(slot->bus, "mmc", -1); if (d) { device_set_ivars(d, slot); (void)device_probe_and_attach(d); } + bus_topo_unlock(); #endif } else SDHCI_UNLOCK(slot); @@ -732,7 +734,9 @@ sdhci_card_task(void *arg, int pending __unused) slot->opt &= ~SDHCI_TUNING_ENABLED; SDHCI_UNLOCK(slot); callout_drain(&slot->retune_callout); + bus_topo_lock(); device_delete_child(slot->bus, d); + bus_topo_unlock(); #endif } else SDHCI_UNLOCK(slot); @@ -761,10 +765,10 @@ sdhci_handle_card_present_locked(struct sdhci_slot *slot, bool is_present) was_present = slot->dev != NULL; #endif if (!was_present && is_present) { - taskqueue_enqueue_timeout(taskqueue_swi_giant, + taskqueue_enqueue_timeout(taskqueue_bus, &slot->card_delayed_task, -SDHCI_INSERT_DELAY_TICKS); } else if (was_present && !is_present) { - taskqueue_enqueue(taskqueue_swi_giant, &slot->card_task); + taskqueue_enqueue(taskqueue_bus, &slot->card_task); } } @@ -1130,7 +1134,7 @@ no_tuning: "timeout", CTLFLAG_RWTUN, &slot->timeout, 0, "Maximum timeout for SDHCI transfers (in secs)"); TASK_INIT(&slot->card_task, 0, sdhci_card_task, slot); - TIMEOUT_TASK_INIT(taskqueue_swi_giant, &slot->card_delayed_task, 0, + TIMEOUT_TASK_INIT(taskqueue_bus, &slot->card_delayed_task, 0, sdhci_card_task, slot); callout_init(&slot->card_poll_callout, 1); callout_init_mtx(&slot->timeout_callout, &slot->mtx, 0); @@ -1184,8 +1188,8 @@ sdhci_cleanup_slot(struct sdhci_slot *slot) callout_drain(&slot->timeout_callout); callout_drain(&slot->card_poll_callout); callout_drain(&slot->retune_callout); - taskqueue_drain(taskqueue_swi_giant, &slot->card_task); - taskqueue_drain_timeout(taskqueue_swi_giant, &slot->card_delayed_task); + taskqueue_drain(taskqueue_bus, &slot->card_task); + taskqueue_drain_timeout(taskqueue_bus, &slot->card_delayed_task); SDHCI_LOCK(slot); d = slot->dev;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504291830.53TIUdXc022626>