Re: [PATCH v4 0/3] NUMA: Apply cluster-NUMA-node boundary for aarch64 and riscv machines

2023-04-11 Thread Gavin Shan
Hi Peter, On 3/27/23 9:26 PM, Igor Mammedov wrote: On Fri, 17 Mar 2023 14:25:39 +0800 Gavin Shan wrote: For arm64 and riscv architecture, the driver (/base/arch_topology.c) is used to populate the CPU topology in the Linux guest. It's required that the CPUs in one cluster can't sp

Re: [PATCH v4 0/3] NUMA: Apply cluster-NUMA-node boundary for aarch64 and riscv machines

2023-04-12 Thread Gavin Shan
On 4/12/23 7:42 PM, Peter Maydell wrote: On Wed, 12 Apr 2023 at 02:08, Gavin Shan wrote: On 3/27/23 9:26 PM, Igor Mammedov wrote: On Fri, 17 Mar 2023 14:25:39 +0800 Gavin Shan wrote: For arm64 and riscv architecture, the driver (/base/arch_topology.c) is used to populate the CPU topology

Re: [PATCH v4 0/3] NUMA: Apply cluster-NUMA-node boundary for aarch64 and riscv machines

2023-04-18 Thread Gavin Shan
Hi Igor, On 4/13/23 7:21 PM, Igor Mammedov wrote: On Thu, 13 Apr 2023 13:50:57 +0800 Gavin Shan wrote: On 4/12/23 7:42 PM, Peter Maydell wrote: On Wed, 12 Apr 2023 at 02:08, Gavin Shan wrote: On 3/27/23 9:26 PM, Igor Mammedov wrote: On Fri, 17 Mar 2023 14:25:39 +0800 Gavin Shan wrote

Re: [PATCH v2 0/4] hw/arm/virt: Support dirty ring

2023-03-13 Thread Gavin Shan
On 2/27/23 12:26 PM, Gavin Shan wrote: This series intends to support dirty ring for live migration for arm64. The dirty ring use discrete buffer to track dirty pages. For arm64, the speciality is to use backup bitmap to track dirty pages when there is no-running-vcpu context. It's known

Re: [PATCH v3 0/3] NUMA: Apply cluster-NUMA-node boundary for aarch64 and riscv machines

2023-03-13 Thread Gavin Shan
On 2/25/23 2:35 PM, Gavin Shan wrote: For arm64 and riscv architecture, the driver (/base/arch_topology.c) is used to populate the CPU topology in the Linux guest. It's required that the CPUs in one cluster can't span mutiple NUMA nodes. Otherwise, the Linux scheduling domain can'

Re: [PATCH v3 1/3] numa: Validate cluster and NUMA node boundary if required

2023-03-13 Thread Gavin Shan
On 3/13/23 7:40 PM, Philippe Mathieu-Daudé wrote: On 25/2/23 07:35, Gavin Shan wrote: For some architectures like ARM64, multiple CPUs in one cluster can be associated with different NUMA nodes, which is irregular configuration because we shouldn't have this in baremetal environment

Re: [PATCH for-8.1] hw: Add compat machines for 8.1

2023-03-16 Thread Gavin Shan
insertions(+), 10 deletions(-) For hw/arm/virt.c: Acked-by: Gavin Shan diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ac626b3bef74..267fe56fae76 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3232,10 +3232,17 @@ static void machvirt_machine_init(void) } type_init

[PATCH v4 0/3] NUMA: Apply cluster-NUMA-node boundary for aarch64 and riscv machines

2023-03-16 Thread Gavin Shan
v2 1/4] related to qtests/numa-test(Gavin) v2: * Fix socket-NUMA-node boundary issues in qtests/numa-test (Gavin) * Add helper set_numa_socket_boundary() and validate the boundary in the generic path (Philippe) Gavin Shan (3): numa: Validate clu

[PATCH v4 2/3] hw/arm: Validate cluster and NUMA node boundary

2023-03-16 Thread Gavin Shan
A nodes. Signed-off-by: Gavin Shan --- hw/arm/sbsa-ref.c | 2 ++ hw/arm/virt.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 0b93558dde..efb380e7c8 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -864,6 +864,8 @@ static void

[PATCH v4 3/3] hw/riscv: Validate cluster and NUMA node boundary

2023-03-16 Thread Gavin Shan
odes. Signed-off-by: Gavin Shan Reviewed-by: Daniel Henrique Barboza --- hw/riscv/spike.c | 2 ++ hw/riscv/virt.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index a584d5b3a2..4bf783884b 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -34

[PATCH v4 1/3] numa: Validate cluster and NUMA node boundary if required

2023-03-16 Thread Gavin Shan
0x140 ret_from_fork+0x10/0x20 Improve the situation to warn when multiple CPUs in one cluster have been associated with different NUMA nodes. However, one NUMA node is allowed to be associated with different clusters. Signed-off-by: Gavin Shan Acked-by: Philippe Mathieu-Daudé --- hw/core/machine.c

Re: [PATCH v3 1/3] numa: Validate cluster and NUMA node boundary if required

2023-03-16 Thread Gavin Shan
On 2/25/23 2:35 PM, Gavin Shan wrote: For some architectures like ARM64, multiple CPUs in one cluster can be associated with different NUMA nodes, which is irregular configuration because we shouldn't have this in baremetal environment. The irregular configuration causes Linux guest to misb

Re: [PATCH] hw/arm/virt: Fix CPU's default NUMA node ID

