Skip to contentSkip to conversation

VCPU hotplug on KVM/ARM

DISCUSSION [email protected] 10 participants 18 messages Feb 27, 2018 – Aug 1, 2018 KVM arm64

lore
Share & tools
lore
#0 lore raw

Hi,

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running guest VM in KVM/ARM. I see that currently, it is not allowed to add a new VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

But I am looking at the KVM side for enabling adding a new VCPU. If you can point me to any relevant work/resources, which I can refer to then it will help me.

Thanks.

Regards,

Bhupinder

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

#1 lore raw

Hi Bhupinder,

Quoted 9 lines · On Tue, Feb 27, 2018 at 03:01:17PM +0530, [email protected] wrote:

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running guest VM in KVM/ARM. I see that currently, it is not allowed to add a new VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

This would require a major rework of a lot of logic surrounding the GIC and other parts of KVM initialization.

Quoted 11 lines

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

But I am looking at the KVM side for enabling adding a new VCPU. If you can point me to any relevant work/resources, which I can refer to then it will help me.

I don't have any specific pointers, but I was always told that the way we were going to do CPU hotplug would be to instantiate a large number of VCPUs, and hotplug would be equivalent to turning on a VCPU which was previously powered off.

Is this not still a feasible solution?

How does VCPU hotplug work on x86?

Thanks,
-Christoffer

#2 lore raw

Hi Christoffer,

Thanks for your reply.

Quoted 28 lines · Christoffer Dall

Hi Bhupinder,

Quoted 9 lines · On Tue, Feb 27, 2018 at 03:01:17PM +0530, [email protected] wrote:

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running guest VM in KVM/ARM. I see that currently, it is not allowed to add a new VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

This would require a major rework of a lot of logic surrounding the GIC and other parts of KVM initialization.

Quoted 11 lines

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

But I am looking at the KVM side for enabling adding a new VCPU. If you can point me to any relevant work/resources, which I can refer to then it will help me.

Quoted 6 lines

I don't have any specific pointers, but I was always told that the way we were going to do CPU hotplug would be to instantiate a large number of VCPUs, and hotplug would be equivalent to turning on a VCPU which was previously powered off.

Is this not still a feasible solution?

It should be a feasible solution provided the guest VM is not able to control the onlining/offlining of VCPUs. It should be controlled by the Host.

Quoted 2 lines

How does VCPU hotplug work on x86?

On x86, you can add a vcpu through libvirt setvcpu command and it shows up in the guest VM as a new CPU if you do lscpu.

Quoted 3 lines

Thanks,
-Christoffer

Regards,
Bhupinder

#3 lore raw
Quoted 42 lines · On Tue, Feb 27, 2018 at 05:34:28PM +0530, [email protected] wrote:

Hi Christoffer,

Thanks for your reply.

Quoted 37 lines · Christoffer Dall

Hi Bhupinder,

Quoted 11 lines · On Tue, Feb 27, 2018 at 03:01:17PM +0530, [email protected] wrote:

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running
guest VM in KVM/ARM. I see that currently, it is not allowed to add a new
VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

This would require a major rework of a lot of logic surrounding the GIC and other parts of KVM initialization.

Quoted 7 lines

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

Quoted 6 lines

But I am looking at the KVM side for enabling adding a new VCPU. If you can
point me to any relevant work/resources, which I can refer to then it will
help me.

I don't have any specific pointers, but I was always told that the way we were going to do CPU hotplug would be to instantiate a large number of VCPUs, and hotplug would be equivalent to turning on a VCPU which was previously powered off.

Quoted 5 lines
Quoted 1 line

Is this not still a feasible solution?

It should be a feasible solution provided the guest VM is not able to control the onlining/offlining of VCPUs. It should be controlled by the Host.

KVM could simply refuse to turn on some of the CPUs unless given permission from host userspace.

Quoted 5 lines
Quoted 2 lines

How does VCPU hotplug work on x86?

On x86, you can add a vcpu through libvirt setvcpu command and it shows up in the guest VM as a new CPU if you do lscpu.

Sure, but what is the mechanism, does x86 qemu actually call KVM_CREATE_VCPU, or is this also a question of turning on already created vcpus ?

Thanks,
-Christoffer

#4 lore raw
Quoted 53 lines · Christoffer Dall
Quoted 42 lines · On Tue, Feb 27, 2018 at 05:34:28PM +0530, [email protected] wrote:

Hi Christoffer,

Thanks for your reply.

