On Wed, Jul 26, 2023 at 12:23:58PM -0400, Dave Voutila wrote: > When adding exec for vm's and fork/exec'd vio{blk,net} devices, the > current verbosity wasn't being set on the new process. The below change > keeps it simple, avoiding runtime string manipulation. Also tosses in an > ifdef around a very chatty debug message related to ipc with devices. > > This doesn't address runtime toggling of verbosity with vmctl(8) nor > does it address the fact vmd has a janky concept of verbosity. Those are > future fixes. > > ok?
I noticed this earlier, thought I was doing something stupid. ok brynet@ > > diffstat /usr/src > M usr.sbin/vmd/virtio.c | 9+ 4- > M usr.sbin/vmd/vmd.h | 4+ 0- > M usr.sbin/vmd/vmm.c | 7+ 4- > > 3 files changed, 20 insertions(+), 8 deletions(-) > > diff /usr/src > commit - 3228b0c4b8598ac2f799f997d457a8ba24307bec > path + /usr/src > blob - a58e35115432b3d16fb456e71bd71f93d9e2467d > file + usr.sbin/vmd/virtio.c > --- usr.sbin/vmd/virtio.c > +++ usr.sbin/vmd/virtio.c > @@ -1475,12 +1475,15 @@ virtio_dev_launch(struct vmd_vm *vm, struct virtio_dev > nargv[5] = "-i"; > nargv[6] = vmm_fd; > nargv[7] = "-n"; > + nargv[8] = NULL; > > - if (env->vmd_verbose) { > - nargv[8] = "-v"; > + if (env->vmd_verbose == 1) { > + nargv[8] = VMD_VERBOSE_1; > nargv[9] = NULL; > - } else > - nargv[8] = NULL; > + } else if (env->vmd_verbose > 1) { > + nargv[8] = VMD_VERBOSE_2; > + nargv[9] = NULL; > + } > > /* Control resumes in vmd.c:main(). */ > execvp(nargv[0], nargv); > @@ -1699,8 +1702,10 @@ virtio_pci_io(int dir, uint16_t reg, uint32_t *data, u > imsg_free(&imsg); > > if (msg.type == VIODEV_MSG_IO_READ && msg.data_valid) { > +#if DEBUG > log_debug("%s: got sync read response (reg=%s)", > __func__, virtio_reg_name(msg.reg)); > +#endif /* DEBUG */ > *data = msg.data; > /* > * It's possible we're asked to {de,}assert after the > blob - 744b8d1957423b91202b9630fe4a5a6dc4158089 > file + usr.sbin/vmd/vmd.h > --- usr.sbin/vmd/vmd.h > +++ usr.sbin/vmd/vmd.h > @@ -102,6 +102,10 @@ enum imsg_type { > /* Unique local address for IPv6 */ > #define VMD_ULA_PREFIX "fd00::/8" > > +/* Verbosity arguments for use when caling execvp(2). */ > +#define VMD_VERBOSE_1 "-v"; > +#define VMD_VERBOSE_2 "-vv"; > + > enum imsg_type { > IMSG_VMDOP_START_VM_REQUEST = IMSG_PROC_MAX, > IMSG_VMDOP_START_VM_CDROM, > blob - 541222e027294ea6d85c957e9cc1a55bb1ac829c > file + usr.sbin/vmd/vmm.c > --- usr.sbin/vmd/vmm.c > +++ usr.sbin/vmd/vmm.c > @@ -782,12 +782,15 @@ vmm_start_vm(struct imsg *imsg, uint32_t *id, pid_t *p > nargv[3] = "-n"; > nargv[4] = "-i"; > nargv[5] = vmm_fd; > + nargv[6] = NULL; > > - if (env->vmd_verbose) { > - nargv[6] = "-v"; > + if (env->vmd_verbose == 1) { > + nargv[6] = VMD_VERBOSE_1; > nargv[7] = NULL; > - } else > - nargv[6] = NULL; > + } else if (env->vmd_verbose > 1) { > + nargv[6] = VMD_VERBOSE_2; > + nargv[7] = NULL; > + } > > /* Control resumes in vmd main(). */ > execvp(nargv[0], nargv); > >