2022-02-25 Thread Gavin Shan
Hi Igor, On 2/17/22 10:14 AM, Gavin Shan wrote: On 1/26/22 5:14 PM, Igor Mammedov wrote: On Wed, 26 Jan 2022 13:24:10 +0800 Gavin Shan wrote: The default CPU-to-NUMA association is given by mc->get_default_cpu_node_id() when it isn't provided explicitly. However, the CPU topolo

Re: [PATCH] hw/arm/virt: Fix CPU's default NUMA node ID

2022-02-27 Thread Gavin Shan
Hi Igor, On 2/25/22 6:03 PM, Igor Mammedov wrote: On Fri, 25 Feb 2022 16:41:43 +0800 Gavin Shan wrote: On 2/17/22 10:14 AM, Gavin Shan wrote: On 1/26/22 5:14 PM, Igor Mammedov wrote: On Wed, 26 Jan 2022 13:24:10 +0800 Gavin Shan wrote: The default CPU-to-NUMA association is given by mc

[PATCH] hw/arm/virt: Validate memory size on the first NUMA node

2022-02-27 Thread Gavin Shan
is given for this specific case. Signed-off-by: Gavin Shan --- hw/arm/virt.c | 9 + hw/core/numa.c | 5 + include/hw/boards.h | 1 + 3 files changed, 15 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 46bf7ceddf..234e7fca28 100644 --- a/hw/arm/virt.c +++ b

Re: [PATCH] hw/arm/virt: Fix CPU's default NUMA node ID

2022-03-01 Thread Gavin Shan
Hi Igor, On 2/28/22 6:54 PM, Igor Mammedov wrote: On Mon, 28 Feb 2022 12:26:53 +0800 Gavin Shan wrote: On 2/25/22 6:03 PM, Igor Mammedov wrote: On Fri, 25 Feb 2022 16:41:43 +0800 Gavin Shan wrote: On 2/17/22 10:14 AM, Gavin Shan wrote: On 1/26/22 5:14 PM, Igor Mammedov wrote: On Wed, 26

Re: [PATCH] hw/arm/virt: Validate memory size on the first NUMA node

2022-03-01 Thread Gavin Shan
Hi Igor, On 2/28/22 5:08 PM, Igor Mammedov wrote: On Mon, 28 Feb 2022 15:52:03 +0800 Gavin Shan wrote: When the memory size on the first NUMA node is less than 128MB, the guest hangs inside EDK2 as the following logs show. /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64

[PATCH v2 0/3] hw/arm/virt: Fix CPU's default NUMA node ID

2022-03-02 Thread Gavin Shan
table (Gavin) Gavin Shan (3): hw/arm/virt: Fix CPU's default NUMA node ID hw/acpi/aml-build: Use existing CPU topology to build PPTT table hw/arm/virt: Unify ACPI processor ID in MADT and SRAT table hw/acpi/aml-build.c

[PATCH v2 2/3] hw/acpi/aml-build: Use existing CPU topology to build PPTT table

2022-03-02 Thread Gavin Shan
in ms->possible_cpus. However, the cluster ID for the CPU instance has to be calculated dynamically because there is no corresponding field in struct CpuInstanceProperties. Currently, the only user of build_pptt() is arm/virt machine. Signed-off-by: Gavin Shan --- hw/acpi/aml-build

[PATCH v2 1/3] hw/arm/virt: Fix CPU's default NUMA node ID

2022-03-02 Thread Gavin Shan
gs are seen from the Linux guest. The 6 CPUs are associated with NODE#0/1, but there are no CPUs associated with NODE#2/3/4/5. Signed-off-by: Gavin Shan --- hw/arm/virt.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 46b

[PATCH v2 3/3] hw/arm/virt: Unify ACPI processor ID in MADT and SRAT table

2022-03-02 Thread Gavin Shan
The value of the following field has been used in ACPI PPTT table to identify the corresponding processor. This takes the same field as the ACPI processor ID in MADT and SRAT tables. ms->possible_cpus->cpus[i].props.thread_id Signed-off-by: Gavin Shan --- hw/arm/virt-acpi-build.

Re: [PATCH] hw/arm/virt: Validate memory size on the first NUMA node

2022-03-02 Thread Gavin Shan
Hi Gerd, On 3/1/22 7:42 PM, Gerd Hoffmann wrote: Unless it architecturally wrong thing i.e. (node size less than 128Mb) ,in which case limiting it in QEMU would be justified, I'd prefer firmware being fixed or it reporting more useful for user error message. [include EDK2 developers] I don't

[PATCH 2/2] hw/arm/virt: Don't create device-tree node for empty NUMA node

2021-10-06 Thread Gavin Shan
NUMA nodes to avoid the error, so that QEMU can be started successfully. Signed-off-by: Gavin Shan --- hw/arm/boot.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 57efb61ee4..4e5898fcdc 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -603,6 +6

[PATCH 0/2] hw/arm/virt: Fix qemu booting failure on device-tree

2021-10-06 Thread Gavin Shan
tree nodes aren't created for the empty NUMA nodes, but their NUMA IDs and distance map matrix should be included in the distance-map device-tree node. Gavin Shan (2): numa: Set default distance map if needed hw/arm/virt: Don't create device-tree node for empty NUMA node hw/arm/b

[PATCH 1/2] numa: Set default distance map if needed

