From nobody Tue Apr 29 18:30:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Zn85D4r4cz5vMmW; Tue, 29 Apr 2025 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Zn85D0Chlz4Hgc; Tue, 29 Apr 2025 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745951440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PTQs3Cu9Ir0E0s1pwlpHpfX5tHrMis/GgqKUQuGecII=; b=CX/SB/h7g3VM1qosLwtEt274FTM7dcTR9e1RjyjuBKXIjzze2iQKUs7Z1pYkVCSTPDFGIQ UErXvjvHrcE0qiwI8SCqjyaCeG7IOQY0a7UoybHWh9RYSFOB/ev7dq1WqL+y+dbu7GHZKe oggFqKpk9+wJ0tSKE5W27Vojez+Wb3KIQcJoFdoARbGbc2OgdDRagJ3flP7RcpOojk19cA GC6yZ0iSjfNP9cVAC/aYBNo3eNQDh++q+vu4dOqXXPMz1XdJ3qhN79DkRYTVUOGQnj+9Pp rZdDTsPuMFQ7Snzxd5XagfxKxatQaf0MySOi6p4a7RLLGbqDksTmr0y5uep7xg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1745951440; a=rsa-sha256; cv=none; b=qeUalQpWb0zy/aA+atIYtp843Ag46tH8s2MQKreNI2d/vN8LHQuRW3Zirj+bm64y9KCLT4 57tLoN8YuL62A6yaWkuyWGYlhdskMhlUhCNVK1LgFWxGG//oc5GDBoTZibN11c6vsmA5Zg 7R++INzFZDNBFfEuwdH6xYva0h8UTeYJj1Mtkn/OqCfwY5J3W91b7VJRasr0WX2An/Tc64 SHGyHqh6cRVzCvEqPUiOWqOJo2w/9xpiHtT3bWDlrAIZCSdwP+EoNhK0+Hv+dKBnJI4GzB hOYV5YBFqAt1UC2PKCgAbJhNYpT/pHYrSo9dz8xaKi8/jSrTurLitq+36BUmRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1745951440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PTQs3Cu9Ir0E0s1pwlpHpfX5tHrMis/GgqKUQuGecII=; b=k3Uk9QvyO+TtLZjakhINTBNB9GPLfpjL5L4Qb8thVYg5CE/hETg98ek0KIFK8SZ5rv6SZI brosX4jY/SV6l7eKwRyhqttkoGtvEdExmWd8cTLykhCB/hvpKlagCNua6VWyx/FwYFq8Rv 6/o3OoGJR3ttPCOzs0XHBcXFAu1vgJY904DT2tsjz1v8hCY/5wcN5WLhrPdodh7DZfdSnz s22fEWEXjI/HV7BtJSGhBb3Sx42x7+0otzKPdNX/ZOO2/GBRjoHzMNMUF0GxHHJRaSdR1J qOrzn8ZOwUnd/bt6zZpYptPL3iOtlpl6slCNe+dXgt6K5WSW/k+ukDDxIfYvEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Zn85C6XC4zXQM; Tue, 29 Apr 2025 18:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 53TIUdOw022629; Tue, 29 Apr 2025 18:30:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 53TIUdXc022626; Tue, 29 Apr 2025 18:30:39 GMT (envelope-from git) Date: Tue, 29 Apr 2025 18:30:39 GMT Message-Id: <202504291830.53TIUdXc022626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 207e58ce8a6d - stable/14 - sdhci: Use bus_topo_lock and taskqueue_bus for hotplug events List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 207e58ce8a6dfdce44f4d5e1607dc98551d15eaa Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=207e58ce8a6dfdce44f4d5e1607dc98551d15eaa commit 207e58ce8a6dfdce44f4d5e1607dc98551d15eaa Author: John Baldwin AuthorDate: 2025-03-10 17:33:49 +0000 Commit: John Baldwin 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;