[PATCH] hw/vhost-user-blk: fix ioeventfd add failed when start reenter

2022-03-28 Thread Jie Wang via
0x7fca423e8ecc in kvm_handle_io 28 0x7fca423ecb48 in kvm_cpu_exec 29 0x7fca424279d5 in qemu_kvm_cpu_thread_fn 30 0x7fca423c9480 in qemu_thread_start 31 0x7fca4257ff3b in ?? () from /usr/lib64/libpthread.so.0 32 0x7fca4270b550 in clone () from /usr/lib64/libc.so.6 Signed-off-by: Ji

[PATCH v3 9/9] hvf: remove the need to lookup memory slots when clearing dirty-bits

2022-03-02 Thread Yan-Jie Wang
`section` passed by the caller to determine the pages that need to be write-protected. Compared to the original method, this saves time. Moreover, this makes only pages whose dirty-bits are cleared write-protected instead of making the whole memory slot write-protected. Signed-off-by: Yan-Jie Wang

[PATCH v3 5/9] hvf: fix memory dirty-tracking

2022-03-02 Thread Yan-Jie Wang
work properly. Buglink: https://bugs.launchpad.net/qemu/+bug/1827005 Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 62 include/sysemu/hvf_int.h | 14 + target/arm/hvf/hvf.c | 5 target/i386/hvf/hvf.c| 25

[PATCH v3 6/9] hvf: add a lock for memory related functions

2022-03-02 Thread Yan-Jie Wang
We follow how KVM accel does in its memory listener (kvm-all.c) and add a lock for the memory related functions. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/accel/hvf/hvf-mem.c b/accel/hvf/hvf-mem.c index 896e718374

[PATCH v3 8/9] hvf: only consider directly writeable memory regions for dirty-tracking

2022-03-02 Thread Yan-Jie Wang
It is no need to dirty-track MMIO regions or other readonly regions. Before we start or stop to dirty-track a memory region, check the type of the memory region. The region must be a writeable ram to be dirty-tracked. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 6 ++ 1 file

[PATCH v3 1/9] hvf: move memory related functions from hvf-accel-ops.c to hvf-mem.c

2022-03-02 Thread Yan-Jie Wang
Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-accel-ops.c | 220 + accel/hvf/hvf-mem.c | 252 ++ accel/hvf/meson.build | 1 + include/sysemu/hvf_int.h | 2 + 4 files changed, 256 insertions(+), 219 deletions

[PATCH v3 4/9] hvf: rename struct hvf_slot to HVFSlot

2022-03-02 Thread Yan-Jie Wang
Follow the QEMU coding style. Structured type names are in CamelCase. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 14 +++--- include/sysemu/hvf_int.h | 8 target/i386/hvf/hvf.c| 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/accel

[PATCH v3 3/9] hvf: use correct data types for addresses in memory related functions

2022-03-02 Thread Yan-Jie Wang
Follow the QEMU coding style. Use hwaddr for guest physical address. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 2 +- include/sysemu/hvf_int.h | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/hvf/hvf-mem.c b/accel/hvf/hvf-mem.c index 32452696b6

[PATCH v2 9/9] hvf: remove the need to lookup memory slots when clearing dirty-bits

2022-03-02 Thread Yan-Jie Wang
`section` passed by the caller to determine the pages that need to be write-protected. Compared to the original method, this saves time. Moreover, this makes only pages whose dirty-bits are cleared write-protected instead of making the whole memory slot write-protected. Signed-off-by: Yan-Jie Wang

[PATCH v2 5/9] hvf: fix memory dirty-tracking

2022-03-02 Thread Yan-Jie Wang
work properly. Buglink: https://bugs.launchpad.net/qemu/+bug/1827005 Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 62 include/sysemu/hvf_int.h | 14 + target/arm/hvf/hvf.c | 5 target/i386/hvf/hvf.c| 25

[PATCH v2 0/9] Many improvements to HVF memory-related codes

2022-03-02 Thread Yan-Jie Wang
es instead of arrays to store in-kernel KVM memory slots. 5. Add a lock to protect the data structures of HVF memory slots Patches have been tested on Apple Silicon Macs and Intel Macs. Yan-Jie Wang (9): hvf: move memory related functions from hvf-accel-ops.c to hvf-mem.c hvf: sim

[PATCH v2 3/9] hvf: use correct data types for addresses in memory related functions

2022-03-02 Thread Yan-Jie Wang
Follow the QEMU coding style. Use hwaddr for guest physical address. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 2 +- include/sysemu/hvf_int.h | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/hvf/hvf-mem.c b/accel/hvf/hvf-mem.c index 32452696b6