Quoted 37 lines · Christoffer Dall

Hi Bhupinder,

Quoted 11 lines · On Tue, Feb 27, 2018 at 03:01:17PM +0530, [email protected] wrote:

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running
guest VM in KVM/ARM. I see that currently, it is not allowed to add a new
VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

This would require a major rework of a lot of logic surrounding the GIC and other parts of KVM initialization.

Quoted 7 lines

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

Quoted 6 lines

But I am looking at the KVM side for enabling adding a new VCPU. If you can
point me to any relevant work/resources, which I can refer to then it will
help me.

I don't have any specific pointers, but I was always told that the way we were going to do CPU hotplug would be to instantiate a large number of VCPUs, and hotplug would be equivalent to turning on a VCPU which was previously powered off.

Quoted 5 lines
Quoted 1 line

Is this not still a feasible solution?

It should be a feasible solution provided the guest VM is not able to control the onlining/offlining of VCPUs. It should be controlled by the Host.

KVM could simply refuse to turn on some of the CPUs unless given permission from host userspace.

Quoted 1 line
Quoted 1 line
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

How does VCPU hotplug work on x86?

On x86, you can add a vcpu through libvirt setvcpu command and it shows up in the guest VM as a new CPU if you do lscpu.

Sure, but what is the mechanism, does x86 qemu actually call KVM_CREATE_VCPU, or is this also a question of turning on already created vcpus ?

CC'ing Igor and qemu-devel

drew

#5 lore raw
Quoted 54 lines · On Tue, 27 Feb 2018 14:21:31 +0100 Andrew Jones <[email protected]> wrote:
Quoted 53 lines · Christoffer Dall
Quoted 42 lines · On Tue, Feb 27, 2018 at 05:34:28PM +0530, [email protected] wrote:

Hi Christoffer,

Thanks for your reply.

Quoted 37 lines · Christoffer Dall

Hi Bhupinder,

Quoted 11 lines · On Tue, Feb 27, 2018 at 03:01:17PM +0530, [email protected] wrote:

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running
guest VM in KVM/ARM. I see that currently, it is not allowed to add a new
VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

This would require a major rework of a lot of logic surrounding the GIC and other parts of KVM initialization.

Quoted 7 lines

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

Quoted 6 lines

But I am looking at the KVM side for enabling adding a new VCPU. If you can
point me to any relevant work/resources, which I can refer to then it will
help me.

I don't have any specific pointers, but I was always told that the way we were going to do CPU hotplug would be to instantiate a large number of VCPUs, and hotplug would be equivalent to turning on a VCPU which was previously powered off.

Quoted 5 lines
Quoted 1 line

Is this not still a feasible solution?

It should be a feasible solution provided the guest VM is not able to control the onlining/offlining of VCPUs. It should be controlled by the Host.

KVM could simply refuse to turn on some of the CPUs unless given permission from host userspace.

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

How does VCPU hotplug work on x86?

On x86, you can add a vcpu through libvirt setvcpu command and it shows up in the guest VM as a new CPU if you do lscpu.

Sure, but what is the mechanism, does x86 qemu actually call KVM_CREATE_VCPU, or is this also a question of turning on already created vcpus ?

In QEMU on x86 (and I think ppc, s390 as well), we create vCPUs on demand.

It would be nice if ARM would be able to do that too, so that it could take advantage of the same code.

Quoted 4 lines

CC'ing Igor and qemu-devel

drew

#6 lore raw
Quoted 4 lines · Igor Mammedov

In QEMU on x86 (and I think ppc, s390 as well), we create vCPUs on demand.

It would be nice if ARM would be able to do that too, so that it could take advantage of the same code.

It's not clear to me how that would work, given that for instance the interrupt controller wants to know up-front how many CPUs it has to deal with.

thanks
-- PMM

#7 lore raw
Quoted 9 lines · Peter Maydell
Quoted 3 lines · Igor Mammedov

In QEMU on x86 (and I think ppc, s390 as well), we create vCPUs on demand.>> It would be nice if ARM would be able to do that too,
so that it could take advantage of the same code.

It's not clear to me how that would work, given that for instance the interrupt controller wants to know up-front how many CPUs it has to deal with.

So how is cpu hotplug handled in HW? Or doesn't it even exist there?

(we have max_cpus for the interrupt controller, but not sure if that is what we want)

Quoted 3 lines

thanks
-- PMM

Signature · 3 lines
Thanks,

