Skip to contentSkip to conversation

xen-netback: respect user provided max_queues

PATCH In review Wei Liu 3 participants 7 messages Sep 9, 2015

Subsystems (3)
lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 xen-netback: respect user provided max_queues

Originally that parameter was always reset to num_online_cpus during module initialisation, which renders it useless.

The fix is to only set max_queues to num_online_cpus when user has not provided a value.

---
Cc: Johnny Strom <[email protected]>
Cc: David Vrabel <[email protected]>

---
 drivers/net/xen-netback/netback.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/xen-netback/netback.c +6 -3
index 42569b9..b219a80 100644
@@ -67,7 +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);
 
-unsigned int xenvif_max_queues;
+unsigned int xenvif_max_queues = 0;
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
@@ -2105,8 +2105,11 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs, by default */
-	xenvif_max_queues = num_online_cpus();
+	/* Allow as many queues as there are CPUs if user has not
+	 * specified a value.
+	 */
+	if (xenvif_max_queues == 0)
+		xenvif_max_queues = 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.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Wei Liu

Originally that parameter was always reset to num_online_cpus during module initialisation, which renders it useless.

The fix is to only set max_queues to num_online_cpus when user has not provided a value.

[...]

drivers/net/xen-netback/netback.c module_param(rx_drain_timeout_msecs, uint, 0444); · line 70

Quoted 8 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -67,7 +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);
 
-unsigned int xenvif_max_queues;
+unsigned int xenvif_max_queues = 0;

You don't need this.

Otherwise,

Is an equivalent fix needed in netfront?

David

Quoted 18 lines
drivers/net/xen-netback/netback.c +5 -2
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
@@ -2105,8 +2105,11 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs, by default */
-	xenvif_max_queues = num_online_cpus();
+	/* Allow as many queues as there are CPUs if user has not
+	 * specified a value.
+	 */
+	if (xenvif_max_queues == 0)
+		xenvif_max_queues = 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",
author
#2 lore raw
Quoted 18 lines · David Vrabel
Quoted 5 lines · Wei Liu

Originally that parameter was always reset to num_online_cpus during module initialisation, which renders it useless.

The fix is to only set max_queues to num_online_cpus when user has not provided a value.

[...]

drivers/net/xen-netback/netback.c module_param(rx_drain_timeout_msecs, uint, 0444); · line 70

Quoted 8 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -67,7 +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);
 
-unsigned int xenvif_max_queues;
+unsigned int xenvif_max_queues = 0;

You don't need this.

Quoted 6 lines

Otherwise,

Is an equivalent fix needed in netfront?

I think so.

I will address your comment and send both fixes (front and back) in a series.

Wei.

Quoted 20 lines

David

Quoted 18 lines
drivers/net/xen-netback/netback.c +5 -2
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
@@ -2105,8 +2105,11 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs, by default */
-	xenvif_max_queues = num_online_cpus();
+	/* Allow as many queues as there are CPUs if user has not
+	 * specified a value.
+	 */
+	if (xenvif_max_queues == 0)
+		xenvif_max_queues = 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",
#3 lore raw
Quoted 22 lines · Wei Liu
Quoted 21 lines · David Vrabel
Quoted 6 lines · Wei Liu

Originally that parameter was always reset to num_online_cpus during module initialisation, which renders it useless.

The fix is to only set max_queues to num_online_cpus when user has not
provided a value.

[...]

drivers/net/xen-netback/netback.c module_param(rx_drain_timeout_msecs, uint, 0444); · line 70

Quoted 8 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -67,7 +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);
 
-unsigned int xenvif_max_queues;
+unsigned int xenvif_max_queues = 0;

You don't need this.

Otherwise,

Quoted 8 lines
Quoted 4 lines

Is an equivalent fix needed in netfront?

I think so.

I will address your comment

With that: Acked-by: Ian Campbell <[email protected]>

Quoted 26 lines

and send both fixes (front and back) in a
series.

Wei.

Quoted 21 lines

David

