qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* State of contrib/vhost-user-input?
@ 2023-10-23 16:18 Alex Bennée
  2023-10-23 23:14 ` Stefan Hajnoczi
  2023-10-24 11:36 ` Marc-André Lureau
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Bennée @ 2023-10-23 16:18 UTC (permalink / raw)
  To: Marc-André Lureau, Stefan Hajnoczi, Michael S. Tsirkin
  Cc: Leo Yan, qemu-devel


Hi,

I'm trying to get the contrib/vhost-user-input working but it exits
during the boot up sequence:

  ➜  gdb --args ./vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
  GNU gdb (GDB) 15.0.50.20231012-git
  <snip>
  Reading symbols from ./vhost-user-input...
  (gdb) b map_ring
  Breakpoint 1 at 0x7634c: file ../../subprojects/libvhost-user/libvhost-user.c, line 618.
  (gdb) r
  Starting program: /home/alex/lsrc/qemu.git/builds/arm.debug/contrib/vhost-user-input/vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
  [New Thread 0x7ffff7afb6c0 (LWP 3807698)]
  ================ Vhost user message ================
  Request: VHOST_USER_GET_FEATURES (1)
  Flags:   0x1
  Size:    0
  Sending back to guest u64: 0x0000000175000000
  ================ Vhost user message ================
  Request: VHOST_USER_GET_PROTOCOL_FEATURES (15)
  Flags:   0x1
  Size:    0
  ================ Vhost user message ================
  Request: VHOST_USER_SET_PROTOCOL_FEATURES (16)
  Flags:   0x1
  Size:    8
  u64: 0x0000000000008e2b
  ================ Vhost user message ================
  Request: VHOST_USER_GET_QUEUE_NUM (17)
  Flags:   0x1
  Size:    0
  ================ Vhost user message ================
  Request: VHOST_USER_GET_MAX_MEM_SLOTS (36)
  Flags:   0x1
  Size:    0
  u64: 0x0000000000000020
  ================ Vhost user message ================
  Request: VHOST_USER_SET_BACKEND_REQ_FD (21)
  Flags:   0x9
  Size:    0
  Fds: 6
  Got backend_fd: 6
  ================ Vhost user message ================
  Request: VHOST_USER_SET_OWNER (3)
  Flags:   0x1
  Size:    0
  ================ Vhost user message ================
  Request: VHOST_USER_GET_FEATURES (1)
  Flags:   0x1
  Size:    0
  Sending back to guest u64: 0x0000000175000000
  ================ Vhost user message ================
  Request: VHOST_USER_SET_VRING_CALL (13)
  Flags:   0x1
  Size:    8
  Fds: 7
  u64: 0x0000000000000000
  Got call_fd: 7 for vq: 0
  ================ Vhost user message ================
  Request: VHOST_USER_SET_VRING_ERR (14)
  Flags:   0x1
  Size:    8
  Fds: 8
  u64: 0x0000000000000000
  ================ Vhost user message ================
  Request: VHOST_USER_SET_VRING_CALL (13)
  Flags:   0x1
  Size:    8
  Fds: 9
  u64: 0x0000000000000001
  Got call_fd: 9 for vq: 1
  ================ Vhost user message ================
  Request: VHOST_USER_SET_VRING_ERR (14)
  Flags:   0x1
  Size:    8
  Fds: 10
  u64: 0x0000000000000001
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_GET_CONFIG (24)
  Flags:   0x1
  Size:    148
  ================ Vhost user message ================
  Request: VHOST_USER_SET_FEATURES (2)
  Flags:   0x1
  Size:    8
  u64: 0x0000000170000000
  ================ Vhost user message ================
  Request: VHOST_USER_SET_VRING_NUM (8)
  Flags:   0x1
  Size:    8
  State.index: 0
  State.num:   64
  ================ Vhost user message ================
  Request: VHOST_USER_SET_VRING_BASE (10)
  Flags:   0x1
  Size:    8
  State.index: 0
  State.num:   0
  ================ Vhost user message ================
  Request: VHOST_USER_SET_VRING_ADDR (9)
  Flags:   0x1
  Size:    40
  vhost_vring_addr:
      index:  0
      flags:  0
      desc_user_addr:   0x00007f283491a000
      used_user_addr:   0x00007f283491a4c0
      avail_user_addr:  0x00007f283491a400
      log_guest_addr:   0x0000000100b1a4c0

  Thread 1 "vhost-user-inpu" hit Breakpoint 1, map_ring (dev=0x7fffffffdd60, vq=0x555555609ea0) at ../../subprojects/libvhost-user/libvhost-user.c:618
  warning: Source file is more recent than executable.
  618         vq->vring.desc = qva_to_va(dev, vq->vra.desc_user_addr);
  (gdb) s
  qva_to_va (dev=0x7fffffffdd60, qemu_addr=139810657378304) at ../../subprojects/libvhost-user/libvhost-user.c:231
  231         for (i = 0; i < dev->nregions; i++) {
  (gdb) p dev->nregions
  $1 = 0
  (gdb) n
  240         return NULL;
  (gdb)
  241     }
  (gdb) c
  Continuing.
  Setting virtq addresses:
      vring_desc  at (nil)
      vring_used  at (nil)
      vring_avail at (nil)

  ** (vhost-user-input:3807669): CRITICAL **: 17:16:14.554: Invalid vring_addr message

  [Thread 0x7ffff7afb6c0 (LWP 3807698) exited]
  [Inferior 1 (process 3807669) exited with code 01]
  (gdb) q

