Skip to contentSkip to conversation

xen/net: limit number of tx/rx queues

PATCH Applied Juergen Gross 3 participants 12 messages Jan 10, 2017 – Jan 30, 2017

Subsystems (4)
lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

cover xen/net: limit number of tx/rx queues

The Xen network frontend/backend supports multiple tx/rx queues for one virtual interface. The number of queues supported by the backend is set to the number of cpus of the backend driver domain (usually dom0) and the number of queues requested by the frontend is limited by the number of vcpus of the related guest.

On large systems this can lead to ridiculous large number of queues exhausting the required number of grant pages rather quick.

To avoid this limit the default maximum on both sides to 8. Both frontend and backend maximum can be individually tuned via module parameters.

Juergen Gross (2):
xen/netfront: set default upper limit of tx/rx queues to 8 xen/netback: set default upper limit of tx/rx queues to 8

 drivers/net/xen-netback/netback.c | 6 ++++--
 drivers/net/xen-netfront.c        | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.10.2
author maintainer
#1 lore raw

PATCH 1/2 xen/netfront: set default upper limit of tx/rx queues to 8

The default for the number of tx/rx queues of one interface is the number of vcpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netfront.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +4 -2
index a479cd9..490c865 100644
@@ -57,6 +57,7 @@
 #include <xen/interface/grant_table.h>
 
 /* Module parameters */
+#define MAX_QUEUES_DEFAULT 8
 static unsigned int xennet_max_queues;
 module_param_named(max_queues, xennet_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
@@ -2164,11 +2165,12 @@ static int __init netif_init(void)
 
 	pr_info("Initialising Xen virtual ethernet driver\n");
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs inut max. 8 if user has not
 	 * specified a value.
 	 */
 	if (xennet_max_queues == 0)
-		xennet_max_queues = num_online_cpus();
+		xennet_max_queues = min_t(unsigned int, MAX_QUEUES_DEFAULT,
+					  num_online_cpus());
 
 	return xenbus_register_frontend(&netfront_driver);
 }
Signature · 1 line
2.10.2
author maintainer
#7 lore raw

PATCH 2/2 xen/netback: set default upper limit of tx/rx queues to 8

In reply to Juergen Gross

The default for the maximum number of tx/rx queues of one interface is the number of cpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netback/netback.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netback/netback.c +4 -2
index 47b4810..f9bcf4a 100644
@@ -67,6 +67,7 @@ module_param(rx_drain_timeout_msecs, uint, 0444);
 unsigned int rx_stall_timeout_msecs = 60000;
 module_param(rx_stall_timeout_msecs, uint, 0444);
 
+#define MAX_QUEUES_DEFAULT 8
 unsigned int xenvif_max_queues;
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
@@ -1622,11 +1623,12 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs but max. 8 if user has not
 	 * specified a value.
 	 */
 	if (xenvif_max_queues == 0)
