kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost_net: fix missing descriptor recovery
@ 2019-07-17 11:58 huhai
  2019-07-17 12:35 ` Jason Wang
  0 siblings, 1 reply; 2+ messages in thread
From: huhai @ 2019-07-17 11:58 UTC (permalink / raw)
  To: mst, jasowang; +Cc: kvm, huhai

When get_tx_bufs get descriptor successful, but this descriptor have
some problem, we should inform the guest to recycle this descriptor,
instead of doing nothing.

Signed-off-by: huhai <huhai@kylinos.cn>
---
 drivers/vhost/net.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 247e5585af5d..939a2ef9c223 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -620,6 +620,7 @@ static int get_tx_bufs(struct vhost_net *net,
 	if (*in) {
 		vq_err(vq, "Unexpected descriptor format for TX: out %d, int %d\n",
 			*out, *in);
+		vhost_add_used_and_signal(&net->dev, vq, ret, 0);
 		return -EFAULT;
 	}
 
@@ -628,6 +629,7 @@ static int get_tx_bufs(struct vhost_net *net,
 	if (*len == 0) {
 		vq_err(vq, "Unexpected header len for TX: %zd expected %zd\n",
 			*len, nvq->vhost_hlen);
+		vhost_add_used_and_signal(&net->dev, vq, ret, 0);
 		return -EFAULT;
 	}
 
-- 
2.20.1




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

* Re: [PATCH] vhost_net: fix missing descriptor recovery
  2019-07-17 11:58 [PATCH] vhost_net: fix missing descriptor recovery huhai
@ 2019-07-17 12:35 ` Jason Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Wang @ 2019-07-17 12:35 UTC (permalink / raw)
  To: huhai, mst; +Cc: kvm


On 2019/7/17 下午7:58, huhai wrote:
> When get_tx_bufs get descriptor successful, but this descriptor have
> some problem, we should inform the guest to recycle this descriptor,
> instead of doing nothing.
>
> Signed-off-by: huhai <huhai@kylinos.cn>
> ---
>   drivers/vhost/net.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 247e5585af5d..939a2ef9c223 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -620,6 +620,7 @@ static int get_tx_bufs(struct vhost_net *net,
>   	if (*in) {
>   		vq_err(vq, "Unexpected descriptor format for TX: out %d, int %d\n",
>   			*out, *in);
> +		vhost_add_used_and_signal(&net->dev, vq, ret, 0);
>   		return -EFAULT;
>   	}
>   
> @@ -628,6 +629,7 @@ static int get_tx_bufs(struct vhost_net *net,
>   	if (*len == 0) {
>   		vq_err(vq, "Unexpected header len for TX: %zd expected %zd\n",
>   			*len, nvq->vhost_hlen);
> +		vhost_add_used_and_signal(&net->dev, vq, ret, 0);
>   		return -EFAULT;
>   	}
>   


This is usually a hint of driver bug. I believe it's better to fail 
explicitly here instead of trying to workaround it.

Thanks


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

end of thread, other threads:[~2019-07-17 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 11:58 [PATCH] vhost_net: fix missing descriptor recovery huhai
2019-07-17 12:35 ` Jason Wang

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).