[PATCH] vhost-user: add missing stub for vhost_user_has_protocol_feature()

Alexandr Moshkov posted 1 patch 1 month, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260929101623.1352299-1-dtalexundeer@yandex-team.ru
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>
hw/virtio/vhost-user-stub.c | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] vhost-user: add missing stub for vhost_user_has_protocol_feature()
Posted by Alexandr Moshkov 1 month, 3 weeks ago
Currently, building with --disable-vhost-user fails to link when other
vhost backends are enabled: vhost.c calls vhost_user_has_protocol_feature(),
but its implementation is not built.

Add a stub returning false to fix the link error.

Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
---
 hw/virtio/vhost-user-stub.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/virtio/vhost-user-stub.c b/hw/virtio/vhost-user-stub.c
index 45559788dd..9d2e521788 100644
--- a/hw/virtio/vhost-user-stub.c
+++ b/hw/virtio/vhost-user-stub.c
@@ -4,3 +4,8 @@
 void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)
 {
 }
+
+bool vhost_user_has_protocol_feature(struct vhost_dev *dev, uint64_t feature)
+{
+    return false;
+}
-- 
2.34.1
Re: [PATCH] vhost-user: add missing stub for vhost_user_has_protocol_feature()
Posted by Clément Chigot 1 month, 3 weeks ago
On Tue, Sep 29, 2026 at 12:16 PM Alexandr Moshkov
<dtalexundeer@yandex-team.ru> wrote:
>
> Currently, building with --disable-vhost-user fails to link when other
> vhost backends are enabled: vhost.c calls vhost_user_has_protocol_feature(),
> but its implementation is not built.
>
> Add a stub returning false to fix the link error.
>
> Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>

I'll let you decide if this is the best solution. Meanwhile,

Tested-by: Clément Chigot <chigot@adacore.com>

> ---
>  hw/virtio/vhost-user-stub.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/hw/virtio/vhost-user-stub.c b/hw/virtio/vhost-user-stub.c
> index 45559788dd..9d2e521788 100644
> --- a/hw/virtio/vhost-user-stub.c
> +++ b/hw/virtio/vhost-user-stub.c
> @@ -4,3 +4,8 @@
>  void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)
>  {
>  }
> +
> +bool vhost_user_has_protocol_feature(struct vhost_dev *dev, uint64_t feature)
> +{
> +    return false;
> +}
> --
> 2.34.1
>
Re: [PATCH] vhost-user: add missing stub for vhost_user_has_protocol_feature()
Posted by Stefano Garzarella 1 month, 3 weeks ago
On Tue, Sep 29, 2026 at 03:16:23PM +0500, Alexandr Moshkov wrote:
>Currently, building with --disable-vhost-user fails to link when other
>vhost backends are enabled: vhost.c calls vhost_user_has_protocol_feature(),
>but its implementation is not built.
>
>Add a stub returning false to fix the link error.
>

Should we add Clément's tag?

Reported-by: Clément Chigot <chigot@adacore.com>


Fixes tag?

Fixes: 5eb2347867 ("vhost-user: add skip_drain param to do_vhost_virtqueue_stop")


Is this one, right?

Looking better at that commit, can we avoid to call 
vhost_user_has_protocol_feature() at all in do_vhost_virtqueue_stop() 
and put an assert in vhost_user_get_vring_base_skip_drain() to check 
that the feature is negotiated?

That said, not sure if it should be an assert TBH.

Thanks,
Stefano


>Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
>---
> hw/virtio/vhost-user-stub.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/hw/virtio/vhost-user-stub.c b/hw/virtio/vhost-user-stub.c
>index 45559788dd..9d2e521788 100644
>--- a/hw/virtio/vhost-user-stub.c
>+++ b/hw/virtio/vhost-user-stub.c
>@@ -4,3 +4,8 @@
> void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)
> {
> }
>+
>+bool vhost_user_has_protocol_feature(struct vhost_dev *dev, uint64_t feature)
>+{
>+    return false;
>+}
>-- 
>2.34.1
>
Re: [PATCH] vhost-user: add missing stub for vhost_user_has_protocol_feature()
Posted by Alexandr Moshkov 1 month, 3 weeks ago
On 9/29/26 15:54, Stefano Garzarella wrote:
> On Tue, Sep 29, 2026 at 03:16:23PM +0500, Alexandr Moshkov wrote:
>> Currently, building with --disable-vhost-user fails to link when other
>> vhost backends are enabled: vhost.c calls 
>> vhost_user_has_protocol_feature(),
>> but its implementation is not built.
>>
>> Add a stub returning false to fix the link error.
>>
>
> Should we add Clément's tag?
>
> Reported-by: Clément Chigot <chigot@adacore.com>
>
>
> Fixes tag?
>
> Fixes: 5eb2347867 ("vhost-user: add skip_drain param to 
> do_vhost_virtqueue_stop")
>
>
> Is this one, right? 

Thanks for reply! Yes, you right. Sorry, I forget about this tags..

>
> Looking better at that commit, can we avoid to call 
> vhost_user_has_protocol_feature() at all in do_vhost_virtqueue_stop() 
> and put an assert in vhost_user_get_vring_base_skip_drain() to check 
> that the feature is negotiated?
>
> That said, not sure if it should be an assert TBH.
>
> Thanks,
> Stefano 

Thanks, I'll see what I can do.

>
>
>> Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
>> ---
>> hw/virtio/vhost-user-stub.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/hw/virtio/vhost-user-stub.c b/hw/virtio/vhost-user-stub.c
>> index 45559788dd..9d2e521788 100644
>> --- a/hw/virtio/vhost-user-stub.c
>> +++ b/hw/virtio/vhost-user-stub.c
>> @@ -4,3 +4,8 @@
>> void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)
>> {
>> }
>> +
>> +bool vhost_user_has_protocol_feature(struct vhost_dev *dev, uint64_t 
>> feature)
>> +{
>> +    return false;
>> +}
>> -- 
>> 2.34.1
>>
>

Re: [PATCH] vhost-user: add missing stub for vhost_user_has_protocol_feature()
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
On 29/9/26 13:51, Alexandr Moshkov wrote:
> 
> On 9/29/26 15:54, Stefano Garzarella wrote:
>> On Tue, Sep 29, 2026 at 03:16:23PM +0500, Alexandr Moshkov wrote:
>>> Currently, building with --disable-vhost-user fails to link when other
>>> vhost backends are enabled: vhost.c calls 
>>> vhost_user_has_protocol_feature(),
>>> but its implementation is not built.
>>>
>>> Add a stub returning false to fix the link error.
>>>
>>
>> Should we add Clément's tag?
>>
>> Reported-by: Clément Chigot <chigot@adacore.com>
>>
>>
>> Fixes tag?
>>
>> Fixes: 5eb2347867 ("vhost-user: add skip_drain param to 
>> do_vhost_virtqueue_stop")
>>
>>
>> Is this one, right? 
> 
> Thanks for reply! Yes, you right. Sorry, I forget about this tags..
> 
>>
>> Looking better at that commit, can we avoid to call 
>> vhost_user_has_protocol_feature() at all in do_vhost_virtqueue_stop() 
>> and put an assert in vhost_user_get_vring_base_skip_drain() to check 
>> that the feature is negotiated?

Yes please.

>>
>> That said, not sure if it should be an assert TBH.
>>
>> Thanks,
>> Stefano 
> 
> Thanks, I'll see what I can do.
> 
>>
>>
>>> Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
>>> ---
>>> hw/virtio/vhost-user-stub.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/hw/virtio/vhost-user-stub.c b/hw/virtio/vhost-user-stub.c
>>> index 45559788dd..9d2e521788 100644
>>> --- a/hw/virtio/vhost-user-stub.c
>>> +++ b/hw/virtio/vhost-user-stub.c
>>> @@ -4,3 +4,8 @@
>>> void vhost_user_qmp_status(struct vhost_dev *dev, VirtioStatus *status)
>>> {
>>> }
>>> +
>>> +bool vhost_user_has_protocol_feature(struct vhost_dev *dev, uint64_t 
>>> feature)
>>> +{
>>> +    return false;
>>> +}
>>> -- 
>>> 2.34.1
>>>
>>
>