Skip to contentSkip to conversation

examples/vhost: change the default value of NIC's max queues

PATCH Superseded Wenwu Ma 6 participants 15 messages Sep 10, 2021 – Nov 3, 2021

lore
Share & tools
lore

Wenwu Ma

author
#0 lore raw

PATCH 1/1 examples/vhost: change the default value of NIC's max queues

vswitch can't launch with 40G FTV due to Device start fails if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -1
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 35 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Friday, September 10, 2021 9:52 PM
To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; Jiang, Cheng1 <[email protected]>; Hu, Jiayu <[email protected]>; Wang, Yinan <[email protected]>; Ma, WenwuX <[email protected]>
Subject: [PATCH] examples/vhost: change the default value of NIC's max queues

vswitch can't launch with 40G FTV due to Device start fails if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

bc3d71c898..36969a4de5 100644

examples/vhost/main.c +1 -2
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
--

2.25.1

#2 lore raw
In reply to Wenwu Ma

Hi Wenwu,

Quoted 10 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Friday, September 10, 2021 9:52 PM
To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; Jiang, Cheng1 <[email protected]>; Hu, Jiayu <[email protected]>; Wang, Yinan <[email protected]>; Ma, WenwuX <[email protected]>
Subject: [PATCH] examples/vhost: change the default value of NIC's max queues

vswitch can't launch with 40G FTV due to Device start fails

Not many people can understand what's FTV. So let's describe it with a driver name. Example if it's 'i40e':

vswitch can't launch with a 40G i40e port...

And Device -> device

Quoted 3 lines

if NIC’s max queues > the default number of 128,
so, we changed the default value from 128 to 512.

I'd say it's not cool to still hard-code the MAX_QUEUES so that only 'some' NICs can work with the example. The app should have a way to check this kind of info before init/start. But as I would like to see at some point, this example will be removed and all our tests go to testpmd. Let's not waste too much effort on this example.

Besides: it can be a fix. Let's backport it.

Thanks,
Chenbo

Quoted 20 lines
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -2
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
--

2.25.1

#3 lore raw
Quoted 24 lines · Chenbo

Hi Wenwu,

Quoted 10 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Friday, September 10, 2021 9:52 PM
To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; Jiang, Cheng1 <[email protected]>; Hu, Jiayu <[email protected]>; Wang, Yinan <[email protected]>; Ma, WenwuX <[email protected]>
Subject: [PATCH] examples/vhost: change the default value of NIC's max queues

vswitch can't launch with 40G FTV due to Device start fails

Not many people can understand what's FTV. So let's describe it with a driver name. Example if it's 'i40e':

vswitch can't launch with a 40G i40e port...

And Device -> device

Quoted 3 lines

if NIC’s max queues > the default number of 128,
so, we changed the default value from 128 to 512.

Quoted 5 lines

I'd say it's not cool to still hard-code the MAX_QUEUES so that only 'some' NICs can work with the example. The app should have a way to check this kind of info before init/start. But as I would like to see at some point, this example will be removed and all our tests go to testpmd. Let's not waste too much effort on this example.

+1 on this, I agree with Chenbo it is better to invest time in porting existing tests to testpmd.

Quoted 27 lines

Besides: it can be a fix. Let's backport it.

Thanks,
Chenbo

Quoted 20 lines
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -2
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
--

2.25.1

#4 lore raw
In reply to Xia, Chenbo

Hi,

Quoted 47 lines · Chenbo

Hi Wenwu,

Quoted 10 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Friday, September 10, 2021 9:52 PM
To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; Jiang, Cheng1 <[email protected]>; Hu, Jiayu <[email protected]>; Wang, Yinan <[email protected]>; Ma, WenwuX <[email protected]>
Subject: [PATCH] examples/vhost: change the default value of NIC's max queues

vswitch can't launch with 40G FTV due to Device start fails

Not many people can understand what's FTV. So let's describe it with a driver name. Example if it's 'i40e':

vswitch can't launch with a 40G i40e port...

And Device -> device

Quoted 3 lines

if NIC’s max queues > the default number of 128,
so, we changed the default value from 128 to 512.

I'd say it's not cool to still hard-code the MAX_QUEUES so that only 'some' NICs can work with the example. The app should have a way to check this kind of info before init/start. But as I would like to see at some point, this example will be removed and all our tests go to testpmd. Let's not waste too much effort on this example.

