Received: from eggs.gnu.org ([2001:4830:134:3::10]:43746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRIdi-0008KH-NL for qemu-devel@nongnu.org; Mon, 26 Nov 2018 10:17:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRIdd-0002o8-PC for qemu-devel@nongnu.org; Mon, 26 Nov 2018 10:17:34 -0500 Received: from mail-bgr052101135016.outbound.protection.outlook.com ([52.101.135.16]:25184 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRIdd-0002hv-8w for qemu-devel@nongnu.org; Mon, 26 Nov 2018 10:17:29 -0500 From: Roman Kagan Date: Mon, 26 Nov 2018 15:17:15 +0000 Message-ID: <20181126151710.GA2285@rkaganb.sw.ru> References: <20180921082217.29481-1-rkagan@virtuozzo.com> <20180921082217.29481-4-rkagan@virtuozzo.com> <20181126154503.291d395a@redhat.com> In-Reply-To: <20181126154503.291d395a@redhat.com> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 03/10] hyperv: only add SynIC in compatible configurations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: "qemu-devel@nongnu.org" , Vijayabhaskar Balakrishna , Eduardo Habkost , Konrad Rzeszutek Wilk , "Michael S. Tsirkin" , Venu Busireddy , Liran Alon , Paolo Bonzini , Si-Wei Liu , Boris Ostrovsky , Karl Heubaum , Vitaly Kuznetsov On Mon, Nov 26, 2018 at 03:45:03PM +0100, Igor Mammedov wrote: > On Fri, 21 Sep 2018 11:22:10 +0300 > Roman Kagan wrote: > > > Certain configurations do not allow SynIC to be used in QEMU. In > > particular, > > > > - when hyperv_vpindex is off, SINT routes can't be used as they refer to > > the destination vCPU by vp_index > > > > - older KVM (which doesn't expose KVM_CAP_HYPERV_SYNIC2) zeroes out > > SynIC message and event pages on every msr load, breaking migration > > > > OTOH in-KVM users of SynIC -- SynIC timers -- do work in those > > configurations, and we shouldn't stop the guest from using them. > > > > To cover both scenarios, introduce an X86CPU property that makes CPU > > init code to skip creation of the SynIC object (and thus disables any > > SynIC use in QEMU) but keeps the KVM part of the SynIC working. > > The property is clear by default but is set via compat logic for older > > machine types. > > > > As a result, when hv_synic and a modern machine type are specified, QEMU > > will refuse to run unless vp_index is on and the kernel is recent > > enough. OTOH with an older machine type QEMU will run fine with > > hv_synic=on against an older kernel and/or without vp_index enabled but > > will disallow the in-QEMU uses of SynIC (in e.g. VMBus). > > > > Signed-off-by: Roman Kagan > > With current upstream and x-hv-synic-kvm-only=on QEMU will SIGSEGV. > Problem was unnoticed since added compat property wasn't actually used > until much later commit > 4a93722f9c hw/i386: add pc-i440fx-3.1 & pc-q35-3.1 > which put compat property in use. > > qemu-system-x86_64 -machine pc-i440fx-2.10,accel=kvm \ > -cpu host,-vmx,hv-relaxed,hv_spinlocks=0x1fff,hv-vpindex,hv-synic > > simpler reproducer: > qemu-system-x86_64 -enable-kvm -cpu host,hv-synic,x-hv-synic-kvm-only=on > > Reported-by: Vitaly Kuznetsov Thanks for the report, fix is on the way to ML. Roman.