git: b3860403a7cf - main - bhyve: nvme: initialize the AEN condition variable

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 11 Nov 2026 16:49:59 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b3860403a7cfbd32e4b21f214c2d3a46ef1a27b9

commit b3860403a7cfbd32e4b21f214c2d3a46ef1a27b9
Author:     Wanpeng Qian <wanpengqian@gmail.com>
AuthorDate: 2026-11-11 15:06:53 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-11 16:49:43 +0000

    bhyve: nvme: initialize the AEN condition variable
    
    aen_cond is used with pthread_cond_wait() and pthread_cond_signal() but
    never initialized.  That works where a zeroed pthread_cond_t is
    initialized on first use; elsewhere pthread_cond_wait() fails at once
    and aen_thr() spins with aen_mtx held.
    
    Signed-off-by:  Wanpeng Qian <wanpengqian@gmail.com>
    
    Reviewed by:    markj
    MFC after:      1 week
    Sponsored by:   keelos.dev
    Differential Revision:  https://reviews.freebsd.org/D61424
---
 usr.sbin/bhyve/pci_nvme.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 50ad8ea21f88..58af9df027a9 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -853,6 +853,7 @@ pci_nvme_aen_init(struct pci_nvme_softc *sc)
 	pci_nvme_aen_reset(sc);
 
 	pthread_mutex_init(&sc->aen_mtx, NULL);
+	pthread_cond_init(&sc->aen_cond, NULL);
 	pthread_create(&sc->aen_tid, NULL, aen_thr, sc);
 	snprintf(nstr, sizeof(nstr), "nvme-aen-%d:%d", sc->nsc_pi->pi_slot,
 	    sc->nsc_pi->pi_func);