* [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
@ 2014-09-03 6:25 Jason Wang
2014-09-03 8:30 ` Michael S. Tsirkin
2014-09-03 8:52 ` Michael S. Tsirkin
0 siblings, 2 replies; 8+ messages in thread
From: Jason Wang @ 2014-09-03 6:25 UTC (permalink / raw)
To: mst, qemu-devel
Cc: Jason Wang, Andrey Korolyov, Michael Roth, Nikolay Nikolaev, qemu-stable
commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
vhost_get_features and vhost_ack_features) removes the step that
initializes the acked_features to backend_features. This will result an
unexpected value of acked_features which may fail the features setting of
vhost. This patch fixes it by recover this step.
Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Cc: Andrey Korolyov <andrey@xdel.ru>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/vhost_net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index f87c798..b1d4b1f 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
void vhost_net_ack_features(struct vhost_net *net, unsigned features)
{
+ net->dev.acked_features = net->dev.backend_features;
vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
2014-09-03 6:25 [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack Jason Wang
@ 2014-09-03 8:30 ` Michael S. Tsirkin
2014-09-03 8:52 ` Michael S. Tsirkin
1 sibling, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 8:30 UTC (permalink / raw)
To: Jason Wang
Cc: qemu-stable, Andrey Korolyov, qemu-devel, Nikolay Nikolaev, Michael Roth
On Wed, Sep 03, 2014 at 02:25:30PM +0800, Jason Wang wrote:
> commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
> vhost_get_features and vhost_ack_features) removes the step that
> initializes the acked_features to backend_features.
But acked features are set in vhost_ack_features.
why would we need to initialize to backend_features?
0 is a better default.
> This will result an
> unexpected value of acked_features which may fail the features setting of
> vhost. This patch fixes it by recover this step.
>
> Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> Cc: Andrey Korolyov <andrey@xdel.ru>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> hw/net/vhost_net.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index f87c798..b1d4b1f 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
>
> void vhost_net_ack_features(struct vhost_net *net, unsigned features)
> {
> + net->dev.acked_features = net->dev.backend_features;
I think it's wrong: you don't want to set all features.
> vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
> }
>
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
2014-09-03 6:25 [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack Jason Wang
2014-09-03 8:30 ` Michael S. Tsirkin
@ 2014-09-03 8:52 ` Michael S. Tsirkin
2014-09-03 8:54 ` Andrey Korolyov
1 sibling, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 8:52 UTC (permalink / raw)
To: Jason Wang
Cc: qemu-stable, Andrey Korolyov, qemu-devel, Nikolay Nikolaev, Michael Roth
On Wed, Sep 03, 2014 at 02:25:30PM +0800, Jason Wang wrote:
> commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
> vhost_get_features and vhost_ack_features) removes the step that
> initializes the acked_features to backend_features. This will result an
> unexpected value of acked_features which may fail the features setting of
> vhost. This patch fixes it by recover this step.
>
> Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> Cc: Andrey Korolyov <andrey@xdel.ru>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
OK I get it and it's correct, but I think it's better to
put the initialization in core vhost code.
Patch sent, could you confirm that it works for you please?
> ---
> hw/net/vhost_net.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index f87c798..b1d4b1f 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
>
> void vhost_net_ack_features(struct vhost_net *net, unsigned features)
> {
> + net->dev.acked_features = net->dev.backend_features;
> vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
> }
>
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
2014-09-03 8:52 ` Michael S. Tsirkin
@ 2014-09-03 8:54 ` Andrey Korolyov
2014-09-03 9:08 ` Michael S. Tsirkin
2014-09-03 9:17 ` Michael S. Tsirkin
0 siblings, 2 replies; 8+ messages in thread
From: Andrey Korolyov @ 2014-09-03 8:54 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Jason Wang, qemu-stable, qemu-devel, Nikolay Nikolaev, Michael Roth
On Wed, Sep 3, 2014 at 12:52 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Wed, Sep 03, 2014 at 02:25:30PM +0800, Jason Wang wrote:
>> commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
>> vhost_get_features and vhost_ack_features) removes the step that
>> initializes the acked_features to backend_features. This will result an
>> unexpected value of acked_features which may fail the features setting of
>> vhost. This patch fixes it by recover this step.
>>
>> Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
>> Cc: Andrey Korolyov <andrey@xdel.ru>
>> Cc: Michael S. Tsirkin <mst@redhat.com>
>> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>
> OK I get it and it's correct, but I think it's better to
> put the initialization in core vhost code.
> Patch sent, could you confirm that it works for you please?
>
>> ---
>> hw/net/vhost_net.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
>> index f87c798..b1d4b1f 100644
>> --- a/hw/net/vhost_net.c
>> +++ b/hw/net/vhost_net.c
>> @@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
>>
>> void vhost_net_ack_features(struct vhost_net *net, unsigned features)
>> {
>> + net->dev.acked_features = net->dev.backend_features;
>> vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
>> }
>>
>> --
>> 1.8.3.1
Yes, this patch fixes both issues with vhost subsystem for me.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
2014-09-03 8:54 ` Andrey Korolyov
@ 2014-09-03 9:08 ` Michael S. Tsirkin
2014-09-03 9:17 ` Michael S. Tsirkin
1 sibling, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 9:08 UTC (permalink / raw)
To: Andrey Korolyov
Cc: Jason Wang, qemu-stable, qemu-devel, Nikolay Nikolaev, Michael Roth
On Wed, Sep 03, 2014 at 12:54:03PM +0400, Andrey Korolyov wrote:
> On Wed, Sep 3, 2014 at 12:52 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Wed, Sep 03, 2014 at 02:25:30PM +0800, Jason Wang wrote:
> >> commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
> >> vhost_get_features and vhost_ack_features) removes the step that
> >> initializes the acked_features to backend_features. This will result an
> >> unexpected value of acked_features which may fail the features setting of
> >> vhost. This patch fixes it by recover this step.
> >>
> >> Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> >> Cc: Andrey Korolyov <andrey@xdel.ru>
> >> Cc: Michael S. Tsirkin <mst@redhat.com>
> >> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
> >> Cc: qemu-stable@nongnu.org
> >> Signed-off-by: Jason Wang <jasowang@redhat.com>
> >
> > OK I get it and it's correct, but I think it's better to
> > put the initialization in core vhost code.
> > Patch sent, could you confirm that it works for you please?
> >
> >> ---
> >> hw/net/vhost_net.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> >> index f87c798..b1d4b1f 100644
> >> --- a/hw/net/vhost_net.c
> >> +++ b/hw/net/vhost_net.c
> >> @@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
> >>
> >> void vhost_net_ack_features(struct vhost_net *net, unsigned features)
> >> {
> >> + net->dev.acked_features = net->dev.backend_features;
> >> vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
> >> }
> >>
> >> --
> >> 1.8.3.1
>
> Yes, this patch fixes both issues with vhost subsystem for me.
Sorry posted a different one - can you pls try it out?
We still have a bug somewhere in error handling I suspect, so
let's keep debugging.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
2014-09-03 8:54 ` Andrey Korolyov
2014-09-03 9:08 ` Michael S. Tsirkin
@ 2014-09-03 9:17 ` Michael S. Tsirkin
1 sibling, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 9:17 UTC (permalink / raw)
To: Andrey Korolyov
Cc: Jason Wang, qemu-stable, qemu-devel, Nikolay Nikolaev, Michael Roth
On Wed, Sep 03, 2014 at 12:54:03PM +0400, Andrey Korolyov wrote:
> On Wed, Sep 3, 2014 at 12:52 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Wed, Sep 03, 2014 at 02:25:30PM +0800, Jason Wang wrote:
> >> commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
> >> vhost_get_features and vhost_ack_features) removes the step that
> >> initializes the acked_features to backend_features. This will result an
> >> unexpected value of acked_features which may fail the features setting of
> >> vhost. This patch fixes it by recover this step.
> >>
> >> Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> >> Cc: Andrey Korolyov <andrey@xdel.ru>
> >> Cc: Michael S. Tsirkin <mst@redhat.com>
> >> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
> >> Cc: qemu-stable@nongnu.org
> >> Signed-off-by: Jason Wang <jasowang@redhat.com>
> >
> > OK I get it and it's correct, but I think it's better to
> > put the initialization in core vhost code.
> > Patch sent, could you confirm that it works for you please?
> >
> >> ---
> >> hw/net/vhost_net.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> >> index f87c798..b1d4b1f 100644
> >> --- a/hw/net/vhost_net.c
> >> +++ b/hw/net/vhost_net.c
> >> @@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
> >>
> >> void vhost_net_ack_features(struct vhost_net *net, unsigned features)
> >> {
> >> + net->dev.acked_features = net->dev.backend_features;
> >> vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
> >> }
> >>
> >> --
> >> 1.8.3.1
>
> Yes, this patch fixes both issues with vhost subsystem for me.
OK, applied, thanks!
But let's hack on the assert a bit more: apparently something
is wrong with the userspace fallback: after init failure,
it should never trigger, and it does.
--
MST
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
2014-09-03 8:50 Michael S. Tsirkin
@ 2014-09-03 8:54 ` Michael S. Tsirkin
0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 8:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Jason Wang, Andrey Korolyov, qemu-stable, Nikolay Nikolaev
On Wed, Sep 03, 2014 at 11:50:05AM +0300, Michael S. Tsirkin wrote:
> commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
> vhost_get_features and vhost_ack_features) removes the step that
> initializes the acked_features to backend_features.
>
> As this field is now uninitialized, vhost initialization will sometimes
> fail.
>
> To fix, initialize field in core vhost code.
>
> As the next step, cleanup vhost scsi code as well.
>
> Reported-by: Jason Wang <jasowang@redhat.com>
> Reported-by: Andrey Korolyov <andrey@xdel.ru>
> Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Oops, it's the wrong patch - original one from jason :(
Sorry, resending.
> ---
> hw/net/vhost_net.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 1fe18c7..e258fda 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
>
> void vhost_net_ack_features(struct vhost_net *net, unsigned features)
> {
> + net->dev.acked_features = net->dev.backend_features;
> vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
> }
>
> --
> MST
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack
@ 2014-09-03 8:50 Michael S. Tsirkin
2014-09-03 8:54 ` Michael S. Tsirkin
0 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2014-09-03 8:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Jason Wang, Andrey Korolyov, qemu-stable, Nikolay Nikolaev
commit 2e6d46d77ed328d34a94688da8371bcbe243479b (vhost: add
vhost_get_features and vhost_ack_features) removes the step that
initializes the acked_features to backend_features.
As this field is now uninitialized, vhost initialization will sometimes
fail.
To fix, initialize field in core vhost code.
As the next step, cleanup vhost scsi code as well.
Reported-by: Jason Wang <jasowang@redhat.com>
Reported-by: Andrey Korolyov <andrey@xdel.ru>
Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/net/vhost_net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 1fe18c7..e258fda 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -115,6 +115,7 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
void vhost_net_ack_features(struct vhost_net *net, unsigned features)
{
+ net->dev.acked_features = net->dev.backend_features;
vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
}
--
MST
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-03 9:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-03 6:25 [Qemu-devel] [PATCH] vhost_net: initialize acked_features to a safe value during ack Jason Wang
2014-09-03 8:30 ` Michael S. Tsirkin
2014-09-03 8:52 ` Michael S. Tsirkin
2014-09-03 8:54 ` Andrey Korolyov
2014-09-03 9:08 ` Michael S. Tsirkin
2014-09-03 9:17 ` Michael S. Tsirkin
2014-09-03 8:50 Michael S. Tsirkin
2014-09-03 8:54 ` Michael S. Tsirkin
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.