[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] upstream QEMU and cpu hotplug Was: [QEMU-traditional] ACPI AML code races with QEMU updating the vCPU count when hotplugging more than ~14 VCPUs.



This reminded me to look for cpu hotplug in upstream QEMU and it looks
like we don't support this feature at all there :-(

We don't even parse the cpu field on xenstore.

What are we going to do about this in 4.3?

On Thu, 9 May 2013, Konrad Rzeszutek Wilk wrote:
> This is a race so the amount varies but on a 4PCPU box
> I seem to get only ~14 out of 16 vCPUs I want to online.
> 
> The issue at hand is that QEMU xenstore.c hotplug code
> does to the command: xl vcpu-set latest 16
> (guest config has vcpus=1, maxvcpus=32) this:
> 
> 
> QEMU:                                         Guest OS:
> -xenstore_process_vcpu_set_event
>  -> Gets an XenBus notification for CPU1
>  -> Updates the gpe_state.cpus_state bitfield.       
>       -> Pulses the ACPI SCI 
>                                               - ACPI SCI kicks in
> 
>  -> Gets an XenBus notification for CPU2
>  -> Updates the gpe_state.cpus_state bitfield.
>       -> Pulses the ACPI SCI 
> 
>  -> Gets an XenBus notification for CPU3
>  -> Updates the gpe_state.cpus_state bitfield.
>       -> Pulses the ACPI SCI 
>    ...
>                                                - Method(PRST) invoked
>                                                         
>  -> Gets an XenBus notification for CPU12
>  -> Updates the gpe_state.cpus_state bitfield.
>       -> Pulses the ACPI SCI 
>                                                 - reads AF00 for CPU state
>                                                   [gets 0xff]
>                                                 - reads AF02 [gets 0x7f]
> 
>                                                       
>  -> Gets an XenBus notification for CPU13
>  -> Updates the gpe_state.cpus_state bitfield.
>       -> Pulses the ACPI SCI 
> 
>       .. until VCPU 16
>                                                - Method PRST updates
>                                                  PR01 through 13 FLG
>                                                  entry.
>                                                - PR01->PR13 _MAD
>                                                  invoked.
> 
>                                                - Brings up 13 CPUs.
> 
> While QEMU updates the rest of the cpus_state bitfields the ACPI AML
> only does the CPU hotplug on those it had read. For reference
> please see the debug patch and also the QEMU log. Look for
> 'gpe_cpus_readb'.
> 
> My thinking of how to fix this is just to add in
> xenstore_process_vcpu_set_event
>  - a scan for all of the other availability/cpu states.
>  - for each of the cpu availability states query the
>    gpe_state.cpus_state and if different modify them (and set
>    a bool that one of them was modified).
>  - When done scanning and if the bool was set, then kick of the
>    qemu_irq_pulse.
> 
> Then if the other events are triggered we can just check the
> gpe_state.cpus_state against what XenBus thinks and if they
> are the same just return without doing the qemu_irq_pulse.
> 
> Thoughts?
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.