From nobody Tue Dec 14 23:53:27 2021 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 9DCD218E3FAE; Tue, 14 Dec 2021 23:53:27 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JDFZH2fZgz3Cr3; Tue, 14 Dec 2021 23:53:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3A61C120A4; Tue, 14 Dec 2021 23:53:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BENrR85070746; Tue, 14 Dec 2021 23:53:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BENrRnL070745; Tue, 14 Dec 2021 23:53:27 GMT (envelope-from git) Date: Tue, 14 Dec 2021 23:53:27 GMT Message-Id: <202112142353.1BENrRnL070745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f581847a7277 - main - hyperv: scanning locking is using the bus mtx 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f581847a7277576dd71e3d4f7de324150799c7f1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639526007; 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=ieIyzHqfoOStkhL8sutWmqWU3BPJrjEGzzYgw1U9q2I=; b=RPKRLKO8IMlNV0BYzHTEb7WMcrJdGw7+JDEw90aGHF+6nOspob3f+Wq2YRvlkvBvO0BYdx CvtQEYLPQn7/c/SkCQ7mrhCaRxSTvGkHTe2bNHcnxY47BwDfyxhLq3U9UphK2giGR/xNjn 3r8qk/D7nlH7JVts6R//E6pIBp6Q3uy0vgj8+wjl03m0FDi1PtqMJEHTvjlc2Dt6oQxqBO 5clRekmSaD0GFEyz3eNMjeKt8GmmYVPzDsFGgYtYSZ+p15Qoro896todv6OYY/+YSGCHF1 tQfwKRmqdFNafR9y4coxCcz7LM7eNmSnDJZ9SnpA43rkjRHAqiQyLjaN7n6gmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639526007; a=rsa-sha256; cv=none; b=uLXCLULAvGgaNNg2Y+jxnRlRZsQxo+MPuGB1tUDgXah3N2DhebAPvFnAjryvq/GjEbzK7h tOMC/gQkhWftY9eC3M9hT98jhWB69H3Q4wT7NCgkutYBgATXdUIwyS/9/sdOHgU9v0yrU/ IcCLeC1gl3dYCZbOoRddyPu6yNkPW3U7Fxa9kzkhcBTHIRbumcIyuc/yBdyDgc3o7g9c2W cZ1x4s/WOBojDs/PHHPEVOVhyf4LePRkGeGPQiot60tnZSMuOzCqS438WIHbSnFQM0hIes gx+oC5tAJhriBdWm1fZ44+nSA0SotfJbsZ/6yJBIfONodpvKwaGojdwih4oaCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f581847a7277576dd71e3d4f7de324150799c7f1 commit f581847a7277576dd71e3d4f7de324150799c7f1 Author: Warner Losh AuthorDate: 2021-12-14 23:45:18 +0000 Commit: Warner Losh CommitDate: 2021-12-14 23:53:09 +0000 hyperv: scanning locking is using the bus mtx The scanning code uses Giant to coordinate its accesses to newbus as well as to synchronize a little state within hyperv's vmbus. Switch to the new bus_topo_* functions instead of referring to Giant explicitly. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D31840 --- sys/dev/hyperv/vmbus/vmbus.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index 31951cbf4858..f0dea84426eb 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -520,9 +520,9 @@ vmbus_scan_done_task(void *xsc, int pending __unused) { struct vmbus_softc *sc = xsc; - mtx_lock(&Giant); + bus_topo_lock(); sc->vmbus_scandone = true; - mtx_unlock(&Giant); + bus_topo_unlock(); wakeup(&sc->vmbus_scandone); } @@ -577,9 +577,9 @@ vmbus_scan(struct vmbus_softc *sc) * Wait for all vmbus devices from the initial channel offers to be * attached. */ - GIANT_REQUIRED; + bus_topo_assert(); while (!sc->vmbus_scandone) - mtx_sleep(&sc->vmbus_scandone, &Giant, 0, "vmbusdev", 0); + mtx_sleep(&sc->vmbus_scandone, bus_topo_mtx(), 0, "vmbusdev", 0); if (bootverbose) { device_printf(sc->vmbus_dev, "device scan, probe and attach " @@ -592,17 +592,17 @@ static void vmbus_scan_teardown(struct vmbus_softc *sc) { - GIANT_REQUIRED; + bus_topo_assert(); if (sc->vmbus_devtq != NULL) { - mtx_unlock(&Giant); + bus_topo_unlock(); taskqueue_free(sc->vmbus_devtq); - mtx_lock(&Giant); + bus_topo_lock(); sc->vmbus_devtq = NULL; } if (sc->vmbus_subchtq != NULL) { - mtx_unlock(&Giant); + bus_topo_unlock(); taskqueue_free(sc->vmbus_subchtq); - mtx_lock(&Giant); + bus_topo_lock(); sc->vmbus_subchtq = NULL; } } @@ -1070,19 +1070,18 @@ vmbus_add_child(struct vmbus_channel *chan) struct vmbus_softc *sc = chan->ch_vmbus; device_t parent = sc->vmbus_dev; - mtx_lock(&Giant); - + bus_topo_lock(); chan->ch_dev = device_add_child(parent, NULL, -1); if (chan->ch_dev == NULL) { - mtx_unlock(&Giant); + bus_topo_unlock(); device_printf(parent, "device_add_child for chan%u failed\n", chan->ch_id); return (ENXIO); } device_set_ivars(chan->ch_dev, chan); device_probe_and_attach(chan->ch_dev); + bus_topo_unlock(); - mtx_unlock(&Giant); return (0); } @@ -1091,13 +1090,13 @@ vmbus_delete_child(struct vmbus_channel *chan) { int error = 0; - mtx_lock(&Giant); + bus_topo_lock(); if (chan->ch_dev != NULL) { error = device_delete_child(chan->ch_vmbus->vmbus_dev, chan->ch_dev); chan->ch_dev = NULL; } - mtx_unlock(&Giant); + bus_topo_unlock(); return (error); }