Which looks like libvhost-user is expecting
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS to be negotiated and the
resulting VHOST_USER_ADD_MEM_REG to be sent. How is this meant to work
if the protocol feature isn't negotiated?

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

* Re: State of contrib/vhost-user-input?
  2023-10-23 16:18 State of contrib/vhost-user-input? Alex Bennée
@ 2023-10-23 23:14 ` Stefan Hajnoczi
  2023-10-24 11:36 ` Marc-André Lureau
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2023-10-23 23:14 UTC (permalink / raw)
  To: Alex Bennée, Gerd Hoffmann
  Cc: Marc-André Lureau, Stefan Hajnoczi, Michael S. Tsirkin,
	Leo Yan, qemu-devel

On Mon, 23 Oct 2023 at 09:29, Alex Bennée <alex.bennee@linaro.org> wrote:
>
>
> Hi,

CCing Gerd for vhost-user-input.

>
> I'm trying to get the contrib/vhost-user-input working but it exits
> during the boot up sequence:
>
>   ➜  gdb --args ./vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
>   GNU gdb (GDB) 15.0.50.20231012-git
>   <snip>
>   Reading symbols from ./vhost-user-input...
>   (gdb) b map_ring
>   Breakpoint 1 at 0x7634c: file ../../subprojects/libvhost-user/libvhost-user.c, line 618.
>   (gdb) r
>   Starting program: /home/alex/lsrc/qemu.git/builds/arm.debug/contrib/vhost-user-input/vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
>   [Thread debugging using libthread_db enabled]
>   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>   [New Thread 0x7ffff7afb6c0 (LWP 3807698)]
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_FEATURES (1)
>   Flags:   0x1
>   Size:    0
>   Sending back to guest u64: 0x0000000175000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_PROTOCOL_FEATURES (15)
>   Flags:   0x1
>   Size:    0
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_PROTOCOL_FEATURES (16)
>   Flags:   0x1
>   Size:    8
>   u64: 0x0000000000008e2b
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_QUEUE_NUM (17)
>   Flags:   0x1
>   Size:    0
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_MAX_MEM_SLOTS (36)
>   Flags:   0x1
>   Size:    0
>   u64: 0x0000000000000020
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_BACKEND_REQ_FD (21)
>   Flags:   0x9
>   Size:    0
>   Fds: 6
>   Got backend_fd: 6
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_OWNER (3)
>   Flags:   0x1
>   Size:    0
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_FEATURES (1)
>   Flags:   0x1
>   Size:    0
>   Sending back to guest u64: 0x0000000175000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_CALL (13)
>   Flags:   0x1
>   Size:    8
>   Fds: 7
>   u64: 0x0000000000000000
>   Got call_fd: 7 for vq: 0
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_ERR (14)
>   Flags:   0x1
>   Size:    8
>   Fds: 8
>   u64: 0x0000000000000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_CALL (13)
>   Flags:   0x1
>   Size:    8
>   Fds: 9
>   u64: 0x0000000000000001
>   Got call_fd: 9 for vq: 1
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_ERR (14)
>   Flags:   0x1
>   Size:    8
>   Fds: 10
>   u64: 0x0000000000000001
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_FEATURES (2)
>   Flags:   0x1
>   Size:    8
>   u64: 0x0000000170000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_NUM (8)
>   Flags:   0x1
>   Size:    8
>   State.index: 0
>   State.num:   64
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_BASE (10)
>   Flags:   0x1
>   Size:    8
>   State.index: 0
>   State.num:   0
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_ADDR (9)
>   Flags:   0x1
>   Size:    40
>   vhost_vring_addr:
>       index:  0
>       flags:  0
>       desc_user_addr:   0x00007f283491a000
>       used_user_addr:   0x00007f283491a4c0
>       avail_user_addr:  0x00007f283491a400
>       log_guest_addr:   0x0000000100b1a4c0
>
>   Thread 1 "vhost-user-inpu" hit Breakpoint 1, map_ring (dev=0x7fffffffdd60, vq=0x555555609ea0) at ../../subprojects/libvhost-user/libvhost-user.c:618
>   warning: Source file is more recent than executable.
>   618         vq->vring.desc = qva_to_va(dev, vq->vra.desc_user_addr);
>   (gdb) s
>   qva_to_va (dev=0x7fffffffdd60, qemu_addr=139810657378304) at ../../subprojects/libvhost-user/libvhost-user.c:231
>   231         for (i = 0; i < dev->nregions; i++) {
>   (gdb) p dev->nregions
>   $1 = 0
>   (gdb) n
>   240         return NULL;
>   (gdb)
>   241     }
>   (gdb) c
>   Continuing.
>   Setting virtq addresses:
>       vring_desc  at (nil)
>       vring_used  at (nil)
>       vring_avail at (nil)
>
>   ** (vhost-user-input:3807669): CRITICAL **: 17:16:14.554: Invalid vring_addr message
>
>   [Thread 0x7ffff7afb6c0 (LWP 3807698) exited]
>   [Inferior 1 (process 3807669) exited with code 01]
>   (gdb) q
>
> Which looks like libvhost-user is expecting
> VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS to be negotiated and the
> resulting VHOST_USER_ADD_MEM_REG to be sent. How is this meant to work
> if the protocol feature isn't negotiated?
>
> --
> Alex Bennée
> Virtualisation Tech Lead @ Linaro
>


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

