[PATCH] memory: avoid unnecessary iteration when updating ioeventfds

2023-02-28 Thread Longpeng(Mike)
From: Longpeng When updating ioeventfds, we need to iterate all address spaces and iterate all flat ranges of each address space. There is so much redundant process that a FlatView would be iterated for so many times during one commit (memory_region_transaction_commit). We can mark a FlatView

[PATCH v1 3/3] virtio-pci: defer to commit kvm irq routing when enable msi/msix

2023-02-28 Thread Longpeng(Mike)
From: Longpeng All unmasked vectors will be setup in msix_set_vector_notifiers(), which is a time-consuming operation because each vector need to be submit to KVM once. It's even worse if the VM has several devices and each devices has dozens of vectors. We can defer and commit the vectors in

[PATCH v1 1/3] virtio-pci: submit msi route changes in batch

2023-02-28 Thread Longpeng(Mike)
From: Longpeng The kvm_irqchip_commit_routes() is a time-intensive operation, it needs scan and update all irqfds that are already assigned during each invocation, so more vectors means need more time to process them. For virtio-pci, we can just submit once when enabling vectors of a virtio-pci

[PATCH v1 0/3] virtio-pci: optimize set_guest_notifier

2023-02-28 Thread Longpeng(Mike)
From: Longpeng This patchset optimizes the time-consuming operation in virtio_pci_set_guest_notifier, especially for the vhost-vdpa migration, the time spend on set_guest_notifier can reduce 87% in some cases. Longpeng (Mike) (3): virtio-pci: submit msi route changes in batch kvm-irqchip

[PATCH v1 2/3] kvm-irqchip: use KVMRouteChange API to update msi route

2023-02-28 Thread Longpeng(Mike)
From: Longpeng The KVMRouteChange API is added by commit 9568690868e ("kvm-irqchip: introduce new API to support route change"). We can also apply it on kvm_irqchip_update_msi_route(), there are no functional changes and we can optimize the virtio-pci core base on this change in the next patch.

[PATCH v3 3/3] vdpa: commit all host notifier MRs in a single MR transaction

2022-12-26 Thread Longpeng(Mike)
From: Longpeng This allows the vhost-vdpa device to batch the setup of all its MRs of host notifiers. This significantly reduces the device starting time, e.g. the time spend on setup the host notifier MRs reduce from 423ms to 32ms for a VM with 64 vCPUs and 3 vhost-vDPA generic devices

[PATCH v3 2/3] vhost: configure all host notifiers in a single MR transaction

