diff options
author | Hans Rosenfeld <hans.rosenfeld@joyent.com> | 2018-08-01 15:25:26 +0000 |
---|---|---|
committer | Hans Rosenfeld <hans.rosenfeld@joyent.com> | 2018-08-01 15:43:35 +0000 |
commit | ecd42ab0a93f0b6015554cb78ddd8aabaf12d8b7 (patch) | |
tree | b937e3eeb2ddfe9c4ac63342d1f154aca7197328 | |
parent | 7cd3f4b8e082236e604a53fa1ab5dacb8d11c0c5 (diff) | |
download | illumos-joyent-ecd42ab0a93f0b6015554cb78ddd8aabaf12d8b7.tar.gz |
OS-6966 SmartOS hangs in boot on bhyve due to recursive mutex in pci_virtio_block.c
Reviewed by: Mike Gerdts <mike.gerdts@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Approved by: John Levon <john.levon@joyent.com>
-rw-r--r-- | usr/src/cmd/bhyve/virtio.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/usr/src/cmd/bhyve/virtio.h b/usr/src/cmd/bhyve/virtio.h index cd28f55738..f59d823448 100644 --- a/usr/src/cmd/bhyve/virtio.h +++ b/usr/src/cmd/bhyve/virtio.h @@ -31,6 +31,8 @@ #ifndef _VIRTIO_H_ #define _VIRTIO_H_ +#include <pthread_np.h> + /* * These are derived from several virtio specifications. * @@ -438,11 +440,25 @@ vq_interrupt(struct virtio_softc *vs, struct vqueue_info *vq) if (pci_msix_enabled(vs->vs_pi)) pci_generate_msix(vs->vs_pi, vq->vq_msix_idx); else { +#ifndef __FreeBSD__ + boolean_t unlock = B_FALSE; + + if (vs->vs_mtx && !pthread_mutex_isowned_np(vs->vs_mtx)) { + unlock = B_TRUE; + pthread_mutex_lock(vs->vs_mtx); + } +#else VS_LOCK(vs); +#endif vs->vs_isr |= VTCFG_ISR_QUEUES; pci_generate_msi(vs->vs_pi, 0); pci_lintr_assert(vs->vs_pi); +#ifndef __FreeBSD__ + if (unlock) + pthread_mutex_unlock(vs->vs_mtx); +#else VS_UNLOCK(vs); +#endif } } |