2021-10-06 Thread Gavin Shan
y distance map, we need to generate the default distance map, where the local and remote distances are 10 and 20 separately. This adds an extra parameter to the exiting complete_init_numa_distance() to generate the default distance map for this case. Signed-off-by: Gavin Shan --- hw/core/numa.c

Re: [PATCH 1/2] numa: Set default distance map if needed

2021-10-06 Thread Gavin Shan
Hi Drew, On 10/6/21 9:35 PM, Andrew Jones wrote: On Wed, Oct 06, 2021 at 06:22:08PM +0800, Gavin Shan wrote: The following option is used to specify the distance map. It's possible the option isn't provided by user. In this case, the distance map isn't populated and exposed to p

[PATCH] hw/arm/virt: Fix CPU's default NUMA node ID

2022-01-25 Thread Gavin Shan
DE#2/3/4/5. Signed-off-by: Gavin Shan --- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 141350bf21..b4a95522d3 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2499,7 +2499,7 @@ virt_cpu_index_to_props(MachineState *ms, unsi

Re: [PATCH v2] hw/arm/virt: Expose empty NUMA nodes through ACPI

2021-11-01 Thread Gavin Shan
On 11/1/21 7:44 PM, Igor Mammedov wrote: On Thu, 28 Oct 2021 22:32:09 +1100 Gavin Shan wrote: On 10/28/21 2:40 AM, Igor Mammedov wrote: On Wed, 27 Oct 2021 13:29:58 +0800 Gavin Shan wrote: The empty NUMA nodes, where no memory resides, aren't exposed through ACPI SRAT table. It&

Re: [PATCH v2] hw/arm/virt: Expose empty NUMA nodes through ACPI

2021-11-05 Thread Gavin Shan
Hi Drew and Igor, On 11/2/21 6:39 PM, Andrew Jones wrote: On Tue, Nov 02, 2021 at 10:44:08AM +1100, Gavin Shan wrote: Yeah, I agree. I don't have strong sense to expose these empty nodes for now. Please ignore the patch. So were describing empty numa nodes on the command line e

[PATCH 0/3] hw/acpi/aml-build: Fix {socket, cluster, core} IDs in PPTT

2022-05-18 Thread Gavin Shan
my host, where the 'ACPI Processor ID valid' is set for cluster/core nodes, but missed from socket nodes. host# pwd /sys/devices/system/cpu host# cat cpu0/topology/physical_package_id; \ cat cpu0/topology/cluster_id; \ cat cpu0/topology/core_id 36 0 0 Gavin Shan

[PATCH 2/3] hw/acpi/aml-build: Fix {socket, cluster, core} IDs in PPTT

2022-05-18 Thread Gavin Shan
ology/physical_package_id; done 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 # for i in `seq 0 15`; do cat cpu$i/topology/cluster_id; done 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 # for i in `seq 0 15`; do cat cpu$i/topology/core_id; done 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 Signed-off-by: Gavin Shan ---

[PATCH 3/3] tests/acpi/virt: Update PPTT ACPI table

2022-05-18 Thread Gavin Shan
lementation : 0 Signed-off-by: Gavin Shan --- tests/data/acpi/virt/PPTT | Bin 96 -> 96 bytes tests/qtest/bios-tables-test-allowed-diff.h | 1 - 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/virt/PPTT b/tests/data/acpi/virt/PPTT index f56ea63

[PATCH 1/3] tests/acpi/virt: Allow PPTT ACPI table changes

2022-05-18 Thread Gavin Shan
This allows PPTT ACPI table changes in "tests/data/acpi/virt/PPTT". Signed-off-by: Gavin Shan --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-di

[PATCH] hw/arm/virt: Expose empty NUMA nodes through ACPI

2021-10-25 Thread Gavin Shan
icitly given to these empty NUMA nodes for sake of completeness. guest# ls /sys/devices/system/node | grep node node0 node1 node2 node3 Signed-off-by: Gavin Shan --- hw/arm/virt-acpi-build.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt-ac

Re: [PATCH] hw/arm/virt: Expose empty NUMA nodes through ACPI

2021-10-26 Thread Gavin Shan
On 10/26/21 5:25 PM, Andrew Jones wrote: On Tue, Oct 26, 2021 at 07:41:01AM +0800, Gavin Shan wrote: The empty NUMA nodes, where no memory resides, aren't exposed through ACPI SRAT table. It's not user preferred behaviour because the corresponding memory node devices are missed from

Re: [PATCH] hw/arm/virt: Expose empty NUMA nodes through ACPI

2021-10-26 Thread Gavin Shan
On 10/26/21 8:47 PM, Igor Mammedov wrote: On Tue, 26 Oct 2021 07:41:01 +0800 Gavin Shan wrote: The empty NUMA nodes, where no memory resides, aren't exposed through ACPI SRAT table. It's not user preferred behaviour because the corresponding memory node devices are missed from

[PATCH v2] hw/arm/virt: Expose empty NUMA nodes through ACPI

2021-10-26 Thread Gavin Shan
al Node 3 MemTotal:0 kB (qemu) object_add memory-backend-ram,id=hp-mem0,size=1G (qemu) device_add pc-dimm,id=hp-dimm0,node=3,memdev=hp-mem0 guest# cat /sys/devices/system/node/node3/meminfo | grep MemTotal Node 3 MemTotal:1048576 kB Signed-off-by: Gavin Shan Reviewed-by: Andrew Jon

Re: [PATCH v2] hw/arm/virt: Expose empty NUMA nodes through ACPI

