[PATCH v1 2/2] system/cpus: Fix resume_all_vcpus() under vCPU hotplug condition

2024-03-17 Thread Keqian Zhu via
vcpu thread. However, during we wait vcpu thread to be created, the bql is unlocked, and other thread is allowed to call resume_all_vcpus(), which will resume the un-realized vcpu. This fixes the issue by filter out un-realized vcpu during resume_all_vcpus(). Signed-off-by: Keqian Zhu --- system

[PATCH v1 1/2] system/cpus: Fix pause_all_vcpus() under concurrent environment

2024-03-17 Thread Keqian Zhu via
so we must retry. Signed-off-by: Keqian Zhu --- system/cpus.c | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/system/cpus.c b/system/cpus.c index 68d161d96b..4e41abe23e 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -571,12 +571,14 @@ static

[PATCH v1 0/2] Some fixes for pause and resume all vcpus

2024-03-17 Thread Keqian Zhu via
I hit these bugs when I test the RFC patch of ARM vCPU hotplug feature. This patch has been verified valid. Keqian Zhu (2): system/cpus: Fix pause_all_vcpus() under concurrent environment system/cpus: Fix resume_all_vcpus() under vCPU hotplug condition system/cpus.c | 32

[PATCH] virtio-gpu: Optimize 2D resource data transfer

2023-06-11 Thread Keqian Zhu via
The following points sometimes can reduce much data to copy: 1. When width matches, we can transfer data with one call of iov_to_buf(). 2. Only the required height need to transfer, not whole image. Signed-off-by: Keqian Zhu --- hw/display/virtio-gpu.c | 22 +++--- 1 file

[PATCH v2] hw/acpi: Add ospm_status hook implementation for acpi-ged

2022-08-16 Thread Keqian Zhu via
b62075021a ("hw/acpi: Add ACPI Generic Event Device Support") Signed-off-by: Keqian Zhu --- hw/acpi/generic_event_device.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index e28457a7d1..a3d31631fe

[PATCH] acpi_ged: Add ospm_status hook implementation

2022-08-16 Thread Keqian Zhu via
ned-off-by: Keqian Zhu --- hw/acpi/generic_event_device.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index e28457a7d1..a3d31631fe 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -267

[PATCH] vmstate: Constify some VMStateDescriptions

2021-04-08 Thread Keqian Zhu
Constify vmstate_ecc_state and vmstate_x86_cpu. Signed-off-by: Keqian Zhu --- hw/block/ecc.c | 2 +- include/hw/block/flash.h | 2 +- target/i386/cpu.h| 2 +- target/i386/machine.c| 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/ecc.c b/hw

Re: [PATCH 0/3] hw: Constify VMStateDescription

2021-04-08 Thread Keqian Zhu
On 2021/4/8 21:22, Philippe Mathieu-Daudé wrote: > On 3/15/21 10:05 AM, Keqian Zhu wrote: >> Hi Philippe, >> >> It seems that vmstate_ecc_state and vmstate_x86_cpu can also be constified. >> Found by . > > Correct (I only searched for the static ones). >

Re: [PATCH v5 00/10] KVM: Dirty ring support (QEMU part)

2021-03-24 Thread Keqian Zhu
Peter, On 2021/3/24 23:09, Peter Xu wrote: > On Wed, Mar 24, 2021 at 10:56:22AM +0800, Keqian Zhu wrote: >> Hi Peter, >> >> On 2021/3/23 22:34, Peter Xu wrote: >>> Keqian, >>> >>> On Tue, Mar 23, 2021 at 02:40:43PM +0800, Keqian Zhu wrote: >&g

Re: [PATCH v5 00/10] KVM: Dirty ring support (QEMU part)

2021-03-23 Thread Keqian Zhu
Hi Peter, On 2021/3/23 22:34, Peter Xu wrote: > Keqian, > > On Tue, Mar 23, 2021 at 02:40:43PM +0800, Keqian Zhu wrote: >>>> The second question is that you observed longer migration time (55s->73s) >>>> when guest >>>> has 24G ram and dirty rat

Re: [PATCH v5 00/10] KVM: Dirty ring support (QEMU part)

2021-03-22 Thread Keqian Zhu
Hi Peter, On 2021/3/23 3:45, Peter Xu wrote: > On Mon, Mar 22, 2021 at 10:02:38PM +0800, Keqian Zhu wrote: >> Hi Peter, > > Hi, Keqian, > > [...] > >> You emphasize that dirty ring is a "Thread-local buffers", but dirty bitmap >> is global

