svn commit: r257729 - head/usr.sbin/bhyve
Peter Grehan
grehan at FreeBSD.org
Wed Nov 6 00:25:19 UTC 2013
Author: grehan
Date: Wed Nov 6 00:25:17 2013
New Revision: 257729
URL: http://svnweb.freebsd.org/changeset/base/257729
Log:
Add the VM name to the process name with setproctitle().
Remove the VM name from some of the thread-naming calls
since it is now in the proc title.
Slightly modify the thread-naming for the net and block
threads.
This improves readability when using top/ps with the -a
and -H options on a system with a large number of bhyve VMs.
Requested by: Michael Dexter
Reviewed by: neel
MFC after: 4 weeks
Modified:
head/usr.sbin/bhyve/bhyverun.c
head/usr.sbin/bhyve/block_if.c
head/usr.sbin/bhyve/mevent.c
head/usr.sbin/bhyve/pci_ahci.c
head/usr.sbin/bhyve/pci_virtio_net.c
Modified: head/usr.sbin/bhyve/bhyverun.c
==============================================================================
--- head/usr.sbin/bhyve/bhyverun.c Tue Nov 5 23:16:52 2013 (r257728)
+++ head/usr.sbin/bhyve/bhyverun.c Wed Nov 6 00:25:17 2013 (r257729)
@@ -190,7 +190,7 @@ fbsdrun_start_thread(void *param)
mtp = param;
vcpu = mtp->mt_vcpu;
- snprintf(tname, sizeof(tname), "%s vcpu %d", vmname, vcpu);
+ snprintf(tname, sizeof(tname), "vcpu %d", vcpu);
pthread_set_name_np(mtp->mt_thr, tname);
vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip);
@@ -685,6 +685,11 @@ main(int argc, char *argv[])
}
/*
+ * Change the proc title to include the VM name.
+ */
+ setproctitle("%s", vmname);
+
+ /*
* Add CPU 0
*/
fbsdrun_addcpu(ctx, BSP, rip);
Modified: head/usr.sbin/bhyve/block_if.c
==============================================================================
--- head/usr.sbin/bhyve/block_if.c Tue Nov 5 23:16:52 2013 (r257728)
+++ head/usr.sbin/bhyve/block_if.c Wed Nov 6 00:25:17 2013 (r257729)
@@ -293,7 +293,7 @@ blockif_open(const char *optstr, const c
pthread_create(&bc->bc_btid, NULL, blockif_thr, bc);
- snprintf(tname, sizeof(tname), "%s blk-%s", vmname, ident);
+ snprintf(tname, sizeof(tname), "blk-%s", ident);
pthread_set_name_np(bc->bc_btid, tname);
return (bc);
Modified: head/usr.sbin/bhyve/mevent.c
==============================================================================
--- head/usr.sbin/bhyve/mevent.c Tue Nov 5 23:16:52 2013 (r257728)
+++ head/usr.sbin/bhyve/mevent.c Wed Nov 6 00:25:17 2013 (r257729)
@@ -381,10 +381,8 @@ mevent_delete_close(struct mevent *evp)
static void
mevent_set_name(void)
{
- char tname[MAXCOMLEN + 1];
- snprintf(tname, sizeof(tname), "%s mevent", vmname);
- pthread_set_name_np(mevent_tid, tname);
+ pthread_set_name_np(mevent_tid, "mevent");
}
void
Modified: head/usr.sbin/bhyve/pci_ahci.c
==============================================================================
--- head/usr.sbin/bhyve/pci_ahci.c Tue Nov 5 23:16:52 2013 (r257728)
+++ head/usr.sbin/bhyve/pci_ahci.c Wed Nov 6 00:25:17 2013 (r257729)
@@ -1714,11 +1714,9 @@ pci_ahci_init(struct vmctx *ctx, struct
/*
* Attempt to open the backing image. Use the PCI
- * slot/func/ahci_port for the identifier string
- * since that uniquely identifies a storage device.
+ * slot/func for the identifier string.
*/
- snprintf(bident, sizeof(bident), "%d:%d:%d", pi->pi_slot, pi->pi_func,
- 0);
+ snprintf(bident, sizeof(bident), "%d:%d", pi->pi_slot, pi->pi_func);
bctxt = blockif_open(opts, bident);
if (bctxt == NULL) {
ret = 1;
Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_net.c Tue Nov 5 23:16:52 2013 (r257728)
+++ head/usr.sbin/bhyve/pci_virtio_net.c Wed Nov 6 00:25:17 2013 (r257729)
@@ -588,7 +588,7 @@ pci_vtnet_init(struct vmctx *ctx, struct
*/
if (!mac_provided) {
snprintf(nstr, sizeof(nstr), "%d-%d-%s", pi->pi_slot,
- pi->pi_func, vmname);
+ pi->pi_func, vmname);
MD5Init(&mdctx);
MD5Update(&mdctx, nstr, strlen(nstr));
@@ -632,7 +632,8 @@ pci_vtnet_init(struct vmctx *ctx, struct
pthread_mutex_init(&sc->tx_mtx, NULL);
pthread_cond_init(&sc->tx_cond, NULL);
pthread_create(&sc->tx_tid, NULL, pci_vtnet_tx_thread, (void *)sc);
- snprintf(tname, sizeof(tname), "%s vtnet%d tx", vmname, pi->pi_slot);
+ snprintf(tname, sizeof(tname), "vtnet-%d:%d tx", pi->pi_slot,
+ pi->pi_func);
pthread_set_name_np(sc->tx_tid, tname);
return (0);
More information about the svn-src-all
mailing list