From nobody Thu Jan 26 19:25:50 2023 X-Original-To: dev-commits-src-branches@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 4P2rKC2hqtz3bTYY; Thu, 26 Jan 2023 19:25:51 +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 4P2rKB6lzSz4J7L; Thu, 26 Jan 2023 19:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674761150; 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=i1BpZdiB5CmpiU6TrY1s1bfSTSM5xpt2oPvVKdHB6rQ=; b=dbQqKLqlyVApziKQogTS1oIg2tihuAX23UxvPmDJZFKX37ieWz4xflckZJi293vFIEnQj+ cmnTAgRusgdz+gUyo9nWIQCX/ulZYh8eTFSTWrSB58QfKOdNSJpaTgir+DT2big2dWxqap rHC88nyEQSbKUb3IFJuFM+MXe8oqgf99fH5p8GIQzKvPOtAhq2+CSxxYegLGEHAxsSerhu M5j7Lb4ta4lVHVlA0r2QAvMpWl2LsR443bRy76mxYB41zdDXF1ziVSSBPgC4hV3iv6ZPuu aLOSOmeuDXIEDTOZllaBzTNtSBCCbciCeSLQoeSSUpeNiG//FL1r9Wl4qXybRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674761151; 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=i1BpZdiB5CmpiU6TrY1s1bfSTSM5xpt2oPvVKdHB6rQ=; b=lw/xDdb5fyoRgVtl3SW3un6pc5yDuLdNEOVcMnXDwdABpo4q98wTpQnf/AqUCmXtqKtF5q vq3Kwv6qty9kWeRhTdiO57ITYRv2ObaAUiR0PqKmuWeqfSHy8zz5Xcwh2uGQqefIHlcmrE hJpwhT10MdEm+y/m91RWrSW+vZoLATHJLNSJSOlE2e0Dv0Js7RZdr1sVupa9gyd0z+LolP JRZzJDZXaBHHZJGe4gk0JoyYk6K0eu0ivaUquWXMRG/SYq+5bL3Ey0ZGywcAFnYWjw6AUg e+r9KmHzKEflafkL+mpuRTq+QZQHXF+r6h9DFY3aRCVqMi9Ni1D35oZf48pWNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674761151; a=rsa-sha256; cv=none; b=tpycbKyuQ9Woy5qD32PpxYpMQnLh1l+gKyFqoizoVwbWQt3LEp0Z4hGhY73UG1bjTy+Adm jH99TTbblR57LVnu8x/ulG3ct6SHv/U/Z+7vWvvXVumqpe5/EpX4U5w7XObu0I5g7SchTq ott+cV3Z/w1Kbnjq+H1tSQ9At9Tyez5jm26nRYGAbf38mY/e+Xw+tigUm/EvH32HVwfoIj nGQtNnmjK48/JxbVi4EtyVB691dFmyF5tWtO9SbFu7Pumnu/nJEnd/uMX/B4nwWgZzSvkC 7M/M5dejq6D9KXXkJ8IRKRrJgTy14qizW9f3ekuoOGBS882qT8Q+LuIe4I4gNw== 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 4P2rKB5sL0zgbD; Thu, 26 Jan 2023 19:25:50 +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 30QJPo9Q077973; Thu, 26 Jan 2023 19:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30QJPo6Z077972; Thu, 26 Jan 2023 19:25:50 GMT (envelope-from git) Date: Thu, 26 Jan 2023 19:25:50 GMT Message-Id: <202301261925.30QJPo6Z077972@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: b0e536909807 - stable/13 - bhyve: missing mutex initializations List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: b0e5369098077f08c1a1ff4bbf7d6235e74c005e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b0e5369098077f08c1a1ff4bbf7d6235e74c005e commit b0e5369098077f08c1a1ff4bbf7d6235e74c005e Author: Andy Fiddaman AuthorDate: 2022-03-16 03:50:36 +0000 Commit: John Baldwin CommitDate: 2023-01-26 19:22:48 +0000 bhyve: missing mutex initializations Explicitly initialize the mutex that a PCI virtio module passes back to virtio. It so happens that these mutexes were being initialized regardless, no functional change intended. Reviewed by: chuck, jhb Differential Revision: https://reviews.freebsd.org/D34372 (cherry picked from commit f6f357efb1067b79678d8f348333ffdfec66ad20) --- usr.sbin/bhyve/pci_nvme.c | 4 ++-- usr.sbin/bhyve/pci_virtio_console.c | 2 ++ usr.sbin/bhyve/pci_virtio_rnd.c | 2 ++ usr.sbin/bhyve/pci_virtio_scsi.c | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index d57014ae4f35..123f91158a21 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -485,7 +485,7 @@ pci_nvme_init_queues(struct pci_nvme_softc *sc, uint32_t nsq, uint32_t ncq) } else { struct nvme_submission_queue *sq = sc->submit_queues; - for (i = 0; i < sc->num_squeues; i++) + for (i = 0; i < sc->num_squeues + 1; i++) pthread_mutex_init(&sq[i].mtx, NULL); } @@ -508,7 +508,7 @@ pci_nvme_init_queues(struct pci_nvme_softc *sc, uint32_t nsq, uint32_t ncq) } else { struct nvme_completion_queue *cq = sc->compl_queues; - for (i = 0; i < sc->num_cqueues; i++) + for (i = 0; i < sc->num_cqueues + 1; i++) pthread_mutex_init(&cq[i].mtx, NULL); } } diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c index ad46482749d3..d16668e6a2cb 100644 --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -698,6 +698,8 @@ pci_vtcon_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) sc->vsc_config->cols = 80; sc->vsc_config->rows = 25; + pthread_mutex_init(&sc->vsc_mtx, NULL); + vi_softc_linkup(&sc->vsc_vs, &vtcon_vi_consts, sc, pi, sc->vsc_queues); sc->vsc_vs.vs_mtx = &sc->vsc_mtx; diff --git a/usr.sbin/bhyve/pci_virtio_rnd.c b/usr.sbin/bhyve/pci_virtio_rnd.c index ed51004416fe..db8dc143e0b2 100644 --- a/usr.sbin/bhyve/pci_virtio_rnd.c +++ b/usr.sbin/bhyve/pci_virtio_rnd.c @@ -179,6 +179,8 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) sc = calloc(1, sizeof(struct pci_vtrnd_softc)); + pthread_mutex_init(&sc->vrsc_mtx, NULL); + vi_softc_linkup(&sc->vrsc_vs, &vtrnd_vi_consts, sc, pi, &sc->vrsc_vq); sc->vrsc_vs.vs_mtx = &sc->vrsc_mtx; diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index a1dd880c65b3..b33e6e432dea 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -720,6 +720,8 @@ pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) return (1); } + pthread_mutex_init(&sc->vss_mtx, NULL); + vi_softc_linkup(&sc->vss_vs, &vtscsi_vi_consts, sc, pi, sc->vss_vq); sc->vss_vs.vs_mtx = &sc->vss_mtx;