[PATCH v2 1/9] hvf: move memory related functions from hvf-accel-ops.c to hvf-mem.c

2022-03-02 Thread Yan-Jie Wang
Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-accel-ops.c | 220 + accel/hvf/hvf-mem.c | 252 ++ accel/hvf/meson.build | 1 + include/sysemu/hvf_int.h | 2 + 4 files changed, 256 insertions(+), 219 deletions

[PATCH v2 7/9] hvf: use GTree to store memory slots instead of fixed-size array

2022-03-02 Thread Yan-Jie Wang
Currently, there are only 32 memory slots in the fixed size array. It is not scalable. Instead of using fixed size array, use GTree (from glib library) and dynamically-allocated structures to store memory slots. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 63

[PATCH v2 6/9] hvf: add a lock for memory related functions

2022-03-02 Thread Yan-Jie Wang
We follow how KVM accel does in its memory listener (kvm-all.c) and add a lock for the memory related functions. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/accel/hvf/hvf-mem.c b/accel/hvf/hvf-mem.c index 896e718374

[PATCH v2 4/9] hvf: rename struct hvf_slot to HVFSlot

2022-03-02 Thread Yan-Jie Wang
Follow the QEMU coding style. Structured type names are in CamelCase. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 14 +++--- include/sysemu/hvf_int.h | 8 target/i386/hvf/hvf.c| 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/accel

[PATCH v3 7/9] hvf: use GTree to store memory slots instead of fixed-size array

2022-03-02 Thread Yan-Jie Wang
Currently, there are only 32 memory slots in the fixed size array. It is not scalable. Instead of using fixed size array, use GTree (from glib library) and dynamically-allocated structures to store memory slots. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 63

[PATCH v2 2/9] hvf: simplify data structures and codes of memory related functions

2022-03-02 Thread Yan-Jie Wang
not overlap with existing sections. - Try to align memory sections first before giving up sections that are not aligned to host page size. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-accel-ops.c | 1 - accel/hvf/hvf-mem.c | 211 +++--- include/sysemu

[PATCH v3 2/9] hvf: simplify data structures and codes of memory related functions

2022-03-02 Thread Yan-Jie Wang
not overlap with existing sections. - Try to align memory sections first before giving up sections that are not aligned to host page size. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-accel-ops.c | 1 - accel/hvf/hvf-mem.c | 211 +++--- include/sysemu

[PATCH v3 0/9] Many improvements to HVF memory-related codes

2022-03-02 Thread Yan-Jie Wang
t the data structures of HVF memory slots Patches have been tested on Apple Silicon Macs and Intel Macs. Yan-Jie Wang (9): hvf: move memory related functions from hvf-accel-ops.c to hvf-mem.c hvf: simplify data structures and codes of memory related functions hvf: use correct data types for

[PATCH v2 8/9] hvf: only consider directly writeable memory regions for dirty-tracking

2022-03-02 Thread Yan-Jie Wang
It is no need to dirty-track MMIO regions or other readonly regions. Before we start or stop to dirty-track a memory region, check the type of the memory region. The region must be a writeable ram to be dirty-tracked. Signed-off-by: Yan-Jie Wang --- accel/hvf/hvf-mem.c | 5 + 1 file

Re: [PATCH qemu 0/7] Many improvements to HVF memory-related codes