Quoted 19 lines
drivers/net/xen-netback/netback.c +5 -2
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
@@ -2105,8 +2105,11 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs, by default */
-	xenvif_max_queues = num_online_cpus();
+	/* Allow as many queues as there are CPUs if user has not
+	 * specified a value.
+	 */
+	if (xenvif_max_queues == 0)
+		xenvif_max_queues = 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",

#4 lore raw
In reply to Wei Liu
Quoted 22 lines · Wei Liu
Quoted 21 lines · David Vrabel
Quoted 6 lines · Wei Liu

Originally that parameter was always reset to num_online_cpus during module initialisation, which renders it useless.

The fix is to only set max_queues to num_online_cpus when user has not
provided a value.

[...]

drivers/net/xen-netback/netback.c module_param(rx_drain_timeout_msecs, uint, 0444); · line 70

Quoted 8 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -67,7 +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);
 
-unsigned int xenvif_max_queues;
+unsigned int xenvif_max_queues = 0;

You don't need this.

Otherwise,

Quoted 8 lines
Quoted 4 lines

Is an equivalent fix needed in netfront?

I think so.

I will address your comment

With that: Acked-by: Ian Campbell <[email protected]>

Quoted 26 lines

and send both fixes (front and back) in a
series.

Wei.

Quoted 21 lines

David

Quoted 19 lines
drivers/net/xen-netback/netback.c +5 -2
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
@@ -2105,8 +2105,11 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs, by default */
-	xenvif_max_queues = num_online_cpus();
+	/* Allow as many queues as there are CPUs if user has not
+	 * specified a value.
+	 */
+	if (xenvif_max_queues == 0)
+		xenvif_max_queues = 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",

author
#5 lore raw
In reply to David Vrabel
Quoted 18 lines · David Vrabel
Quoted 5 lines · Wei Liu

Originally that parameter was always reset to num_online_cpus during module initialisation, which renders it useless.

The fix is to only set max_queues to num_online_cpus when user has not provided a value.

[...]

drivers/net/xen-netback/netback.c module_param(rx_drain_timeout_msecs, uint, 0444); · line 70

Quoted 8 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -67,7 +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);
 
-unsigned int xenvif_max_queues;
+unsigned int xenvif_max_queues = 0;

You don't need this.

Quoted 6 lines

Otherwise,

Is an equivalent fix needed in netfront?

I think so.

I will address your comment and send both fixes (front and back) in a series.

Wei.

Quoted 20 lines

David

Quoted 18 lines
drivers/net/xen-netback/netback.c +5 -2
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
@@ -2105,8 +2105,11 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs, by default */
-	xenvif_max_queues = num_online_cpus();
+	/* Allow as many queues as there are CPUs if user has not
+	 * specified a value.
+	 */
+	if (xenvif_max_queues == 0)
+		xenvif_max_queues = 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",
Reviewed-by on v1 1/1
#6 lore raw
In reply to Wei Liu
Quoted 5 lines · Wei Liu

Originally that parameter was always reset to num_online_cpus during module initialisation, which renders it useless.

The fix is to only set max_queues to num_online_cpus when user has not provided a value.

[...]

drivers/net/xen-netback/netback.c module_param(rx_drain_timeout_msecs, uint, 0444); · line 70

Quoted 8 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -67,7 +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);
 
-unsigned int xenvif_max_queues;
+unsigned int xenvif_max_queues = 0;

You don't need this.

Otherwise,

Is an equivalent fix needed in netfront?

David

Quoted 18 lines
drivers/net/xen-netback/netback.c +5 -2
 module_param_named(max_queues, xenvif_max_queues, uint, 0644);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
@@ -2105,8 +2105,11 @@ static int __init netback_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	/* Allow as many queues as there are CPUs, by default */
-	xenvif_max_queues = num_online_cpus();
+	/* Allow as many queues as there are CPUs if user has not
+	 * specified a value.
+	 */
+	if (xenvif_max_queues == 0)
+		xenvif_max_queues = 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",