2021-10-28 Thread Gavin Shan
On 10/28/21 2:40 AM, Igor Mammedov wrote: On Wed, 27 Oct 2021 13:29:58 +0800 Gavin Shan wrote: The empty NUMA nodes, where no memory resides, aren't exposed through ACPI SRAT table. It's not user preferred behaviour because the corresponding memory node devices are missed from

Re: [PATCH v3 2/2] hw/arm/virt: Support for virtio-mem-pci

2022-01-07 Thread Gavin Shan
Hi Peter, On 1/8/22 12:40 AM, Peter Maydell wrote: On Fri, 3 Dec 2021 at 23:34, Gavin Shan wrote: This supports virtio-mem-pci device on "virt" platform, by simply following the implementation on x86. * This implements the hotplug handlers to support virtio-mem-pci devi

[PATCH v4 0/2] hw/arm/virt: Support for virtio-mem-pci

2022-01-10 Thread Gavin Shan
EXTENT to 512MB on ARM64 in PATCH[1/2] (David) * PATCH[2/2] is added to correct the THP sizes on ARM64 (David) Gavin Shan (2): virtio-mem: Correct default THP size for ARM64 hw/arm/virt: Support for virtio-mem-pci hw/arm/Kconfig | 1 + hw/arm/virt.

[PATCH v4 2/2] hw/arm/virt: Support for virtio-mem-pci

2022-01-10 Thread Gavin Shan
Co-developed-by: Jonathan Cameron Signed-off-by: Gavin Shan Reviewed-by: Jonathan Cameron Reviewed-by: David Hildenbrand --- hw/arm/Kconfig | 1 + hw/arm/virt.c | 70 ++ hw/virtio/virtio-mem.c | 4 ++- 3 files changed, 74 insertions(+), 1 de

[PATCH v4 1/2] virtio-mem: Correct default THP size for ARM64

2022-01-10 Thread Gavin Shan
brand Signed-off-by: Gavin Shan Reviewed-by: Jonathan Cameron Reviewed-by: David Hildenbrand --- hw/virtio/virtio-mem.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 04c223b0c9..1ca453

Re: [PATCH] hw/arm/virt: Fix CPU's default NUMA node ID

2022-02-15 Thread Gavin Shan
On 1/28/22 3:05 PM, wangyanan (Y) via wrote On 2022/1/26 17:14, Igor Mammedov wrote: On Wed, 26 Jan 2022 13:24:10 +0800 Gavin Shan wrote: The default CPU-to-NUMA association is given by mc->get_default_cpu_node_id() when it isn't provided explicitly. However, the CPU topology isn

Re: [PATCH] hw/arm/virt: Fix CPU's default NUMA node ID

2022-02-16 Thread Gavin Shan
On 2/15/22 4:32 PM, Andrew Jones wrote: On Tue, Feb 15, 2022 at 04:19:01PM +0800, Gavin Shan wrote: The issue isn't related to CPU topology directly. It's actually related to the fact: the default NUMA node ID will be picked for one particular CPU if the associated NUMA node ID isn&

Re: [PATCH] hw/arm/virt: Fix CPU's default NUMA node ID

2022-02-16 Thread Gavin Shan
On 1/26/22 5:14 PM, Igor Mammedov wrote: On Wed, 26 Jan 2022 13:24:10 +0800 Gavin Shan wrote: The default CPU-to-NUMA association is given by mc->get_default_cpu_node_id() when it isn't provided explicitly. However, the CPU topology isn't fully considered in the default assoc

Re: [PATCH v8 0/5] hw/arm/virt: Fix CPU's default NUMA node ID

2022-05-02 Thread Gavin Shan
Hi Peter and maintainers, On 4/25/22 11:27 AM, Gavin Shan wrote: When the CPU-to-NUMA association isn't provided by user, the default NUMA node ID for the specific CPU is returned from virt_get_default_cpu_node_id(). Unfortunately, the default NUMA node ID breaks socket boundary and lea

Re: [PATCH v8 2/5] qtest/numa-test: Specify CPU topology in aarch64_numa_cpu()

2022-05-02 Thread Gavin Shan
Hi Igor, On 5/2/22 4:52 PM, Igor Mammedov wrote: On Mon, 25 Apr 2022 11:27:59 +0800 Gavin Shan wrote: The CPU topology isn't enabled on arm/virt machine yet, but we're going to do it in next patch. After the CPU topology is enabled by next patch, "thrad-id=1" becomes inv

[PATCH v9 2/6] qtest/numa-test: Specify CPU topology in aarch64_numa_cpu()

2022-05-03 Thread Gavin Shan
ore the CPU topology is enabled in next patch. Signed-off-by: Gavin Shan Reviewed-by: Yanan Wang --- tests/qtest/numa-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index 90bf68a5b3..aeda8c774c 100644 --- a/tests/q

[PATCH v9 3/6] hw/arm/virt: Consider SMP configuration in CPU topology

2022-05-03 Thread Gavin Shan
lated. The die ID for the given CPU isn't assigned since it's not supported on arm/virt machine. Besides, the used SMP configuration in qtest/numa-test/aarch64_numa_cpu() is corrcted to avoid testing failure Signed-off-by: Gavin Shan Reviewed-by: Yanan Wang Acked-by: Igor Mammedov ---

Re: [PATCH v8 2/5] qtest/numa-test: Specify CPU topology in aarch64_numa_cpu()