2022-12-26 Thread Longpeng(Mike)
From: Longpeng This allows the vhost device to batch the setup of all its host notifiers. This significantly reduces the device starting time, e.g. the time spend on enabling notifiers reduce from 376ms to 9.1ms for a VM with 64 vCPUs and 3 vhost-vDPA generic devices (vdpa_sim_blk, 64vq per

[PATCH v3 1/3] vhost: simplify vhost_dev_enable_notifiers

2022-12-26 Thread Longpeng(Mike)
From: Longpeng Simplify the error path in vhost_dev_enable_notifiers by using vhost_dev_disable_notifiers directly. Signed-off-by: Longpeng --- hw/virtio/vhost.c | 20 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c

[PATCH v3 0/3] two optimizations to speed up the start time

2022-12-26 Thread Longpeng(Mike)
From: Longpeng Changes v3->v2: - cleanup the code [Philippe] Changes v2->v1: Patch-1: - remove vq_init_count [Jason] Patch-2: - new added. [Jason] v1: https://www.mail-archive.com/qemu-devel@nongnu.org/msg922499.html Longpeng (Mike) (3): vhost: simplify vhost_dev_enable_not

[PATCH 1/2] vdpa-dev: get iova range explicitly

2022-12-24 Thread Longpeng(Mike)
From: Longpeng In commit a585fad26b ("vdpa: request iova_range only once") we remove GET_IOVA_RANGE form vhost_vdpa_init, the generic vdpa device will start without iova_range populated, so the device won't work. Let's call GET_IOVA_RANGE ioctl explicitly. Fixes: a585fad26b2e6ccc ("vdpa:

[PATCH 2/2] vdpa: harden the error path if get_iova_range failed

2022-12-24 Thread Longpeng(Mike)
From: Longpeng We should stop if the GET_IOVA_RANGE ioctl failed. Signed-off-by: Longpeng --- net/vhost-vdpa.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index ffdc435d19..e65023d013 100644 --- a/net/vhost-vdpa.c +++

[PATCH 0/2] Fix the init path of generic vhost-vdpa device

2022-12-24 Thread Longpeng(Mike)
f vdpa/net. Longpeng (Mike) (2): vdpa-dev: get iova range explicitly vdpa: harden the error path if get_iova_range failed hw/virtio/vdpa-dev.c | 9 + hw/virtio/vhost-vdpa.c | 7 +++ include/hw/virtio/vhost-vdpa.h | 2 ++ net/vhost-vdpa.c

[PATCH v11 3/5] vdpa: add vdpa-dev-pci support

2022-12-15 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v11 1/5] virtio: get class_id and pci device id by the virtio id

2022-12-15 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88

[PATCH v11 4/5] vdpa-dev: mark the device as unmigratable

2022-12-15 Thread Longpeng(Mike)
From: Longpeng The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily. Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vdpa-dev.c

[PATCH v11 0/5] add generic vDPA device support

2022-12-15 Thread Longpeng(Mike)
[Stefan] - fix the misleading description of 'dc->desc' [Stefano] Patch 5: - check returned number of virtqueues [Stefan] Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (5): virtio: get class_id and pci device id by the virtio id

[PATCH v11 5/5] docs: Add generic vhost-vdpa device documentation

2022-12-15 Thread Longpeng(Mike)
From: Longpeng Signed-off-by: Longpeng --- .../devices/vhost-vdpa-generic-device.rst | 68 +++ 1 file changed, 68 insertions(+) create mode 100644 docs/system/devices/vhost-vdpa-generic-device.rst diff --git a/docs/system/devices/vhost-vdpa-generic-device.rst

[PATCH v11 2/5] vdpa: add vdpa-dev support

2022-12-15 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 +

[PATCH v2 1/2] vhost: configure all host notifiers in a single MR transaction

2022-12-06 Thread Longpeng(Mike)
From: Longpeng This allows the vhost device to batch the setup of all its host notifiers. This significantly reduces the device starting time, e.g. the time spend on enabling notifiers reduce from 376ms to 9.1ms for a VM with 64 vCPUs and 3 vhost-vDPA generic devices[1] (64vq per device) [1]

[PATCH v2 2/2] vdpa: commit all host notifier MRs in a single MR transaction

2022-12-06 Thread Longpeng(Mike)
From: Longpeng This allows the vhost-vdpa device to batch the setup of all its MRs of host notifiers. This significantly reduces the device starting time, e.g. the time spend on setup the host notifier MRs reduce from 423ms to 32ms for a VM with 64 vCPUs and 3 vhost-vDPA generic devices[1]

[PATCH v2 0/2] two optimizations to speed up the start time

2022-12-06 Thread Longpeng(Mike)
From: Longpeng Changes v2->v1: Patch-1: - remove vq_init_count [Jason] Patch-2: - new added. [Jason] v1: https://www.mail-archive.com/qemu-devel@nongnu.org/msg922499.html Longpeng (Mike) (2): vhost: configure all host notifiers in a single MR transaction vdpa: commit all h

[PATCH v10 3/5] vdpa: add vdpa-dev-pci support

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v10 4/5] vdpa-dev: mark the device as unmigratable

2022-12-05 Thread Longpeng(Mike)
From: Longpeng The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily. Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vdpa-dev.c

