[PATCH for 9.1 v9 08/11] hw/pci: Replace -1 with UINT32_MAX for romsize

2024-03-14 Thread Akihiko Odaki
romsize is an uint32_t variable. Specifying -1 as an uint32_t value is obscure way to denote UINT32_MAX. Worse, if int is wider than 32-bit, it will change the behavior of a construct like the following: romsize = -1; if (romsize != -1) { ... } When -1 is assigned to romsize, -1 will be

[PATCH for 9.1 v9 03/11] pcie_sriov: Ensure VF function number does not overflow

2024-03-14 Thread Akihiko Odaki
pci_new() aborts when creating a VF with a function number equals to or is greater than PCI_DEVFN_MAX. Signed-off-by: Akihiko Odaki --- docs/pcie_sriov.txt | 8 +--- include/hw/pci/pcie_sriov.h | 5 +++-- hw/net/igb.c| 13 ++--- hw/nvme/ctrl.c

[PATCH for 9.1 v9 11/11] hw/qdev: Remove opts member

2024-03-14 Thread Akihiko Odaki
It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- include/hw/qdev-core.h | 4 hw/core/qdev.c | 1 - system/qdev-monitor.c | 12 +++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git

[PATCH for 9.1 v9 05/11] pcie_sriov: Release VFs failed to realize

2024-03-14 Thread Akihiko Odaki
Release VFs failed to realize just as we do in unregister_vfs(). Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pcie_sriov.c

[PATCH for 9.1 v9 07/11] pcie_sriov: Register VFs after migration

2024-03-14 Thread Akihiko Odaki
pcie_sriov doesn't have code to restore its state after migration, but igb, which uses pcie_sriov, naively claimed its migration capability. Add code to register VFs after migration and fix igb migration. Fixes: 3a977deebe6b ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki ---

[PATCH for 9.1 v9 10/11] hw/pci: Determine if rombar is explicitly enabled

2024-03-14 Thread Akihiko Odaki
vfio determines if rombar is explicitly enabled by inspecting QDict. Inspecting QDict is not nice because QDict is untyped and depends on the details on the external interface. Add an infrastructure to determine if rombar is explicitly enabled to hw/pci. This changes the semantics of UINT32_MAX,

[PATCH for 9.1 v9 09/11] hw/pci: Use UINT32_MAX as a default value for rombar

2024-03-14 Thread Akihiko Odaki
Currently there is no way to distinguish the case that rombar is explicitly specified as 1 and the case that rombar is not specified. Set rombar UINT32_MAX by default to distinguish these cases just as it is done for addr and romsize. It was confirmed that changing the default value to UINT32_MAX

[PATCH for 9.1 v9 06/11] pcie_sriov: Remove num_vfs from PCIESriovPF

2024-03-14 Thread Akihiko Odaki
num_vfs is not migrated so use PCI_SRIOV_CTRL_VFE and PCI_SRIOV_NUM_VF instead. Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 1 - hw/pci/pcie_sriov.c | 28 hw/pci/trace-events | 2 +- 3 files changed, 21 insertions(+), 10

[PATCH for 9.1 v9 04/11] pcie_sriov: Reuse SR-IOV VF device instances

2024-03-14 Thread Akihiko Odaki
Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realization errors at PF realization time. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h| 5 ---

[PATCH for 9.1 v9 01/11] hw/pci: Rename has_power to enabled

2024-03-14 Thread Akihiko Odaki
The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h| 7 ++- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c| 14 +++---

[PATCH for 9.1 v9 00/11] hw/pci: SR-IOV related fixes and improvements

2024-03-14 Thread Akihiko Odaki
I submitted a RFC series[1] to add support for SR-IOV emulation to virtio-net-pci. During the development of the series, I fixed some trivial bugs and made improvements that I think are independently useful. This series extracts those fixes and improvements from the RFC series. [1]:

[PATCH for 9.1 v9 02/11] pcie_sriov: Do not manually unrealize