2022-05-03 Thread Gavin Shan
Hi Igor, On 5/3/22 4:54 PM, Igor Mammedov wrote: On Mon, 2 May 2022 18:07:00 +0800 Gavin Shan wrote: On 5/2/22 4:52 PM, Igor Mammedov wrote: On Mon, 25 Apr 2022 11:27:59 +0800 Gavin Shan wrote: The CPU topology isn't enabled on arm/virt machine yet, but we're going to do

[PATCH v9 6/6] hw/acpi/aml-build: Use existing CPU topology to build PPTT table

2022-05-03 Thread Gavin Shan
user of build_pptt() is arm/virt machine. Signed-off-by: Gavin Shan Tested-by: Yanan Wang Reviewed-by: Yanan Wang Acked-by: Igor Mammedov --- hw/acpi/aml-build.c | 111 +++- 1 file changed, 48 insertions(+), 63 deletions(-) diff --git a/hw/acpi/aml-buil

[PATCH v9 5/6] hw/arm/virt: Fix CPU's default NUMA node ID

2022-05-03 Thread Gavin Shan
e associated with NODE#0/1, but there are no CPUs associated with NODE#2/3/4/5. Signed-off-by: Gavin Shan Reviewed-by: Igor Mammedov Reviewed-by: Yanan Wang --- hw/arm/virt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 6df3981b1e..766c

[PATCH v9 1/6] qapi/machine.json: Add cluster-id

2022-05-03 Thread Gavin Shan
::machine_numa_finish_cpu_init() to record CPU slots with no NUMA mapping set. * hw/core/machine-hmp-cmds.c::hmp_hotpluggable_cpus() to dump cluster-id. Signed-off-by: Gavin Shan Reviewed-by: Yanan Wang Acked-by: Igor Mammedov --- hw/core/machine-hmp-cmds.c | 4 hw/core/machine.c | 16

[PATCH v9 4/6] qtest/numa-test: Correct CPU and NUMA association in aarch64_numa_cpu()

2022-05-03 Thread Gavin Shan
hread -- 0100 0 1000 0 Suggested-by: Igor Mammedov Signed-off-by: Gavin Shan --- tests/qtest/numa-test.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --

[PATCH v9 0/6] hw/arm/virt: Fix CPU's default NUMA node ID

2022-05-03 Thread Gavin Shan
node_id() (Igor) * Added PATCH[2/3] to use the existing CPU topology when the PPTT table is built(Igor) * Added PATCH[3/3] to take thread ID as ACPI processor ID in MADT and SRAT table (Gavin) Gavin Shan (6): qapi/machine.json:

Re: [PATCH v9 0/6] hw/arm/virt: Fix CPU's default NUMA node ID

2022-05-08 Thread Gavin Shan
Hi Peter and maintainers, On 5/3/22 10:02 PM, Gavin Shan wrote: When the CPU-to-NUMA association isn't provided by user, the default NUMA node ID for the specific CPU is returned from virt_get_default_cpu_node_id(). Unfortunately, the default NUMA node ID breaks socket boundary and leads t

[PATCH v2 0/4] hw/arm/virt: Improve address assignment for high memory regions

2022-08-14 Thread Gavin Shan
(Gavin) * Improved changelog (Marc) * Use 'bool fits' in virt_set_high_memmap() (Eric) Gavin Shan (4): hw/arm/virt: Rename variable size to region_size in virt_set_memmap() hw/arm/virt: Introduce variable re

[PATCH v2 2/4] hw/arm/virt: Introduce variable region_base in virt_set_memmap()

2022-08-14 Thread Gavin Shan
This introduces variable 'region_base' for the base address of the specific high memory region. It's the preparatory to improve the address assignment for high memory region in next patch. No functional change intended. Signed-off-by: Gavin Shan --- hw/arm/virt.c | 10 +++

[PATCH v2 1/4] hw/arm/virt: Rename variable size to region_size in virt_set_memmap()

2022-08-14 Thread Gavin Shan
This renames variable 'size' to 'region_size' in virt_set_memmap(). It's counterpart to 'region_base', which will be introducded in next patch. No functional change intended. Signed-off-by: Gavin Shan --- hw/arm/virt.c | 12 ++-- 1 file changed, 6

[PATCH v2 4/4] virt/hw/virt: Add virt_set_high_memmap() helper

2022-08-14 Thread Gavin Shan
The logic to assign high memory region's address in virt_set_memmap() is independent. Lets move the logic to virt_set_high_memmap() helper. "each device" is replaced by "each region" in the comments. No functional change intended. Signed-off-by: Gavin Shan

[PATCH v2 3/4] hw/arm/virt: Improve address assignment for high memory regions

2022-08-14 Thread Gavin Shan
n disabled in case (1), (2) and (3). Signed-off-by: Gavin Shan --- hw/arm/virt.c | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 582a8960fc..e38b6919c9 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c

Re: [PATCH v2 0/4] hw/arm/virt: Improve address assignment for high memory regions

2022-08-23 Thread Gavin Shan
Hi Marc, On 8/15/22 4:29 PM, Gavin Shan wrote: There are three high memory regions, which are VIRT_HIGH_REDIST2, VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses are floating on highest RAM address. However, they can be disabled in several cases. (1) One specific high

Re: [PATCH v2 0/4] hw/arm/virt: Improve address assignment for high memory regions

