From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Leo Yan <leo.yan@linaro.org>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: State of contrib/vhost-user-input?
Date: Tue, 24 Oct 2023 15:32:07 +0100 [thread overview]
Message-ID: <87jzrc2ihe.fsf@linaro.org> (raw)
In-Reply-To: <CAMxuvaw8b6QEZO_Z_-ityoEOFPRuQ7D0pBVwK3BEKBNWX3S3KA@mail.gmail.com>
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
next prev parent reply other threads:[~2023-10-24 14:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2023-10-24 15:20 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jzrc2ihe.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=leo.yan@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).