Re: [PATCHv2 0/2] kvm/x86: vhost task creation failure handling

From: Keith Busch
Date: Thu Feb 27 2025 - 10:16:20 EST


On Thu, Feb 27, 2025 at 06:21:34PM +0800, Lei Yang wrote:
> Hi Keith
>
> There are some error messages from qemu output when I tested this
> series of patches with the virtio-net regression test. It can
> reproduced by boot up a guest with vhost device after applied your
> patches.
> Error messages:
> Qemu output:
> qemu-kvm: -netdev {"id": "idoejzv8", "type": "tap", "vhost": true,
> "vhostfd": "16", "fd": "10"}: vhost_set_owner failed: Cannot allocate
> memory
> qemu-kvm: -netdev {"id": "idoejzv8", "type": "tap", "vhost": true,
> "vhostfd": "16", "fd": "10"}: vhost-net requested but could not be
> initialized

*facepalm*

I accidently left the "!" in the condition:

@@ -666,7 +666,7 @@ static struct vhost_worker *vhost_worker_create(struct vhost_dev *dev)

vtsk = vhost_task_create(vhost_run_work_list, vhost_worker_killed,
worker, name);
- if (!vtsk)
+ if (!IS_ERR(vtsk))
goto free_worker;