[libvirt] [RFC PATCH 00/12] qemu: add support to hot-plug/unplug cpu device

Zhu Guihua zhugh.fnst at cn.fujitsu.com
Thu Jan 22 08:42:56 UTC 2015

On Wed, 2015-01-21 at 09:49 +0100, Peter Krempa wrote:
> On Wed, Jan 21, 2015 at 16:00:52 +0800, Zhu Guihua wrote:
> > If you apply the folowing patchset
> > [PATCH v3 0/7] cpu: add device_add foo-x86_64-cpu support
> > https://lists.nongnu.org/archive/html/qemu-devel/2015-01/msg01552.html,
> > and [PATCH v2 00/11] cpu: add i386 cpu hot remove support
> > https://lists.nongnu.org/archive/html/qemu-devel/2015-01/msg01557.html,
> > qemu can support hotplug and hot-unplug cpu device.
> > 
> > So this patch series will make libvirt support hotplug and hot-unplug cpu
> > device for qemu driver, and now only supports one cpu driver which is
> > 'qemu64-x86_64-cpu'.
> > 
> > The cpu device's xml like this:
> > <cpu driver='qemu64-x86_64-cpu' apic_id='3'>
> >
> Libvirt already implements vCPU hotplug and unplug via
> virDomainSetVcpusFlags() API and implements this API also for the qemu
> driver. Granted that the existing code uses older comands but that can
> be tweaked to support the new stuff too.

Now Libvirt only supported vCPU hotplug by qemu command 'cpu-add', but
vCPU hot-unplug has not been implemented for qemu driver.

> Additionally the new <cpu> subelement of <devices> doesn't seem
> necessary:
> - There's only one model that can be plugged

there are more model will be plugged in next version.

> - Configuring the APIC id doesn't make much sense for users

I agree. I will not consider the APIC id in future.

> - nothing else can be configured

Yes, only cpu model shoud be configured.

> I have following questions though:
> Is there a difference in specifying the cpu via the -device option and
> via the legacy -cpu argument?

Of course, -device has more functions than -cpu.

> Is there a plan to have more than one cpu "model" that can be plugged?

Yes, all x86 cpu model will be supported. This is an RFC patchset, so
the feature is realized in a simple way.

> Can more than one cpu model be plugged to the same VM at the same time?

Yes, it can.

> In general I don't think it's necessary to add the new device type and
> we should rather improve the existing API to support the new device
> type.

I think it's necessary to support more cpu model. When user hotplug a
cpu, it is essential to point the cpu model.

And I think improve the existing API would change too much. 
The feature is implemented by command 'device_add', so I think it should
also keep consistent with the other devices' hotplug.


> More comments will be inline in the patches.
> Peter

More information about the libvir-list mailing list