David / dhildenb
#8 lore raw
Quoted 6 lines · David Hildenbrand
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Igor Mammedov

In QEMU on x86 (and I think ppc, s390 as well), we create vCPUs on demand.>> It would be nice if ARM would be able to do that too,
so that it could take advantage of the same code.

Quoted 6 lines
Quoted 4 lines

It's not clear to me how that would work, given that for instance the interrupt controller wants to know up-front how many CPUs it has to deal with.

So how is cpu hotplug handled in HW? Or doesn't it even exist there?

I don't know of any physical system offering that facility.

Quoted 2 lines

(we have max_cpus for the interrupt controller, but not sure if that is what we want)

We'd need something along those lines. Each CPU has a notional point to point link to the interrupt controller (to the redistributor, to be precise), and this entity must pre-exist.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#9 lore raw
In reply to Andrew Jones

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

Thanks,
-Maran

Quoted 64 lines · Andrew Jones
Quoted 48 lines · Christoffer Dall
Quoted 39 lines · On Tue, Feb 27, 2018 at 05:34:28PM +0530, [email protected] wrote:

Hi Christoffer,

Thanks for your reply.

Quoted 34 lines · Christoffer Dall

Hi Bhupinder,

Quoted 11 lines · On Tue, Feb 27, 2018 at 03:01:17PM +0530, [email protected] wrote:

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running
guest VM in KVM/ARM. I see that currently, it is not allowed to add a new
VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

This would require a major rework of a lot of logic surrounding the GIC and other parts of KVM initialization.

Quoted 6 lines

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

Quoted 6 lines

But I am looking at the KVM side for enabling adding a new VCPU. If you can
point me to any relevant work/resources, which I can refer to then it will
help me.

I don't have any specific pointers, but I was always told that the way we were going to do CPU hotplug would be to instantiate a large number of VCPUs, and hotplug would be equivalent to turning on a VCPU which was previously powered off.

Quoted 5 lines
Quoted 1 line

Is this not still a feasible solution?

It should be a feasible solution provided the guest VM is not able to control the onlining/offlining of VCPUs. It should be controlled by the Host.

KVM could simply refuse to turn on some of the CPUs unless given permission from host userspace.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

How does VCPU hotplug work on x86?

On x86, you can add a vcpu through libvirt setvcpu command and it shows up in the guest VM as a new CPU if you do lscpu.

Sure, but what is the mechanism, does x86 qemu actually call KVM_CREATE_VCPU, or is this also a question of turning on already created vcpus ?

CC'ing Igor and qemu-devel

drew
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

#10 lore raw
Quoted 4 lines · On Tue, 24 Jul 2018 11:35:31 -0700 Maran Wilson <[email protected]> wrote:

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

I'm working on QEMU side of it as time allows.

I can guide or share task if are you interested in helping out with it?

Quoted 70 lines

Thanks,
-Maran

Quoted 64 lines · Andrew Jones
Quoted 48 lines · Christoffer Dall
Quoted 39 lines · On Tue, Feb 27, 2018 at 05:34:28PM +0530, [email protected] wrote:

Hi Christoffer,

Thanks for your reply.

Quoted 34 lines · Christoffer Dall

Hi Bhupinder,

Quoted 11 lines · On Tue, Feb 27, 2018 at 03:01:17PM +0530, [email protected] wrote:

I hope it is the right forum to post my query.

I am currently looking at the possibility of adding a new VCPU to a running
guest VM in KVM/ARM. I see that currently, it is not allowed to add a new
VCPU to a guest VM, if it is already initialized. The first check in kvm_arch_vcpu_create() returns failure if it is already initialized.

This would require a major rework of a lot of logic surrounding the GIC and other parts of KVM initialization.

Quoted 6 lines

There was some work done in QEMU to add support for VCPU hotplug:
https://lists.gnu.org/archive/html/qemu-arm/2017-05/msg00404.html

Quoted 6 lines

But I am looking at the KVM side for enabling adding a new VCPU. If you can
point me to any relevant work/resources, which I can refer to then it will
help me.

I don't have any specific pointers, but I was always told that the way we were going to do CPU hotplug would be to instantiate a large number of VCPUs, and hotplug would be equivalent to turning on a VCPU which was previously powered off.

Quoted 5 lines
Quoted 1 line

Is this not still a feasible solution?

It should be a feasible solution provided the guest VM is not able to control the onlining/offlining of VCPUs. It should be controlled by the Host.

KVM could simply refuse to turn on some of the CPUs unless given permission from host userspace.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