* Re: State of contrib/vhost-user-input?
  2023-10-23 16:18 State of contrib/vhost-user-input? Alex Bennée
  2023-10-23 23:14 ` Stefan Hajnoczi
@ 2023-10-24 11:36 ` Marc-André Lureau
  2023-10-24 14:32   ` Alex Bennée
  1 sibling, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2023-10-24 11:36 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Stefan Hajnoczi, Michael S. Tsirkin, Leo Yan, qemu-devel

Hi Alex

On Mon, Oct 23, 2023 at 8:34 PM Alex Bennée <alex.bennee@linaro.org> wrote:
>
>
> Hi,
>
> I'm trying to get the contrib/vhost-user-input working but it exits
> during the boot up sequence:
>
>   ➜  gdb --args ./vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
>   GNU gdb (GDB) 15.0.50.20231012-git
>   <snip>
>   Reading symbols from ./vhost-user-input...
>   (gdb) b map_ring
>   Breakpoint 1 at 0x7634c: file ../../subprojects/libvhost-user/libvhost-user.c, line 618.
>   (gdb) r
>   Starting program: /home/alex/lsrc/qemu.git/builds/arm.debug/contrib/vhost-user-input/vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
>   [Thread debugging using libthread_db enabled]
>   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>   [New Thread 0x7ffff7afb6c0 (LWP 3807698)]
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_FEATURES (1)
>   Flags:   0x1
>   Size:    0
>   Sending back to guest u64: 0x0000000175000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_PROTOCOL_FEATURES (15)
>   Flags:   0x1
>   Size:    0
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_PROTOCOL_FEATURES (16)
>   Flags:   0x1
>   Size:    8
>   u64: 0x0000000000008e2b
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_QUEUE_NUM (17)
>   Flags:   0x1
>   Size:    0
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_MAX_MEM_SLOTS (36)
>   Flags:   0x1
>   Size:    0
>   u64: 0x0000000000000020
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_BACKEND_REQ_FD (21)
>   Flags:   0x9
>   Size:    0
>   Fds: 6
>   Got backend_fd: 6
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_OWNER (3)
>   Flags:   0x1
>   Size:    0
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_FEATURES (1)
>   Flags:   0x1
>   Size:    0
>   Sending back to guest u64: 0x0000000175000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_CALL (13)
>   Flags:   0x1
>   Size:    8
>   Fds: 7
>   u64: 0x0000000000000000
>   Got call_fd: 7 for vq: 0
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_ERR (14)
>   Flags:   0x1
>   Size:    8
>   Fds: 8
>   u64: 0x0000000000000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_CALL (13)
>   Flags:   0x1
>   Size:    8
>   Fds: 9
>   u64: 0x0000000000000001
>   Got call_fd: 9 for vq: 1
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_ERR (14)
>   Flags:   0x1
>   Size:    8
>   Fds: 10
>   u64: 0x0000000000000001
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_GET_CONFIG (24)
>   Flags:   0x1
>   Size:    148
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_FEATURES (2)
>   Flags:   0x1
>   Size:    8
>   u64: 0x0000000170000000
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_NUM (8)
>   Flags:   0x1
>   Size:    8
>   State.index: 0
>   State.num:   64
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_BASE (10)
>   Flags:   0x1
>   Size:    8
>   State.index: 0
>   State.num:   0
>   ================ Vhost user message ================
>   Request: VHOST_USER_SET_VRING_ADDR (9)
>   Flags:   0x1
>   Size:    40
>   vhost_vring_addr:
>       index:  0
>       flags:  0
>       desc_user_addr:   0x00007f283491a000
>       used_user_addr:   0x00007f283491a4c0
>       avail_user_addr:  0x00007f283491a400
>       log_guest_addr:   0x0000000100b1a4c0
>
>   Thread 1 "vhost-user-inpu" hit Breakpoint 1, map_ring (dev=0x7fffffffdd60, vq=0x555555609ea0) at ../../subprojects/libvhost-user/libvhost-user.c:618
>   warning: Source file is more recent than executable.
>   618         vq->vring.desc = qva_to_va(dev, vq->vra.desc_user_addr);
>   (gdb) s
>   qva_to_va (dev=0x7fffffffdd60, qemu_addr=139810657378304) at ../../subprojects/libvhost-user/libvhost-user.c:231
>   231         for (i = 0; i < dev->nregions; i++) {
>   (gdb) p dev->nregions
>   $1 = 0
>   (gdb) n
>   240         return NULL;
>   (gdb)
>   241     }
>   (gdb) c
>   Continuing.
>   Setting virtq addresses:
>       vring_desc  at (nil)
>       vring_used  at (nil)
>       vring_avail at (nil)
>
>   ** (vhost-user-input:3807669): CRITICAL **: 17:16:14.554: Invalid vring_addr message
>
>   [Thread 0x7ffff7afb6c0 (LWP 3807698) exited]
>   [Inferior 1 (process 3807669) exited with code 01]
>   (gdb) q
>
> Which looks like libvhost-user is expecting
> VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS to be negotiated and the
> resulting VHOST_USER_ADD_MEM_REG to be sent. How is this meant to work
> if the protocol feature isn't negotiated?


How did you start QEMU ? Did you forget to use shared memory ? We
should probably add some error at QEMU level when vhost-user devices
are used without shared memory!



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

* Re: State of contrib/vhost-user-input?
  2023-10-24 11:36 ` Marc-André Lureau
