From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings Date: Tue, 06 Mar 2012 12:37:49 +0200 Message-ID: <4F55E8FD.1090408@redhat.com> References: <1330950548-10918-1-git-send-email-avi@redhat.com> <1331011859.25651.6.camel@concordia> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: michael@ellerman.id.au Return-path: Received: from mx1.redhat.com ([209.132.183.28]:22319 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758905Ab2CFKhz (ORCPT ); Tue, 6 Mar 2012 05:37:55 -0500 In-Reply-To: <1331011859.25651.6.camel@concordia> Sender: kvm-owner@vger.kernel.org List-ID: On 03/06/2012 07:30 AM, Michael Ellerman wrote: > On Mon, 2012-03-05 at 14:29 +0200, Avi Kivity wrote: > > If some vcpus are created before KVM_CREATE_IRQCHIP, then > > irqchip_in_kernel() and vcpu->arch.apic will be inconsistent, leading > > to potential NULL pointer dereferences. > > > > Fix by: > > - ensuring that no vcpus are installed when KVM_CREATE_IRQCHIP is called > > - ensuring that a vcpu has an apic if it is installed after KVM_CREATE_IRQCHIP > > > > This is somewhat long winded because vcpu->arch.apic is created without > > kvm->lock held. > > Hi Avi, > > Thanks for following up on this. This looks OK to me. > > I wonder if we will end up needing to add other sanity tests at the same > point, ie. when we install the vcpu, in which case we might need a > generic "sanity hook". But better to keep it specific until we need > something generalised. Right, ARM will also have the same problem (with/without GIC). > When we do irqchip-in-kernel on powerpc we'll need to rework the #ifdef > in kvm_host.h, because we don't want CONFIG_KVM_APIC_ARCHITECTURE, but > we will need our own kvm_vcpu_compatible(). But again we'll do that at > the time. > -- error compiling committee.c: too many arguments to function