How does VCPU hotplug work on x86?

On x86, you can add a vcpu through libvirt setvcpu command and it shows up in the guest VM as a new CPU if you do lscpu.

Sure, but what is the mechanism, does x86 qemu actually call KVM_CREATE_VCPU, or is this also a question of turning on already created vcpus ?

CC'ing Igor and qemu-devel

drew
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

#11 lore raw
In reply to Maran Wilson
Quoted 4 lines · Maran Wilson

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

This is typically a project for someone who would have this particular itch to scratch, and who has a demonstrable need for this functionality.

Work wise, it would have to include adding physical CPU hotplug support to the arm64 kernel as a precondition, before worrying about doing it in KVM.

For KVM itself, particular area of interests would be:
- Making GICv3 redistributors magically appear in the IPA space
- Live resizing of GICv3 structures
- Dynamic allocation of MPIDR, and mapping with vcpu_id

This should keep someone busy for a good couple of weeks (give or take a few months).

That being said, I'd rather see support in QEMU first, creating all the vcpu/redistributors upfront, and signalling the hotplug event via the virtual firmware. And then post some numbers to show that creating all the vcpus upfront is not acceptable.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#12 lore raw
Quoted 9 lines · Marc Zyngier
Quoted 4 lines · Maran Wilson

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

This is typically a project for someone who would have this particular itch to scratch, and who has a demonstrable need for this functionality.

Quoted 8 lines

Work wise, it would have to include adding physical CPU hotplug support to the arm64 kernel as a precondition, before worrying about doing it in KVM.

For KVM itself, particular area of interests would be:
- Making GICv3 redistributors magically appear in the IPA space
- Live resizing of GICv3 structures
- Dynamic allocation of MPIDR, and mapping with vcpu_id

I have CPU topology description patches on the QEMU list now[*]. A next step for me is to this MPIDR work. I probably won't get to it until the end of August though.

[*] http://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg01168.html

Quoted 3 lines

This should keep someone busy for a good couple of weeks (give or take a few months).

:-)

Quoted 5 lines

That being said, I'd rather see support in QEMU first, creating all the vcpu/redistributors upfront, and signalling the hotplug event via the virtual firmware. And then post some numbers to show that creating all the vcpus upfront is not acceptable.

I think the upfront allocation, allocating all possible cpus, but only activating all present cpus, was the planned approach. What were the concerns about that approach? Just vcpu memory overhead for too many overly ambitious VM configs?

Thanks,
drew

#13 lore raw
Quoted 37 lines · Andrew Jones
Quoted 9 lines · Marc Zyngier
Quoted 4 lines · Maran Wilson

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

This is typically a project for someone who would have this particular itch to scratch, and who has a demonstrable need for this functionality.

Quoted 8 lines

Work wise, it would have to include adding physical CPU hotplug support to the arm64 kernel as a precondition, before worrying about doing it in KVM.

For KVM itself, particular area of interests would be:
- Making GICv3 redistributors magically appear in the IPA space
- Live resizing of GICv3 structures
- Dynamic allocation of MPIDR, and mapping with vcpu_id

I have CPU topology description patches on the QEMU list now[*]. A next step for me is to this MPIDR work. I probably won't get to it until the end of August though.

[*] http://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg01168.html

Quoted 3 lines

This should keep someone busy for a good couple of weeks (give or take a few months).

:-)

Quoted 5 lines

That being said, I'd rather see support in QEMU first, creating all the vcpu/redistributors upfront, and signalling the hotplug event via the virtual firmware. And then post some numbers to show that creating all the vcpus upfront is not acceptable.

Quoted 4 lines

I think the upfront allocation, allocating all possible cpus, but only activating all present cpus, was the planned approach. What were the concerns about that approach? Just vcpu memory overhead for too many overly ambitious VM configs?

I don't have any ARM-specific concern about that, and I think this is the right approach. It has the good property of not requiring much change in the kernel (other than actually supporting CPU hotplug).

vcpu memory overhead is a generic concern though, and not only for ARM. We currently allow up to 512 vcpus per VM, which looks like a lot, but really isn't. If we're to allow this to be bumped up significantly, we should start accounting the vcpu-related memory against the user's allowance...

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#14 lore raw

Thanks everyone. It sounds like there is consensus around how best to proceed (at a high level at least).

Since Igor has already gotten started, I'll coordinate with him offline to see where I can jump in.

Thanks,
-Maran