@ 2023-10-24 14:32   ` Alex Bennée
  2023-10-24 15:20     ` Alex Bennée
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2023-10-24 14:32 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: Stefan Hajnoczi, Michael S. Tsirkin, Leo Yan, qemu-devel


Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Hi Alex
>
> On Mon, Oct 23, 2023 at 8:34 PM Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>>
>> Hi,
>>
>> I'm trying to get the contrib/vhost-user-input working but it exits
>> during the boot up sequence:
>>
>>   ➜  gdb --args ./vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
>>   GNU gdb (GDB) 15.0.50.20231012-git
>>   <snip>
>>   Reading symbols from ./vhost-user-input...
>>   (gdb) b map_ring
>>   Breakpoint 1 at 0x7634c: file ../../subprojects/libvhost-user/libvhost-user.c, line 618.
>>   (gdb) r
>>   Starting program: /home/alex/lsrc/qemu.git/builds/arm.debug/contrib/vhost-user-input/vhost-user-input -p /dev/input/event22 -s /tmp/mouse.sock
>>   [Thread debugging using libthread_db enabled]
>>   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>>   [New Thread 0x7ffff7afb6c0 (LWP 3807698)]
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_FEATURES (1)
>>   Flags:   0x1
>>   Size:    0
>>   Sending back to guest u64: 0x0000000175000000
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_PROTOCOL_FEATURES (15)
>>   Flags:   0x1
>>   Size:    0
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_PROTOCOL_FEATURES (16)
>>   Flags:   0x1
>>   Size:    8
>>   u64: 0x0000000000008e2b
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_QUEUE_NUM (17)
>>   Flags:   0x1
>>   Size:    0
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_MAX_MEM_SLOTS (36)
>>   Flags:   0x1
>>   Size:    0
>>   u64: 0x0000000000000020
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_BACKEND_REQ_FD (21)
>>   Flags:   0x9
>>   Size:    0
>>   Fds: 6
>>   Got backend_fd: 6
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_OWNER (3)
>>   Flags:   0x1
>>   Size:    0
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_FEATURES (1)
>>   Flags:   0x1
>>   Size:    0
>>   Sending back to guest u64: 0x0000000175000000
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_VRING_CALL (13)
>>   Flags:   0x1
>>   Size:    8
>>   Fds: 7
>>   u64: 0x0000000000000000
>>   Got call_fd: 7 for vq: 0
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_VRING_ERR (14)
>>   Flags:   0x1
>>   Size:    8
>>   Fds: 8
>>   u64: 0x0000000000000000
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_VRING_CALL (13)
>>   Flags:   0x1
>>   Size:    8
>>   Fds: 9
>>   u64: 0x0000000000000001
>>   Got call_fd: 9 for vq: 1
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_VRING_ERR (14)
>>   Flags:   0x1
>>   Size:    8
>>   Fds: 10
>>   u64: 0x0000000000000001
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_GET_CONFIG (24)
>>   Flags:   0x1
>>   Size:    148
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_FEATURES (2)
>>   Flags:   0x1
>>   Size:    8
>>   u64: 0x0000000170000000
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_VRING_NUM (8)
>>   Flags:   0x1
>>   Size:    8
>>   State.index: 0
>>   State.num:   64
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_VRING_BASE (10)
>>   Flags:   0x1
>>   Size:    8
>>   State.index: 0
>>   State.num:   0
>>   ================ Vhost user message ================
>>   Request: VHOST_USER_SET_VRING_ADDR (9)
>>   Flags:   0x1
>>   Size:    40
>>   vhost_vring_addr:
>>       index:  0
>>       flags:  0
>>       desc_user_addr:   0x00007f283491a000
>>       used_user_addr:   0x00007f283491a4c0
>>       avail_user_addr:  0x00007f283491a400
>>       log_guest_addr:   0x0000000100b1a4c0
>>
>>   Thread 1 "vhost-user-inpu" hit Breakpoint 1, map_ring (dev=0x7fffffffdd60, vq=0x555555609ea0) at ../../subprojects/libvhost-user/libvhost-user.c:618
>>   warning: Source file is more recent than executable.
>>   618         vq->vring.desc = qva_to_va(dev, vq->vra.desc_user_addr);
>>   (gdb) s
>>   qva_to_va (dev=0x7fffffffdd60, qemu_addr=139810657378304) at ../../subprojects/libvhost-user/libvhost-user.c:231
>>   231         for (i = 0; i < dev->nregions; i++) {
>>   (gdb) p dev->nregions
>>   $1 = 0
>>   (gdb) n
>>   240         return NULL;
>>   (gdb)
>>   241     }
>>   (gdb) c
>>   Continuing.
>>   Setting virtq addresses:
>>       vring_desc  at (nil)
>>       vring_used  at (nil)
>>       vring_avail at (nil)
>>
>>   ** (vhost-user-input:3807669): CRITICAL **: 17:16:14.554: Invalid vring_addr message
>>
>>   [Thread 0x7ffff7afb6c0 (LWP 3807698) exited]
>>   [Inferior 1 (process 3807669) exited with code 01]
>>   (gdb) q
>>
>> Which looks like libvhost-user is expecting
>> VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS to be negotiated and the
>> resulting VHOST_USER_ADD_MEM_REG to be sent. How is this meant to work
>> if the protocol feature isn't negotiated?
>
>
> How did you start QEMU ? Did you forget to use shared memory ?