[PATCH v10 5/5] docs: Add generic vhost-vdpa device documentation

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Signed-off-by: Longpeng --- .../devices/vhost-vdpa-generic-device.rst | 66 +++ 1 file changed, 66 insertions(+) create mode 100644 docs/system/devices/vhost-vdpa-generic-device.rst diff --git a/docs/system/devices/vhost-vdpa-generic-device.rst

[PATCH v10 2/5] vdpa: add vdpa-dev support

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 +

[PATCH v10 1/5] virtio: get class_id and pci device id by the virtio id

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88

[PATCH v10 0/5] add generic vDPA device support

2022-12-05 Thread Longpeng(Mike)
tch 5: - check returned number of virtqueues [Stefan] Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (5): virtio: get class_id and pci device id by the virtio id vdpa: add vdpa-dev support vdpa: add vdpa-dev-pci support vdpa-dev: mark the de

[PATCH] vhost: configure all host notifiers in a single MR transaction

2022-11-18 Thread Longpeng(Mike)
From: Longpeng This allows the vhost device to batch the setup of all its host notifiers. This significantly reduces the device starting time, e.g. the vhost-vDPA generic device [1] start time reduce from 376ms to 9.1ms for a VM with 64 vCPUs and 3 vDPA device(64vq per device). [1]

[PATCH v9 4/5] vdpa-dev: mark the device as unmigratable

2022-11-12 Thread Longpeng(Mike)
From: Longpeng The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily. Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vdpa-dev.c

[PATCH v9 0/5] add generic vDPA device support

2022-11-12 Thread Longpeng(Mike)
tch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (5): virtio: get class_id and pci device id by the virtio id vdpa: add vdpa-dev support vdpa: add vdpa-dev-pci support vdpa-dev: mark the device as unmigratable docs: Add generic vhost-vd

[PATCH v9 1/5] virtio: get class_id and pci device id by the virtio id

2022-11-12 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88

[PATCH v9 3/5] vdpa: add vdpa-dev-pci support

2022-11-12 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v9 5/5] docs: Add generic vhost-vdpa device documentation

2022-11-12 Thread Longpeng(Mike)
From: Longpeng Signed-off-by: Longpeng --- .../devices/vhost-vdpa-generic-device.rst | 46 +++ 1 file changed, 46 insertions(+) create mode 100644 docs/system/devices/vhost-vdpa-generic-device.rst diff --git a/docs/system/devices/vhost-vdpa-generic-device.rst

[PATCH v9 2/5] vdpa: add vdpa-dev support

2022-11-12 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 +

[PATCH v8 1/5] virtio: get class_id and pci device id by the virtio id

2022-11-07 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88

[PATCH v8 4/5] vdpa-dev: mark the device as unmigratable

2022-11-07 Thread Longpeng(Mike)
From: Longpeng The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 2885d06cbe..62d83d3423

[PATCH v8 5/5] docs: Add generic vhost-vdpa device documentation

2022-11-07 Thread Longpeng(Mike)
From: Longpeng Signed-off-by: Longpeng --- docs/system/devices/vhost-vdpa-device.rst | 43 +++ 1 file changed, 43 insertions(+) create mode 100644 docs/system/devices/vhost-vdpa-device.rst diff --git a/docs/system/devices/vhost-vdpa-device.rst

[PATCH v8 3/5] vdpa: add vdpa-dev-pci support

2022-11-07 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v8 0/5] add generic vDPA device support

2022-11-07 Thread Longpeng(Mike)
- fix the misleading description of 'dc->desc' [Stefano] Patch 5: - check returned number of virtqueues [Stefan] Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (5): virtio: get class_id and pci device id by the virtio id vdpa

[PATCH v8 2/5] vdpa: add vdpa-dev support

2022-11-07 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 +

[PATCH v7 resend 3/4] vdpa: add vdpa-dev-pci support

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v7 resend 2/4] vdpa: add vdpa-dev support

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 +