Re: [PATCH v5 10/10] KVM: Dirty ring support

2021-03-22 Thread Keqian Zhu
On 2021/3/23 2:52, Peter Xu wrote: > On Mon, Mar 22, 2021 at 09:37:19PM +0800, Keqian Zhu wrote: >>> +/* Should be with all slots_lock held for the address spaces. */ >>> +static void kvm_dirty_ring_mark_page(KVMState *s, uint32_t as_id, >>> +

Re: [PATCH v5 00/10] KVM: Dirty ring support (QEMU part)

2021-03-22 Thread Keqian Zhu
Hi Peter, On 2021/3/11 4:32, Peter Xu wrote: > This is v5 of the qemu dirty ring interface support. > > > > v5: > > - rebase > > - dropped patch "update-linux-headers: Include const.h" after rebase > > - dropped patch "KVM: Fixup kvm_log_clear_one_slot() ioctl return check" since > > simi

Re: [PATCH v5 10/10] KVM: Dirty ring support

2021-03-22 Thread Keqian Zhu
On 2021/3/11 4:33, Peter Xu wrote: > KVM dirty ring is a new interface to pass over dirty bits from kernel to the > userspace. Instead of using a bitmap for each memory region, the dirty ring > contains an array of dirtied GPAs to fetch (in the form of offset in slots). > For each vcpu there wi

Re: [PATCH v5 02/10] KVM: Use a big lock to replace per-kml slots_lock

2021-03-22 Thread Keqian Zhu
Hi Peter, On 2021/3/11 4:32, Peter Xu wrote: > Per-kml slots_lock will bring some trouble if we want to take all slots_lock > of > all the KMLs, especially when we're in a context that we could have taken some > of the KML slots_lock, then we even need to figure out what we've taken and > what we

Re: [PATCH v5 09/10] KVM: Disable manual dirty log when dirty ring enabled

2021-03-22 Thread Keqian Zhu
Hi Peter, On 2021/3/11 4:33, Peter Xu wrote: > KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is for KVM_CLEAR_DIRTY_LOG, which is only > useful for KVM_GET_DIRTY_LOG. Skip enabling it for kvm dirty ring. > > More importantly, KVM_DIRTY_LOG_INITIALLY_SET will not wr-protect all the > pages > initially, whic

Re: [PATCH 0/3] hw: Constify VMStateDescription

2021-03-15 Thread Keqian Zhu
Hi Philippe, It seems that vmstate_ecc_state and vmstate_x86_cpu can also be constified. Found by . Thanks, Keqian On 2021/3/14 1:11, Philippe Mathieu-Daudé wrote: > VMStateDescription isn't supposed to be modified. > > > > Philippe Mathieu-Daudé (3): > > hw/arm: Constify VMStateDescriptio

Re: [PATCH V3 1/8] hw/block/nvme: support namespace detach

2021-03-14 Thread Keqian Zhu
Hi, I don't dig into code logic, just some nit below. On 2021/3/1 0:10, Minwoo Im wrote: > Given that now we have nvme-subsys device supported, we can manage > namespace allocated, but not attached: detached. This patch introduced s/introduced/introduces > a parameter for nvme-ns device named '

Re: [PATCH] vfio: Support host translation granule size

2021-03-10 Thread Keqian Zhu
Hi Alex, On 2021/3/11 4:24, Alex Williamson wrote: > On Wed, 10 Mar 2021 15:19:33 +0800 > Kunkun Jiang wrote: > >> Hi Alex, >> >> On 2021/3/10 7:17, Alex Williamson wrote: >>> On Thu, 4 Mar 2021 21:34:46 +0800 >>> Kunkun Jiang wrote: >>> The cpu_physical_memory_set_dirty_lebitmap() can q

Re: [PATCH v2 2/2] accel: kvm: Add aligment assert for kvm_log_clear_one_slot

2021-03-09 Thread Keqian Zhu
On 2021/3/10 0:08, Peter Xu wrote: > On Tue, Mar 09, 2021 at 02:57:53PM +, Dr. David Alan Gilbert wrote: >> * Thomas Huth (th...@redhat.com) wrote: >>> On 09/03/2021 15.05, Keqian Zhu wrote: >>>> >>>> >>>> On 2021/3/9 21:48, Thomas H

Re: [PATCH] vfio: Support host translation granule size

2021-03-09 Thread Keqian Zhu
Hi Alex, On 2021/3/10 7:17, Alex Williamson wrote: > On Thu, 4 Mar 2021 21:34:46 +0800 > Kunkun Jiang wrote: > >> The cpu_physical_memory_set_dirty_lebitmap() can quickly deal with >> the dirty pages of memory by bitmap-traveling, regardless of whether >> the bitmap is aligned correctly or not.

Re: [PATCH v2 2/2] accel: kvm: Add aligment assert for kvm_log_clear_one_slot

2021-03-09 Thread Keqian Zhu
On 2021/3/9 21:48, Thomas Huth wrote: > On 17/12/2020 02.49, Keqian Zhu wrote: >> The parameters start and size are transfered from QEMU memory >> emulation layer. It can promise that they are TARGET_PAGE_SIZE >> aligned. However, KVM needs they are qemu_real_page_size ali

[PATCH v2] vfio/migrate: Move switch of dirty tracking into vfio_memory_listener

2021-03-08 Thread Keqian Zhu
the switch of vfio dirty_page_tracking into vfio_memory_listener can solve above problems. Besides, Do not require devices in SAVING state for vfio_sync_dirty_bitmap(). [1] https://www.spinics.net/lists/kvm/msg229967.html Reported-by: Zenghui Yu Signed-off-by: Keqian Zhu Suggested-by: Pao

[PING] accel: kvm: Some bugfixes for kvm dirty log

2021-03-02 Thread Keqian Zhu
Hi, This patch is still not queued. Who can help to do this? Thanks :) Keqian On 2020/12/17 9:49, Keqian Zhu wrote: > Hi all, > > This series fixes memory waste and adds alignment check for unmatched > qemu_real_host_page_size and TARGET_PAGE_SIZE. > > Thanks. > > K

