All of lore.kernel.org
 help / color / mirror / Atom feed
* [Virtio-fs] vhost_set_vring_kick failed
@ 2022-05-24 14:29 Prashant Dewan
  2022-05-25 16:02 ` Stefan Hajnoczi
  0 siblings, 1 reply; 13+ messages in thread
From: Prashant Dewan @ 2022-05-24 14:29 UTC (permalink / raw)
  To: virtio-fs

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

I am trying to setup virtfs using KVM and QEMU.


  1.  Inside the VM, I do
     *   mount -t virtiofs myfs /dev/myfile  --succeeds
     *   cd /dev/myfile  -hangs


  1.  The host logs -

 qemu-system: Failed to write msg. Wrote -1 instead of 20.
May 24 14:01:08 device-myhost[644]: qemu-system: vhost_set_vring_kick failed: Invalid argument (22)
May 24 14:01:08 device-myhost[644]: qemu-system: Failed to set msg fds.
May 24 14:01:08 device-myhost[644]: qemu-system: vhost VQ 0 ring restore failed: -1: Invalid argument (22)
May 24 14:01:08 device-myhost[644]: qemu-system: Error starting vhost: 22
May 24 14:01:08 device-myhost[644]: qemu-system: Failed to set msg fds.
May 24 14:01:08 device-myhost[644]: qemu-system: vhost_set_vring_call failed: Resource temporarily unavailable (11)
May 24 14:01:08 device-myhost[644]: qemu-system: Failed to set msg fds.
May 24 14:01:08 device-myhost[644]: qemu-system: vhost_set_vring_call failed: Resource temporarily unavailable (11)
May 24 14:01:08 device-myhost[644]: qemu-system: Failed to read from slave.


  1.   Qemu parameters -

 "-device",
    "vhost-user-fs-device,queue-size=1024,chardev=char0,tag=myfs",
    "-object",
    "memory-backend-memfd,id=mem,size=4G,share=on"

Any input is appreciated...

Thanks


[-- Attachment #2: Type: text/html, Size: 3131 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [Virtio-fs] vhost_set_vring_kick failed
@ 2022-05-26  5:34 Prashant Dewan
  2022-05-26  7:49 ` Stefan Hajnoczi
  0 siblings, 1 reply; 13+ messages in thread
From: Prashant Dewan @ 2022-05-26  5:34 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: virtio-fs

[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]

Hello Stefan,

Here is the output from virtofsd..

------------------------------------
- Journal begins at Thu 2022-05-26 04:23:42 UTC, ends at Thu 2022-05-26 04:41:57 UTC. --
May 26 04:24:13 localhost systemd[1]: Started virtio-fs vhost-user device daemon.<<Placeholder: run this daemon as non-privileged user>>.
May 26 04:24:13 localhost virtiofsd[505]: [2022-05-26T04:24:13Z INFO  virtiofsd] Waiting for vhost-user socket connection...
May 26 04:27:11 device-3e4b479e2ee9c647 virtiofsd[505]: [2022-05-26T04:27:11Z INFO  virtiofsd] Client connected, servicing requests
May 26 04:27:33 device-3e4b479e2ee9c647 virtiofsd[505]: [2022-05-26T04:27:33Z ERROR virtiofsd] Waiting for daemon failed: HandleRequest(InvalidParam)
May 26 04:27:33 device-3e4b479e2ee9c647 systemd[1]: virtiofsd.service: Deactivated successfully.
May 26 04:27:33 device-3e4b479e2ee9c647 systemd[1]: virtiofsd.service: Scheduled restart job, restart counter is at 1.

________________________________
From: Stefan Hajnoczi
Sent: Wednesday, May 25, 2022 4:02 PM
To: Prashant Dewan
Cc: virtio-fs@redhat.com
Subject: Re: [Virtio-fs] vhost_set_vring_kick failed

