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 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] 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 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 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] 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

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

2023-02-21 Thread Gavin Shan
_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 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

[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

[PATCH v1 4/6] kvm: Add helper kvm_dirty_ring_init()

2023-02-12 Thread Gavin Shan
ring. With this, the code looks a bit clean. No functional change intended. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 76 - 1 file changed, 47 insertions(+), 29 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index

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

2023-02-12 Thread Gavin Shan
in the subsequent patches. No functional change intended. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 2 +- include/exec/memory.h | 5 +++-- migration/dirtyrate.c | 4 ++-- migration/ram.c | 20 ++-- softmmu/memory.c | 10 +- 5 files changed, 21 insertions

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

2023-02-12 Thread Gavin Shan
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 using the backup bitmap to track dirty guest memory, corresponding to various hardware tables.

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

2023-02-12 Thread Gavin Shan
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 +++ include/sysemu/kvm_int.h | 1 + 2 files changed, 12 insertions(+) diff --git a/accel/kvm

[PATCH v1 6/6] kvm: Enable dirty ring for arm64

2023-02-12 Thread Gavin Shan
arm64 has different capability from x86 to enable the dirty ring, which is KVM_CAP_DIRTY_LOG_RING_ACQ_REL. To enable it in kvm_dirty_ring_init() when KVM_CAP_DIRTY_LOG_RING isn't supported. Signed-off-by: Gavin Shan Reviewed-by: Juan Quintela --- accel/kvm/kvm-all.c | 10 -- 1 file

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

2023-02-12 Thread Gavin Shan
Signed-off-by: Gavin Shan --- linux-headers/asm-arm64/kvm.h | 1 + linux-headers/linux/kvm.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h index 4bf2d7246e..a7cfefb3a8 100644 --- a/linux-headers/asm-arm64/kvm.h +++ b

[PATCH v1 0/6] hw/arm/virt: Support dirty ring

2023-02-12 Thread Gavin Shan
(Juan) Gavin Shan (6): linux-headers: Update for dirty ring migration: Add last stage indicator to global dirty log synchronization kvm: Synchronize the backup bitmap in the last stage kvm: Add helper kvm_dirty_ring_init() hw/arm/virt: Enable backup bitmap for

Re: [PATCH RFCv1 2/8] memory: Add last stage indicator to global dirty log synchronization

2023-02-09 Thread Gavin Shan
On 2/10/23 6:48 AM, Peter Xu wrote: On Mon, Feb 06, 2023 at 07:20:04PM +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 RFCv1 6/8] kvm: Add helper kvm_dirty_ring_init()

2023-02-09 Thread Gavin Shan
On 2/9/23 9:11 AM, Juan Quintela wrote: Gavin Shan wrote: Due to multiple capabilities associated with the dirty ring for different architectures: KVM_CAP_DIRTY_{LOG_RING, LOG_RING_ACQ_REL} for x86 and arm64 separately. There will be more to be done in order to support the dirty ring for arm64

Re: [PATCH RFCv1 4/8] kvm: Introduce secondary dirty bitmap

2023-02-09 Thread Gavin Shan
On 2/9/23 9:07 AM, Juan Quintela wrote: Gavin Shan wrote: When dirty ring is enabled on ARM64, the backup bitmap may be used to track the dirty pages in no-running-vcpu situations. The original bitmap is the primary one, used for the dirty ring buffer. We need the secondary bitmap to collect

[PATCH RFCv1 6/8] kvm: Add helper kvm_dirty_ring_init()

2023-02-06 Thread Gavin Shan
ring. With this, the code looks a bit clean. No functional change intended. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 73 - 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index

[PATCH RFCv1 5/8] kvm: Synchronize secondary bitmap in last stage

2023-02-06 Thread Gavin Shan
In the last stage of live migration or memory slot removal, the backup bitmap needs to be synchronized. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 1a93985574..9ec117c441 100644

[PATCH RFCv1 7/8] hw/arm/virt: Enable backup bitmap for dirty ring

