mbox series

[v2,00/10] Adds CPU hot-plug support to Loongarch

Message ID cover.1694433326.git.lixianglai@loongson.cn (mailing list archive)
Headers show
Series Adds CPU hot-plug support to Loongarch | expand

Message

Xianglai Li Sept. 12, 2023, 2:11 a.m. UTC
Hello everyone, We refer to the implementation of ARM CPU
Hot-Plug to add GED-based CPU Hot-Plug support to Loongarch.

The first 4 patches are changes to the QEMU common code,
including adding GED support for CPU Hot-Plug, updating
the ACPI table creation process, and adding qdev_disconnect_gpio_out_named
and cpu_address_space_destroy interfaces to release resources
when CPU un-plug.

For the modification of the public part of the code, we refer to the
arm-related patch, and the link address of the corresponding patch is
as follows:
https://lore.kernel.org/all/20200613213629.21984-1-salil.mehta@huawei.com/

In order to respect the work of "Salil Mehta", we will rebase the first
4 patches in the final patch, which are referenced here to ensure that
the loongarch cpu hotplug can work properly.

The last 6 patches are Loongarch architecture-related,
and the modifications include the definition of the hook
function related to the CPU Hot-(UN)Plug, the allocation
and release of CPU resources when CPU Hot-(UN)Plug,
the creation process of updating the ACPI table,
and finally the custom switch for the CPU Hot-Plug.

V2:
- Fix formatting and spelling errors
- Split large patches into smaller patches
  - Split the original patch
    <<Add basic CPU hot-(un)plug support for Loongarch>> into
    <<Added CPU topology support for Loongarch>>
    <<Optimize loongarch_irq_init function implementation >>
    <<Add basic CPU hot-(un)plug support for Loongarch>>.
  - Split the original patch
    <<Update the ACPI table for the Loongarch CPU>> into
    <<Add generic event device for Loongarch>>
    <<Update the ACPI table for the Loongarch CPU>>
- Added loongarch cpu topology calculation method.
- Change the position of the cpu topology patch.
- Change unreasonable variable and function names.



xianglai li (10):
  Update ACPI GED framework to support vcpu hot-(un)plug
  Update CPUs AML with cpu-(ctrl)dev change
  make qdev_disconnect_gpio_out_named() public
  Introduce the CPU address space destruction function
  Added CPU topology support for Loongarch
  Optimize loongarch_irq_init function implementation
  Add basic CPU hot-(un)plug support for Loongarch
  Add support of *unrealize* for Loongarch cpu
  Add generic event device for Loongarch
  Update the ACPI table for the Loongarch CPU

 .../devices/loongarch64-softmmu/default.mak   |   1 +
 docs/system/loongarch/virt.rst                |  31 ++
 hw/acpi/acpi-cpu-hotplug-stub.c               |  15 +
 hw/acpi/cpu.c                                 |  27 +-
 hw/acpi/generic_event_device.c                |  33 ++
 hw/core/gpio.c                                |   4 +-
 hw/i386/acpi-build.c                          |   2 +-
 hw/loongarch/acpi-build.c                     |  33 +-
 hw/loongarch/generic_event_device_loongarch.c |  36 ++
 hw/loongarch/meson.build                      |   2 +-
 hw/loongarch/virt.c                           | 424 +++++++++++++++---
 include/exec/cpu-common.h                     |   8 +
 include/hw/acpi/cpu.h                         |   5 +-
 include/hw/acpi/cpu_hotplug.h                 |  10 +
 include/hw/acpi/generic_event_device.h        |   6 +
 include/hw/core/cpu.h                         |   1 +
 include/hw/loongarch/virt.h                   |  10 +-
 include/hw/qdev-core.h                        |   2 +
 softmmu/physmem.c                             |  24 +
 target/loongarch/cpu.c                        |  35 +-
 target/loongarch/cpu.h                        |  13 +-
 21 files changed, 635 insertions(+), 87 deletions(-)
 create mode 100644 hw/loongarch/generic_event_device_loongarch.c

Cc: "Salil Mehta" <salil.mehta@opnsrc.net>
Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Cc: Song Gao <gaosong@loongson.cn>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Ani Sinha <anisinha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Eduardo Habkost <eduardo@habkost.net>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Yanan Wang <wangyanan55@huawei.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Xianglai li <lixianglai@loongson.cn>
--
2.39.1

Comments

Salil Mehta Sept. 12, 2023, 9:08 a.m. UTC | #1
Hi Xianglai,

