diff mbox

[PATCHv3,2/2] kvmtool: Restrict virtio queue number to 1 when vhost on

Message ID 1437459483-24535-3-git-send-email-fan.du@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Du, Fan July 21, 2015, 6:18 a.m. UTC
vhost kernel driver does not support mutiple queue yet,
Tweak queue number will fail with "--net mode=tap,vhost=1,mq=2"
as below when lkvm trying to set ring kick fd for queue 2:

VHOST_SET_VRING_KICK failed: No buffer space available

Error on this scenario, and overide with the default one queue
configuration.

Signed-off-by: Fan Du <fan.du@intel.com>
---
 virtio/net.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andre Przywara July 21, 2015, 9:44 a.m. UTC | #1
Hi,

On 21/07/15 07:18, Fan Du wrote:
> vhost kernel driver does not support mutiple queue yet,
> Tweak queue number will fail with "--net mode=tap,vhost=1,mq=2"
> as below when lkvm trying to set ring kick fd for queue 2:
> 
> VHOST_SET_VRING_KICK failed: No buffer space available
> 
> Error on this scenario, and overide with the default one queue
> configuration.

I don't like the idea of overriding an explicitly given command line
parameter (mq=2).
So why do you provide mq=2 in the first place if you know that the
kernel does not support it?
I'd rather see the error message to be more descriptive in that case.
That would help the user to understand what's going on, also it would
still work should the kernel ever support multiple queues in the future.

Cheers,
Andre.

> 
> Signed-off-by: Fan Du <fan.du@intel.com>
> ---
>  virtio/net.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/virtio/net.c b/virtio/net.c
> index d343615..21a80f3 100644
> --- a/virtio/net.c
> +++ b/virtio/net.c
> @@ -730,6 +730,10 @@ static int set_net_param(struct kvm *kvm, struct virtio_net_params *p,
>  		p->mq = atoi(val);
>  	} else
>  		die("Unknown network parameter %s", param);
> +	if (p->vhost && p->mq > 1) {
> +		p->mq = 1;
> +		pr_err("vhost does not support mq yet, overide mq to 1.");
> +	}
>  
>  	return 0;
>  }
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Du, Fan Aug. 5, 2015, 3:05 a.m. UTC | #2
>-----Original Message-----
>From: Andre Przywara [mailto:andre.przywara@arm.com]
>Sent: Tuesday, July 21, 2015 5:45 PM
>To: Du, Fan; Will Deacon
>Cc: kvm@vger.kernel.org; Marc Zyngier
>Subject: Re: [PATCHv3 2/2] kvmtool: Restrict virtio queue number to 1 when
>vhost on
>
>Hi,
>
>On 21/07/15 07:18, Fan Du wrote:
>> vhost kernel driver does not support mutiple queue yet,
>> Tweak queue number will fail with "--net mode=tap,vhost=1,mq=2"
>> as below when lkvm trying to set ring kick fd for queue 2:
>>
>> VHOST_SET_VRING_KICK failed: No buffer space available
>>
>> Error on this scenario, and overide with the default one queue
>> configuration.
>
>I don't like the idea of overriding an explicitly given command line
>parameter (mq=2).
>So why do you provide mq=2 in the first place if you know that the
>kernel does not support it?

On the contrary, the help message doesn't explicitly state mq is not supported
when vhost=1, what's the insanity to supply with mq option?!

>I'd rather see the error message to be more descriptive in that case.
>That would help the user to understand what's going on, also it would
>still work should the kernel ever support multiple queues in the future.

I will check how it could be support, either in user land or kernel.
So let's drop this patch.

>Cheers,
>Andre.
>
>>
>> Signed-off-by: Fan Du <fan.du@intel.com>
>> ---
>>  virtio/net.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/virtio/net.c b/virtio/net.c
>> index d343615..21a80f3 100644
>> --- a/virtio/net.c
>> +++ b/virtio/net.c
>> @@ -730,6 +730,10 @@ static int set_net_param(struct kvm *kvm, struct
>virtio_net_params *p,
>>  		p->mq = atoi(val);
>>  	} else
>>  		die("Unknown network parameter %s", param);
>> +	if (p->vhost && p->mq > 1) {
>> +		p->mq = 1;
>> +		pr_err("vhost does not support mq yet, overide mq to 1.");
>> +	}
>>
>>  	return 0;
>>  }
>>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/virtio/net.c b/virtio/net.c
index d343615..21a80f3 100644
--- a/virtio/net.c
+++ b/virtio/net.c
@@ -730,6 +730,10 @@  static int set_net_param(struct kvm *kvm, struct virtio_net_params *p,
 		p->mq = atoi(val);
 	} else
 		die("Unknown network parameter %s", param);
+	if (p->vhost && p->mq > 1) {
+		p->mq = 1;
+		pr_err("vhost does not support mq yet, overide mq to 1.");
+	}
 
 	return 0;
 }