2023-02-06 Thread Gavin Shan
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 using the backup bitmap to track dirty guest memory, corresponding to various hardware tables.

[PATCH RFCv1 8/8] kvm: Enable dirty ring for arm64

2023-02-06 Thread Gavin Shan
arm64 has different capability from x86 to enable the dirty ring, which is KVM_CAP_DIRTY_LOG_RING_ACQ_REL. To enable it in kvm_dirty_ring_init() when KVM_CAP_DIRTY_LOG_RING isn't supported. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 10 -- 1 file changed, 8 insertions(+), 2

[PATCH RFCv1 4/8] kvm: Introduce secondary dirty bitmap

2023-02-06 Thread Gavin Shan
. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 50 ++-- include/sysemu/kvm_int.h | 1 + 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 01a6a026af..1a93985574 100644 --- a/accel/kvm/kvm

[PATCH RFCv1 3/8] migration: Add last stage indicator to global dirty log synchronization

2023-02-06 Thread Gavin Shan
For the pre-copy live migration scenario, the last stage indicator is needed for KVM backend to collect the dirty pages from the backup bitmap when dirty ring is used. The indicator isn't used so far. No functional change intended. Signed-off-by: Gavin Shan --- migration/ram.c | 16

[PATCH RFCv1 1/8] linux-headers: Update for dirty ring

2023-02-06 Thread Gavin Shan
Signed-off-by: Gavin Shan --- linux-headers/asm-arm64/kvm.h | 1 + linux-headers/linux/kvm.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h index 4bf2d7246e..a7cfefb3a8 100644 --- a/linux-headers/asm-arm64/kvm.h +++ b

[PATCH RFCv1 2/8] memory: Add last stage indicator to global dirty log synchronization

2023-02-06 Thread Gavin Shan
. Signed-off-by: Gavin Shan --- accel/kvm/kvm-all.c | 2 +- include/exec/memory.h | 5 +++-- migration/dirtyrate.c | 4 ++-- migration/ram.c | 6 +++--- softmmu/memory.c | 10 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm

[PATCH RFCv1 0/8] hw/arm/virt: Support dirty ring

2023-02-06 Thread Gavin Shan
0,mac=52:54:00:f1:26:a0 -netdev tap,id=vnet0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown \ -device virtio-net-pci,bus=pcie.6,netdev=vnet0,mac=52:54:00:f1:26:b0 Gavin Shan (8): linux-headers: Update for dirty ring memory: Add last stage indicator to global dirty log synchronizat

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

2022-11-14 Thread Gavin Shan
(Markus) v2: The property is changed to smp-cpus since 5.0 (Phild) --- qapi/qom.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Reviewed-by: Gavin Shan diff --git a/qapi/qom.json b/qapi/qom.json index 30e76653ad..f4a7917f3d 100644 --- a/qapi/qom.json

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 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-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 v6 0/7] hw/arm/virt: Improve address assignment for high memory regions

2022-10-29 Thread Gavin Shan
Hi Peter, On 10/29/22 2:06 AM, Peter Maydell wrote: On Wed, 26 Oct 2022 at 01:30, Gavin Shan wrote: On 10/24/22 11:54 AM, 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

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

2022-10-29 Thread Gavin Shan
Hi Marc, On 10/29/22 7:29 PM, Marc Zyngier wrote: On Wed, 26 Oct 2022 01:29:56 +0100, Gavin Shan wrote: On 10/24/22 11:54 AM, 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

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

2022-10-29 Thread Gavin Shan
gion for GICv3 and GICv4 has been enabled or not. Suggested-by: Marc Zyngier Signed-off-by: Gavin Shan Reviewed-by: Marc Zyngier --- docs/system/arm/virt.rst | 13 +++ hw/arm/virt.c| 75 ++-- 2 files changed, 86 insertions(+), 2 deletions

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