2024-03-14 Thread Akihiko Odaki
A device gets automatically unrealized when being unparented. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 4 1 file changed, 4 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index e9b23221d713..499becd5273f 100644 --- a/hw/pci/pcie_sriov.c +++

Re: [PATCH v2 1/6] virtio/virtio-pci: Handle extra notification data

2024-03-14 Thread Jonah Palmer
On 3/14/24 3:05 PM, Eugenio Perez Martin wrote: On Thu, Mar 14, 2024 at 5:06 PM Jonah Palmer wrote: On 3/14/24 10:55 AM, Eugenio Perez Martin wrote: On Thu, Mar 14, 2024 at 1:16 PM Jonah Palmer wrote: On 3/13/24 11:01 PM, Jason Wang wrote: On Wed, Mar 13, 2024 at 7:55 PM Jonah

Re: [PATCH v2 1/6] virtio/virtio-pci: Handle extra notification data

2024-03-14 Thread Eugenio Perez Martin
On Thu, Mar 14, 2024 at 5:06 PM Jonah Palmer wrote: > > > > On 3/14/24 10:55 AM, Eugenio Perez Martin wrote: > > On Thu, Mar 14, 2024 at 1:16 PM Jonah Palmer > > wrote: > >> > >> > >> > >> On 3/13/24 11:01 PM, Jason Wang wrote: > >>> On Wed, Mar 13, 2024 at 7:55 PM Jonah Palmer > >>> wrote: >

Re: [PATCH v2] block: Use LVM tools for LV block device truncation

2024-03-14 Thread Daniel P . Berrangé
On Thu, Mar 14, 2024 at 06:25:00PM +0100, Alexander Ivanov wrote: > > > On 3/14/24 13:44, Daniel P. Berrangé wrote: > > On Wed, Mar 13, 2024 at 11:43:27AM +0100, Alexander Ivanov wrote: > > > If a block device is an LVM logical volume we can resize it using > > > standard LVM tools. > > > > > >

Re: [PATCH v2] block: Use LVM tools for LV block device truncation

2024-03-14 Thread Alexander Ivanov
On 3/14/24 13:44, Daniel P. Berrangé wrote: On Wed, Mar 13, 2024 at 11:43:27AM +0100, Alexander Ivanov wrote: If a block device is an LVM logical volume we can resize it using standard LVM tools. Add a helper to detect if a device is a DM device. In raw_co_truncate() check if the block

[PATCH for-9.0 0/2] nbd: Fix server crash on reset with iothreads

2024-03-14 Thread Kevin Wolf
Kevin Wolf (2): nbd/server: Fix race in draining the export iotests: Add test for reset/AioContext switches with NBD exports nbd/server.c | 15 ++--- tests/qemu-iotests/tests/iothreads-nbd-export | 66 +++ .../tests/iothreads-nbd-export.out

[PATCH for-9.0 1/2] nbd/server: Fix race in draining the export

2024-03-14 Thread Kevin Wolf
When draining an NBD export, nbd_drained_begin() first sets client->quiescing so that nbd_client_receive_next_request() won't start any new request coroutines. Then nbd_drained_poll() tries to makes sure that we wait for any existing request coroutines by checking that client->nb_requests has

[PATCH for-9.0 2/2] iotests: Add test for reset/AioContext switches with NBD exports

2024-03-14 Thread Kevin Wolf
This replicates the scenario in which the bug was reported. Unfortunately this relies on actually executing a guest (so that the firmware initialises the virtio-blk device and moves it to its configured iothread), so this can't make use of the qtest accelerator like most other test cases. I tried

Re: [PATCH v2 1/6] virtio/virtio-pci: Handle extra notification data

2024-03-14 Thread Jonah Palmer
On 3/14/24 10:55 AM, Eugenio Perez Martin wrote: On Thu, Mar 14, 2024 at 1:16 PM Jonah Palmer wrote: On 3/13/24 11:01 PM, Jason Wang wrote: On Wed, Mar 13, 2024 at 7:55 PM Jonah Palmer wrote: Add support to virtio-pci devices for handling the extra data sent from the driver to the