2022-03-01 Thread Yan-Jie Wang
Sorry, I made a mistake. The last line in the function, hvf_find_free_slot, introduced in this commit "hvf: simplify data structures and codes of memory related functions" should be "return NULL;" static hvf_slot *hvf_find_free_slot(void) { hvf_slot *slot; int x; for (x = 0; x < HVF_NU

Re: [PATCH qemu 0/7] Many improvements to HVF memory-related codes

2022-03-01 Thread Yan-Jie Wang
For the dirty-tracking part in my patch series, the major difference between this patch and Alex's patch is that the dirty-tracking logic in my patch will only mark the page being written dirty instead of marking the whole memory slot dirty, and will only restore the write permission to the pag

[PATCH] scsi: fix bug scsi resp sense is 0 when expand disk

2021-06-29 Thread Jie Wang
s add req_has_ua to avoid this kind of thing. Signed-off-by: suruifeng Signed-off-by: Jie Wang --- hw/scsi/scsi-bus.c | 10 -- include/hw/scsi/scsi.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 2a0a98cac9..20ec4

[PATCH v2] util: fix fd leak in qemu_write_pidfile()

2021-05-10 Thread Jie Wang
if execute qemu_open success, have no branch to free the fd, so unlink it inadvance, let it free by process exit. Signed-off-by: Jie Wang --- util/oslib-posix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 36820fec16..fa881f2ee8 100644 --- a

[PATCH] util: fix fd leak in qemu_write_pidfile()

2021-05-10 Thread Jie Wang
if execute qemu_open success, have no branch to free the fd, so unlink it inadvance, let it free by process exit. Signed-off-by: Jie Wang --- util/oslib-posix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 36820fec16..30bf39bf4f 100644 --- a

[Qemu-devel] Ping Re: [PATCH] vhost: remove the dead code

2019-05-29 Thread Jie Wang
On 2019/5/2 0:38, Stefan Hajnoczi wrote: > On Tue, Apr 30, 2019 at 02:10:14PM +0800, Jie Wang wrote: >> remove the dead code >> >> Signed-off-by: Jie Wang >> --- >> hw/virtio/vhost.c | 1 - >> 1 file changed, 1 deletion(-) > Reviewed-by: Stefan Hajnoczi

[Qemu-devel] Ping Re: [PATCH] vhost: fix memory leak in vhost_user_scsi_realize

2019-05-29 Thread Jie Wang
On 2019/5/2 0:40, Stefan Hajnoczi wrote: > On Tue, Apr 30, 2019 at 03:15:00PM +0800, Jie Wang wrote: >> fix memory leak in vhost_user_scsi_realize >> >> Signed-off-by: Jie Wang >> --- >> hw/scsi/vhost-user-scsi.c | 3 +++ >> 1 file changed, 3 insertions(+) > Reviewed-by: Stefan Hajnoczi

Re: [Qemu-devel] [Qemu-block] [PATCH] pr-manager-helper: fix pr process been killed when reconectting

2019-05-29 Thread Jie Wang
wrote: > On 5/28/19 7:45 PM, Paolo Bonzini wrote: >> On 28/05/19 15:06, Jie Wang wrote: >>> if pr-helper been killed and qemu send disconnect event to libvirt >>> and libvirt started a new pr-helper process, the new pr-heleper >>> been killed again when qemu is c

[Qemu-devel] [PATCH] pr-manager-helper: fix pr process been killed when reconectting

2019-05-28 Thread Jie Wang
-off-by: Jie Wang --- scsi/pr-manager-helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c index 438380fced..b7341b8f47 100644 --- a/scsi/pr-manager-helper.c +++ b/scsi/pr-manager-helper.c @@ -120,6 +120,7 @@ static int

[Qemu-devel] [PATCH] vhost: fix memory leak in vhost_user_scsi_realize

2019-04-30 Thread Jie Wang
fix memory leak in vhost_user_scsi_realize Signed-off-by: Jie Wang --- hw/scsi/vhost-user-scsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 8b1e6876db..a9fd8ea305 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost

[Qemu-devel] [PATCH] vhost: fix incorrect print type

2019-04-30 Thread Jie Wang
fix incorrect print type in vhost_virtqueue_stop Signed-off-by: Jie Wang --- hw/virtio/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 7f61018f2a..286bb27c65 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1081,7

[Qemu-devel] [PATCH] vhost: remove the dead code

2019-04-30 Thread Jie Wang
remove the dead code Signed-off-by: Jie Wang --- hw/virtio/vhost.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 7f61018f2a..2303a8c206 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1650,7 +1650,6 @@ fail_vq

[Qemu-devel] question: Does qemu-pr-helper have its own log files?

2019-04-22 Thread Jie Wang
 Does qemu-pr-helper have its own log files?

[Qemu-devel] [PATCH] block/file-posix: fix the wrong result of find_allocation() in macOS.

2018-09-08 Thread Yan-Jie Wang
as input may create corrupted images in macOS especially for large files, and qemu-img map may also report wrong things. This patch fixes this undesired behaviors. Signed-off-by: Yan-Jie Wang --- block/file-posix.c | 59 ++ 1 file changed, 59 insertions

[Qemu-devel] [Bug 1776920] Re: qemu-img convert on Mac OSX creates corrupt images

2018-09-07 Thread Yan-Jie Wang
I have done some experiments and find out that the behavior of lseek with whence set to SEEK_DATA is different from the behavior of Linux's lseek. If the supplied offset is in the middle of a data region, it returns the start of the next data region. There may be many data regions in a big file

[Qemu-devel] [Bug 1779120] Re: disk missing in the guest contingently when hotplug several virtio scsi disks consecutively

2018-06-28 Thread Jie Wang
I also met this bug -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1779120 Title: disk missing in the guest contingently when hotplug several virtio scsi disks consecutively Status in QEMU: New

[Qemu-devel] [PATCH v2] util/async: avoid NULL pointer dereference

2018-06-11 Thread Jie Wang
if laio_init create linux_aio failed and return NULL, NULL pointer dereference will occur when laio_attach_aio_context dereference linux_aio in aio_get_linux_aio. Let's avoid it and report error. Signed-off-by: Jie Wang --- block/file-posix.c | 19 +-- util/async.c

[Qemu-devel] [PATCH v2] util/async: avoid NULL pointer dereference

2018-06-11 Thread Jie Wang
if laio_init create linux_aio failed and return NULL, NULL pointer dereference will occur when laio_attach_aio_context dereference linux_aio in aio_get_linux_aio. Let's avoid it and report error. Signed-off-by: Jie Wang --- block/file-posix.c | 19 +-- util/async.c

[Qemu-devel] [PATCH] util/async: avoid NULL pointer dereference

2018-06-11 Thread Jie Wang
if laio_init create linux_aio failed and return NULL, NULL pointer dereference will occur when laio_attach_aio_context dereference linux_aio in aio_get_linux_aio, so add assert to avoid it. Signed-off-by: Jie Wang --- util/async.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/async.c

[Qemu-devel] [PATCH v6 2/2] iothread: let aio_epoll_disable fit to aio_context_destroy

2018-05-16 Thread Jie Wang
epoll_available will only be set if epollfd != -1, os we can swap the two variables in aio_epoll_disable, and aio_context_destroy can call aio_epoll_disable directly. Signed-off-by: Jie Wang --- util/aio-posix.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/util

[Qemu-devel] [PATCH v6 1/2] iothread: fix epollfd leak in the process of delIOThread

2018-05-16 Thread Jie Wang
When we call addIOThread, the epollfd created in aio_context_setup, but not close it in the process of delIOThread, so the epollfd will leak. Signed-off-by: Jie Wang --- include/block/aio.h | 8 util/aio-posix.c| 9 + util/aio-win32.c| 4 util/async.c| 1

[Qemu-devel] [PATCH v5] iothread: fix epollfd leak in the process of delIOThread

2018-05-16 Thread Jie Wang
When we call addIOThread, the epollfd created in aio_context_setup, but not close it in the process of delIOThread, so the epollfd will leak. Signed-off-by: Jie Wang --- include/block/aio.h | 8 util/aio-posix.c| 13 ++--- util/aio-win32.c| 4 util/async.c

[Qemu-devel] [PATCH v4] iothread: fix epollfd leak in the process of delIOThread

2018-05-16 Thread Jie Wang
When we call addIOThread, the epollfd created in aio_context_setup, but not close it in the process of delIOThread, so the epollfd will leak. Signed-off-by: Jie Wang --- include/block/aio.h | 8 util/aio-posix.c| 9 + util/aio-win32.c| 4 util/async.c| 1

[Qemu-devel] [PATCH v3] iothread: fix epollfd leak in the process of delIOThread

2018-05-16 Thread Jie Wang
From: w00251574 When we call addIOThread, the epollfd created in aio_context_setup, but not close it in the process of delIOThread, so the epollfd will leak. Signed-off-by: Jie Wang --- include/block/aio.h | 8 util/aio-posix.c| 9 + util/aio-win32.c| 4 util

[Qemu-devel] [PATCH v2] iothread: fix epollfd leak in the process of delIOThread

2018-05-16 Thread Jie Wang
From: w00251574 When we call addIOThread, the epollfd created in aio_context_setup, but not close it in the process of delIOThread, so the epollfd will leak. Signed-off-by: Jie Wang --- include/block/aio.h | 8 util/aio-posix.c| 7 +++ util/aio-win32.c| 4 util

[Qemu-devel] [PATCH] iothread: fix epollfd leak in the process of delIOThread

2018-05-15 Thread Jie Wang
When we call addIOThread, the epollfd created in aio_context_setup, but not close it in the process of delIOThread, so the epollfd will leak. Signed-off-by: Jie Wang --- iothread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iothread.c b/iothread.c index aff1281..23ac0a8 100644 --- a

[Qemu-devel] [PATCH] test: add drive-mirror qtest

2016-09-06 Thread Jie Wang
Signed-off-by: Jie Wang --- tests/Makefile.include| 3 ++ tests/drive-mirror-test.c | 96 +++ 2 files changed, 99 insertions(+) create mode 100755 tests/drive-mirror-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index

[Qemu-devel] [PATCH] tests: add drive-mirror qtest

2016-09-06 Thread Jie Wang
Signed-off-by: Jie Wang --- tests/Makefile.include| 3 ++ tests/drive-mirror-test.c | 96 +++ 2 files changed, 99 insertions(+) create mode 100755 tests/drive-mirror-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index