svn commit: r242404 - projects/bhyve/usr.sbin/bhyve

Peter Grehan grehan at FreeBSD.org
Wed Oct 31 19:17:56 UTC 2012


Author: grehan
Date: Wed Oct 31 19:17:55 2012
New Revision: 242404
URL: http://svn.freebsd.org/changeset/base/242404

Log:
  Change the thread name of the vCPU threads to contain the
  name of the VM and the vCPU number. This helps hugely
  when using top -H to identify what a VM is doing.
  
  Reviewed by:	neel
  Obtained from:	NetApp

Modified:
  projects/bhyve/usr.sbin/bhyve/fbsdrun.c

Modified: projects/bhyve/usr.sbin/bhyve/fbsdrun.c
==============================================================================
--- projects/bhyve/usr.sbin/bhyve/fbsdrun.c	Wed Oct 31 18:16:42 2012	(r242403)
+++ projects/bhyve/usr.sbin/bhyve/fbsdrun.c	Wed Oct 31 19:17:55 2012	(r242404)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <errno.h>
 #include <signal.h>
 #include <pthread.h>
+#include <pthread_np.h>
 
 #include <machine/vmm.h>
 #include <vmmapi.h>
@@ -196,10 +197,16 @@ fbsdrun_muxed(void)
 static void *
 fbsdrun_start_thread(void *param)
 {
+	char tname[MAXCOMLEN + 1];
+	struct mt_vmm_info *mtp;
 	int vcpu;
-	struct mt_vmm_info *mtp = param;
 
+	mtp = param;
 	vcpu = mtp->mt_vcpu;
+
+	snprintf(tname, sizeof(tname), "%s vcpu %d", vmname, vcpu);
+	pthread_set_name_np(mtp->mt_thr, tname);
+
 	vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip);
 
 	/* not reached */


More information about the svn-src-projects mailing list