Besides: it can be a fix. Let's backport it.

Thanks,
Chenbo

Quoted 12 lines
---
  examples/vhost/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +0 -0
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
  #include "main.h"
 
Quoted 9 lines
Quoted 8 lines
examples/vhost/main.c +1 -2
  #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
  #endif
 
  /* the maximum number of external ports supported */
--

2.25.1

Are you planning to post a new revision handling Chenbo's comments?

Thanks,
Maxime

#5 lore raw
In reply to Xia, Chenbo
Quoted 6 lines · Chenbo
Quoted 3 lines

if NIC’s max queues > the default number of 128,
so, we changed the default value from 128 to 512.

I'd say it's not cool to still hard-code the MAX_QUEUES so that only 'some' NICs can work with the example. The app should have a way to check this kind of info

+1...

Quoted 3 lines

before init/start. But as I would like to see at some point, this example will be removed and all our tests go to testpmd. Let's not waste too much effort on this example.

And +1, this example is a mess.

Signature · 1 line
David Marchand
author
#6 lore raw

PATCH v2 1/1 examples/vhost: change the default value of NIC's max queues

In reply to Wenwu Ma

vswitch can't launch with a 40G i40e port due to device start fails if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -1
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
Signature · 1 line
2.25.1
#7 lore raw
Quoted 3 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Saturday, October 16, 2021 4:01 AM

Is your server time incorrect? You are sending patch from future

Quoted 10 lines

To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; Jiang, Cheng1 <[email protected]>; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Ma, WenwuX <[email protected]>
Subject: [PATCH v2] examples/vhost: change the default value of NIC's max queues

vswitch can't launch with a 40G i40e port due to device start fails if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

Still missing fix and cc-stable tag.

/Chenbo

Quoted 21 lines
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -2
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
--

2.25.1

author
#8 lore raw

PATCH v3 1/1 examples/vhost: change the default value of NIC's max queues

In reply to Wenwu Ma

vswitch can't launch with a 40G i40e port due to device start fails if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

Fixes 4796ad63ba1f ("examples/vhost: import userspace vhost application")
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -1
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
Signature · 1 line
2.25.1
Reviewed-by on v3 1/1
#9 lore raw
Quoted 18 lines · Wenwu Ma

vswitch can't launch with a 40G i40e port due to device start fails if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

Fixes 4796ad63ba1f ("examples/vhost: import userspace vhost application")
---
  examples/vhost/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +0 -0
index bc3d71c898..36969a4de5 100644

examples/vhost/main.c line 35

Quoted 8 lines
examples/vhost/main.c +1 -1
@@ -29,7 +29,7 @@
  #include "main.h"
 
  #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
  #endif
 
  /* the maximum number of external ports supported */

As discussed, this is far from ideal, but let's use our time to remove gaps in Vhost testing with testpmd so that we can remove this example later.

Thanks,
Maxime

#10 lore raw
In reply to Wenwu Ma
Quoted 4 lines · Wenwu Ma

vswitch can't launch with a 40G i40e port due to device start fails if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

Quoted 8 lines
Fixes 4796ad63ba1f ("examples/vhost: import userspace vhost application")
---
  examples/vhost/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to dpdk-next-virtio/main.

Thanks,
Maxime

#11 lore raw
In reply to Wenwu Ma
Quoted 1 line · Wenwu Ma

vswitch can't launch with a 40G i40e port due to device start fails

what is 'vswitch' that is referred? I expect what can't launch should be this sample app but why referring it as 'vswitch'?

Also patch title describes what is done, better to describe why it is done, like:
examples/vhost: fix init for devices that has big max queue number

btw, why a device with big max queue number causes failure in the sample app? Can you please provide more detail on the error? What and why fails on device start?

Quoted 25 lines

if NIC’s max queues > the default number of 128, so, we changed the default value from 128 to 512.

Fixes 4796ad63ba1f ("examples/vhost: import userspace vhost application")
---
  examples/vhost/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -1
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
  #include "main.h"
 
  #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
  #endif
 
  /* the maximum number of external ports supported */
author
#12 lore raw

PATCH v4 1/1 examples/vhost: fix failure to launch dpdk-vhost

In reply to Wenwu Ma

When the default max queue value of vhost is 128, dpdk-vhost will fail to launch with a 40G i40e port due to the mbuf allocation of the port queue fails. Therefore, we modify the default value of max queue from 128 to 512, it will ensure that there are enough mbufs.