2022-10-29 Thread Gavin Shan
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: Eric Auger Reviewed-by: Cornelia Huck Reviewed-by: Marc Zyngier Tested-by: Zhenyu Zhang --- hw/arm/virt

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

2022-10-29 Thread Gavin Shan
n machine, which is virt-7.1 or ealier than it. It means the optimization is enabled by default from virt-7.2. Besides, 'compact-highmem' property is added so that the optimization can be explicitly enabled or disabled on all machine types by users. Signed-off-by: Gavin Shan Reviewed-by: Eric Auger

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

2022-10-29 Thread Gavin Shan
vin) * Add 'highmem-compact' property 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 (

[PATCH v7 4/7] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper

2022-10-29 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 Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck Revie

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

2022-10-29 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 Reviewed-by: Cornelia Huck Reviewed

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

2022-10-29 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 Reviewed-by: Cornelia Huck Reviewed-by: Marc Zyngier Tested-by: Zhenyu

[PATCH v7 1/7] hw/arm/virt: Introduce virt_set_high_memmap() helper

2022-10-29 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

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

2022-10-28 Thread Gavin Shan
Hi Connie, On 10/26/22 7:10 PM, Cornelia Huck wrote: On Wed, Oct 26 2022, Gavin Shan wrote: On 10/25/22 6:54 PM, Cornelia Huck wrote: On Mon, Oct 24 2022, Gavin Shan wrote: These 3 high memory regions are usually enabled by default, but s/These 3/The/ ? Ok. they may be not used

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

2022-10-28 Thread Gavin Shan
Hi Connie, On 10/26/22 6:43 PM, Cornelia Huck wrote: On Wed, Oct 26 2022, Gavin Shan wrote: On 10/26/22 12:29 AM, Eric Auger wrote: On 10/24/22 05:54, 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

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

2022-10-25 Thread Gavin Shan
Hi Connie, On 10/25/22 6:54 PM, Cornelia Huck wrote: On Mon, Oct 24 2022, Gavin Shan wrote: These 3 high memory regions are usually enabled by default, but s/These 3/The/ ? Ok. they may be not used. For example, VIRT_HIGH_GIC_REDIST2 isn't needed by GICv2. This leads to waste

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

2022-10-25 Thread Gavin Shan
Hi Connie, On 10/25/22 6:30 PM, Cornelia Huck wrote: On Mon, Oct 24 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

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

2022-10-25 Thread Gavin Shan
Hi Eric, On 10/26/22 12:29 AM, Eric Auger wrote: On 10/24/22 05:54, 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

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

2022-10-25 Thread Gavin Shan
Hi Peter and Marc, On 10/24/22 11:54 AM, 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

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

2022-10-24 Thread Gavin Shan
n machine, which is virt-7.1 or ealier than it. It means the optimization is enabled by default from virt-7.2. Besides, 'compact-highmem' property is added so that the optimization can be explicitly enabled or disabled on all machine types by users. Signed-off-by: Gavin Shan Reviewed-by: Cornelia Huc

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

2022-10-24 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 Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang --- hw/arm/virt.c

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

2022-10-24 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 Reviewed-by: Cornelia Huck Tested

[PATCH v6 4/7] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper

2022-10-23 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 Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck Tes

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

2022-10-23 Thread Gavin Shan
gh_memmap() (Eric) Gavin Shan (7): hw/arm/virt: Introduce virt_set_high_memmap() helper hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap() hw/arm/virt: Introduce variable region_base in virt_set_high_memmap() hw/arm/virt:

[PATCH v6 1/7] hw/arm/virt: Introduce virt_set_high_memmap() helper

2022-10-23 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

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

2022-10-23 Thread Gavin Shan
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 Zhang --- hw/arm/virt.c | 15 ++- include/hw/arm/virt.h | 1 +

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

2022-10-23 Thread Gavin Shan
quot;, "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/system

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. Could you

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-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

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

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

2022-10-11 Thread Gavin Shan
. '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 Tested-by: Zhenyu Zhang --- hw/arm/virt.c | 23 +++ include/hw/arm/virt.h | 1 +

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

2022-10-11 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 Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang --- hw/arm/virt.c

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

2022-10-11 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 Tested-by: Zhenyu Zhang --- hw/arm/virt.c |

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

2022-10-11 Thread Gavin Shan
added so that the optimization can be explicitly enabled or disabled on all machine types by users. Signed-off-by: Gavin Shan Tested-by: Zhenyu Zhang --- docs/system/arm/virt.rst | 4 hw/arm/virt.c| 47 include/hw/arm/virt.h| 1 + 3 files ch

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

2022-10-11 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 Reviewed-by: Cornelia Huck Tested

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

2022-10-11 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

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

2022-10-11 Thread Gavin Shan
* 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: Introduce virt_set_high_memmap() helper hw/arm/vir

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

2022-10-11 Thread Gavin Shan
On 10/12/22 12:45 AM, Eric Auger wrote: On 10/5/22 00:47, Gavin Shan wrote: 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 poin

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 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

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

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

2022-10-03 Thread Gavin Shan
. '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 --- include/hw/arm/virt.h | 1 + 2 files changed, 13 inserti

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

2022-10-03 Thread Gavin Shan
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(+) diff --g

[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 0/6] hw/arm/virt: Improve address assignment for high memory regions

2022-10-03 Thread Gavin Shan
er review(Gavin) * Improved changelog (Marc) * Use 'bool fits' in virt_set_high_memmap() (Eric) Gavin Shan (6): hw/arm/virt: Introduce virt_set_high_memmap() helper hw/arm/virt: Rename variable size to re

[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 --- 1 file changed, 8 insertions

[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

[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 ++-- 1

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

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-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 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 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 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 preparatory work (same

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

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

2022-09-21 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 --- hw/arm/virt.c | 12 ++-- 1 file changed, 6

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

2022-09-21 Thread Gavin Shan
es, which is virt-7.1 or ealier than it. It means the optimization is enabled by default from virt-7.2. Besides, 'highmem-compact' property is 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

[PATCH v3 1/5] hw/arm/virt: Introduce virt_set_high_memmap() helper

2022-09-21 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 --- hw/arm

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

2022-09-21 Thread Gavin Shan
ed-off-by: Gavin Shan --- hw/arm/virt.c | 44 ++-- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index b0b679d1f4..b702f8f2b5 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1693,15 +1693,31 @@ stati

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

2022-09-21 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 --- hw/arm/virt.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff

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

2022-09-21 Thread Gavin Shan
(Eric) Gavin Shan (5): hw/arm/virt: Introduce virt_set_high_memmap() helper hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap() hw/arm/virt: Introduce variable region_base in virt_set_high_memmap() hw/arm/virt: Improve high memory region address assignment hw/ar

Re: [PATCH] KVM: use store-release to mark dirty pages as harvested

2022-09-06 Thread Gavin Shan
rio CPU1 must read the correct value of gfn2's fields. Therefore RESET must be set with a store-release, that will synchronize with KVM's load-acquire in CPU1. Cc: Gavin Shan Cc: Peter Xu Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 18 +- 1 file changed, 17 inserti

Re: [PATCH v2] KVM: dirty ring: add missing memory barrier

2022-09-06 Thread Gavin Shan
On 8/27/22 6:22 PM, Paolo Bonzini wrote: The KVM_DIRTY_GFN_F_DIRTY flag ensures that the entry is valid. If the read of the fields are not ordered after the read of the flag, QEMU might see stale values. Cc: Peter Xu Cc: Gavin Shan Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 6

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

2022-09-05 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

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

2022-08-26 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

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

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

2022-08-15 Thread Gavin Shan
ed-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 @@ -1746,10 +1746,26 @@ static void virt_set_

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

2022-08-15 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 1/4] hw/arm/virt: Rename variable size to region_size in virt_set_memmap()

2022-08-15 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 insertions(+), 6 deletions(-) diff

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

2022-08-15 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 +- 1 file

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