From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: qemu polling KVM_IRQ_LINE_STATUS when stopped Date: Tue, 17 Oct 2017 14:34:16 -0700 Message-ID: <87a80pihlz.fsf@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain To: kvm@vger.kernel.org Return-path: Received: from mga09.intel.com ([134.134.136.24]:52044 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966268AbdJQVeS (ORCPT ); Tue, 17 Oct 2017 17:34:18 -0400 Sender: kvm-owner@vger.kernel.org List-ID: 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}) clock_gettime(CLOCK_MONOTONIC, {tv_sec=1118693, tv_nsec=583227127}) = 0 gettimeofday({tv_sec=1508275611, tv_usec=558526}, NULL) = 0 ioctl(12, KVM_IRQ_LINE_STATUS, 0x7ffc15ce8f30) = 0 gettimeofday({tv_sec=1508275611, tv_usec=558569}, NULL) = 0 clock_gettime(CLOCK_MONOTONIC, {tv_sec=1118693, tv_nsec=583313870}) = 0 gettimeofday({tv_sec=1508275611, tv_usec=558612}, NULL) = 0 clock_gettime(CLOCK_MONOTONIC, {tv_sec=1118693, tv_nsec=583357101}) = 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}) read(7, "\3\0\0\0\0\0\0\0", 512) = 8 clock_gettime(CLOCK_MONOTONIC, {tv_sec=1118693, tv_nsec=583433228}) = 0 clock_gettime(CLOCK_MONOTONIC, {tv_sec=1118693, tv_nsec=583455717}) = 0