On 17/10/2017 23:34, Andi Kleen wrote: > One issue I see for some time is that even when I stop a Linux KVM guest using libvirt > it still sometimes uses a lot of CPU time. > > According to strace it loops polling on KVM_IRQ_LINE_STATUS > > I see it with various qemu versions, both FC25, FC26, OpenSUSE Leap 42.1/2 > > IIRC old enough KVM didn't have this problem, at least I didn't notice it. > > My workaround is to kill -STOP the qemu process too, but is there a > better fix? > > -Andi > > strace of a stopped qemu using ~18% CPU time of a core. > > write(7, "\1\0\0\0\0\0\0\0", 8) = 8 > clock_gettime(CLOCK_MONOTONIC, {tv_sec=1118693, tv_nsec=583125997}) = 0 > gettimeofday({tv_sec=1508275611, tv_usec=558425}, NULL) = 0 > clock_gettime(CLOCK_MONOTONIC, {tv_sec=1118693, tv_nsec=583171115}) = 0 > ppoll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, > events=POLLIN}, {fd=8, events=POLLIN}, {fd=13, events=POLLIN}, {fd=15, > events=POLLIN}, {fd=24, events=POLLIN}], 7, {tv_sec=0, tv_nsec=0}, NULL, > 8) = 1 ([{fd=7, revents=POLLIN}], left {tv_sec=0, tv_nsec=0}) Because the polling time is zero here, and fd=7 has POLLIN, it seems that QEMU is continuously scheduling a callback (a timer with a deadline in the past, or a bottom half). Can you perhaps attach gdb and see what callback it is? Paolo