Re: [PATCH v2 1/6] virtio/virtio-pci: Handle extra notification data

2024-03-14 Thread Eugenio Perez Martin
On Thu, Mar 14, 2024 at 1:16 PM Jonah Palmer wrote: > > > > On 3/13/24 11:01 PM, Jason Wang wrote: > > On Wed, Mar 13, 2024 at 7:55 PM Jonah Palmer > > wrote: > >> > >> Add support to virtio-pci devices for handling the extra data sent > >> from the driver to the device when the

Re: [PATCH for-9.0] mirror: Don't call job_pause_point() under graph lock

2024-03-14 Thread Stefan Hajnoczi
On Wed, Mar 13, 2024 at 04:30:00PM +0100, Kevin Wolf wrote: > Calling job_pause_point() while holding the graph reader lock > potentially results in a deadlock: bdrv_graph_wrlock() first drains > everything, including the mirror job, which pauses it. The job is only > unpaused at the end of the

Re: [PATCH v4 4/5] qapi: blockdev-backup: add discard-source parameter

2024-03-14 Thread Vladimir Sementsov-Ogievskiy
On 13.03.24 19:08, Markus Armbruster wrote: Vladimir Sementsov-Ogievskiy writes: Add a parameter that enables discard-after-copy. That is mostly useful in "push backup with fleecing" scheme, when source is snapshot-access format driver node, based on copy-before-write filter snapshot-access

Re: [PATCH] file-posix: rearrange BDRVRawState fields

2024-03-14 Thread Stefan Hajnoczi
On Thu, Mar 14, 2024 at 04:47:41PM +0530, Prasad Pandit wrote: > From: Prasad Pandit > > Rearrange BRDVRawState structure fields to avoid memory > fragments in its object's memory and save some(~8) bytes > per object. > > Signed-off-by: Prasad Pandit > --- > block/file-posix.c | 39

Re: [PATCH v4] linux-aio: add IO_CMD_FDSYNC command support

2024-03-14 Thread Stefan Hajnoczi
On Thu, Mar 14, 2024 at 04:46:28PM +0530, Prasad Pandit wrote: > From: Prasad Pandit > > Libaio defines IO_CMD_FDSYNC command to sync all outstanding > asynchronous I/O operations, by flushing out file data to the > disk storage. > > Enable linux-aio to submit such aio request. This helps to >

Re: [PATCH v2] block: Use LVM tools for LV block device truncation

2024-03-14 Thread Daniel P . Berrangé
On Wed, Mar 13, 2024 at 11:43:27AM +0100, Alexander Ivanov wrote: > If a block device is an LVM logical volume we can resize it using > standard LVM tools. > > Add a helper to detect if a device is a DM device. In raw_co_truncate() > check if the block device is DM and resize it executing

Re: [PATCH v2 1/6] virtio/virtio-pci: Handle extra notification data

2024-03-14 Thread Jonah Palmer
On 3/13/24 11:01 PM, Jason Wang wrote: On Wed, Mar 13, 2024 at 7:55 PM Jonah Palmer wrote: Add support to virtio-pci devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated. The extra data that's

[PATCH] file-posix: rearrange BDRVRawState fields

2024-03-14 Thread Prasad Pandit
From: Prasad Pandit Rearrange BRDVRawState structure fields to avoid memory fragments in its object's memory and save some(~8) bytes per object. Signed-off-by: Prasad Pandit --- block/file-posix.c | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-)

[PATCH v4] linux-aio: add IO_CMD_FDSYNC command support

2024-03-14 Thread Prasad Pandit
From: Prasad Pandit Libaio defines IO_CMD_FDSYNC command to sync all outstanding asynchronous I/O operations, by flushing out file data to the disk storage. Enable linux-aio to submit such aio request. This helps to reduce latency induced via pthread_create calls by thread-pool (aio=threads).