2022-08-25 Thread Gavin Shan
Hi Eric, On 8/24/22 6:06 PM, Eric Auger wrote: On 8/24/22 05:29, Gavin Shan wrote: On 8/15/22 4:29 PM, Gavin Shan wrote: There are three high memory regions, which are VIRT_HIGH_REDIST2, VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses are floating on highest RAM address

[PATCH] hw/arm/virt: Prevent CPUs in one socket to span mutiple NUMA nodes

2023-02-21 Thread Gavin Shan
/0x910 sched_init_domains+0xac/0xe0 sched_init_smp+0x48/0xc8 kernel_init_freeable+0x140/0x1ac kernel_init+0x28/0x140 ret_from_fork+0x10/0x20 Fix it by preventing mutiple CPUs in one socket to be associated with different NUMA nodes. Reported-by: Yihuang Yu Signed-off-by: Gavin Shan

Re: [PATCH] hw/arm/virt: Prevent CPUs in one socket to span mutiple NUMA nodes

2023-02-21 Thread Gavin Shan
On 2/21/23 8:15 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 09:53, Gavin Shan wrote: Linux kernel guest reports warning when two CPUs in one socket have been associated with different NUMA nodes, using the following command lines.    -smp 6,maxcpus=6,sockets=2,clusters=1,cores=3,threads=1

Re: [PATCH] kvm: dirty-ring: Fix race with vcpu creation

2023-02-21 Thread Gavin Shan
+ assert(dirty_gfns && ring_size); trace_kvm_dirty_ring_reap_vcpu(cpu->cpu_index); Reviewed-by: Gavin Shan

Re: [PATCH] hw/arm/virt: Prevent CPUs in one socket to span mutiple NUMA nodes

2023-02-21 Thread Gavin Shan
On 2/21/23 9:21 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 10:21, Gavin Shan wrote: On 2/21/23 8:15 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 09:53, Gavin Shan wrote: Linux kernel guest reports warning when two CPUs in one socket have been associated with different NUMA nodes, using the

Re: [PATCH v1 1/6] linux-headers: Update for dirty ring

2023-02-21 Thread Gavin Shan
On 2/22/23 3:30 AM, Peter Maydell wrote: On Mon, 13 Feb 2023 at 00:39, Gavin Shan wrote: Signed-off-by: Gavin Shan --- linux-headers/asm-arm64/kvm.h | 1 + linux-headers/linux/kvm.h | 2 ++ 2 files changed, 3 insertions(+) For this to be a non-RFC patch, this needs to be a proper

Re: [PATCH v1 2/6] migration: Add last stage indicator to global dirty log synchronization

2023-02-21 Thread Gavin Shan
On 2/22/23 4:36 AM, Peter Xu wrote: On Mon, Feb 13, 2023 at 08:39:21AM +0800, Gavin Shan wrote: The global dirty log synchronization is used when KVM and dirty ring are enabled. There is a particularity for ARM64 where the backup bitmap is used to track dirty pages in non-running-vcpu

Re: [PATCH] hw/arm/virt: Prevent CPUs in one socket to span mutiple NUMA nodes

2023-02-21 Thread Gavin Shan
On 2/22/23 10:31 AM, Philippe Mathieu-Daudé wrote: On 22/2/23 00:12, Gavin Shan wrote: On 2/21/23 9:21 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 10:21, Gavin Shan wrote: On 2/21/23 8:15 PM, Philippe Mathieu-Daudé wrote: On 21/2/23 09:53, Gavin Shan wrote: Linux kernel guest reports

Re: [PATCH v1 3/6] kvm: Synchronize the backup bitmap in the last stage

2023-02-21 Thread Gavin Shan
On 2/22/23 4:46 AM, Peter Xu wrote: On Mon, Feb 13, 2023 at 08:39:22AM +0800, Gavin Shan wrote: In the last stage of live migration or memory slot removal, the backup bitmap needs to be synchronized when it has been enabled. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 11

Re: [PATCH v1 5/6] hw/arm/virt: Enable backup bitmap for dirty ring

2023-02-21 Thread Gavin Shan
On 2/22/23 3:27 AM, Peter Maydell wrote: On Mon, 13 Feb 2023 at 00:40, Gavin Shan wrote: When KVM device "kvm-arm-gicv3" or "arm-its-kvm" is used, we have to enable the backup bitmap for the dirty ring. Otherwise, the migration will fail because those two devices are usi

Re: [PATCH v1 3/6] kvm: Synchronize the backup bitmap in the last stage

2023-02-21 Thread Gavin Shan
On 2/22/23 10:58 AM, Peter Xu wrote: On Wed, Feb 22, 2023 at 10:44:07AM +1100, Gavin Shan wrote: Peter, could you please give some hints for me to understand the atomic and non-atomic update here? Ok, I will drop this part of changes in next revision with the assumption that we have atomic

Re: [PATCH v1 1/6] linux-headers: Update for dirty ring

2023-02-22 Thread Gavin Shan
On 2/22/23 7:49 PM, Cornelia Huck wrote: On Wed, Feb 22 2023, Gavin Shan wrote: On 2/22/23 3:30 AM, Peter Maydell wrote: On Mon, 13 Feb 2023 at 00:39, Gavin Shan wrote: Signed-off-by: Gavin Shan --- linux-headers/asm-arm64/kvm.h | 1 + linux-headers/linux/kvm.h | 2 ++ 2 files

Re: [PATCH v3] qapi/qom: Memory backend property prealloc-threads doc fix