[PATCH v7 resend 4/4] docs: Add generic vhost-vdpa device documentation

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Signed-off-by: Longpeng --- docs/system/devices/vhost-vdpa-device.rst | 43 +++ 1 file changed, 43 insertions(+) create mode 100644 docs/system/devices/vhost-vdpa-device.rst diff --git a/docs/system/devices/vhost-vdpa-device.rst

[PATCH v7 resend 1/4] virtio: get class_id and pci device id by the virtio id

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88

[PATCH v7 resend 0/4] add generic vDPA device support

2022-11-05 Thread Longpeng(Mike)
o] Patch 5: - check returned number of virtqueues [Stefan] Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (4): virtio: get class_id and pci device id by the virtio id vdpa: add vdpa-dev support vdpa: add vdpa-dev-pci support docs

[PATCH v7 4/4] docs: Add generic vhost-vdpa device documentation

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Signed-off-by: Longpeng --- docs/system/devices/vhost-vdpa-device.rst | 43 +++ 1 file changed, 43 insertions(+) create mode 100644 docs/system/devices/vhost-vdpa-device.rst diff --git a/docs/system/devices/vhost-vdpa-device.rst

[PATCH v7 3/4] vdpa: add vdpa-dev-pci support

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v7 1/4] virtio: get class_id and pci device id by the virtio id

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88

[PATCH v7 0/4] add generic vDPA device support

2022-11-05 Thread Longpeng(Mike)
o] Patch 5: - check returned number of virtqueues [Stefan] Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (4): virtio: get class_id and pci device id by the virtio id vdpa: add vdpa-dev support vdpa: add vdpa-dev-pci support docs

[PATCH v7 2/4] vdpa: add vdpa-dev support

2022-11-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 +

[PATCH v6 resend 2/4] virtio: get class_id and pci device id by the virtio id

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88

[PATCH v6 resend 0/4] add generic vDPA device support

2022-05-13 Thread Longpeng(Mike)
- init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (4): linux-headers: Update headers to Linux 5.18-rc6 virtio: get class_id and pci device id by the virtio id vdpa: add vdpa-dev support vdpa: add vdpa-dev-pci support hw/virtio/Kconfig|

[PATCH v6 resend 3/4] vdpa: add vdpa-dev support

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 + hw/virtio/meson.build| 1 +

[PATCH v6 resend 1/4] linux-headers: Update headers to Linux 5.18-rc6

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Update headers to 5.18-rc6. I need latest vhost changes. Signed-off-by: Longpeng --- linux-headers/linux/vhost.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index c998860d7b..5d99e7c242 100644 ---

[PATCH v6 4/4] vdpa: add vdpa-dev-pci support

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v6 resend 4/4] vdpa: add vdpa-dev-pci support

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102

[PATCH v6 2/4] virtio: get class_id and pci device id by the virtio id

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 101

[PATCH v6 1/4] linux-headers: Update headers to Linux 5.18-rc6

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Update headers to 5.18-rc6. I need latest vhost changes. Signed-off-by: Longpeng --- linux-headers/linux/vhost.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index c998860d7b..5d99e7c242 100644 ---

[PATCH v6 3/4] vdpa: add vdpa-dev support

2022-05-13 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 + hw/virtio/meson.build| 1 +

[PATCH v6 0/4] add generic vDPA device support

2022-05-13 Thread Longpeng(Mike)
Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (4): linux-headers: Update headers to Linux 5.18-rc6 virtio: get class_id and pci device id by the virtio id vdpa: add vdpa-dev support vdpa: add vdpa-dev-pci support hw/virtio/Kconfig

[PATCH v5 2/4] virtio: get class_id and pci device id by the virtio id

2022-05-12 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 77

[PATCH v5 4/4] vdpa: add vdpa-dev-pci support

2022-05-12 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 101 +++ 2 files changed, 102

[PATCH v5 1/4] linux-headers: Update headers to Linux 5.18-rc6

