From nobody Mon Mar 10 17:35:42 2025 X-Original-To: dev-commits-src-main@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 4ZBPDv0ZSnz5r7Dd; Mon, 10 Mar 2025 17:35:43 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZBPDt5F1Jz3TSw; Mon, 10 Mar 2025 17:35:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1741628142; 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=5UjtaLSRXPMeiEsKHjwwsYycvxfv8h+0ROvM++Pl64s=; b=lK6ikGEJb3Q75wQTFeoJcP34UtB96GVDor5nTyc6dvzYlP6vsWNf6SHWEvdQgparhuBdx6 6E8ZCQNptITt/K92/SzeMHAfYN42rGi9metrx09JTNekYPGAFRHAICY8nzTN9NZNR9Bh8G Eoi9x3KrOAEN00tOi3X51P0qUNv9KHwj4KXx0ow/+cfQarSss/Fld5CESGbCvh88B0AsqV W+X2/urpkuQuM4WOyDkexcGbBf4KcU5P62nKwXgU3H6sVOVEwFAnymPx0ZRZ8lNGhIeGnO o+jhui6uWXmZZcspDh7VJEUvw2mmTk9FOY+nPoe6nmvQhCrvH6ryY5uh+S2SNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1741628142; a=rsa-sha256; cv=none; b=hEikGxKiKyHU0fNAIqLttQ279CHz63Q/UVLcnan7hOtdlW1IpSh7R4c4SxqNtpnhoqNrnW I+I2w4htPDEIt6y44kHBZTGFpzpenqw50BzJqwUIMQBGxtkIru4hQI2Fs3udQr+Sa8CjqX ucdS+LF+EHEmJNJR3mCtgP3CqkwAPcRt1DQ0LGia1rr99ncGSM9gAQO0PONX96U+3yRqx7 g3QrNuIOmONiheoqX/FzIZLGsa2gZF9A1X/vf/lRCdVxgdIs3EuX53S+jTW3RhWvH08ZGA xv1hToXZySrN6MDJimIbqd9y6Eeb7+FocAfF53AYa7dBeJ8958u17yg+yZoAOg== 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=1741628142; 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=5UjtaLSRXPMeiEsKHjwwsYycvxfv8h+0ROvM++Pl64s=; b=c9cjIoJCBGuS1vH1WwU+7A+Ih4dEpcqJHNWvJCE6WUgds6qjn1/24GhLHualNy5RVMLOxw I+Hjpf1+xyV51kwi9Eu9He4E5IDOBLhCM+3vIT2NMptJ6d3Z/+UkB7J3m0EG0bGHFIEedJ 4WlYizqX+4xpl29Cn2qKUOyBh1bE0DTwko1xNxzIyABKdd+Gh2kFcER64GGvNkpIbs9cMC OHGf595U10JBfR1I32uw4PekfcuCzmi/yu+IrvQJVwY+c3gOOWY0uUUjLJ/YnpnhR663mr hGAa+i6VqHZwnZW/IBkEWwV8LA7wDGS5lQYf9voC24ur+CVS6fHL4NBVBkNr1g== 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 4ZBPDt4rpyzq99; Mon, 10 Mar 2025 17:35:42 +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 52AHZgWB027137; Mon, 10 Mar 2025 17:35:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 52AHZgdT027134; Mon, 10 Mar 2025 17:35:42 GMT (envelope-from git) Date: Mon, 10 Mar 2025 17:35:42 GMT Message-Id: <202503101735.52AHZgdT027134@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: aaf0a7302d10 - main - sdhci: Use bus_topo_lock and taskqueue_bus for hotplug events List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: aaf0a7302d10912e62dcd8e047798b4a2aefa039 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=aaf0a7302d10912e62dcd8e047798b4a2aefa039 commit aaf0a7302d10912e62dcd8e047798b4a2aefa039 Author: John Baldwin AuthorDate: 2025-03-10 17:33:49 +0000 Commit: John Baldwin CommitDate: 2025-03-10 17:33:49 +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 --- 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 0be20e7aa523..2f79d3099f47 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -700,12 +700,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", DEVICE_UNIT_ANY); SDHCI_UNLOCK(slot); + bus_topo_lock(); + d = slot->dev = device_add_child(slot->bus, "mmc", DEVICE_UNIT_ANY); if (d) { device_set_ivars(d, slot); (void)device_probe_and_attach(d); } + bus_topo_unlock(); #endif } else SDHCI_UNLOCK(slot); @@ -731,7 +733,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); @@ -760,10 +764,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); } } @@ -1129,7 +1133,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); @@ -1186,8 +1190,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;