2022-11-10 Thread Gavin Shan
1 file changed, 1 insertion(+), 1 deletion(-) With the following comments addressed: Reviewed-by: Gavin Shan --- Please consider amending the commit log to something like below. The default "prealloc-threads" value is set to 1 when the property is added by commit ffac16fab33

Re: [PATCH v3] qapi/qom: Memory backend property prealloc-threads doc fix

2022-11-11 Thread Gavin Shan
On 11/11/22 5:13 PM, Igor Mammedov wrote: On Fri, 11 Nov 2022 07:47:16 +0100 Markus Armbruster wrote: Gavin Shan writes: On 11/11/22 11:05 AM, Zhenyu Zhang wrote: Commit ffac16fab3 "hostmem: introduce "prealloc-threads" property" (v5.0.0) changed the default number of

Re: [PATCH v3] qapi/qom: Memory backend property prealloc-threads doc fix

2022-11-11 Thread Gavin Shan
On 11/11/22 6:54 PM, Igor Mammedov wrote: On Fri, 11 Nov 2022 17:34:04 +0800 Gavin Shan wrote: On 11/11/22 5:13 PM, Igor Mammedov wrote: On Fri, 11 Nov 2022 07:47:16 +0100 Markus Armbruster wrote: Gavin Shan writes: On 11/11/22 11:05 AM, Zhenyu Zhang wrote: Commit ffac16fab3 "ho

Re: [PATCH] KVM: dirty ring: Add memory barrier when marking pfn collected

2022-09-22 Thread Gavin Shan
On 9/23/22 7:35 AM, Peter Xu wrote: Following commit 4802bf910eee9, add the other missing barrier when marking the PFN as collected. This will also be required just like 4802bf910eee9 on weak ordering architectures like aarch64. Cc: Marc Zyngier Cc: Gavin Shan Cc: Paolo Bonzini Signed-off

Re: [PATCH v3 3/5] hw/arm/virt: Introduce variable region_base in virt_set_high_memmap()

2022-09-28 Thread Gavin Shan
Hi Eric, On 9/28/22 10:10 PM, Eric Auger wrote: On 9/22/22 01:13, Gavin Shan wrote: This introduces variable 'region_base' for the base address of the specific high memory region. It's the preparatory work to optimize high memory region address assignment. Why is it a prepara

Re: [PATCH v3 4/5] hw/arm/virt: Improve high memory region address assignment

2022-09-28 Thread Gavin Shan
Hi Eric, On 9/28/22 10:51 PM, Eric Auger wrote: On 9/22/22 01:13, Gavin Shan wrote: There are three high memory regions, which are VIRT_HIGH_REDIST2, VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses are floating on highest RAM address. However, they can be disabled in several

Re: [PATCH v3 5/5] hw/arm/virt: Add 'highmem-compact' property

2022-09-28 Thread Gavin Shan
Hi Eric, On 9/28/22 10:22 PM, Eric Auger wrote: On 9/22/22 01:13, Gavin Shan wrote: After the improvement to high memory region address assignment is applied, the memory layout is changed. For example, VIRT_HIGH_PCIE_MMIO s/the memory layout is changed./the memory layout is changed

Re: [PATCH v3 5/5] hw/arm/virt: Add 'highmem-compact' property

2022-09-29 Thread Gavin Shan
Hi Cornelia, On 9/29/22 8:27 PM, Cornelia Huck wrote: On Thu, Sep 29 2022, Gavin Shan wrote: On 9/28/22 10:22 PM, Eric Auger wrote: On 9/22/22 01:13, Gavin Shan wrote: After the improvement to high memory region address assignment is applied, the memory layout is changed. For example

Re: [PATCH v3 4/5] hw/arm/virt: Improve high memory region address assignment

2022-10-03 Thread Gavin Shan
Hi Eric, On 10/3/22 4:44 PM, Eric Auger wrote: On 9/29/22 01:37, Gavin Shan wrote: On 9/28/22 10:51 PM, Eric Auger wrote: On 9/22/22 01:13, Gavin Shan wrote: There are three high memory regions, which are VIRT_HIGH_REDIST2, VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses

Re: [PATCH v3 5/5] hw/arm/virt: Add 'highmem-compact' property

2022-10-03 Thread Gavin Shan
Hi Eric, On 10/3/22 4:49 PM, Eric Auger wrote: On 9/29/22 01:49, Gavin Shan wrote: On 9/28/22 10:22 PM, Eric Auger wrote: On 9/22/22 01:13, Gavin Shan wrote: After the improvement to high memory region address assignment is applied, the memory layout is changed. For example

[PATCH v4 3/6] hw/arm/virt: Introduce variable region_base in virt_set_high_memmap()

2022-10-03 Thread Gavin Shan
This introduces variable 'region_base' for the base address of the specific high memory region. It's the preparatory work to optimize high memory region address assignment. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Eric Auger --- hw/arm/virt.c | 12

[PATCH v4 1/6] hw/arm/virt: Introduce virt_set_high_memmap() helper

2022-10-03 Thread Gavin Shan
This introduces virt_set_high_memmap() helper. The logic of high memory region address assignment is moved to the helper. The intention is to make the subsequent optimization for high memory region address assignment easier. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by

[PATCH v4 2/6] hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap()

2022-10-03 Thread Gavin Shan
This renames variable 'size' to 'region_size' in virt_set_high_memmap(). Its counterpart ('region_base') will be introduced in next patch. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Eric Auger --- hw/arm/virt.c | 15 ---

