virtio-devices: Derive thread names from device ids

In order to make the thread naming more useful derive their name from
the device id (which can be supplied by the user) and a device specific
suffix that has details of the individual queue (or queue pair.)

e.g.

rob@artemis:~$ pstree -p -c -l -t `pidof cloud-hypervisor`
cloud-hyperviso(27501)─┬─{_console}(27525)
                       ├─{_disk0_q0}(27529)
                       ├─{_disk0_q1}(27532)
                       ├─{_net1_ctrl}(27533)
                       ├─{_net1_qp0}(27534)
                       ├─{_net1_qp1}(27535)
                       ├─{_rng}(27526)
                       ├─{http-server}(27504)
                       ├─{seccomp_signal_}(27502)
                       ├─{signal_handler}(27523)
                       ├─{vcpu0}(27520)
                       ├─{vcpu1}(27522)
                       └─{vmm}(27503)

Fixes: #2077

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2021-01-13 13:10:36 +00:00
committed by Sebastien Boeuf
parent 3b43551d98
commit 23afe89089
14 changed files with 20 additions and 20 deletions

View File

@@ -456,7 +456,7 @@ where
get_seccomp_filter(&self.seccomp_action, Thread::VirtioVsock)
.map_err(ActivateError::CreateSeccompFilter)?;
thread::Builder::new()
.name("virtio_vsock".to_string())
.name(self.id.clone())
.spawn(move || {
if let Err(e) = SeccompFilter::apply(virtio_vsock_seccomp_filter) {
error!("Error applying seccomp filter: {:?}", e);