> From: qemu-devel-bounces+salil.mehta=huawei.com@nongnu.org <qemu-devel-
> bounces+salil.mehta=huawei.com@nongnu.org> On Behalf Of xianglai li
> Sent: Tuesday, September 12, 2023 3:12 AM
> To: qemu-devel@nongnu.org
> Cc: Salil Mehta <salil.mehta@opnsrc.net>; Xiaojuan Yang
> <yangxiaojuan@loongson.cn>; Song Gao <gaosong@loongson.cn>; Michael S.
> Tsirkin <mst@redhat.com>; Igor Mammedov <imammedo@redhat.com>; Ani Sinha
> <anisinha@redhat.com>; Paolo Bonzini <pbonzini@redhat.com>; Richard
> Henderson <richard.henderson@linaro.org>; Eduardo Habkost
> <eduardo@habkost.net>; Marcel Apfelbaum <marcel.apfelbaum@gmail.com>;
> Philippe Mathieu-Daudé <philmd@linaro.org>; wangyanan (Y)
> <wangyanan55@huawei.com>; Daniel P. Berrangé <berrange@redhat.com>; Peter
> Xu <peterx@redhat.com>; David Hildenbrand <david@redhat.com>; Bibo Mao
> <maobibo@loongson.cn>; Xianglai li <lixianglai@loongson.cn>
> Subject: [PATCH v2 00/10] Adds CPU hot-plug support to Loongarch
> 
> Hello everyone, We refer to the implementation of ARM CPU
> Hot-Plug to add GED-based CPU Hot-Plug support to Loongarch.
> 
> The first 4 patches are changes to the QEMU common code,
> including adding GED support for CPU Hot-Plug, updating
> the ACPI table creation process, and adding qdev_disconnect_gpio_out_named
> and cpu_address_space_destroy interfaces to release resources
> when CPU un-plug.
> 
> For the modification of the public part of the code, we refer to the
> arm-related patch, and the link address of the corresponding patch is
> as follows:
> https://lore.kernel.org/all/20200613213629.21984-1-salil.mehta@huawei.com/
> 
> In order to respect the work of "Salil Mehta", we will rebase the first
> 4 patches in the final patch, which are referenced here to ensure that
> the loongarch cpu hotplug can work properly.


Just to let you know RFC V2 for above link is undergoing internal review
process and I will be posting the patches to community soon.

Also, I am planning to post RFC V2 as one complete patch-set initially.
(This is required to reflect the clear change from RFC V1)
This will have patches which are ARM specific and architecture common.
Later patches can be cherry picked and compiled independently.

After RFC V2 has been posted, and you have confirmed that architecture
common patches works well with your changes, I will split the RFC V2
further into 2 patch-sets,
1. Architecture common patch-set (This will come with no RFC) 
2. ARM specific patch-set  (This will continue as RFC V3)

This will help patch-set 1 getting absorbed earlier in this Qemu
cycle if everything goes well.


Thanks
Salil.


