On 19/12/2014 03:32, Chen, Tiejun wrote: > > Are you saying something below? > > if (enable_apicv) > ... > else { > kvm_x86_ops->hwapic_irr_update = NULL; Yes. > But this means we have to revise hadware_setup() to get 'kvm' inside, This would not even be possible, since hardware_setup() is only called once. However, for the only caller of hwapic_isr_update (but presumably all of them, as is the case for hwapic_irr_update), you already know that irqchip_in_kernel(kvm) is true. You are in kvm_apic_post_state_restore, which takes a kvm_lapic_state, and no lapic exists if !irqchip_in_kernel(kvm). (Yes, irqchip_in_kernel) is a bit weird and tests pic_irqchip(kvm) instead, but it's the same. It tests pic_irqchip(kvm) only because the LAPIC is per-cpu and irqchip_in_kernel takes a struct kvm). So it's possible to NULL out hwapic_isr_update in hardware_setup. It simply shouldn't happen that you call hwapic_isr_update without the in-kernel irqchip. The kernel knows nothing about ISR/IRR without the in-kernel irqchip. Paolo > then rebase other callers to hwapic_isr_update(), is it really good? -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html