Re: [PATCH] vfio/migrate: Move switch of dirty tracking into vfio_memory_listener

2021-02-28 Thread Keqian Zhu
Hi Kirti, What's your opinion about this? Thanks. Keqian On 2021/1/30 14:30, Keqian Zhu wrote: > Hi Kirti, > > On 2021/1/28 5:03, Kirti Wankhede wrote: >> >> >> On 1/11/2021 1:04 PM, Keqian Zhu wrote: >>> For now the switch of vfio dirty

Re: [PATCH v2 2/2] accel: kvm: Add aligment assert for kvm_log_clear_one_slot

2021-02-01 Thread Keqian Zhu
Hi Philippe, On 2021/2/1 23:14, Philippe Mathieu-Daudé wrote: > Hi, > > On 12/17/20 2:49 AM, Keqian Zhu wrote: >> The parameters start and size are transfered from QEMU memory >> emulation layer. It can promise that they are TARGET_PAGE_SIZE >> aligned.

Re: [PATCH v2 0/2] accel: kvm: Some bugfixes for kvm dirty log

2021-02-01 Thread Keqian Zhu
Hi All, Kindly Ping ;-) ... On 2021/1/25 15:51, Keqian Zhu wrote: > Hi Paolo, > > Any suggestions on this patch series :-) ? Thanks, > > Keqian > > On 2020/12/17 9:49, Keqian Zhu wrote: >> Hi all, >> >> This series fixes memory waste

Re: [PATCH] vfio/migrate: Move switch of dirty tracking into vfio_memory_listener

2021-01-29 Thread Keqian Zhu
Hi Kirti, On 2021/1/28 5:03, Kirti Wankhede wrote: > > > On 1/11/2021 1:04 PM, Keqian Zhu wrote: >> For now the switch of vfio dirty page tracking is integrated into >> the vfio_save_handler, it causes some problems [1]. >> > > Sorry, I missed [1] mail, som

Re: [PATCH] vfio/migrate: Move switch of dirty tracking into vfio_memory_listener

2021-01-29 Thread Keqian Zhu
On 2021/1/29 15:49, Paolo Bonzini wrote: > On 28/01/21 21:02, Dr. David Alan Gilbert wrote: >> * Paolo Bonzini (pbonz...@redhat.com) wrote: >>> On 11/01/21 08:34, Keqian Zhu wrote: >>>> +static void vfio_listener_log_

Re: [PATCH] vfio/migrate: Move switch of dirty tracking into vfio_memory_listener

2021-01-28 Thread Keqian Zhu
Hi Paolo and Kirti, Many thanks for reply. I am busy today and will reply you tomorrow, Thanks. Keqian. On 2021/1/28 5:03, Kirti Wankhede wrote: > > > On 1/11/2021 1:04 PM, Keqian Zhu wrote: >> For now the switch of vfio dirty page tracking is integrated into >> the