> 
> The last 6 patches are Loongarch architecture-related,
> and the modifications include the definition of the hook
> function related to the CPU Hot-(UN)Plug, the allocation
> and release of CPU resources when CPU Hot-(UN)Plug,
> the creation process of updating the ACPI table,
> and finally the custom switch for the CPU Hot-Plug.
> 
> V2:
> - Fix formatting and spelling errors
> - Split large patches into smaller patches
>   - Split the original patch
>     <<Add basic CPU hot-(un)plug support for Loongarch>> into
>     <<Added CPU topology support for Loongarch>>
>     <<Optimize loongarch_irq_init function implementation >>
>     <<Add basic CPU hot-(un)plug support for Loongarch>>.
>   - Split the original patch
>     <<Update the ACPI table for the Loongarch CPU>> into
>     <<Add generic event device for Loongarch>>
>     <<Update the ACPI table for the Loongarch CPU>>
> - Added loongarch cpu topology calculation method.
> - Change the position of the cpu topology patch.
> - Change unreasonable variable and function names.
> 
> 
> 
> xianglai li (10):
>   Update ACPI GED framework to support vcpu hot-(un)plug
>   Update CPUs AML with cpu-(ctrl)dev change
>   make qdev_disconnect_gpio_out_named() public
>   Introduce the CPU address space destruction function
>   Added CPU topology support for Loongarch
>   Optimize loongarch_irq_init function implementation
>   Add basic CPU hot-(un)plug support for Loongarch
>   Add support of *unrealize* for Loongarch cpu
>   Add generic event device for Loongarch
>   Update the ACPI table for the Loongarch CPU
> 
>  .../devices/loongarch64-softmmu/default.mak   |   1 +
>  docs/system/loongarch/virt.rst                |  31 ++
>  hw/acpi/acpi-cpu-hotplug-stub.c               |  15 +
>  hw/acpi/cpu.c                                 |  27 +-
>  hw/acpi/generic_event_device.c                |  33 ++
>  hw/core/gpio.c                                |   4 +-
>  hw/i386/acpi-build.c                          |   2 +-
>  hw/loongarch/acpi-build.c                     |  33 +-
>  hw/loongarch/generic_event_device_loongarch.c |  36 ++
>  hw/loongarch/meson.build                      |   2 +-
>  hw/loongarch/virt.c                           | 424 +++++++++++++++---
>  include/exec/cpu-common.h                     |   8 +
>  include/hw/acpi/cpu.h                         |   5 +-
>  include/hw/acpi/cpu_hotplug.h                 |  10 +
>  include/hw/acpi/generic_event_device.h        |   6 +
>  include/hw/core/cpu.h                         |   1 +
>  include/hw/loongarch/virt.h                   |  10 +-
>  include/hw/qdev-core.h                        |   2 +
>  softmmu/physmem.c                             |  24 +
>  target/loongarch/cpu.c                        |  35 +-
>  target/loongarch/cpu.h                        |  13 +-
>  21 files changed, 635 insertions(+), 87 deletions(-)
>  create mode 100644 hw/loongarch/generic_event_device_loongarch.c
> 
> Cc: "Salil Mehta" <salil.mehta@opnsrc.net>
> Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>
> Cc: Song Gao <gaosong@loongson.cn>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Ani Sinha <anisinha@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Eduardo Habkost <eduardo@habkost.net>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>
> Cc: Yanan Wang <wangyanan55@huawei.com>
> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
> Cc: Peter Xu <peterx@redhat.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Bibo Mao <maobibo@loongson.cn>
> Cc: Xianglai li <lixianglai@loongson.cn>
> --
> 2.39.1
> 
>
Xianglai Li Sept. 13, 2023, 3:52 a.m. UTC | #2
Hi, Salil Mehta :
> Hi Xianglai,
>
>> From: qemu-devel-bounces+salil.mehta=huawei.com@nongnu.org <qemu-devel-
>> bounces+salil.mehta=huawei.com@nongnu.org> On Behalf Of xianglai li
>> Sent: Tuesday, September 12, 2023 3:12 AM
>> To: qemu-devel@nongnu.org
>> Cc: Salil Mehta <salil.mehta@opnsrc.net>; Xiaojuan Yang
>> <yangxiaojuan@loongson.cn>; Song Gao <gaosong@loongson.cn>; Michael S.
>> Tsirkin <mst@redhat.com>; Igor Mammedov <imammedo@redhat.com>; Ani Sinha
>> <anisinha@redhat.com>; Paolo Bonzini <pbonzini@redhat.com>; Richard
>> Henderson <richard.henderson@linaro.org>; Eduardo Habkost
>> <eduardo@habkost.net>; Marcel Apfelbaum <marcel.apfelbaum@gmail.com>;
>> Philippe Mathieu-Daudé <philmd@linaro.org>; wangyanan (Y)
>> <wangyanan55@huawei.com>; Daniel P. Berrangé <berrange@redhat.com>; Peter
>> Xu <peterx@redhat.com>; David Hildenbrand <david@redhat.com>; Bibo Mao
>> <maobibo@loongson.cn>; Xianglai li <lixianglai@loongson.cn>
>> Subject: [PATCH v2 00/10] Adds CPU hot-plug support to Loongarch
>>
>> Hello everyone, We refer to the implementation of ARM CPU
>> Hot-Plug to add GED-based CPU Hot-Plug support to Loongarch.
>>
>> The first 4 patches are changes to the QEMU common code,
>> including adding GED support for CPU Hot-Plug, updating
>> the ACPI table creation process, and adding qdev_disconnect_gpio_out_named
>> and cpu_address_space_destroy interfaces to release resources
>> when CPU un-plug.
>>
>> For the modification of the public part of the code, we refer to the
>> arm-related patch, and the link address of the corresponding patch is
>> as follows:
>> https://lore.kernel.org/all/20200613213629.21984-1-salil.mehta@huawei.com/
>>
>> In order to respect the work of "Salil Mehta", we will rebase the first
>> 4 patches in the final patch, which are referenced here to ensure that
>> the loongarch cpu hotplug can work properly.
>
> Just to let you know RFC V2 for above link is undergoing internal review
> process and I will be posting the patches to community soon.
>
> Also, I am planning to post RFC V2 as one complete patch-set initially.
> (This is required to reflect the clear change from RFC V1)
> This will have patches which are ARM specific and architecture common.
> Later patches can be cherry picked and compiled independently.
>
> After RFC V2 has been posted, and you have confirmed that architecture
> common patches works well with your changes, I will split the RFC V2
> further into 2 patch-sets,
> 1. Architecture common patch-set (This will come with no RFC)
> 2. ARM specific patch-set  (This will continue as RFC V3)
>
> This will help patch-set 1 getting absorbed earlier in this Qemu
> cycle if everything goes well.
>
>
> Thanks
> Salil.
>
That's great,Looking forward to your patch.