2022-05-12 Thread Longpeng(Mike)
From: Longpeng Update headers to 5.18-rc6. I need latest vhost changes. Signed-off-by: Longpeng --- linux-headers/linux/vhost.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index c998860d7b..5d99e7c242 100644 ---

[PATCH v5 0/4] add generic vDPA device support

2022-05-12 Thread Longpeng(Mike)
to make the code clearer [Stefan] - fix the misleading description of 'dc->desc' [Stefano] Patch 5: - check returned number of virtqueues [Stefan] Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (4): linux-headers: Update

[PATCH v5 3/4] vdpa: add vdpa-dev support

2022-05-12 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 + hw/virtio/meson.build| 1 +

[PATCH v4 3/4] vdpa: add vdpa-dev support

2022-05-10 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev. Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 + hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev.c | 385 +++ include/hw/virtio/vdpa-dev.h | 43 4 files changed, 434 insertions(+) create

[PATCH v4 4/4] vdpa: add vdpa-dev-pci support

2022-05-10 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 101 +++ 2 files changed, 102

[PATCH v4 2/4] virtio: get class_id and pci device id by the virtio id

2022-05-10 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 77

[PATCH v4 0/4] add generic vDPA device support

2022-05-10 Thread Longpeng(Mike)
- free s->dev.vqs [Stefano] Longpeng (Mike) (4): linux-headers: Update headers to Linux 5.18-rc6 virtio: get class_id and pci device id by the virtio id vdpa: add vdpa-dev support vdpa: add vdpa-dev-pci support hw/virtio/Kconfig| 5 + hw/virtio/meson.build| 2

[PATCH v4 1/4] linux-headers: Update headers to Linux 5.18-rc6

2022-05-10 Thread Longpeng(Mike)
From: Longpeng Update headers to 5.18-rc6. I need latest vhost changes. Signed-off-by: Longpeng --- linux-headers/linux/vhost.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index c998860d7b..5d99e7c242 100644 ---

[PATCH v6 4/5] Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration"

2022-03-26 Thread Longpeng(Mike)
Signed-off-by: Longpeng(Mike) --- hw/vfio/pci.c | 20 +++- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 6f49e71cd4..6801391cf6 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -572,9 +572,6 @@ static void vfio_msix_vector_release

[PATCH v6 1/5] vfio: simplify the conditional statements in vfio_msi_enable

2022-03-26 Thread Longpeng(Mike)
It's unnecessary to test against the specific return value of VFIO_DEVICE_SET_IRQS, since any positive return is an error indicating the number of vectors we should retry with. Signed-off-by: Longpeng(Mike) --- hw/vfio/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v6 3/5] vfio: simplify the failure path in vfio_msi_enable

2022-03-26 Thread Longpeng(Mike)
Use vfio_msi_disable_common to simplify the error handling in vfio_msi_enable. Signed-off-by: Longpeng(Mike) --- hw/vfio/pci.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index a1916e2e36..6f49e71cd4 100644 --- a/hw/vfio

[PATCH v6 2/5] vfio: move re-enabling INTX out of the common helper

2022-03-26 Thread Longpeng(Mike)
Move re-enabling INTX out, and the callers should decide to re-enable it or not. Signed-off-by: Longpeng(Mike) --- hw/vfio/pci.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 1433989aeb..a1916e2e36 100644 --- a/hw/vfio

[PATCH v6 0/5] optimize the downtime for vfio migration

2022-03-26 Thread Longpeng(Mike)
rrors [Alex, Philippe] - split fixups and cleanups into separate patches [Alex, Philippe] - introduce kvm_irqchip_add_deferred_msi_route to minimize code changes[Alex] - enable the optimization in msi setup path[Alex] Longpeng (Mike) (5): vfio: simplify the conditional statements in vfio_ms

[PATCH v6 5/5] vfio: defer to commit kvm irq routing when enable msi/msix