Re: [PATCH v2 0/2] accel: kvm: Some bugfixes for kvm dirty log

2021-01-24 Thread Keqian Zhu
Hi Paolo, Any suggestions on this patch series :-) ? Thanks, Keqian On 2020/12/17 9:49, Keqian Zhu wrote: > Hi all, > > This series fixes memory waste and adds alignment check for unmatched > qemu_real_host_page_size and TARGET_PAGE_SIZE. > > Thanks. > > Keqian Zhu

[PATCH] vfio/migrate: Move switch of dirty tracking into vfio_memory_listener

2021-01-10 Thread Keqian Zhu
es in SAVING state for vfio_sync_dirty_bitmap(). [1] https://www.spinics.net/lists/kvm/msg229967.html Reported-by: Zenghui Yu Signed-off-by: Keqian Zhu --- hw/vfio/common.c| 53 + hw/vfio/migration.c | 35 -- 2 files change

[PATCH v2] Docs/RCU: Correct sample code of qatomic_rcu_set

2021-01-05 Thread Keqian Zhu
Correct sample code to avoid confusing readers. Signed-off-by: Keqian Zhu Cc: qemu-triv...@nongnu.org Reviewed-by: Paolo Bonzini Reviewed-by: Peter Xu --- v2: - Add Cc and R-b. --- docs/devel/rcu.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devel/rcu.txt b

Re: [PATCH v2 0/2] accel: kvm: Some bugfixes for kvm dirty log

2021-01-05 Thread Keqian Zhu
Friendly ping ... Hi, please queue this well reviewed series, Thanks :-) Keqian On 2020/12/17 9:49, Keqian Zhu wrote: > Hi all, > > This series fixes memory waste and adds alignment check for unmatched > qemu_real_host_page_size and TARGET_PAGE_SIZE. > > Thanks. > > K

Re: [PATCH v2 1/2] ramlist: Make dirty bitmap blocks of ramlist resizable