Fixes 4796ad63ba1f ("examples/vhost: import userspace vhost application")
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -1
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
Signature · 1 line
2.25.1
Acked-by Konstantin Ananyev on v4 1/1
#13 lore raw

Re: [dpdk-dev] [PATCH v4] examples/vhost: fix failure to launch dpdk-vhost

Hi,

Quoted 10 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Wednesday, November 3, 2021 10:17 PM
To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; Yigit, Ferruh <[email protected]>; Jiang, Cheng1 <[email protected]>; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Ma, WenwuX <[email protected]>; [email protected]
Subject: [PATCH v4] examples/vhost: fix failure to launch dpdk-vhost

Quoted 7 lines

When the default max queue value of vhost is 128, dpdk-vhost will fail to launch with a 40G i40e port due to the mbuf allocation of the port queue fails. Therefore, we modify the default value of max queue from 128 to 512, it will ensure that there are enough mbufs.

Fixes 4796ad63ba1f ("examples/vhost: import userspace vhost application")

When I was tracking the bad commit, I notice this change is on purpose to save hugepages:

commit f17eb179046962fdc29c3609b1c9bd46bfefa4f5

Author: Bernard Iremonger <[email protected]>
Date:   Thu Dec 10 15:49:17 2015 +0000

examples/vhost: reduce number of hugepages needed

Add #ifndef MAX_QUEUES to change MAX_QUEUES at compile time if needed. Change MAX_QUEUES from 512 to 128 to reduce the number of hugepages required by the vhost-switch program.

To change MAX_QUEUES add '-D MAX_QUEUES=512' to the EXTRA_CFLAGS variable, before building the application.

So as there's a way to solve the problem (although not perfect), I would suggest using the compiler flag to do tests with the specific NIC.

If no one has objection, let's drop the patch.

Thanks,
Chenbo

Quoted 22 lines
---
 examples/vhost/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -2
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
 #include "main.h"
 
 #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
 #endif
 
 /* the maximum number of external ports supported */
--

2.25.1

#14 lore raw

Re: [dpdk-dev] [PATCH v4] examples/vhost: fix failure to launch dpdk-vhost

Hi Chenbo,

Quoted 35 lines · Chenbo

Hi,

Quoted 10 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Wednesday, November 3, 2021 10:17 PM
To: [email protected]
Cc: [email protected]; Xia, Chenbo <[email protected]>; Yigit, Ferruh <[email protected]>; Jiang, Cheng1 <[email protected]>; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Ma, WenwuX <[email protected]>; [email protected]
Subject: [PATCH v4] examples/vhost: fix failure to launch dpdk-vhost

Quoted 7 lines

When the default max queue value of vhost is 128, dpdk-vhost will fail to launch with a 40G i40e port due to the mbuf allocation of the port queue fails. Therefore, we modify the default value of max queue from 128 to 512, it will ensure that there are enough mbufs.

Fixes 4796ad63ba1f ("examples/vhost: import userspace vhost application")

When I was tracking the bad commit, I notice this change is on purpose to save hugepages:

commit f17eb179046962fdc29c3609b1c9bd46bfefa4f5

Author: Bernard Iremonger <[email protected]>
Date:   Thu Dec 10 15:49:17 2015 +0000

examples/vhost: reduce number of hugepages needed

Add #ifndef MAX_QUEUES to change MAX_QUEUES at compile time if needed. Change MAX_QUEUES from 512 to 128 to reduce the number of hugepages required by the vhost-switch program.

To change MAX_QUEUES add '-D MAX_QUEUES=512' to the EXTRA_CFLAGS variable, before building the application.

Quoted 7 lines

So as there's a way to solve the problem (although not perfect), I would suggest using the compiler flag to do tests with the specific NIC.

If no one has objection, let's drop the patch.

I agree, let's drop it.

Thanks,
Maxime

Quoted 26 lines

Thanks,
Chenbo

Quoted 22 lines
---
  examples/vhost/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/main.c +1 -2
index bc3d71c898..36969a4de5 100644
@@ -29,7 +29,7 @@
  #include "main.h"
 
  #ifndef MAX_QUEUES
-#define MAX_QUEUES 128
+#define MAX_QUEUES 512
  #endif
 
  /* the maximum number of external ports supported */
--

2.25.1