Quoted 49 lines · Marc Zyngier
Quoted 27 lines · Andrew Jones
Quoted 8 lines · Marc Zyngier
Quoted 4 lines · Maran Wilson

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

This is typically a project for someone who would have this particular itch to scratch, and who has a demonstrable need for this functionality.

Quoted 8 lines

Work wise, it would have to include adding physical CPU hotplug support to the arm64 kernel as a precondition, before worrying about doing it in KVM.

For KVM itself, particular area of interests would be:
- Making GICv3 redistributors magically appear in the IPA space
- Live resizing of GICv3 structures
- Dynamic allocation of MPIDR, and mapping with vcpu_id

I have CPU topology description patches on the QEMU list now[*]. A next step for me is to this MPIDR work. I probably won't get to it until the end of August though.

[*] http://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg01168.html

Quoted 2 lines

This should keep someone busy for a good couple of weeks (give or take a few months).

:-)

Quoted 8 lines
Quoted 4 lines

That being said, I'd rather see support in QEMU first, creating all the vcpu/redistributors upfront, and signalling the hotplug event via the virtual firmware. And then post some numbers to show that creating all the vcpus upfront is not acceptable.

I think the upfront allocation, allocating all possible cpus, but only activating all present cpus, was the planned approach. What were the concerns about that approach? Just vcpu memory overhead for too many overly ambitious VM configs?

I don't have any ARM-specific concern about that, and I think this is the right approach. It has the good property of not requiring much change in the kernel (other than actually supporting CPU hotplug).

vcpu memory overhead is a generic concern though, and not only for ARM. We currently allow up to 512 vcpus per VM, which looks like a lot, but really isn't. If we're to allow this to be bumped up significantly, we should start accounting the vcpu-related memory against the user's allowance...

Thanks,

	M.
#15 lore raw
In reply to Marc Zyngier
Quoted 38 lines · On Wed, 25 Jul 2018 14:07:12 +0100 Marc Zyngier <[email protected]> wrote:
Quoted 37 lines · Andrew Jones
Quoted 9 lines · Marc Zyngier
Quoted 4 lines · Maran Wilson

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

This is typically a project for someone who would have this particular itch to scratch, and who has a demonstrable need for this functionality.

Quoted 8 lines

Work wise, it would have to include adding physical CPU hotplug support to the arm64 kernel as a precondition, before worrying about doing it in KVM.

For KVM itself, particular area of interests would be:
- Making GICv3 redistributors magically appear in the IPA space
- Live resizing of GICv3 structures
- Dynamic allocation of MPIDR, and mapping with vcpu_id

I have CPU topology description patches on the QEMU list now[*]. A next step for me is to this MPIDR work. I probably won't get to it until the end of August though.

[*] http://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg01168.html

Quoted 3 lines

This should keep someone busy for a good couple of weeks (give or take a few months).

:-)

Quoted 5 lines

That being said, I'd rather see support in QEMU first, creating all the vcpu/redistributors upfront, and signalling the hotplug event via the virtual firmware. And then post some numbers to show that creating all the vcpus upfront is not acceptable.

Quoted 8 lines
Quoted 4 lines

I think the upfront allocation, allocating all possible cpus, but only activating all present cpus, was the planned approach. What were the concerns about that approach? Just vcpu memory overhead for too many overly ambitious VM configs?

I don't have any ARM-specific concern about that, and I think this is the right approach. It has the good property of not requiring much change in the kernel (other than actually supporting CPU hotplug).

for x86 we allocate VCPUs dynamically (both QEMU and KVM) CCing ppc/s390 folks as I don't recall how it's implemented there.

but we do not delete vcpus in KVM after they were created (as it deemed to be too complicated), we are just deleting QEMU part of it and keep kvm's vcpu for reuse with future hotplug.

Quoted 9 lines

vcpu memory overhead is a generic concern though, and not only for ARM. We currently allow up to 512 vcpus per VM, which looks like a lot, but really isn't. If we're to allow this to be bumped up significantly, we should start accounting the vcpu-related memory against the user's allowance...

Thanks,

	M.
#16 lore raw
Quoted 46 lines · Igor Mammedov
Quoted 43 lines · On Wed, 25 Jul 2018 14:07:12 +0100 Marc Zyngier <[email protected]> wrote:
Quoted 41 lines · Andrew Jones
Quoted 9 lines · Marc Zyngier
Quoted 4 lines · Maran Wilson

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU hotplug on KVM/ARM ? Or is this a project that is still waiting for an owner who has the time and inclination to get started?