However, I suggest that you pay attention to the community's feedback

on patch 3 and patch 4 in the patch series I sent.

I think it may be helpful for your later patch submission.

And I'm still working on how to reply to the community.

>> The last 6 patches are Loongarch architecture-related,
>> and the modifications include the definition of the hook
>> function related to the CPU Hot-(UN)Plug, the allocation
>> and release of CPU resources when CPU Hot-(UN)Plug,
>> the creation process of updating the ACPI table,
>> and finally the custom switch for the CPU Hot-Plug.
>>
>> V2:
>> - Fix formatting and spelling errors
>> - Split large patches into smaller patches
>>    - Split the original patch
>>      <<Add basic CPU hot-(un)plug support for Loongarch>> into
>>      <<Added CPU topology support for Loongarch>>
>>      <<Optimize loongarch_irq_init function implementation >>
>>      <<Add basic CPU hot-(un)plug support for Loongarch>>.
>>    - Split the original patch
>>      <<Update the ACPI table for the Loongarch CPU>> into
>>      <<Add generic event device for Loongarch>>
>>      <<Update the ACPI table for the Loongarch CPU>>
>> - Added loongarch cpu topology calculation method.
>> - Change the position of the cpu topology patch.
>> - Change unreasonable variable and function names.
>>
>>
>>
>> xianglai li (10):
>>    Update ACPI GED framework to support vcpu hot-(un)plug
>>    Update CPUs AML with cpu-(ctrl)dev change
>>    make qdev_disconnect_gpio_out_named() public
>>    Introduce the CPU address space destruction function
>>    Added CPU topology support for Loongarch
>>    Optimize loongarch_irq_init function implementation
>>    Add basic CPU hot-(un)plug support for Loongarch
>>    Add support of *unrealize* for Loongarch cpu
>>    Add generic event device for Loongarch
>>    Update the ACPI table for the Loongarch CPU
>>
>>   .../devices/loongarch64-softmmu/default.mak   |   1 +
>>   docs/system/loongarch/virt.rst                |  31 ++
>>   hw/acpi/acpi-cpu-hotplug-stub.c               |  15 +
>>   hw/acpi/cpu.c                                 |  27 +-
>>   hw/acpi/generic_event_device.c                |  33 ++
>>   hw/core/gpio.c                                |   4 +-
>>   hw/i386/acpi-build.c                          |   2 +-
>>   hw/loongarch/acpi-build.c                     |  33 +-
>>   hw/loongarch/generic_event_device_loongarch.c |  36 ++
>>   hw/loongarch/meson.build                      |   2 +-
>>   hw/loongarch/virt.c                           | 424 +++++++++++++++---
>>   include/exec/cpu-common.h                     |   8 +
>>   include/hw/acpi/cpu.h                         |   5 +-
>>   include/hw/acpi/cpu_hotplug.h                 |  10 +
>>   include/hw/acpi/generic_event_device.h        |   6 +
>>   include/hw/core/cpu.h                         |   1 +
>>   include/hw/loongarch/virt.h                   |  10 +-
>>   include/hw/qdev-core.h                        |   2 +
>>   softmmu/physmem.c                             |  24 +
>>   target/loongarch/cpu.c                        |  35 +-
>>   target/loongarch/cpu.h                        |  13 +-
>>   21 files changed, 635 insertions(+), 87 deletions(-)
>>   create mode 100644 hw/loongarch/generic_event_device_loongarch.c
>>
>> Cc: "Salil Mehta" <salil.mehta@opnsrc.net>
>> Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>
>> Cc: Song Gao <gaosong@loongson.cn>
>> Cc: "Michael S. Tsirkin" <mst@redhat.com>
>> Cc: Igor Mammedov <imammedo@redhat.com>
>> Cc: Ani Sinha <anisinha@redhat.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Richard Henderson <richard.henderson@linaro.org>
>> Cc: Eduardo Habkost <eduardo@habkost.net>
>> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>> Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>
>> Cc: Yanan Wang <wangyanan55@huawei.com>
>> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
>> Cc: Peter Xu <peterx@redhat.com>
>> Cc: David Hildenbrand <david@redhat.com>
>> Cc: Bibo Mao <maobibo@loongson.cn>
>> Cc: Xianglai li <lixianglai@loongson.cn>
>> --
>> 2.39.1
>>
>>