2020-12-25 Thread Keqian Zhu
[...] >>> -for (j = old_num_blocks; j < new_num_blocks; j++) { >>> -new_blocks->blocks[j] = bitmap_new(DIRTY_MEMORY_BLOCK_SIZE); >>> +if (extend) { >>> +for (j = cpy_num_blocks; j < new_num_blocks; j++) { >>> +new_blocks->blocks[j] = >>> b

[PATCH] Docs/RCU: Correct sample code of qatomic_rcu_set

2020-12-21 Thread Keqian Zhu
Correct sample code to avoid confusing readers. Signed-off-by: Keqian Zhu --- docs/devel/rcu.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/devel/rcu.txt b/docs/devel/rcu.txt index cdf002edd8..2e6cc607a1 100644 --- a/docs/devel/rcu.txt +++ b/docs/devel/rcu.txt

Re: [PATCH v2 1/2] ramlist: Make dirty bitmap blocks of ramlist resizable

2020-12-20 Thread Keqian Zhu
On 2020/12/17 18:05, Stefan Hajnoczi wrote: > On Mon, Nov 30, 2020 at 09:11:03PM +0800, Keqian Zhu wrote: >> @@ -1839,15 +1841,26 @@ static void dirty_memory_extend(ram_addr_t >> old_ram_size, >> new_blocks = g_malloc(sizeof(*new_blocks) + >>

Ping: [PATCH v2] bugfix: hostmem: Free host_nodes list right after visited

2020-12-18 Thread Keqian Zhu
Hi Peter, Friendly ping :-) Are you going to queue this? Thanks, Keqian On 2020/12/10 15:52, Keqian Zhu wrote: > In host_memory_backend_get_host_nodes, we build host_nodes > list and output it to v (a StringOutputVisitor) but forget > to free the list. This fixes the memory leak.

[PATCH v2 1/2] accel: kvm: Fix memory waste under mismatch page size

2020-12-16 Thread Keqian Zhu
lot dirty_bmap may waste memory. For example, when qemu_real_host_page_size is 64K and TARGET_PAGE_SIZE is 4K, it wastes 93.75% (15/16) memory. Signed-off-by: Keqian Zhu Reviewed-by: Andrew Jones Reviewed-by: Peter Xu --- accel/kvm/kvm-all.c | 6 +- 1 file changed, 5 insertions(+), 1 delet

[PATCH v2 2/2] accel: kvm: Add aligment assert for kvm_log_clear_one_slot

2020-12-16 Thread Keqian Zhu
avoid future breaking. Signed-off-by: Keqian Zhu --- accel/kvm/kvm-all.c | 7 +++ 1 file changed, 7 insertions(+) --- v2 - Address Andrew's commment (Use assert instead of return err). diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f6b16a8df8..73b195cc41 100644 --- a/acc

[PATCH v2 0/2] accel: kvm: Some bugfixes for kvm dirty log

2020-12-16 Thread Keqian Zhu
Hi all, This series fixes memory waste and adds alignment check for unmatched qemu_real_host_page_size and TARGET_PAGE_SIZE. Thanks. Keqian Zhu (2): accel: kvm: Fix memory waste under mismatch page size accel: kvm: Add aligment assert for kvm_log_clear_one_slot accel/kvm/kvm-all.c | 13

Re: [PATCH 1/2] accel: kvm: Fix memory waste under mismatch page size

2020-12-16 Thread Keqian Zhu
On 2020/12/17 4:48, Peter Xu wrote: > On Wed, Dec 16, 2020 at 04:21:17PM +0800, Keqian Zhu wrote: >> One more thing, we should consider whether @start and @size is psize aligned >> (my second >> patch). Do you agree to add assert on them directly? > > Yes I think

Re: [PATCH 1/2] accel: kvm: Fix memory waste under mismatch page size

2020-12-16 Thread Keqian Zhu
Hi Peter, On 2020/12/16 1:57, Peter Xu wrote: > On Tue, Dec 15, 2020 at 03:19:47PM +0800, Keqian Zhu wrote: >> When handle dirty log, we face qemu_real_host_page_size and >> TARGET_PAGE_SIZE. The first one is the granule of KVM dirty >> bitmap, and the second one is the

Re: [PATCH 2/2] accel: kvm: Add aligment check for kvm_log_clear_one_slot

2020-12-16 Thread Keqian Zhu
On 2020/12/16 15:23, Andrew Jones wrote: > On Tue, Dec 15, 2020 at 12:55:50PM +0100, Andrew Jones wrote: >> On Tue, Dec 15, 2020 at 03:19:48PM +0800, Keqian Zhu wrote: >>> The parameters start and size are transfered from QEMU memory >>> emulation layer. I

Re: [PATCH 2/2] accel: kvm: Add aligment check for kvm_log_clear_one_slot

2020-12-16 Thread Keqian Zhu
On 2020/12/15 19:55, Andrew Jones wrote: > On Tue, Dec 15, 2020 at 03:19:48PM +0800, Keqian Zhu wrote: >> The parameters start and size are transfered from QEMU memory >> emulation layer. It can promise that they are TARGET_PAGE_SIZE >> aligned. However, KVM needs they ar

Re: [PATCH 1/2] accel: kvm: Fix memory waste under mismatch page size

2020-12-16 Thread Keqian Zhu
Hi drew, On 2020/12/15 19:20, Andrew Jones wrote: > On Tue, Dec 15, 2020 at 03:19:47PM +0800, Keqian Zhu wrote: >> When handle dirty log, we face qemu_real_host_page_size and >> TARGET_PAGE_SIZE. The first one is the granule of KVM dirty >> bitmap, and the second one is the

[PATCH 0/2] accel: kvm: Some bugfixes for kvm dirty log

2020-12-14 Thread Keqian Zhu
Keqian Zhu (2): accel: kvm: Fix memory waste under mismatch page size accel: kvm: Add aligment check for kvm_log_clear_one_slot accel/kvm/kvm-all.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.23.0

[PATCH 2/2] accel: kvm: Add aligment check for kvm_log_clear_one_slot

2020-12-14 Thread Keqian Zhu
avoid future breaking. Signed-off-by: Keqian Zhu --- accel/kvm/kvm-all.c | 5 + 1 file changed, 5 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index c5e06288eb..3d0e3aa872 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -701,6 +701,11 @@ stati

[PATCH 1/2] accel: kvm: Fix memory waste under mismatch page size

2020-12-14 Thread Keqian Zhu
lot dirty_bmap may waste memory. For example, when qemu_real_host_page_size is 64K and TARGET_PAGE_SIZE is 4K, this bugfix can save 93.75% memory. Signed-off-by: Keqian Zhu --- accel/kvm/kvm-all.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/

[PATCH v2] bugfix: hostmem: Free host_nodes list right after visited

2020-12-09 Thread Keqian Zhu
: Keqian Zhu --- backends/hostmem.c | 1 + 1 file changed, 1 insertion(+) --- v2: - Update commit message. - Add Chen Qun's T.b. - Add Igor's R.b. diff --git a/backends/hostmem.c b/backends/hostmem.c index 4bde00e8e7..9f9ac95edd 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c

[PATCH] bugfix: hostmem: Free host_nodes list right after visited

2020-12-08 Thread Keqian Zhu
) ??:? #19 0xaaac0c82ed5f (/usr/libexec/qemu-kvm+0x88ed5f) ??:? SUMMARY: AddressSanitizer: 32 byte(s) leaked in 2 allocation(s). Fixes: 4cf1b76bf1e2 (hostmem: add properties for NUMA memory policy) Reported-by: Euler Robot Signed-off-by: Keqian Zhu --- backends/hostmem.c | 1 + 1 file changed, 1

[PATCH v2 0/2] bugfix: Decrease dirty bitmap blocks after we remove ramblock

2020-11-30 Thread Keqian Zhu
Keqian Zhu (2): ramlist: Make dirty bitmap blocks of ramlist resizable ramlist: Resize dirty bitmap blocks after remove ramblock softmmu/physmem.c | 37 + 1 file changed, 29 insertions(+), 8 deletions(-) -- 2.23.0

[PATCH v2 2/2] ramlist: Resize dirty bitmap blocks after remove ramblock

2020-11-30 Thread Keqian Zhu
296 byte(s) leaked in 9 allocation(s). Reported-by: Euler Robot Signed-off-by: Keqian Zhu little concern: According to code, my bugfix can solve two problems: 1. Lose reference to dirty bitmap of deleted ramblock, because the reference is covered by dirty bitmap of newly added ramblock. 2.

[PATCH v2 1/2] ramlist: Make dirty bitmap blocks of ramlist resizable

2020-11-30 Thread Keqian Zhu
When we remove a ramblock, we should decrease the dirty bitmap blocks of ramlist to avoid memory leakage. This patch rebuilds dirty_memory_ extend to support both "extend" and "decrease". Reported-by: Euler Robot Signed-off-by: Keqian Zhu --- so

[PATCH] net: Use correct default-path macro for downscript

2020-11-22 Thread Keqian Zhu
Fixes: 63c4db4c2e6d (net: relocate paths to helpers and scripts) Signed-off-by: Keqian Zhu --- net/tap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tap.c b/net/tap.c index c46ff66184..b8e5cca51c 100644 --- a/net/tap.c +++ b/net/tap.c @@ -951,7 +951,8 @@ free_fail

[RFC PATCH 2/2] ramlist: Resize dirty bitmap blocks after remove ramblock

2020-11-20 Thread Keqian Zhu
Use the new "dirty_bitmap_resize" interface to reduce dirty bitmap blocks after we remove a ramblock from ramlist. Signed-off-by: Keqian Zhu --- softmmu/physmem.c | 8 1 file changed, 8 insertions(+) diff --git a/softmmu/physmem.c b/softmmu/physmem.c index f6ff78378e..

[RFC PATCH 1/2] ramlist: Make dirty bitmap blocks of ramlist resizable

2020-11-20 Thread Keqian Zhu
When we remove a ramblock, we should decrease the dirty bitmap blocks of ramlist to avoid memory leakage. This patch rebuilds dirty_memory_ extend to support both "extend" and "decrease". Signed-off-by: Keqian Zhu --- softmmu/physmem.c | 28

[RFC PATCH 0/2] bugfix: Decrease dirty bitmap blocks after we remove ramblock

2020-11-20 Thread Keqian Zhu
Hi all, I failed to find where we free dirty bitmap blocks of ramlist. If this is a memory leakage problem, I hope this patch series can fix it properly :-). Thanks, Keqian. Keqian Zhu (2): ramlist: Make dirty bitmap blocks of ramlist resizable ramlist: Resize dirty bitmap blocks after

[PATCH] bugfix: irq: Avoid covering object refcount of qemu_irq

2020-07-27 Thread Keqian Zhu
Avoid covering object refcount of qemu_irq, otherwise it may causes memory leak. Signed-off-by: Keqian Zhu --- hw/core/irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/core/irq.c b/hw/core/irq.c index fb3045b912..59af4dfc74 100644 --- a/hw/core/irq.c +++ b/hw/core

[PATCH] migration: Assign current_migration as NULL after migration

2020-06-27 Thread Keqian Zhu
In migration_shutdown, global var current_migration is freed but not assigned to NULL, which may cause heap-use-after-free problem if the following code logic is abnormal. Signed-off-by: Keqian Zhu --- migration/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration

[PATCH v3] migration: Count new_dirty instead of real_dirty

2020-06-21 Thread Keqian Zhu
ned-off-by: Keqian Zhu --- Changelog: v3: - Address Dave's comments. v2: - Use new_dirty_pages instead of accu_dirty_pages. - Adjust commit messages. --- include/exec/ram_addr.h | 5 + migration/ram.c | 8 +--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git

[PATCH v2] migration: Count new_dirty instead of real_dirty

2020-06-15 Thread Keqian Zhu
d of first ram save iteration. Signed-off-by: Keqian Zhu --- Changelog: v2: - use new_dirty_pages instead of accu_dirty_pages. - adjust commit messages. --- include/exec/ram_addr.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/

[PATCH] migration: Count new_dirty instead of real_dirty

2020-05-31 Thread Keqian Zhu
"real dirty rate" is less than real "real dirty rate". Signed-off-by: Keqian Zhu --- include/exec/ram_addr.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 5e59a3d8d7..af9677e291 100644 --- a/inc

[PATCH v3] migration/throttle: Add cpu-throttle-tailslow migration parameter

2020-04-13 Thread Keqian Zhu
make migration time longer, and is disabled by default. Signed-off-by: Keqian Zhu --- Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" Cc: Eric Blake Cc: Markus Armbruster --- migration/migration.c | 13 migration/ram.c | 25 +- monitor/hmp

[PATCH 1/3] bugfix: Use gicr_typer in arm_gicv3_icc_reset

2020-04-13 Thread Keqian Zhu
The KVM_VGIC_ATTR macro expect the second parameter as gicr_typer, of which high 32bit is constructed by mp_affinity. For most case, the high 32bit of mp_affinity is zero, so it will always access the ICC_CTLR_EL1 of CPU0. Signed-off-by: Keqian Zhu --- hw/intc/arm_gicv3_kvm.c | 4 +--- 1 file

[PATCH 2/3] intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1

2020-04-13 Thread Keqian Zhu
Replace kvm_device_access with kvm_gicc_access to simplify code. Signed-off-by: Keqian Zhu --- hw/intc/arm_gicv3_kvm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index ca43bf87ca..85f6420498 100644 --- a/hw/intc

[PATCH 0/3] Some trivial fixes

2020-04-13 Thread Keqian Zhu
Hi all, This patch-set contains trivial bugfix and typo fix. Thanks, Keqian Keqian Zhu (3): bugfix: Use gicr_typer in arm_gicv3_icc_reset intc/gicv3_kvm: use kvm_gicc_access to get ICC_CTLR_EL1 Typo: Correct the name of CPU hotplug memory region hw/acpi/cpu.c | 2 +- hw/intc

[PATCH 3/3] Typo: Correct the name of CPU hotplug memory region

2020-04-13 Thread Keqian Zhu
Replace "acpi-mem-hotplug" with "acpi-cpu-hotplug" Signed-off-by: Keqian Zhu --- hw/acpi/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index e2c957ce00..3d6a500fb7 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -

[PATCH v2] migration/throttle: Add cpu-throttle-tailslow migration parameter

2020-03-15 Thread Keqian Zhu
ation time longer, and is disabled by default. Signed-off-by: Keqian Zhu --- Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" Cc: Eric Blake Cc: Markus Armbruster --- migration/migration.c | 13 migration/ram.c | 25 +- monitor/hmp-cmds.c| 8

[PATCH v2 2/2] migration: not require length align when choose fast dirty sync path

2020-03-10 Thread Keqian Zhu
ram_addr_t allocation on long boundaries. So currently we wont "updated the total dirty page count for both". By removing the alignment constraint of length in fast path, we can always use fast dirty sync path if start_global is aligned to word page. Signed-off-by: Keqian Zhu --- include/e

[PATCH v2 1/2] memory: Introduce start_global variable in dirty bitmap sync

2020-03-10 Thread Keqian Zhu
In the cpu_physical_memory_sync_dirty_bitmap func, use start_global variable to make code more clear. And the addr variable is only used in slow path, so move it to slow path. Signed-off-by: Keqian Zhu --- include/exec/ram_addr.h | 11 +-- 1 file changed, 5 insertions(+), 6 deletions

[PATCH v2 0/2] Some optimization in dirty bitmap sync

2020-03-10 Thread Keqian Zhu
This patch series including code style change and performace fix about dirty bitmap sync. --- changelogs: v2: - split code style change and performace fix. Keqian Zhu (2): memory: Introduce start_global variable in dirty bitmap sync migration: not require length align when choose fast

[PATCH] migration: not require length align when choose fast dirty sync path

2020-03-05 Thread Keqian Zhu
nd we can always use fast dirty sync path. Signed-off-by: Keqian Zhu --- Cc: Paolo Bonzini Cc: "Dr. David Alan Gilbert" Cc: qemu-devel@nongnu.org --- include/exec/ram_addr.h | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/exec/ram_addr.h b

[RESEND PATCH v2] migration/throttle: Add throttle-trig-thres migration parameter

2020-02-23 Thread Keqian Zhu
time. We can make this parameter configurable to switch between mig- ration time first or guest performance first. The default value is 50 and valid range is 1 to 100. Signed-off-by: Keqian Zhu --- Changelog: v1->v2 -Use full name for parameter. Suggested by Eric Blake. -Change the upper bo

[PATCH] migration/throttle: Add throttle-trig-thres migration parameter

2020-02-23 Thread Keqian Zhu
time. We can make this parameter configurable to switch between mig- ration time first or guest performance first. The default value is 50 and valid range is 1 to 100. Signed-off-by: Keqian Zhu --- Changelog: v1->v2 -Use full name for parameter. Suggested by Eric Blake. -Change the upper bo

[PATCH] migration/throttle: Add throttle-trig-thres migration parameter

2020-02-20 Thread Keqian Zhu
time. We can configure this parameter to switch between migration time firt or guest performance first. The default value is 50. Signed-off-by: Keqian Zhu --- Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" Cc: Eric Blake Cc: Markus Armbruster --- migration/migrat

[PATCH] migration/throttle: Make throttle slower at tail stage

2020-02-13 Thread Keqian Zhu
At the tail stage of throttle, VM is very sensitive to CPU percentage. We just throttle 30% of remaining CPU when throttle is more than 80 percentage. This doesn't conflict with cpu_throttle_increment. This may make migration time longer, and is disabled by default. Signed-off-by: Keqia

[PATCH] migration: Optimization about wait-unplug migration state

2020-02-03 Thread Keqian Zhu
), once hit a unplug-pending failover device, then it can return true right now to save cpu time. Signed-off-by: Keqian Zhu --- Cc: jfreim...@redhat.com Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" --- migration/migration.c | 2 +- migration/savevm.c| 24 +++- m

[PATCH v3 2/2] hw/arm: Use helper function to trigger hotplug handler plug

2020-01-19 Thread Keqian Zhu
We can use existing helper function to trigger hotplug handler plug, which makes code clearer. Reviewed-by: Igor Mammedov Signed-off-by: Keqian Zhu --- hw/arm/virt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 39ab5f47e0

[PATCH v3 1/2] hw/acpi: Remove extra indent in ACPI GED hotplug cb

2020-01-19 Thread Keqian Zhu
There is extra indent in ACPI GED hotplug cb that should be deleted. Reviewed-by: Igor Mammedov Signed-off-by: Keqian Zhu --- hw/acpi/generic_event_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index

[PATCH v3 0/2] Adjust some codes about memory hotplug

2020-01-19 Thread Keqian Zhu
This removes extra indent and makes some code refactor related to memory hotplug. Changelog: v2 -> v3 - Addressed Peter's comments. v1 -> v2 - Add Igor's R-b. Keqian Zhu (2): hw/acpi: Remove extra indent in ACPI GED hotplug cb hw/arm: Use helper function to trigger hotp

[PATCH v2] hw/arm: Adjust some coding styles about memory hotplug

2020-01-16 Thread Keqian Zhu
From: zhukeqian There is extra indent in ACPI GED plug cb. And we can use existing helper function to trigger hotplug handler plug. Reviewed-by: Igor Mammedov Signed-off-by: Keqian Zhu --- v1->v2: - Add Igor's R-b Cc: Shameer Kolothum Cc: "Michael S. Tsirkin" Cc: Igor M

[PATCH] hw/arm: Adjust some coding styles about memory hotplug

2020-01-16 Thread Keqian Zhu
From: zhukeqian There is extra indent in ACPI GED plug cb. And we can use existing helper function to trigger hotplug handler plug. Signed-off-by: Keqian Zhu Cc: Shameer Kolothum Cc: "Michael S. Tsirkin" Cc: Igor Mammedov --- hw/acpi/generic_event_device.c | 2 +- hw/