-		xenvif_max_queues = num_online_cpus();
+		xenvif_max_queues = min_t(unsigned int, MAX_QUEUES_DEFAULT,
+					  num_online_cpus());
 
 	if (fatal_skb_slots < XEN_NETBK_LEGACY_SLOTS_MAX) {
 		pr_info("fatal_skb_slots too small (%d), bump it to XEN_NETBK_LEGACY_SLOTS_MAX (%d)\n",
Signature · 1 line
2.10.2
author maintainer
#6 lore raw

PATCH 1/2 xen/netfront: set default upper limit of tx/rx queues to 8

In reply to Juergen Gross

The default for the number of tx/rx queues of one interface is the number of vcpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netfront.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +4 -2
index a479cd9..490c865 100644
@@ -57,6 +57,7 @@
 #include <xen/interface/grant_table.h>
 
 /* Module parameters */
+#define MAX_QUEUES_DEFAULT 8
 static unsigned int xennet_max_queues;
 module_param_named(max_queues, xennet_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
@@ -2164,11 +2165,12 @@ static int __init netif_init(void)
 
 	pr_info("Initialising Xen virtual ethernet driver\n");
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs inut max. 8 if user has not
 	 * specified a value.
 	 */
 	if (xennet_max_queues == 0)
-		xennet_max_queues = num_online_cpus();
+		xennet_max_queues = min_t(unsigned int, MAX_QUEUES_DEFAULT,
+					  num_online_cpus());
 
 	return xenbus_register_frontend(&netfront_driver);
 }
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author maintainer
#8 lore raw

PATCH 2/2 xen/netback: set default upper limit of tx/rx queues to 8

In reply to Juergen Gross

The default for the maximum number of tx/rx queues of one interface is the number of cpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netback/netback.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netback/netback.c +4 -2
index 47b4810..f9bcf4a 100644
@@ -67,6 +67,7 @@ module_param(rx_drain_timeout_msecs, uint, 0444);
 unsigned int rx_stall_timeout_msecs = 60000;
 module_param(rx_stall_timeout_msecs, uint, 0444);
 
+#define MAX_QUEUES_DEFAULT 8
 unsigned int xenvif_max_queues;
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
@@ -1622,11 +1623,12 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs but max. 8 if user has not
 	 * specified a value.
 	 */
 	if (xenvif_max_queues == 0)
-		xenvif_max_queues = num_online_cpus();
+		xenvif_max_queues = min_t(unsigned int, MAX_QUEUES_DEFAULT,
+					  num_online_cpus());
 
 	if (fatal_skb_slots < XEN_NETBK_LEGACY_SLOTS_MAX) {
 		pr_info("fatal_skb_slots too small (%d), bump it to XEN_NETBK_LEGACY_SLOTS_MAX (%d)\n",
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on the v1 series
#9 lore raw
In reply to Juergen Gross
Quoted 9 lines · Juergen Gross

The Xen network frontend/backend supports multiple tx/rx queues for one virtual interface. The number of queues supported by the backend is set to the number of cpus of the backend driver domain (usually dom0) and the number of queues requested by the frontend is limited by the number of vcpus of the related guest.

On large systems this can lead to ridiculous large number of queues exhausting the required number of grant pages rather quick.

Quoted 8 lines

To avoid this limit the default maximum on both sides to 8. Both frontend and backend maximum can be individually tuned via module parameters.

Juergen Gross (2):
xen/netfront: set default upper limit of tx/rx queues to 8 xen/netback: set default upper limit of tx/rx queues to 8

Acked-by on the v1 series
#10 lore raw
In reply to Juergen Gross
Quoted 9 lines · Juergen Gross

The Xen network frontend/backend supports multiple tx/rx queues for one virtual interface. The number of queues supported by the backend is set to the number of cpus of the backend driver domain (usually dom0) and the number of queues requested by the frontend is limited by the number of vcpus of the related guest.

On large systems this can lead to ridiculous large number of queues exhausting the required number of grant pages rather quick.

Quoted 8 lines

To avoid this limit the default maximum on both sides to 8. Both frontend and backend maximum can be individually tuned via module parameters.

Juergen Gross (2):
xen/netfront: set default upper limit of tx/rx queues to 8 xen/netback: set default upper limit of tx/rx queues to 8

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xen/netfront: set default upper limit of tx/rx queues to 8

In reply to Juergen Gross
Quoted 26 lines · Juergen Gross

The default for the number of tx/rx queues of one interface is the number of vcpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netfront.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +1 -0
index a479cd9..490c865 100644
@@ -57,6 +57,7 @@
 #include <xen/interface/grant_table.h>
 
 /* Module parameters */
+#define MAX_QUEUES_DEFAULT 8
 static unsigned int xennet_max_queues;
 module_param_named(max_queues, xennet_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,

drivers/net/xen-netfront.c static int __init netif_init(void) · line 2168

Quoted 5 lines
drivers/net/xen-netfront.c +1 -1
@@ -2164,11 +2165,12 @@ static int __init netif_init(void)
 
 	pr_info("Initialising Xen virtual ethernet driver\n");
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs inut max. 8 if user has not

Based on comment change in the second patch: s/inut/but/ ? Also, comment style in both patches.

Other than that, for both:

drivers/net/xen-netfront.c static int __init netif_init(void) · line 2176

Quoted 9 lines
drivers/net/xen-netfront.c +2 -1
 	 * specified a value.
 	 */
 	if (xennet_max_queues == 0)
-		xennet_max_queues = num_online_cpus();
+		xennet_max_queues = min_t(unsigned int, MAX_QUEUES_DEFAULT,
+					  num_online_cpus());
 
 	return xenbus_register_frontend(&netfront_driver);
 }

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] xen/netfront: set default upper limit of tx/rx queues to 8

In reply to Juergen Gross
Quoted 26 lines · Juergen Gross

The default for the number of tx/rx queues of one interface is the number of vcpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netfront.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +1 -0
index a479cd9..490c865 100644
@@ -57,6 +57,7 @@
 #include <xen/interface/grant_table.h>
 
 /* Module parameters */
+#define MAX_QUEUES_DEFAULT 8
 static unsigned int xennet_max_queues;
 module_param_named(max_queues, xennet_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,

drivers/net/xen-netfront.c static int __init netif_init(void) · line 2168

Quoted 5 lines
drivers/net/xen-netfront.c +1 -1
@@ -2164,11 +2165,12 @@ static int __init netif_init(void)
 
 	pr_info("Initialising Xen virtual ethernet driver\n");
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs inut max. 8 if user has not

Based on comment change in the second patch: s/inut/but/ ? Also, comment style in both patches.

Other than that, for both:

Quoted 9 lines
drivers/net/xen-netfront.c +2 -1
 	 * specified a value.
 	 */
 	if (xennet_max_queues == 0)
-		xennet_max_queues = num_online_cpus();
+		xennet_max_queues = min_t(unsigned int, MAX_QUEUES_DEFAULT,
+					  num_online_cpus());
 
 	return xenbus_register_frontend(&netfront_driver);
 }
author maintainer
#4 lore raw

Re: [PATCH 1/2] xen/netfront: set default upper limit of tx/rx queues to 8

Quoted 28 lines · Boris Ostrovsky
Quoted 27 lines · Juergen Gross

The default for the number of tx/rx queues of one interface is the number of vcpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netfront.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +1 -0
index a479cd9..490c865 100644
@@ -57,6 +57,7 @@
 #include <xen/interface/grant_table.h>
 
 /* Module parameters */
+#define MAX_QUEUES_DEFAULT 8
 static unsigned int xennet_max_queues;
 module_param_named(max_queues, xennet_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
@@ -2164,11 +2165,12 @@ static int __init netif_init(void)
 
Quoted 7 lines

drivers/net/xen-netfront.c static int __init netif_init(void) · line 2168

Quoted 4 lines
drivers/net/xen-netfront.c +1 -1
 	pr_info("Initialising Xen virtual ethernet driver\n");
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs inut max. 8 if user has not

Based on comment change in the second patch: s/inut/but/ ? Also, comment style in both patches.

Typo: yes
Style: no. checkpatch tells me that the net directory doesn't follow common kernel style.

Quoted 4 lines

Other than that, for both:

Thanks,

Juergen

author maintainer
#5 lore raw

Re: [PATCH 1/2] xen/netfront: set default upper limit of tx/rx queues to 8

In reply to Boris Ostrovsky
Quoted 28 lines · Boris Ostrovsky
Quoted 27 lines · Juergen Gross

The default for the number of tx/rx queues of one interface is the number of vcpus of the system today. As each queue pair reserves 512 grant pages this default consumes a ridiculous number of grants for large guests.

Limit the queue number to 8 as default. This value can be modified via a module parameter if required.

---
 drivers/net/xen-netfront.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +1 -0
index a479cd9..490c865 100644
@@ -57,6 +57,7 @@
 #include <xen/interface/grant_table.h>
 
 /* Module parameters */
+#define MAX_QUEUES_DEFAULT 8
 static unsigned int xennet_max_queues;
 module_param_named(max_queues, xennet_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
@@ -2164,11 +2165,12 @@ static int __init netif_init(void)
 
Quoted 7 lines

drivers/net/xen-netfront.c static int __init netif_init(void) · line 2168

Quoted 4 lines
drivers/net/xen-netfront.c +1 -1
 	pr_info("Initialising Xen virtual ethernet driver\n");
 
-	/* Allow as many queues as there are CPUs if user has not
+	/* Allow as many queues as there are CPUs inut max. 8 if user has not

Based on comment change in the second patch: s/inut/but/ ? Also, comment style in both patches.

Typo: yes
Style: no. checkpatch tells me that the net directory doesn't follow common kernel style.

Quoted 4 lines

Other than that, for both:

Thanks,

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw
In reply to Juergen Gross
Quoted 13 lines · Juergen Gross

The Xen network frontend/backend supports multiple tx/rx queues for one virtual interface. The number of queues supported by the backend is set to the number of cpus of the backend driver domain (usually dom0) and the number of queues requested by the frontend is limited by the number of vcpus of the related guest.

On large systems this can lead to ridiculous large number of queues exhausting the required number of grant pages rather quick.

To avoid this limit the default maximum on both sides to 8. Both frontend and backend maximum can be individually tuned via module parameters.

Quoted 8 lines

Juergen Gross (2):
xen/netfront: set default upper limit of tx/rx queues to 8 xen/netback: set default upper limit of tx/rx queues to 8

 drivers/net/xen-netback/netback.c | 6 ++++--
 drivers/net/xen-netfront.c        | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

Applied to for-linus-4.11

-boris

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel