From nobody Wed Mar 16 03:59:26 2022 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 D66501A1F898; Wed, 16 Mar 2022 03:59:26 +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 4KJGk65k7Zz3pW4; Wed, 16 Mar 2022 03:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647403166; 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=qn1+PpT197nFeXlVCjuXK3Dojszofv7WZL9/mnmV7jU=; b=XrA9vP1jz8uxOS/fnZp4uk05DBbUEbRhXL/8WHXkqQ+CShjojiJ0jf+KAcmu1JYzDLZ+aW Bd1LSym2O0+TOdf6AF6ujqZWuXnEMyQe6GSj+nfJo8Sh4g7SLcZR9UZZhgsdSTUbMz930s flMehcwkaSJJ3J7/xqwnocZuQwMzOTRiDqrjtvcmgSK/aMRfX1uFVWLu7y5p3Xqe9OP1LK txdA3H++iJMnp0jjHCIJDEnWULYOcxHETPPROXmA6WdOlE+DlYzBCPyCn7nhUr0hNvRgeZ BzlTDlQgBWig+zCaH7haYoWGKpT9oKdAJWpy6LlikqcsZQzoqCYyUiVQnhDAJA== 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 A4D04717E; Wed, 16 Mar 2022 03:59:26 +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 22G3xQqM057016; Wed, 16 Mar 2022 03:59:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22G3xQcV057015; Wed, 16 Mar 2022 03:59:26 GMT (envelope-from git) Date: Wed, 16 Mar 2022 03:59:26 GMT Message-Id: <202203160359.22G3xQcV057015@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: f6f357efb106 - main - bhyve: missing mutex initializations 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: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6f357efb1067b79678d8f348333ffdfec66ad20 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647403166; 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=qn1+PpT197nFeXlVCjuXK3Dojszofv7WZL9/mnmV7jU=; b=Gmufb8wZ172fcO6A/1o+3Pm++N4e8V0chGrqCNUF3cpfrzt3sedLFyBWGs5CGhlOamOHls fmqOWfye32pzyctp+Zx/SNRdKgZ/Qrf00uUPNkM8psRfYv3sV0u3seE1s6QpjSwwR1NSI3 fIj8a87rMQPj9VYjgPHOgirZvrkB+G7rLkvK8lD8XAkhR46elktxH1sfYzeOfBkRylDQ+7 cWSb0xDQRccLPI3wX1oi7Npy/1bv/5Rt4NJBJgXDA+ZgCUi7sM2dhpYmE1g7HJfgrkUGzS 98bFE2zKQ4fvK6lnX2nnwrl8pEZ+/jlxBSBp03EGM9grwJIxl9ozs62EkS0H3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647403166; a=rsa-sha256; cv=none; b=bSaRV/rH0QydDLgXKBvpS7z3in8nBhA1qC0Y17hlF12W9ztX1u1VA+S1wtJuj3B9aM6V9l qbhuE9zNnEK87DBAAw4TvOJ5C/a3IReaMEF+xKkxByB96D//Ea91ne6iD8c0OieXUyYA1K jEdS/pu1MOUN8pYpbwH4qxvfQiEKx5TxhT+JlK8llADUSaQBj0s7gaE/ISuoqH9lkP0KN3 1TJcvfU66T3t2joEFlHkpMR4ncqmpKApi9usbx1J7Z1Z5nYOpsml+jSOOGA7h8YRmqXzhP /p7mqiJ+Kj0DRmP0iLzF4cYY9TkO6QxgqffEkZTlDSKEMlnjAc1a/2wwOjVsIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=f6f357efb1067b79678d8f348333ffdfec66ad20 commit f6f357efb1067b79678d8f348333ffdfec66ad20 Author: Andy Fiddaman AuthorDate: 2022-03-16 03:50:36 +0000 Commit: Robert Wing CommitDate: 2022-03-16 03:54:16 +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 --- 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 b780b5529da2..098f0aba1084 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 0414fc540c2b..a716aa592eb4 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 7274d0b05912..7023e0e03b0c 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 b080749f7931..6f00f5881198 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -700,6 +700,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;