This is typically a project for someone who would have this particular itch to scratch, and who has a demonstrable need for this functionality.

Quoted 8 lines

Work wise, it would have to include adding physical CPU hotplug support to the arm64 kernel as a precondition, before worrying about doing it in KVM.

For KVM itself, particular area of interests would be:
- Making GICv3 redistributors magically appear in the IPA space
- Live resizing of GICv3 structures
- Dynamic allocation of MPIDR, and mapping with vcpu_id

I have CPU topology description patches on the QEMU list now[*]. A next step for me is to this MPIDR work. I probably won't get to it until the end of August though.

[*] http://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg01168.html

Quoted 3 lines

This should keep someone busy for a good couple of weeks (give or take a few months).

:-)

Quoted 5 lines

That being said, I'd rather see support in QEMU first, creating all the vcpu/redistributors upfront, and signalling the hotplug event via the virtual firmware. And then post some numbers to show that creating all the vcpus upfront is not acceptable.

I think the upfront allocation, allocating all possible cpus, but only activating all present cpus, was the planned approach. What were the concerns about that approach? Just vcpu memory overhead for too many overly ambitious VM configs?

Quoted 5 lines
Quoted 3 lines

I don't have any ARM-specific concern about that, and I think this is the right approach. It has the good property of not requiring much change in the kernel (other than actually supporting CPU hotplug).

for x86 we allocate VCPUs dynamically (both QEMU and KVM) CCing ppc/s390 folks as I don't recall how it's implemented there.

s390x: also handled that way. Dynamically allocated.

Unplug: not supported by the architecture and fenced.

I remember a discussion where people said dynamically creating/deleting VCPUs (and therefore threads) is preferred, because then there is no way on earth a malicious guest could make use of such a CPU (in case there would be a subtle BUG in QEMU).

Signature · 3 lines
Thanks,

David / dhildenb
#17 lore raw
In reply to Igor Mammedov
Quoted 57 lines · Igor Mammedov
Quoted 5 lines · On Wed, 25 Jul 2018 14:07:12 +0100 Marc Zyngier <[email protected]> wrote:
Quoted 4 lines · Andrew Jones
Quoted 3 lines · Marc Zyngier
Quoted 2 lines · Maran Wilson

It's been a few months since this email thread died off. Has anyone started working on a potential solution that would allow VCPU

hotplug on

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

KVM/ARM ? Or is this a project that is still waiting for an owner

who

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

has the time and inclination to get started?

This is typically a project for someone who would have this particular itch to scratch, and who has a demonstrable need for this

functionality.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Work wise, it would have to include adding physical CPU hotplug

support

Quoted 1 line
Quoted 1 line
Quoted 1 line

to the arm64 kernel as a precondition, before worrying about doing it

in

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

KVM.

For KVM itself, particular area of interests would be:
- Making GICv3 redistributors magically appear in the IPA space
- Live resizing of GICv3 structures
- Dynamic allocation of MPIDR, and mapping with vcpu_id

Quoted 5 lines
Quoted 5 lines

I have CPU topology description patches on the QEMU list now[*]. A next step for me is to this MPIDR work. I probably won't get to it until the end of August though.

[*] http://lists.nongnu.org/archive/html/qemu-devel/2018-

07/msg01168.html

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

This should keep someone busy for a good couple of weeks (give or

take a

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

few months).

:-)

Quoted 2 lines

That being said, I'd rather see support in QEMU first, creating all

the

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

vcpu/redistributors upfront, and signalling the hotplug event via the virtual firmware. And then post some numbers to show that creating all the vcpus upfront is not acceptable.

Quoted 8 lines
Quoted 4 lines

I think the upfront allocation, allocating all possible cpus, but only activating all present cpus, was the planned approach. What were the concerns about that approach? Just vcpu memory overhead for too many overly ambitious VM configs?

I don't have any ARM-specific concern about that, and I think this is the right approach. It has the good property of not requiring much change in the kernel (other than actually supporting CPU hotplug).

Quoted 7 lines

for x86 we allocate VCPUs dynamically (both QEMU and KVM) CCing ppc/s390 folks as I don't recall how it's implemented there.

but we do not delete vcpus in KVM after they were created (as it deemed to be too complicated), we are just deleting QEMU part of it and keep kvm's vcpu for reuse with future hotplug.

Same with PPC, we too dynamically create vcpus and during unplug keep the KVM's vcpus for reuse.

Regards,
Bharata.