vduse: Add suspend
Eugenio Pérez
maintainerPATCH v3 1/1 vduse: Add suspend
Implement suspend operation for vduse devices, so vhost-vdpa will offer that backend feature and userspace can effectively suspend the device.
This is a must before get virtqueue indexes (base) for live migration, since the device could modify them after userland gets them.
This patch does not implement resume, so VMM resets the whole device to recover from a live migration failure. Resume optimization can be implemented on top of these patches, as other vDPA devices have done in the past.
---
This patch depends on
https://lore.kernel.org/lkml/[email protected]
v3:
* Expand the patch message with information about resume operation.
v2:
* Take the rwsem only before the actual kick, not in vduse_vdpa_kick_vq. This assures that we're not in a critical section.
--- drivers/vdpa/vdpa_user/vduse_dev.c | 86 +++++++++++++++++++++++++++++- include/uapi/linux/vduse.h | 4 ++ 2 files changed, 88 insertions(+), 2 deletions(-)
drivers/vdpa/vdpa_user/vduse_dev.c +84 -2
@@ -54,7 +54,8 @@#define IRQ_UNBOUND -1/* Supported VDUSE features */ -static const uint64_t vduse_features =BIT_U64 (VDUSE_F_QUEUE_READY ); +static const uint64_t vduse_features =BIT_U64 (VDUSE_F_QUEUE_READY ) | +BIT_U64 (VDUSE_F_SUSPEND );/* * VDUSE instance have not asked the vduse API version, so assume 0.
@@ -85,6 +86,7 @@ struct vduse_virtqueue {int irq_effective_cpu;struct cpumask irq_affinity;struct kobject kobj; +struct vduse_dev *dev; };struct vduse_dev ;
@@ -134,6 +136,7 @@ struct vduse_dev {int minor;bool broken;bool connected; +bool suspended;u64 api_version;u64 device_features;u64 driver_features;
@@ -503,6 +506,7 @@ static void vduse_dev_reset(struct vduse_dev *dev)down_write (&dev->rwsem); + dev->suspended = false; dev->status =0 ; dev->driver_features =0 ; dev->generation++;
@@ -561,6 +565,10 @@ static void vduse_vq_kick(struct vduse_virtqueue *vq)if (!vq->ready) goto unlock; +guard (rwsem_read)(&vq->dev->rwsem); +if (vq->dev->suspended) +return ; +if (vq->kickfd)eventfd_signal (vq->kickfd);else
@@ -919,6 +927,27 @@ static int vduse_vdpa_set_map(struct vdpa_device *vdpa,return 0 ; } +static int vduse_vdpa_suspend (struct vdpa_device *vdpa) +{ +struct vduse_dev *dev =vdpa_to_vduse (vdpa); +struct vduse_dev_msg msg = {0 }; +int ret; + + msg.req.type =VDUSE_SUSPEND ; + + ret =vduse_dev_msg_sync (dev, &msg); +if (ret ==0 ) { +scoped_guard (rwsem_write, &dev->rwsem) + dev->suspended = true; + +cancel_work_sync (&dev->inject); +for (u32 i =0 ; i < dev->vq_num; i++) +cancel_work_sync (&dev->vqs[i]->inject); + } + +return ret; +} +static void vduse_vdpa_free (struct vdpa_device *vdpa) {struct vduse_dev *dev =vdpa_to_vduse (vdpa);
@@ -960,6 +989,41 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = { .free = vduse_vdpa_free, }; +static const struct vdpa_config_ops vduse_vdpa_config_ops_with_suspend = { + .set_vq_address = vduse_vdpa_set_vq_address, + .kick_vq = vduse_vdpa_kick_vq, + .set_vq_cb = vduse_vdpa_set_vq_cb, + .set_vq_num = vduse_vdpa_set_vq_num, + .get_vq_size = vduse_vdpa_get_vq_size, + .get_vq_group = vduse_get_vq_group, + .set_vq_ready = vduse_vdpa_set_vq_ready, + .get_vq_ready = vduse_vdpa_get_vq_ready, + .set_vq_state = vduse_vdpa_set_vq_state, + .get_vq_state = vduse_vdpa_get_vq_state, + .get_vq_align = vduse_vdpa_get_vq_align, + .get_device_features = vduse_vdpa_get_device_features, + .set_driver_features = vduse_vdpa_set_driver_features, + .get_driver_features = vduse_vdpa_get_driver_features, + .set_config_cb = vduse_vdpa_set_config_cb, + .get_vq_num_max = vduse_vdpa_get_vq_num_max, + .get_device_id = vduse_vdpa_get_device_id, + .get_vendor_id = vduse_vdpa_get_vendor_id, + .get_status = vduse_vdpa_get_status, + .set_status = vduse_vdpa_set_status, + .get_config_size = vduse_vdpa_get_config_size, + .get_config = vduse_vdpa_get_config, + .set_config = vduse_vdpa_set_config, + .get_generation = vduse_vdpa_get_generation, + .set_vq_affinity = vduse_vdpa_set_vq_affinity, + .get_vq_affinity = vduse_vdpa_get_vq_affinity, + .reset = vduse_vdpa_reset, + .set_map = vduse_vdpa_set_map, + .set_group_asid = vduse_set_group_asid, + .get_vq_map = vduse_get_vq_map, + .suspend = vduse_vdpa_suspend, + .free = vduse_vdpa_free, +}; +static void vduse_dev_sync_single_for_device (union virtio_map token,dma_addr_t dma_addr,size_t size,enum dma_data_direction dir)
@@ -1171,6 +1235,10 @@ static void vduse_dev_irq_inject(struct work_struct *work) { struct vduse_dev *dev = container_of(work, struct vduse_dev, inject); +guard (rwsem_read)(&dev->rwsem); +if (dev->suspended) +return ; +spin_lock_bh (&dev->irq_lock);if (dev->config_cb.callback) dev->config_cb.callback (dev->config_cb.private);
@@ -1182,6 +1250,10 @@ static void vduse_vq_irq_inject(struct work_struct *work)struct vduse_virtqueue *vq =container_of (work, struct vduse_virtqueue, inject); +guard (rwsem_read)(&vq->dev->rwsem); +if (vq->dev->suspended) +return ; +spin_lock_bh (&vq->irq_lock);if (vq->ready && vq->cb.callback) vq->cb.callback (vq->cb.private);
@@ -1212,6 +1284,9 @@ static int vduse_dev_queue_irq_work(struct vduse_dev *dev,int ret = -EINVAL ;down_read (&dev->rwsem); +if (dev->suspended) +return ret; +if (!(dev->status &VIRTIO_CONFIG_S_DRIVER_OK )) goto unlock;
@@ -1976,6 +2051,7 @@ static int vduse_dev_init_vqs(struct vduse_dev *dev, u32 vq_align, u32 vq_num) } dev->vqs[i]->index = i; + dev->vqs[i]->dev = dev; dev->vqs[i]->irq_effective_cpu =IRQ_UNBOUND ;INIT_WORK (&dev->vqs[i]->inject, vduse_vq_irq_inject);INIT_WORK (&dev->vqs[i]->kick, vduse_vq_kick_work);
@@ -2426,12 +2502,18 @@ static struct vduse_mgmt_dev *vduse_mgmt;static int vduse_dev_init_vdpa (struct vduse_dev *dev,const char *name) {struct vduse_vdpa *vdev; +const struct vdpa_config_ops *ops;if (dev->vdev)return -EEXIST ; +if (dev->vduse_features &BIT_U64 (VDUSE_F_SUSPEND )) + ops = &vduse_vdpa_config_ops_with_suspend; +else + ops = &vduse_vdpa_config_ops; + vdev = vdpa_alloc_device(struct vduse_vdpa, vdpa, dev->dev, - &vduse_vdpa_config_ops, &vduse_map_ops, + ops, &vduse_map_ops, dev->ngroups, dev->nas, name, true);if (IS_ERR (vdev))return PTR_ERR (vdev);
include/uapi/linux/vduse.h +4 -0
@@ -17,6 +17,9 @@/* The VDUSE instance expects a request for vq ready */ #define VDUSE_F_QUEUE_READY 0 +/* The VDUSE instance expects a request for suspend */ +#define VDUSE_F_SUSPEND 1 +/* * Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION). * This is used for future extension.
@@ -334,6 +337,7 @@ enum vduse_req_type {VDUSE_UPDATE_IOTLB ,VDUSE_SET_VQ_GROUP_ASID ,VDUSE_SET_VQ_READY , + VDUSE_SUSPEND, };/**
Signature · 1 line
2.54.0
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Eugenio,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20260609]
[cannot apply to linus/master v7.1-rc7 v7.1-rc6 v7.1-rc5 v7.1-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugenio-P-rez/vduse-Add-suspend/20260610-164534 base: next-20260609 patch link: https://lore.kernel.org/r/20260610083452.477759-1-eperezma%40redhat.com patch subject: [PATCH v3] vduse: Add suspend config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260611/[email protected]/config) compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 7917772d7d61384696c61102c08c2ea158e610fa) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260611/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/vdpa/vdpa_user/vduse_dev.c:566:3: error: cannot jump from this goto statement to its label
566 | goto unlock;
| ^
drivers/vdpa/vdpa_user/vduse_dev.c:568:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
568 | guard(rwsem_read)(&vq->dev->rwsem);
| ^
include/linux/cleanup.h:423:2: note: expanded from macro 'guard'
423 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/cleanup.h:303:3: note: expanded from macro 'CLASS'
303 | class_##_name##_constructor
| ^
<scratch space>:132:1: note: expanded from here
132 | class_rwsem_read_constructor
| ^
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:138:1: note: expanded from here
138 | __UNIQUE_ID_unlock_770
| ^
drivers/vdpa/vdpa_user/vduse_dev.c:568:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
include/linux/cleanup.h:423:15: note: expanded from macro 'guard'
423 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/compiler.h:165:2: note: expanded from macro '__UNIQUE_ID'
165 | __PASTE(__UNIQUE_ID_, \
| ^
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:126:1: note: expanded from here
126 | __UNIQUE_ID_guard_769
| ^1 error generated.
vim +566 drivers/vdpa/vdpa_user/vduse_dev.c
c8a6153b6c59d9 Xie Yongji 2021-08-31 561
c8a6153b6c59d9 Xie Yongji 2021-08-31 562 static void vduse_vq_kick(struct vduse_virtqueue *vq)
c8a6153b6c59d9 Xie Yongji 2021-08-31 563 {
c8a6153b6c59d9 Xie Yongji 2021-08-31 564 spin_lock(&vq->kick_lock);
c8a6153b6c59d9 Xie Yongji 2021-08-31 565 if (!vq->ready)
c8a6153b6c59d9 Xie Yongji 2021-08-31 @566 goto unlock;
c8a6153b6c59d9 Xie Yongji 2021-08-31 567
9c4307e82fa1dc Eugenio Pérez 2026-06-10 568 guard(rwsem_read)(&vq->dev->rwsem);
9c4307e82fa1dc Eugenio Pérez 2026-06-10 569 if (vq->dev->suspended)
9c4307e82fa1dc Eugenio Pérez 2026-06-10 570 return;
9c4307e82fa1dc Eugenio Pérez 2026-06-10 571
c8a6153b6c59d9 Xie Yongji 2021-08-31 572 if (vq->kickfd)
3652117f854819 Christian Brauner 2023-11-22 573 eventfd_signal(vq->kickfd);
c8a6153b6c59d9 Xie Yongji 2021-08-31 574 else
c8a6153b6c59d9 Xie Yongji 2021-08-31 575 vq->kicked = true;
c8a6153b6c59d9 Xie Yongji 2021-08-31 576 unlock:
c8a6153b6c59d9 Xie Yongji 2021-08-31 577 spin_unlock(&vq->kick_lock);
c8a6153b6c59d9 Xie Yongji 2021-08-31 578 }
c8a6153b6c59d9 Xie Yongji 2021-08-31 579 --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Dan Carpenter
build botBCC: [email protected] CC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: "Eugenio Pérez"…
BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: "Eugenio Pérez" <[email protected]>
TO: "Michael S . Tsirkin" <[email protected]>
CC: [email protected]
CC: Jason Wang <[email protected]>
CC: Cindy Lu <[email protected]>
CC: Xuan Zhuo <[email protected]>
CC: Stefano Garzarella <[email protected]>
CC: [email protected]
CC: Laurent Vivier <[email protected]>
CC: Yongji Xie <[email protected]>
CC: "Eugenio Pérez" <[email protected]>
CC: Maxime Coquelin <[email protected]>
Hi Eugenio,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20260609]
[cannot apply to linus/master v7.1-rc7 v7.1-rc6 v7.1-rc5 v7.1-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugenio-P-rez/vduse-Add-suspend/20260610-164534 base: next-20260609 patch link: https://lore.kernel.org/r/20260610083452.477759-1-eperezma%40redhat.com patch subject: [PATCH v3] vduse: Add suspend
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
config: arm64-randconfig-r072-20260610 (https://download.01.org/0day-ci/archive/20260611/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9185-gbcc58b9c
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/vdpa/vdpa_user/vduse_dev.c:577 vduse_vq_kick() warn: inconsistent returns '&vq->kick_lock'. drivers/vdpa/vdpa_user/vduse_dev.c:1302 vduse_dev_queue_irq_work() warn: inconsistent returns '&dev->rwsem'.
vim +577 drivers/vdpa/vdpa_user/vduse_dev.c
c8a6153b6c59d9 Xie Yongji 2021-08-31 561
c8a6153b6c59d9 Xie Yongji 2021-08-31 562 static void vduse_vq_kick(struct vduse_virtqueue *vq)
c8a6153b6c59d9 Xie Yongji 2021-08-31 563 {
c8a6153b6c59d9 Xie Yongji 2021-08-31 564 spin_lock(&vq->kick_lock);
c8a6153b6c59d9 Xie Yongji 2021-08-31 565 if (!vq->ready)
c8a6153b6c59d9 Xie Yongji 2021-08-31 566 goto unlock;
c8a6153b6c59d9 Xie Yongji 2021-08-31 567
9c4307e82fa1dc Eugenio Pérez 2026-06-10 568 guard(rwsem_read)(&vq->dev->rwsem);
9c4307e82fa1dc Eugenio Pérez 2026-06-10 569 if (vq->dev->suspended)
9c4307e82fa1dc Eugenio Pérez 2026-06-10 570 return;
9c4307e82fa1dc Eugenio Pérez 2026-06-10 571
c8a6153b6c59d9 Xie Yongji 2021-08-31 572 if (vq->kickfd)
3652117f854819 Christian Brauner 2023-11-22 573 eventfd_signal(vq->kickfd);
c8a6153b6c59d9 Xie Yongji 2021-08-31 574 else
c8a6153b6c59d9 Xie Yongji 2021-08-31 575 vq->kicked = true;
c8a6153b6c59d9 Xie Yongji 2021-08-31 576 unlock:
c8a6153b6c59d9 Xie Yongji 2021-08-31 @577 spin_unlock(&vq->kick_lock);
c8a6153b6c59d9 Xie Yongji 2021-08-31 578 }c8a6153b6c59d9 Xie Yongji 2021-08-31 579
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Michael S. Tsirkin
maintainerQuoted 39 lines · Dan Carpenter
Hi Eugenio,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugenio-P-rez/vduse-Add-suspend/20260610-164534 base: next-20260609 patch link: https://lore.kernel.org/r/20260610083452.477759-1-eperezma%40redhat.com patch subject: [PATCH v3] vduse: Add suspend config: arm64-randconfig-r072-20260610 (https://download.01.org/0day-ci/archive/20260611/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 8.5.0 smatch: v0.5.0-9185-gbcc58b9cIf you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/vdpa/vdpa_user/vduse_dev.c:577vduse_vq_kick()warn: inconsistent returns '&vq->kick_lock'.drivers/vdpa/vdpa_user/vduse_dev.c:1302vduse_dev_queue_irq_work()warn: inconsistent returns '&dev->rwsem'.vim +577
drivers/vdpa/vdpa_user/vduse_dev.cc8a6153b6c59d9 Xie Yongji 2021-08-31 562 static void vduse_vq_kick(struct vduse_virtqueue *vq) c8a6153b6c59d9 Xie Yongji 2021-08-31 563 { c8a6153b6c59d9 Xie Yongji 2021-08-31 564 spin_lock(&vq->kick_lock); ^^^^^^^^^^^^^^^^^^^^^^^^^^ c8a6153b6c59d9 Xie Yongji 2021-08-31 565 if (!vq->ready) c8a6153b6c59d9 Xie Yongji 2021-08-31 566 goto unlock; c8a6153b6c59d9 Xie Yongji 2021-08-31 567 9c4307e82fa1dc Eugenio Pérez 2026-06-10 568 guard(rwsem_read)(&vq->dev->rwsem); 9c4307e82fa1dc Eugenio Pérez 2026-06-10 569 if (vq->dev->suspended) 9c4307e82fa1dc Eugenio Pérez 2026-06-10 570 return;unlock before returning?
Quoted 8 lines
9c4307e82fa1dcEugenio Pérez 2026-06-10 571c8a6153b6c59d9 Xie Yongji 2021-08-31 572 if (vq->kickfd) 3652117f854819 Christian Brauner 2023-11-22 573 eventfd_signal(vq->kickfd); c8a6153b6c59d9 Xie Yongji 2021-08-31 574 else c8a6153b6c59d9 Xie Yongji 2021-08-31 575 vq->kicked = true; c8a6153b6c59d9 Xie Yongji 2021-08-31 576 unlock: c8a6153b6c59d9 Xie Yongji 2021-08-31 @577 spin_unlock(&vq->kick_lock); c8a6153b6c59d9 Xie Yongji 2021-08-31 578 }
I think this is fixed by:
commit e4a249d15eb2d4b28213bebb1eefaf2e6d99de0b (HEAD -> vhost, linux-next-vhost/linux-next, kernel.org/vhost, kernel.org/test)
Author: Nathan Chancellor <[email protected]> Date: Wed Jun 10 12:16:49 2026 -0700
vduse: Fix error around jumping over a __cleanup() variable
right?
Quoted 3 lines
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Quoted 52 lines · Michael S. Tsirkin
Quoted 39 lines · Dan Carpenter
Hi Eugenio,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugenio-P-rez/vduse-Add-suspend/20260610-164534 base: next-20260609 patch link: https://lore.kernel.org/r/20260610083452.477759-1-eperezma%40redhat.com patch subject: [PATCH v3] vduse: Add suspend config: arm64-randconfig-r072-20260610 (https://download.01.org/0day-ci/archive/20260611/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 8.5.0 smatch: v0.5.0-9185-gbcc58b9cIf you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/vdpa/vdpa_user/vduse_dev.c:577vduse_vq_kick()warn: inconsistent returns '&vq->kick_lock'.drivers/vdpa/vdpa_user/vduse_dev.c:1302vduse_dev_queue_irq_work()warn: inconsistent returns '&dev->rwsem'.vim +577
drivers/vdpa/vdpa_user/vduse_dev.cc8a6153b6c59d9 Xie Yongji 2021-08-31 562 static void vduse_vq_kick(struct vduse_virtqueue *vq) c8a6153b6c59d9 Xie Yongji 2021-08-31 563 { c8a6153b6c59d9 Xie Yongji 2021-08-31 564 spin_lock(&vq->kick_lock); ^^^^^^^^^^^^^^^^^^^^^^^^^^ c8a6153b6c59d9 Xie Yongji 2021-08-31 565 if (!vq->ready) c8a6153b6c59d9 Xie Yongji 2021-08-31 566 goto unlock; c8a6153b6c59d9 Xie Yongji 2021-08-31 567 9c4307e82fa1dc Eugenio Pérez 2026-06-10 568 guard(rwsem_read)(&vq->dev->rwsem); 9c4307e82fa1dc Eugenio Pérez 2026-06-10 569 if (vq->dev->suspended) 9c4307e82fa1dc Eugenio Pérez 2026-06-10 570 return;unlock before returning?
Quoted 8 lines
9c4307e82fa1dcEugenio Pérez 2026-06-10 571c8a6153b6c59d9 Xie Yongji 2021-08-31 572 if (vq->kickfd) 3652117f854819 Christian Brauner 2023-11-22 573 eventfd_signal(vq->kickfd); c8a6153b6c59d9 Xie Yongji 2021-08-31 574 else c8a6153b6c59d9 Xie Yongji 2021-08-31 575 vq->kicked = true; c8a6153b6c59d9 Xie Yongji 2021-08-31 576 unlock: c8a6153b6c59d9 Xie Yongji 2021-08-31 @577 spin_unlock(&vq->kick_lock); c8a6153b6c59d9 Xie Yongji 2021-08-31 578 }I think this is fixed by:
Quoted 7 lines
commit
e4a249d15eb2d4b28213bebb1eefaf2e6d99de0b(HEAD -> vhost, linux-next-vhost/linux-next, kernel.org/vhost, kernel.org/test)Author: Nathan Chancellor <[email protected]> Date: Wed Jun 10 12:16:49 2026 -0700vduse: Fix error around jumping over a
__cleanup()variableright?
These things haven't hit linux-next yet. I found the email.
https://lore.kernel.org/all/20260610-vduse_vq_kick-fix-guard-usage-v1-1-0ce02c08006e@kernel.org/
That only fixes the bug in vduse_vq_kick(), not the bug in vduse_dev_queue_irq_work(). I don't see a fix for that yet on lore but I may have missed it.
regards,
dan carpenter
Eugenio Perez Martin
maintainerQuoted 60 lines · Dan Carpenter
Quoted 58 lines · Michael S. Tsirkin
Quoted 39 lines · Dan Carpenter
Hi Eugenio,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugenio-P-rez/vduse-Add-suspend/20260610-164534 base: next-20260609 patch link: https://lore.kernel.org/r/20260610083452.477759-1-eperezma%40redhat.com patch subject: [PATCH v3] vduse: Add suspend config: arm64-randconfig-r072-20260610 (https://download.01.org/0day-ci/archive/20260611/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 8.5.0 smatch: v0.5.0-9185-gbcc58b9cIf you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/vdpa/vdpa_user/vduse_dev.c:577vduse_vq_kick()warn: inconsistent returns '&vq->kick_lock'.drivers/vdpa/vdpa_user/vduse_dev.c:1302vduse_dev_queue_irq_work()warn: inconsistent returns '&dev->rwsem'.vim +577
drivers/vdpa/vdpa_user/vduse_dev.cc8a6153b6c59d9 Xie Yongji 2021-08-31 562 static void vduse_vq_kick(struct vduse_virtqueue *vq) c8a6153b6c59d9 Xie Yongji 2021-08-31 563 { c8a6153b6c59d9 Xie Yongji 2021-08-31 564 spin_lock(&vq->kick_lock); ^^^^^^^^^^^^^^^^^^^^^^^^^^ c8a6153b6c59d9 Xie Yongji 2021-08-31 565 if (!vq->ready) c8a6153b6c59d9 Xie Yongji 2021-08-31 566 goto unlock; c8a6153b6c59d9 Xie Yongji 2021-08-31 567 9c4307e82fa1dc Eugenio Pérez 2026-06-10 568 guard(rwsem_read)(&vq->dev->rwsem); 9c4307e82fa1dc Eugenio Pérez 2026-06-10 569 if (vq->dev->suspended) 9c4307e82fa1dc Eugenio Pérez 2026-06-10 570 return;unlock before returning?
Quoted 8 lines
9c4307e82fa1dcEugenio Pérez 2026-06-10 571c8a6153b6c59d9 Xie Yongji 2021-08-31 572 if (vq->kickfd) 3652117f854819 Christian Brauner 2023-11-22 573 eventfd_signal(vq->kickfd); c8a6153b6c59d9 Xie Yongji 2021-08-31 574 else c8a6153b6c59d9 Xie Yongji 2021-08-31 575 vq->kicked = true; c8a6153b6c59d9 Xie Yongji 2021-08-31 576 unlock:
c8a6153b6c59d9Xie Yongji 2021-08-31 @577spin_unlock(&vq->kick_lock);c8a6153b6c59d9Xie Yongji 2021-08-31 578 }I think this is fixed by:
commit
e4a249d15eb2d4b28213bebb1eefaf2e6d99de0b(HEAD -> vhost, linux-next-vhost/linux-next, kernel.org/vhost, kernel.org/test)Author: Nathan Chancellor <[email protected]> Date: Wed Jun 10 12:16:49 2026 -0700vduse: Fix error around jumping over a
__cleanup()variable
Quoted 9 lines
Quoted 1 line
right?
These things haven't hit linux-next yet. I found the email.
https://lore.kernel.org/all/20260610-vduse_vq_kick-fix-guard-usage-v1-1-0ce02c08006e@kernel.org/That only fixes the bug in
vduse_vq_kick(), not the bug invduse_dev_queue_irq_work(). I don't see a fix for that yet on lore but I may have missed it.
No, I can test & send a fast patch for that.
Thanks!
Michael S. Tsirkin
maintainerQuoted 66 lines · Eugenio Perez Martin
Quoted 65 lines · Dan Carpenter
Quoted 52 lines · Michael S. Tsirkin
Quoted 39 lines · Dan Carpenter
Hi Eugenio,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugenio-P-rez/vduse-Add-suspend/20260610-164534 base: next-20260609 patch link: https://lore.kernel.org/r/20260610083452.477759-1-eperezma%40redhat.com patch subject: [PATCH v3] vduse: Add suspend config: arm64-randconfig-r072-20260610 (https://download.01.org/0day-ci/archive/20260611/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 8.5.0 smatch: v0.5.0-9185-gbcc58b9cIf you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/vdpa/vdpa_user/vduse_dev.c:577vduse_vq_kick()warn: inconsistent returns '&vq->kick_lock'.drivers/vdpa/vdpa_user/vduse_dev.c:1302vduse_dev_queue_irq_work()warn: inconsistent returns '&dev->rwsem'.vim +577
drivers/vdpa/vdpa_user/vduse_dev.cc8a6153b6c59d9 Xie Yongji 2021-08-31 562 static void vduse_vq_kick(struct vduse_virtqueue *vq) c8a6153b6c59d9 Xie Yongji 2021-08-31 563 { c8a6153b6c59d9 Xie Yongji 2021-08-31 564 spin_lock(&vq->kick_lock); ^^^^^^^^^^^^^^^^^^^^^^^^^^ c8a6153b6c59d9 Xie Yongji 2021-08-31 565 if (!vq->ready) c8a6153b6c59d9 Xie Yongji 2021-08-31 566 goto unlock; c8a6153b6c59d9 Xie Yongji 2021-08-31 567 9c4307e82fa1dc Eugenio Pérez 2026-06-10 568 guard(rwsem_read)(&vq->dev->rwsem); 9c4307e82fa1dc Eugenio Pérez 2026-06-10 569 if (vq->dev->suspended) 9c4307e82fa1dc Eugenio Pérez 2026-06-10 570 return;unlock before returning?
Quoted 8 lines
9c4307e82fa1dcEugenio Pérez 2026-06-10 571c8a6153b6c59d9 Xie Yongji 2021-08-31 572 if (vq->kickfd) 3652117f854819 Christian Brauner 2023-11-22 573 eventfd_signal(vq->kickfd); c8a6153b6c59d9 Xie Yongji 2021-08-31 574 else c8a6153b6c59d9 Xie Yongji 2021-08-31 575 vq->kicked = true; c8a6153b6c59d9 Xie Yongji 2021-08-31 576 unlock:
c8a6153b6c59d9Xie Yongji 2021-08-31 @577spin_unlock(&vq->kick_lock);c8a6153b6c59d9Xie Yongji 2021-08-31 578 }I think this is fixed by:
Quoted 7 lines
commit
e4a249d15eb2d4b28213bebb1eefaf2e6d99de0b(HEAD -> vhost, linux-next-vhost/linux-next, kernel.org/vhost, kernel.org/test)Author: Nathan Chancellor <[email protected]> Date: Wed Jun 10 12:16:49 2026 -0700vduse: Fix error around jumping over a
__cleanup()variableright?
These things haven't hit linux-next yet. I found the email.
https://lore.kernel.org/all/20260610-vduse_vq_kick-fix-guard-usage-v1-1-0ce02c08006e@kernel.org/
Quoted 8 lines
Quoted 4 lines
That only fixes the bug in
vduse_vq_kick(), not the bug invduse_dev_queue_irq_work(). I don't see a fix for that yet on lore but I may have missed it.No, I can test & send a fast patch for that.
Thanks!
Alright.
Signature · 1 line
MST
Eugenio Perez Martin
maintainerQuoted 53 lines · Michael S. Tsirkin
Quoted 39 lines · Dan Carpenter
Hi Eugenio,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eugenio-P-rez/vduse-Add-suspend/20260610-164534 base: next-20260609 patch link: https://lore.kernel.org/r/20260610083452.477759-1-eperezma%40redhat.com patch subject: [PATCH v3] vduse: Add suspend config: arm64-randconfig-r072-20260610 (https://download.01.org/0day-ci/archive/20260611/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 8.5.0 smatch: v0.5.0-9185-gbcc58b9cIf you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/vdpa/vdpa_user/vduse_dev.c:577vduse_vq_kick()warn: inconsistent returns '&vq->kick_lock'.drivers/vdpa/vdpa_user/vduse_dev.c:1302vduse_dev_queue_irq_work()warn: inconsistent returns '&dev->rwsem'.vim +577
drivers/vdpa/vdpa_user/vduse_dev.cc8a6153b6c59d9 Xie Yongji 2021-08-31 562 static void vduse_vq_kick(struct vduse_virtqueue *vq) c8a6153b6c59d9 Xie Yongji 2021-08-31 563 { c8a6153b6c59d9 Xie Yongji 2021-08-31 564 spin_lock(&vq->kick_lock); ^^^^^^^^^^^^^^^^^^^^^^^^^^ c8a6153b6c59d9 Xie Yongji 2021-08-31 565 if (!vq->ready) c8a6153b6c59d9 Xie Yongji 2021-08-31 566 goto unlock; c8a6153b6c59d9 Xie Yongji 2021-08-31 567 9c4307e82fa1dc Eugenio Pérez 2026-06-10 568 guard(rwsem_read)(&vq->dev->rwsem); 9c4307e82fa1dc Eugenio Pérez 2026-06-10 569 if (vq->dev->suspended) 9c4307e82fa1dc Eugenio Pérez 2026-06-10 570 return;unlock before returning?
Quoted 8 lines
9c4307e82fa1dcEugenio Pérez 2026-06-10 571c8a6153b6c59d9 Xie Yongji 2021-08-31 572 if (vq->kickfd) 3652117f854819 Christian Brauner 2023-11-22 573 eventfd_signal(vq->kickfd); c8a6153b6c59d9 Xie Yongji 2021-08-31 574 else c8a6153b6c59d9 Xie Yongji 2021-08-31 575 vq->kicked = true; c8a6153b6c59d9 Xie Yongji 2021-08-31 576 unlock:
c8a6153b6c59d9Xie Yongji 2021-08-31 @577spin_unlock(&vq->kick_lock);c8a6153b6c59d9Xie Yongji 2021-08-31 578 }I think this is fixed by:
Quoted 8 lines
commit
e4a249d15eb2d4b28213bebb1eefaf2e6d99de0b(HEAD -> vhost, linux-next-vhost/linux-next, kernel.org/vhost, kernel.org/test)Author: Nathan Chancellor <[email protected]> Date: Wed Jun 10 12:16:49 2026 -0700vduse: Fix error around jumping over a
__cleanup()variableright?
Right, that was fast indeed.