Re: [PATCH] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings

2012-03-06 Thread Avi Kivity
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

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings

2012-03-05 Thread Michael Ellerman
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.

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.

cheers



signature.asc
Description: This is a digitally signed message part