From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luiz Capitulino Subject: Re: [RFC] kvm: x86: export vCPU halted state to sysfs Date: Fri, 2 Feb 2018 08:49:01 -0500 Message-ID: <20180202084901.72b57ddd@redhat.com> References: <20180201125441.2f5b4fdd@redhat.com> <20180202124925.GB15403@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Cc: kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, ehabkost@redhat.com To: "Daniel P. =?UTF-8?B?QmVycmFuZ8Op?=" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56856 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbeBBNtD (ORCPT ); Fri, 2 Feb 2018 08:49:03 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92EB825C41 for ; Fri, 2 Feb 2018 13:49:02 +0000 (UTC) In-Reply-To: <20180202124925.GB15403@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, 2 Feb 2018 12:49:25 +0000 Daniel P. Berrangé wrote: > On Thu, Feb 01, 2018 at 12:54:41PM -0500, Luiz Capitulino wrote: > > > > Libvirt needs to know when a vCPU is halted. To get this information, > > libvirt has started using the query-cpus command from QEMU. However, > > if in kernel irqchip is in use, query-cpus will force all vCPUs > > to user-space since they have to issue the KVM_GET_MP_STATE ioctl. > > This has catastrophic implications to low-latency workloads like > > KVM-RT and zero packet loss with DPDK. To make matters worse, there's > > an OpenStack service called ceilometer that causes libvirt to > > issue query-cpus every few minutes. > > > > The solution proposed in this patch is to export the vCPU > > halted state in the already existing vcpu directory in sysfs. > > This way, libvirt can read the vCPU halted state from sysfs and avoid > > using the query-cpus command. This solution seems to be sufficient > > for libvirt needs, but it has the following cons: > > > > * vcpu information in sysfs lives in a debug directory, so > > libvirt would be basing its API on debug info > > Is this part of regular sysfs mount point, or does it require a > debug fs to be mounted separately at /sys/fs/debug ? Yeah, it depends on debugfs being separately mounted at /sys/fs/debug. > > * Currently, only x86 supports the vcpu dir in sysfs, so > > we'd have to expand this to other archs (should be doable) > > Yep, that would be fairly important That's doable. The code that exports the vcpu information to sysfs is pretty arch-independent. Only x86 does it today because it's the only arch that actually exports anything per vcpu (which is the tsc-offset).