From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8AT6-0003pZ-Fb for qemu-devel@nongnu.org; Tue, 28 Jan 2014 10:20:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8ASz-0006TM-Iq for qemu-devel@nongnu.org; Tue, 28 Jan 2014 10:20:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8ASz-0006T9-2T for qemu-devel@nongnu.org; Tue, 28 Jan 2014 10:20:45 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0SFKgIW030911 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Jan 2014 10:20:43 -0500 From: "Dr. David Alan Gilbert (git)" Date: Tue, 28 Jan 2014 15:20:36 +0000 Message-Id: <1390922439-30750-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [PATCH 0/3] Name threads List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, lersek@redhat.com, mst@redhat.com From: "Dr. David Alan Gilbert" This series uses pthread_setname_np (when available) to set the names on threads that QEMU creates to make life easier when debugging. It's turned off by default (because there were worries that it might break tools that relied on process names) but is enabled by adding namethreads=on to the --name option. Note that the initial thread still has the default name (or the value passed as the process= parameter to --name). The naming of the individual threads is not meant to form an API; tools shall not rely on the names. The first patch converts --name to use QemuOpts, a side effect of this is that --name process=foo,bar no longer allows a process name of 'foo,bar', since ',' is a separator. With this enabled in gdb we see: (gdb) info threads Id Target Id Frame 5 Thread 0x7fb6670f9700 (LWP 18243) "worker" 0x00007fb66b8fcec0 in sem_timedwait () from /lib64/libpthread.so.0 4 Thread 0x7fb666515700 (LWP 18244) "CPU/KVM" 0x00007fb669ab0117 in ioctl () from /lib64/libc.so.6 3 Thread 0x7fb665d14700 (LWP 18245) "CPU/KVM" 0x00007fb669ab0117 in ioctl () from /lib64/libc.so.6 2 Thread 0x7fb5d7fff700 (LWP 18247) "vnc_worker" 0x00007fb66b8fad20 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 * 1 Thread 0x7fb66d451a00 (LWP 18242) "qemuprocess" 0x00007fb669aaeb4f in ppoll () from /lib64/libc.so.6 and it also shows up well in 'top' using the H and V options. Dr. David Alan Gilbert (3): Rework --name to use QemuOpts Add 'namethreads' suboption to --name Add a 'name' parameter to qemu_thread_create cpus.c | 6 ++--- hw/block/dataplane/virtio-blk.c | 2 +- hw/usb/ccid-card-emulated.c | 8 +++--- include/qemu/thread.h | 3 ++- libcacard/vscclient.c | 2 +- migration.c | 2 +- qemu-options.hx | 6 +++-- thread-pool.c | 2 +- ui/vnc-jobs.c | 3 ++- util/compatfd.c | 3 ++- util/qemu-thread-posix.c | 16 +++++++++-- util/qemu-thread-win32.c | 10 ++++++- vl.c | 59 ++++++++++++++++++++++++++++++++--------- 13 files changed, 90 insertions(+), 32 deletions(-) -- 1.8.5.3