2022-03-26 Thread Longpeng(Mike)
t already assigned and need to process in this round. The optimization can be applied to msi type too. Signed-off-by: Longpeng(Mike) --- hw/vfio/pci.c | 130 +- hw/vfio/pci.h | 2 + 2 files changed, 99 insertions(+), 33 deletions(-) diff --git a/hw/vfi

[PATCH v3 06/10] vdpa-dev: implement the unrealize interface

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Implements the .unrealize interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 4defe6c33d..1713818bc3 100644 ---

[PATCH v3 05/10] vdpa-dev: implement the realize interface

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Implements the .realize interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev-pci.c | 18 - hw/virtio/vdpa-dev.c | 132 +++ include/hw/virtio/vdpa-dev.h | 10 +++ 3 files changed, 159 insertions(+), 1 deletion(-) diff --git

[PATCH v3 00/10] add generic vDPA device support

2022-03-19 Thread Longpeng(Mike)
misleading description of 'dc->desc' [Stefano] Patch 5: - check returned number of virtqueues [Stefan] Patch 6: - init s->num_queues [Stefano] - free s->dev.vqs [Stefano] Longpeng (Mike) (10): virtio: get class_id and pci device id by the virtio id update linux

[PATCH v3 09/10] vdpa-dev: implement the set_status interface

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Implements the .set_status interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 100 ++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 9536982061..c6847df7aa

[PATCH v3 08/10] vdpa-dev: implement the get_features interface

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Implements the .get_features interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index f28d3ed5f9..9536982061 100644 --- a/hw/virtio/vdpa-dev.c +++

[PATCH v3 10/10] vdpa-dev: mark the device as unmigratable

2022-03-19 Thread Longpeng(Mike)
From: Longpeng The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index c6847df7aa..5224617574

[PATCH v3 02/10] update linux headers

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Update linux headers to 5.xxx (kernel part is not merged yet) To support generic vdpa deivce, we need add the following ioctls: - VHOST_VDPA_GET_CONFIG_SIZE: get the configuration size. - VHOST_VDPA_GET_VQS_COUNT: get the count of supported virtqueues. Signed-off-by: Longpeng

[PATCH v3 03/10] vdpa: add the infrastructure of vdpa-dev

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Add the infrastructure of vdpa-dev (the generic vDPA device), we can add a generic vDPA device as follow: -device vhost-vdpa-device-pci,vdpa-dev=/dev/vhost-vdpa-X Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 +++ hw/virtio/meson.build| 2 ++

[PATCH v3 01/10] virtio: get class_id and pci device id by the virtio id

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 77

[PATCH v3 07/10] vdpa-dev: implement the get_config/set_config interface

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Implements the .get_config and .set_config interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 1713818bc3..f28d3ed5f9 100644 ---

[PATCH v3 04/10] vdpa-dev: implement the instance_init/class_init interface

2022-03-19 Thread Longpeng(Mike)
From: Longpeng Implements the .instance_init and the .class_init interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev-pci.c | 22 +++- hw/virtio/vdpa-dev.c | 69 ++-- include/hw/virtio/vdpa-dev.h | 3 ++ 3 files changed, 91

[PATCH resend 2/2] kvm/msi: do explicit commit when adding msi routes

2022-02-22 Thread Longpeng(Mike)
From: Longpeng We invoke the kvm_irqchip_commit_routes() for each addition to MSI route table, which is not efficient if we are adding lots of routes in some cases. This patch lets callers invoke the kvm_irqchip_commit_routes(), so the callers can decide how to optimize. [1]

[PATCH resend 1/2] kvm-irqchip: introduce new API to support route change

2022-02-22 Thread Longpeng(Mike)
From: Longpeng Paolo suggested adding the new API to support route changes [1]. We should invoke kvm_irqchip_begin_route_changes() before changing the routes, increasing the KVMRouteChange.changes if the routes are changed, and commit the changes at last. [1]

[PATCH resend 0/2] kvm/msi: do explicit commit when adding msi routes