[PATCH v4 0/6] hw/arm/virt: Improve address assignment for high memory regions

2022-10-03 Thread Gavin Shan
perty for backwards compatibility (Eric) v2: * Split the patches for easier review(Gavin) * Improved changelog (Marc) * Use 'bool fits' in virt_set_high_memmap() (Eric) Gavin Shan (6): hw/arm/virt:

[PATCH v4 4/6] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper

2022-10-03 Thread Gavin Shan
This introduces virt_get_high_memmap_enabled() helper, which returns the pointer to vms->highmem_{redists, ecam, mmio}. The pointer will be used in the subsequent patches. No functional change intended. Signed-off-by: Gavin Shan --- hw/arm/virt.c | 30 +- 1 f

[PATCH v4 6/6] hw/arm/virt: Add 'compact-highmem' property

2022-10-03 Thread Gavin Shan
s added so that the optimization can be explicitly enabled or disabled on all machine types by users. Signed-off-by: Gavin Shan --- docs/system/arm/virt.rst | 4 hw/arm/virt.c| 47 include/hw/arm/virt.h| 1 + 3 files changed, 52 insertions(+)

[PATCH v4 5/6] hw/arm/virt: Improve high memory region address

2022-10-03 Thread Gavin Shan
it has been disabled in case (1), (2) and (3). 'vms->high_compact' is false for now, meaning that we don't have any behavior changes until it becomes configurable through property 'compact-highmem' in next patch. Signed-off-by: Gavin Shan --- hw/arm/virt.c | 19

Re: [PATCH v4 4/6] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper

2022-10-04 Thread Gavin Shan
Hi Connie, On 10/4/22 6:41 PM, Cornelia Huck wrote: On Tue, Oct 04 2022, Gavin Shan wrote: This introduces virt_get_high_memmap_enabled() helper, which returns the pointer to vms->highmem_{redists, ecam, mmio}. The pointer will be used in the subsequent patches. No functional cha

Re: [PATCH v4 5/6] hw/arm/virt: Improve high memory region address

2022-10-04 Thread Gavin Shan
Hi Connie, On 10/4/22 6:53 PM, Cornelia Huck wrote: On Tue, Oct 04 2022, Gavin Shan wrote: There are three high memory regions, which are VIRT_HIGH_REDIST2, VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses are floating on highest RAM address. However, they can be disabled in

Re: [PATCH v4 6/6] hw/arm/virt: Add 'compact-highmem' property

2022-10-04 Thread Gavin Shan
Hi Marc, On 10/5/22 1:39 AM, Marc Zyngier wrote: On Tue, 04 Oct 2022 01:26:27 +0100, Gavin Shan wrote: After the improvement to high memory region address assignment is applied, the memory layout can be changed, introducing possible migration breakage. For example, VIRT_HIGH_PCIE_MMIO memory

Re: [PATCH v5 5/6] hw/arm/virt: Improve high memory region address assignment

2022-10-19 Thread Gavin Shan
Hi Eric, On 10/20/22 4:07 AM, Eric Auger wrote: On 10/12/22 01:18, Gavin Shan wrote: There are three high memory regions, which are VIRT_HIGH_REDIST2, VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses are floating on highest RAM address. However, they can be disabled in several

Re: [PATCH v5 6/6] hw/arm/virt: Add 'compact-highmem' property

2022-10-19 Thread Gavin Shan
Hi Connie, On 10/19/22 10:00 PM, Cornelia Huck wrote: On Wed, Oct 12 2022, Gavin Shan wrote: After the improvement to high memory region address assignment is applied, the memory layout can be changed, introducing possible migration breakage. For example, VIRT_HIGH_PCIE_MMIO memory region is

Re: [PATCH v5 6/6] hw/arm/virt: Add 'compact-highmem' property

2022-10-19 Thread Gavin Shan
Hi Eric, On 10/20/22 4:18 AM, Eric Auger wrote: On 10/12/22 01:18, Gavin Shan wrote: After the improvement to high memory region address assignment is applied, the memory layout can be changed, introducing possible migration breakage. For example, VIRT_HIGH_PCIE_MMIO memory region is disabled

Re: [PATCH v5 6/6] hw/arm/virt: Add 'compact-highmem' property

2022-10-20 Thread Gavin Shan
Hi Marc, On 10/20/22 5:44 PM, Marc Zyngier wrote: On Thu, 20 Oct 2022 00:57:32 +0100, Gavin Shan wrote: For Marc's suggestion to add properties so that these high memory regions can be disabled by users. I can add one patch after this one to introduce the following 3 properties. Coul

[PATCH v6 7/7] hw/arm/virt: Add properties to disable high memory regions

2022-10-23 Thread Gavin Shan
ecam", "highmem-mmio". Suggested-by: Marc Zyngier Signed-off-by: Gavin Shan --- docs/system/arm/virt.rst | 12 hw/arm/virt.c| 64 2 files changed, 76 insertions(+) diff --git a/docs/system/arm/virt.rst b/docs/s

[PATCH v6 5/7] hw/arm/virt: Improve high memory region address assignment

2022-10-23 Thread Gavin Shan
ement should be applied. For now, 'vms->highmem_compact' is set to false, meaning that we don't have memory layout change until it becomes configurable through property 'compact-highmem' in next patch. Signed-off-by: Gavin Shan Reviewed-by: Cornelia Huck Tested-by: Zhenyu Z

<    1   2   3   4   5   6   7   8   9   10   >