On Tue, May 24, 2022 at 02:29:12PM +0000, Pra Dew wrote:
> I am trying to setup virtfs using KVM and QEMU.
>
>
>   1.  Inside the VM, I do
>      *   mount -t virtiofs myfs /dev/myfile  --succeeds
>      *   cd /dev/myfile  -hangs
>
>
>   1.  The host logs -
>
>  qemu-system: Failed to write msg. Wrote -1 instead of 20.

Sending a vhost-user protocol message failed. It is likely that the
virtiofsd process terminated and the UNIX domain socket closed on QEMU.

Is there any output from virtiofsd?

Stefan

[-- Attachment #2: Type: text/html, Size: 3268 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [Virtio-fs] vhost_set_vring_kick failed
@ 2022-05-26 16:07 Pra.. Dew..
  2022-05-31 10:50 ` Sergio Lopez
  0 siblings, 1 reply; 13+ messages in thread
From: Pra.. Dew.. @ 2022-05-26 16:07 UTC (permalink / raw)
  To: Sergio Lopez, Stefan Hajnoczi; +Cc: virtio-fs, gmaglione

[-- Attachment #1: Type: text/plain, Size: 2560 bytes --]

Thanks for the response.  The  version of the qemu is 5.1.0 and  here is the comandline..


[/usr/bin/qemu-system-test-machine test --enable-kvm -display none -mon mon-console,mode=readline -chardev socket,host=,port=5001,server,nowait,id=mon-console -device virtio-serial-device,max_ports=2 -device virtconsole,chardev=console,name=console -chardev socket,host=,port=5000,server,nowait,id=console -netdev tap,id=tap0,ifname=tap0,vhost=on,script=no,downscript=no -device virtio-net-device,netdev=tap0 -device vhost-vsock-device,guest-cid=4 -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 -chardev socket,id=char0,path=/run/vm001-vhost-fs.sock -device vhost-user-fs-device,queue-size=2,chardev=char0,tag=myfs -object memory-backend-memfd,id=mem,size=4G,share=on -kernel /var/lib/are/images/active/kernel.bin -dtb /var/lib/are/images/active/device-tree.dtb -device virtio-blk-device,drive=writable,serial=writable -drive file=/var/lib/are/volumes/writable.bin,if=none,id=writable,format=raw -device virtio-blk-device,drive=rootfs,serial=rootfs -drive file=/var/lib/are/images/active/rootfs/rootfs.bin,if=none,id=rootfs,format=raw,readonly]


________________________________
From: Sergio Lopez
Sent: Thursday, May 26, 2022 8:06 AM
To: Stefan Hajnoczi
Cc: Prashant Dewan; virtio-fs@redhat.com; gmaglione@redhat.com
Subject: Re: [Virtio-fs] vhost_set_vring_kick failed

On Thu, May 26, 2022 at 08:49:34AM +0100, Stefan Hajnoczi wrote:
> On Thu, May 26, 2022 at 05:34:42AM +0000, Prashant Dewan wrote:
> > Hello Stefan,
> >
> > Here is the output from virtofsd..
> >
> > ------------------------------------
> > - Journal begins at Thu 2022-05-26 04:23:42 UTC, ends at Thu 2022-05-26 04:41:57 UTC. --
> > May 26 04:24:13 localhost systemd[1]: Started virtio-fs vhost-user device daemon.<<Placeholder: run this daemon as non-privileged user>>.
> > May 26 04:24:13 localhost virtiofsd[505]: [2022-05-26T04:24:13Z INFO  virtiofsd] Waiting for vhost-user socket connection...
> > May 26 04:27:11 device-3e4b479e2ee9c647 virtiofsd[505]: [2022-05-26T04:27:11Z INFO  virtiofsd] Client connected, servicing requests
> > May 26 04:27:33 device-3e4b479e2ee9c647 virtiofsd[505]: [2022-05-26T04:27:33Z ERROR virtiofsd] Waiting for daemon failed: HandleRequest(InvalidParam)
>
> virtiofsd terminated. I have CCed Sergio and German, who may have
> suggestions about what to check next.

Hi,

Could you please tell us which QEMU version are you running, and paste
here the its command line?

Thanks,
Sergio.

[-- Attachment #2: Type: text/html, Size: 3888 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [Virtio-fs] vhost_set_vring_kick failed
@ 2022-05-31 18:33 Pra.. Dew..
  0 siblings, 0 replies; 13+ messages in thread
From: Pra.. Dew.. @ 2022-05-31 18:33 UTC (permalink / raw)
  To: Sergio Lopez; +Cc: Stefan Hajnoczi, virtio-fs, gmaglione, Vivek Goyal

[-- Attachment #1: Type: text/plain, Size: 2305 bytes --]

Thank you Sergio.  Is there a patch I could use to make it work with an older version?

Thanks
Prashant



________________________________
From: Sergio Lopez
Sent: Tuesday, May 31, 2022 10:50 AM
To: Pra.. Dew..
Cc: Stefan Hajnoczi; virtio-fs@redhat.com; gmaglione@redhat.com; Vivek Goyal
Subject: Re: [Virtio-fs] vhost_set_vring_kick failed

On Thu, May 26, 2022 at 04:07:36PM +0000, Pra.. Dew.. wrote:
> Thanks for the response.  The  version of the qemu is 5.1.0 and  here is the comandline..
>
>
> [/usr/bin/qemu-system-test-machine test --enable-kvm -display none -mon mon-console,mode=readline -chardev socket,host=,port=5001,server,nowait,id=mon-console -device virtio-serial-device,max_ports=2 -device virtconsole,chardev=console,name=console -chardev socket,host=,port=5000,server,nowait,id=console -netdev tap,id=tap0,ifname=tap0,vhost=on,script=no,downscript=no -device virtio-net-device,netdev=tap0 -device vhost-vsock-device,guest-cid=4 -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 -chardev socket,id=char0,path=/run/vm001-vhost-fs.sock -device vhost-user-fs-device,queue-size=2,chardev=char0,tag=myfs -object memory-backend-memfd,id=mem,size=4G,share=on -kernel /var/lib/are/images/active/kernel.bin -dtb /var/lib/are/images/active/device-tree.dtb -device virtio-blk-device,drive=writable,serial=writable -drive file=/var/lib/are/volumes/writable.bin,if=none,id=writable,format=raw -device virtio-blk-device,drive=rootfs,serial=rootfs -drive file=/var/lib/are/images/active/rootfs/rootfs.bin,if=none,id=rootfs,format=raw,readonly]

Thanks for the details. I knew that we didn't support older versions,
but didn't want to reply that without explaining why.

I've just took a look, and the origin of this incompatibility is this
change in "hw/virtio/vhost-user.c":

qemu-5.1.0:

typedef struct VhostUserMemRegMsg {
    uint32_t padding;
    VhostUserMemoryRegion region;
} VhostUserMemRegMsg;

qemu-upstream (since 3009edff8192991293fe9e2b50b0d90db83c4a89):

typedef struct VhostUserMemRegMsg {
    uint64_t padding;
    VhostUserMemoryRegion region;
} VhostUserMemRegMsg;

Note how "padding" has changed from uint32_t to uint64_t.

This means we only support QEMU versions starting 5.2.0.

Regards,
Sergio.

[-- Attachment #2: Type: text/html, Size: 3792 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [Virtio-fs] vhost_set_vring_kick failed
@ 2022-06-01 19:12 Pra.. Dew..
  0 siblings, 0 replies; 13+ messages in thread
From: Pra.. Dew.. @ 2022-06-01 19:12 UTC (permalink / raw)
  To: Sergio Lopez; +Cc: Vivek Goyal, Stefan Hajnoczi, virtio-fs

[-- Attachment #1: Type: text/plain, Size: 4855 bytes --]

Thank you Sergio. When I applied the patch, I got stuck  here. The header size is correct (40 bytes).

vhost-user.c
 390     ret = qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size);
 391     if (ret != size) {
 392         error_report("Failed to write msg."
 393                      " Wrote %d instead of %d.", ret, size);
 394         return -1;
 395     }


----
Jun 01 19:01:52 device-d1fe4f98f7091676 systemd[1]: Started Application Runtime Environment VMM.
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info: Passing through UIO device usb-phy@29910000:
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         Region: base: 0000000029910000 size: 0000000000010000
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         IRQ: 104
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info: Passing through UIO device gpio@2d010000:
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         Region: base: 000000002d010000 size: 0000000000002000
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         IRQ: 131
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info: Passing through UIO device ram:
Jun 01 19:01:52 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         Region: base: 00000000b0000000 size: 0000000050000000
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info: Passing through UIO device uio@298c0000:
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         Region: base: 00000000298c0000 size: 0000000000010000
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info: Passing through UIO device uio@29800000:
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         Region: base: 0000000029800000 size: 0000000000010000
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info: Passing through UIO device usb@29900000:
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         Region: base: 0000000029900000 size: 0000000000001000
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info:         IRQ: 103
Jun 01 19:01:55 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: info: Successfully realized 6 UIO devices
Jun 01 19:01:57 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: warning: Could not locate arm,scmi-shmem node
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: AS_DEBUG: hdr_size=0x28
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: Failed to write msg. Wrote -1 instead of 52.
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: vhost_set_vring_addr failed: Invalid argument (22)
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: Failed to set msg fds.
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: vhost VQ 0 ring restore failed: -1: Invalid argument (22)
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: Error starting vhost: 22
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: Failed to set msg fds.
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: vhost_set_vring_call failed: Resource temporarily unavailable (11)
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: Failed to set msg fds.
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: vhost_set_vring_call failed: Resource temporarily unavailable (11)
Jun 01 19:02:23 device-d1fe4f98f7091676 are-launcher[651]: qemu-system-device: Failed to read from slave.
device-d1fe4f98f7091676:~$

________________________________
From: Sergio Lopez
Sent: Wednesday, June 1, 2022 6:01 AM
To: Pra.. Dew..
Cc: Vivek Goyal; Stefan Hajnoczi; virtio-fs@redhat.com
Subject: Re: [Virtio-fs] vhost_set_vring_kick failed

On Tue, May 31, 2022 at 10:25:12PM +0000, Pra.. Dew.. wrote:
> Thank you so much Vivek. I enabled the trace in the code itself and
> ran it. The only message I got was InvalidParam message below. I did
> not get any other message.  We are going to try changing the
> structure [VhostUserMemRegMsg]  padding to see if that fixes the
> problem. Is there anything else we should try?

Applying 3009edff81 to qemu-5.1.0 should do the trick. I'm attaching
the patch to this email, so you can simply apply it with something
like:

patch -p1 < 0001-vhost-user-fix-VHOST_USER_ADD-REM_MEM_REG-truncation.patch

Sergio.

[-- Attachment #2: Type: text/html, Size: 7297 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-06-01 19:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 14:29 [Virtio-fs] vhost_set_vring_kick failed Prashant Dewan
2022-05-25 16:02 ` Stefan Hajnoczi
2022-05-26  5:34 Prashant Dewan
2022-05-26  7:49 ` Stefan Hajnoczi
2022-05-26  8:06   ` Sergio Lopez
2022-05-30 22:11     ` Vivek Goyal
2022-05-31 22:25       ` Pra.. Dew..
2022-05-31 22:50         ` Vivek Goyal
2022-06-01  6:01         ` Sergio Lopez
2022-05-26 16:07 Pra.. Dew..
2022-05-31 10:50 ` Sergio Lopez
2022-05-31 18:33 Pra.. Dew..
2022-06-01 19:12 Pra.. Dew..

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.