2022-02-22 Thread Longpeng(Mike)
From: Longpeng This patchset moves the call to kvm_irqchip_commit_routes() out of kvm_irqchip_add_msi_route(). An optimization of vfio migration [1] depends on this changes. [1] https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg00968.html Longpeng (Mike) (2): kvm-irqchip: introduce

[PATCH v2 3/3] sem-posix: refactor qemu-sem with qemu-cond and qemu-mutex

2022-02-22 Thread Longpeng(Mike)
Now, qemu-sem is based on the pthread_cond only, we can use qemu-cond and qemu-mutex to make the code neater and the mutex trace can be supported in qemu-sem naturally. Signed-off-by: Longpeng(Mike) --- include/qemu/thread-posix.h | 5 +-- util/qemu-thread-posix.c| 103

[PATCH v2 0/3] qemu-sem-posix: use monotonic clock instead

2022-02-22 Thread Longpeng(Mike)
of the realtime clock, this could make sure we would not be affected by the system time anymore. Changes v1(RFC) -> v2: Patch 2: - clean the code [Paolo] - use pthread_condattr_setclock when initializing qemu-cond. [Paolo] Patch 3: - new added, make the qemu-sem code neater. [Longpeng] Longpeng (M

[PATCH v2 1/3] sem-posix: remove the posix semaphore support

2022-02-22 Thread Longpeng(Mike)
remove CONFIG_SEM_TIMEDWAIT in this way? No, because some systems (e.g. mac os) mark the sem_xxx API as deprecated. So maybe remove the usage of POSIX semaphore and turn to use the pthread variant for all systems looks better. Signed-off-by: Longpeng(Mike) --- include/qemu/thread-posix.h | 4

[PATCH v2 2/3] sem-posix: use monotonic clock instead

2022-02-22 Thread Longpeng(Mike)
Use CLOCK_MONOTONIC, so the timeout isn't affected by changes to the system time. It depends on the pthread_condattr_setclock(), while some systems(e.g. mac os) does not support it, so the behavior won't change in these systems. Signed-off-by: Longpeng(Mike) --- meson.build | 11

[RFC 0/2] qemu-sem-posix: use monotonic clock instead

2022-02-21 Thread Longpeng(Mike)
of the realtime clock, this could make sure we would not be affected by the system time anymore. Longpeng (Mike) (2): sem-posix: remove the posix semaphore support sem-posix: use monotonic clock instead include/qemu/thread-posix.h | 5 +-- meson.build | 12 ++- util/qemu-thread

[RFC 2/2] sem-posix: use monotonic clock instead

2022-02-21 Thread Longpeng(Mike)
Use CLOCK_MONOTONIC, so the timeout isn't affected by changes to the system time. It depends on the pthread_condattr_setclock(), while some systems(e.g. mac os) do not support it, the behavior won't change in these systems. Signed-off-by: Longpeng(Mike) --- include/qemu/thread-posix.h | 1

[RFC 1/2] sem-posix: remove the posix semaphore support

2022-02-21 Thread Longpeng(Mike)
remove CONFIG_SEM_TIMEDWAIT in this way? No, because some systems (e.g. mac os) mark the sem_xxx API as deprecated. So maybe remove the usage of POSIX semaphore and turn to use the pthread variant for all systems looks better. Signed-off-by: Longpeng(Mike) --- include/qemu/thread-posix.h | 4

[PATCH v2 09/10] vdpa-dev: implement the set_status interface

2022-01-17 Thread Longpeng(Mike)
From: Longpeng Implements the .set_status interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 100 ++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 7bf07fef9b..99722c88a1

[PATCH v2 01/10] virtio: get class_id and pci device id by the virtio id

2022-01-17 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 77

[PATCH v2 05/10] vdpa-dev: implement the realize interface

2022-01-17 Thread Longpeng(Mike)
From: Longpeng Implements the .realize interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 101 +++ include/hw/virtio/vdpa-dev.h | 8 +++ 2 files changed, 109 insertions(+) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index

  1   2   3   4   5   6   >