On Thu, 2021-05-06 at 17:14 -0400, Steven Rostedt wrote: > Searching for the qemu task to find what task the CID is for is not a > reliable method, as the qemu executable may be called different names > on > different systems, and qemu may not even be used. > > Instead, trace the sched_waking and kvm_exit events and do a vsock > connection to the CID. By doing so, you can find the task that runs the > guest. > > trace-cmd wakes up "vhost-<pid>" > vhost-<pid> wakes up "CPUX/KVM" > CPUX/KVM calls "kvm_exit" > This may very well be me, but I don't get why we need to follow the wakeup chains. Doesn't a VMExit always happen in the thread that runs the vCPU anyway? I mean, just by tracing 'kvm:kvm_exit', I get: <...>-74350 [003] 903542.374465: kvm_exit: reason MSR_WRITE rip 0xffffffffac4757d4 info 0 0 <...>-74355 [012] 903542.374465: kvm_exit: reason MSR_WRITE rip 0xffffffffac4757d4 info 0 0 <...>-74350 [003] 903542.374470: kvm_exit: reason MSR_WRITE rip 0xffffffffac4757d4 info 0 0 <...>-74355 [012] 903542.374470: kvm_exit: reason MSR_WRITE rip 0xffffffffac4757d4 info 0 0 <...>-74355 [012] 903542.374485: kvm_exit: reason MSR_WRITE rip 0xffffffffac4757d4 info 0 0 <...>-74355 [012] 903542.374487: kvm_exit: reason HLT rip 0xffffffffacca465d info 0 0 <...>-74350 [003] 903542.374488: kvm_exit: reason MSR_WRITE rip 0xffffffffac4757d4 info 0 0 <...>-74350 [003] 903542.374490: kvm_exit: reason HLT rip 0xffffffffacca465d info 0 0 <...>-74341 [126] 903542.374813: kvm_exit: reason MSR_WRITE rip 0xffffffffac4757d4 info 0 0 This tells us already that 74341, 74350 and 74355 are the pids of some vcpu threads on the host. At this point, /proc will tell us that these are in fact vcpus of the same VM, and which is the PID of the thread group leader that we want to use in /sys/kernel/debug/kvm: grep Tgid /proc/{74341,74350,74355}/status /proc/74341/status:Tgid: 74306 /proc/74350/status:Tgid: 74306 /proc/74355/status:Tgid: 74306 ls /sys/kernel/debug/kvm/ 74306-19 What am I missing? Regards -- Dario Faggioli, Ph.D http://about.me/dario.faggioli Virtualization Software Engineer SUSE Labs, SUSE https://www.suse.com/ ------------------------------------------------------------------- <<This happens because _I_ choose it to happen!>> (Raistlin Majere)
Attachment:
signature.asc
Description: This is a digitally signed message part