I had:

       -m 8192 \
       -object memory-backend-memfd,id=mem,size=8G,share=on \

Alongside:

       -device virtio-gpu-pci \
       -device qemu-xhci -device usb-kbd \
       -kernel ~/lsrc/linux.git/builds/arm64/arch/arm64/boot/Image.gz -append 'console=ttyAMA0 root=/dev/sda2' \
       -display gtk,gl=on \
       -chardev socket,id=mouse2,path=/tmp/mouse.sock -device vhost-user-input-pci,chardev=mouse2

I even double checked with the generic device I was working with:

       -chardev socket,id=mouse2,path=/tmp/mouse.sock -device vhost-user-device-pci,chardev=mouse2,virtio-id=18,config_size=136,num_vqs=2

> We should probably add some error at QEMU level when vhost-user devices
> are used without shared memory!

That would certainly be a good idea.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

* Re: State of contrib/vhost-user-input?
  2023-10-24 14:32   ` Alex Bennée
@ 2023-10-24 15:20     ` Alex Bennée
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2023-10-24 15:20 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Marc-André Lureau, Stefan Hajnoczi, Michael S. Tsirkin,
	Leo Yan, qemu-devel


Alex Bennée <alex.bennee@linaro.org> writes:

> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
>> Hi Alex
>>
>> On Mon, Oct 23, 2023 at 8:34 PM Alex Bennée <alex.bennee@linaro.org> wrote:
>>>
>>>
>>> Hi,
>>>
>>> I'm trying to get the contrib/vhost-user-input working but it exits
>>> during the boot up sequence:
>>>
<snip>
>>> Which looks like libvhost-user is expecting
>>> VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS to be negotiated and the
>>> resulting VHOST_USER_ADD_MEM_REG to be sent. How is this meant to work
>>> if the protocol feature isn't negotiated?
>>
>>
>> How did you start QEMU ? Did you forget to use shared memory ?
>
> I had:
>
>        -m 8192 \
>        -object memory-backend-memfd,id=mem,size=8G,share=on \
>
> Alongside:
>
>        -device virtio-gpu-pci \
>        -device qemu-xhci -device usb-kbd \
>        -kernel ~/lsrc/linux.git/builds/arm64/arch/arm64/boot/Image.gz
> -append 'console=ttyAMA0 root=/dev/sda2' \
>        -display gtk,gl=on \
>        -chardev socket,id=mouse2,path=/tmp/mouse.sock -device vhost-user-input-pci,chardev=mouse2
>
> I even double checked with the generic device I was working with:
>
>        -chardev socket,id=mouse2,path=/tmp/mouse.sock -device
> vhost-user-device-pci,chardev=mouse2,virtio-id=18,config_size=136,num_vqs=2

Ahh but not the magic:

  -numa node,memdev=mem

>
>> We should probably add some error at QEMU level when vhost-user devices
>> are used without shared memory!
>
> That would certainly be a good idea.

Where would the best place to do this check be?

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

end of thread, other threads:[~2023-10-24 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-23 16:18 State of contrib/vhost-user-input? Alex Bennée
2023-10-23 23:14 ` Stefan Hajnoczi
2023-10-24 11:36 ` Marc-André Lureau
2023-10-24 14:32   ` Alex Bennée
2023-10-24 15:20     ` Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).