ixgbe: [RFC] [PATCH] Fix return of invalid txq
Subsystems (2)
A developer had complained of getting lots of warnings:
"eth16 selects TX queue 98, but real number of TX queues is 64"
http://www.mail-archive.com/[email protected]/msg02200.html
As there was no follow up on that bug, I am submitting this patch assuming that the other return points will not return invalid txq's, and also that this fixes the bug (not tested).
--- drivers/net/ixgbe/ixgbe_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_main.c +4 -1
@@ -5514,8 +5514,11 @@ static u16 ixgbe_select_queue(struct netstruct ixgbe_adapter *adapter =netdev_priv (dev);int txq =smp_processor_id (); -if (adapter->flags &IXGBE_FLAG_FDIR_HASH_CAPABLE ) +if (adapter->flags &IXGBE_FLAG_FDIR_HASH_CAPABLE ) { +while (unlikely (txq >= dev->real_num_tx_queues)) + txq -= dev->real_num_tx_queues;return txq; + }#ifdef IXGBE_FCOE if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
Quoted 12 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Krishna Kumar
Sent: Thursday, January 14, 2010 9:31 PM
To: [email protected]
Cc: [email protected]; Kirsher, Jeffrey T; Krishna Kumar
Subject: ixgbe: [RFC] [PATCH] Fix return of invalid txqA developer had complained of getting lots of warnings:
"eth16 selects TX queue 98, but real number of TX queues is 64"
Quoted 8 lines
http://www.mail-archive.com/e1000-
[email protected]/msg02200.htmlAs there was no follow up on that bug, I am submitting this patch assuming that the other return points will not return invalid txq's, and also that this fixes the bug (not tested).
Signed-off-by Krishna Kumar <[email protected]>
This looks reasonable to me. I've been trying to find time to add something like igb has, with a tiny Tx lookup table that maps CPUs into a smaller set of Tx queues, but I like this simple approach to fix the current bug.
We'll want to pull this in for a quick set of regression tests, but again I think this will work well.
Thanks Krishna,
-PJ
Quoted 27 lines
---
drivers/net/ixgbe/ixgbe_main.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)diff -ruNp
org/drivers/net/ixgbe/ixgbe_main.cnew/drivers/net/ixgbe/ixgbe_main.c
---org/drivers/net/ixgbe/ixgbe_main.c2010-01-12 11:50:24.000000000
+0530
+++new/drivers/net/ixgbe/ixgbe_main.c2010-01-12 11:50:44.000000000
+0530drivers/net/ixgbe/ixgbe_main.c +4
-2@@ -5514,8 +5514,11 @@ static u16 ixgbe_select_queue(struct netstruct ixgbe_adapter *adapter =netdev_priv (dev);int txq =smp_processor_id (); -if (adapter->flags &IXGBE_FLAG_FDIR_HASH_CAPABLE ) +if (adapter->flags &IXGBE_FLAG_FDIR_HASH_CAPABLE ) { +while (unlikely (txq >= dev->real_num_tx_queues)) + txq -= dev->real_num_tx_queues;return txq; + }#ifdef IXGBE_FCOE if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Krishna Kumar <[email protected]>
Date: Fri, 15 Jan 2010 11:01:17 +0530
Quoted 11 lines
A developer had complained of getting lots of warnings:
"eth16 selects TX queue 98, but real number of TX queues is 64"
http://www.mail-archive.com/[email protected]/msg02200.html
As there was no follow up on that bug, I am submitting this patch assuming that the other return points will not return invalid txq's, and also that this fixes the bug (not tested).
Signed-off-by Krishna Kumar <[email protected]>
Guys I'm really sick of seeing this bug. Stop assuming that the platform has limitations that platforms you happen to work on have.
NR_CPUS can be 4096, so you must assume everywhere that smp_processor_id() can return just about any number.
Modulo the damn thing, or similar.
Don't use tables or crap like that. We do like Krishna's scheme in net/core/dev.c:skb_tx_hash(), and that's what we should do here too.
Krishna's patch is therefore correct, and I don't want to hear anything about "tables", unless you're going to add "tables" to net/core/dev.c :-)
David Miller
maintainerFrom: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Thu, 14 Jan 2010 23:58:17 -0800
Quoted 2 lines
I've been trying to find time to add something like igb has, with a tiny Tx lookup table that maps CPUs into a smaller set of Tx queues.
Why do you need "tables"? Just modulo the it, with whatever optimizations you can come up with.
Or do we not have enough data references in the TX path already? :-/
I would suggest getting rid of the table in IGB too.
Either "tables" are a good idea (I think they definitely are not) or they are not. And whatever the decision is we should do it consistently. net/core/dev.c doesn't use tables, it does the subtraction modulo thing like Krishna does.
Quoted 12 lines · David Miller
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Thu, 14 Jan 2010 23:58:17 -0800Quoted 2 lines
I've been trying to find time to add something like igb has, with a tiny Tx lookup table that maps CPUs into a smaller set of Tx queues.
Why do you need "tables"? Just modulo the it, with whatever optimizations you can come up with.
Or do we not have enough data references in the TX path already? :-/
Quoted 6 lines
I would suggest getting rid of the table in IGB too.
Either "tables" are a good idea (I think they definitely are not) or they are not. And whatever the decision is we should do it consistently.
net/core/dev.cdoesn't use tables, it does the subtraction modulo thing like Krishna does.
What I've been thinking of is more for the NUMA allocations per port. If we have, say 2 sockets, 8 cores a piece, then we have 16 CPUs. If we assign a port to socket 0, I think the best use of resources is to allocate 8 Rx/Tx queues, one per core in that socket. If an application comes from the other socket, we can have a table to map the other 8 cores from that socket into the 8 queues, instead of piling them all into one of the Tx queues.
Cheers,
-PJ
David Miller
maintainerFrom: Peter P Waskiewicz Jr <[email protected]>
Date: Fri, 15 Jan 2010 01:00:20 -0800
Quoted 7 lines
What I've been thinking of is more for the NUMA allocations per port. If we have, say 2 sockets, 8 cores a piece, then we have 16 CPUs. If we assign a port to socket 0, I think the best use of resources is to allocate 8 Rx/Tx queues, one per core in that socket. If an application comes from the other socket, we can have a table to map the other 8 cores from that socket into the 8 queues, instead of piling them all into one of the Tx queues.
I fail to see how this can act substantially better than simply feeding traffic evenly amongst whatever group of queues have been configured.
Quoted 15 lines
-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Friday, January 15, 2010 1:06 AM
To: Waskiewicz Jr, Peter P
Cc: [email protected]; [email protected]; Kirsher, Jeffrey T
Subject: Re: ixgbe: [RFC] [PATCH] Fix return of invalid txqFrom: Peter P Waskiewicz Jr <[email protected]>
Date: Fri, 15 Jan 2010 01:00:20 -0800Quoted 2 lines
What I've been thinking of is more for the NUMA allocations per port. If we have, say 2 sockets, 8 cores a piece, then we have 16 CPUs. If
we
Quoted 2 lines
assign a port to socket 0, I think the best use of resources is to allocate 8 Rx/Tx queues, one per core in that socket. If an
Quoted 8 lines
application
Quoted 3 lines
comes from the other socket, we can have a table to map the other 8 cores from that socket into the 8 queues, instead of piling them all into one of the Tx queues.
I fail to see how this can act substantially better than simply feeding traffic evenly amongst whatever group of queues have been configured.
On systems with a large number of cores, and depending on how a NIC is allocated to a set of processors, there is a difference. If a port is allocated to socket three on a large NUMA system, then it could be CPUs 16-23 that it'd be using, and I'd have 8 Tx/Rx queues. I can either use the easy approach Krishna has, which could then execute two minus operations, or I can setup a lookup table in the driver on open(), and then I make a single indexed lookup. Using the lookup table makes the queue selection O(1) for whatever CPU/queue layout we come up with.
Either way works though. I still think the table is the better way to go, because of the determinism for any system and NIC configuration/layout. The overhead of configuring the table is taken during open(), so it's not in the hotpath at all.
Cheers,
-PJ
David Miller
maintainerFrom: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Sat, 16 Jan 2010 02:53:15 -0800
Quoted 4 lines
Either way works though. I still think the table is the better way to go, because of the determinism for any system and NIC configuration/layout. The overhead of configuring the table is taken during
open(), so it's not in the hotpath at all.
How many minus operations can your cpu perform in the same amount of time it takes to access memory? :-)
Quoted 10 lines · David Miller
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Sat, 16 Jan 2010 02:53:15 -0800Quoted 4 lines
Either way works though. I still think the table is the better way to go, because of the determinism for any system and NIC configuration/layout. The overhead of configuring the table is taken during
open(), so it's not in the hotpath at all.How many minus operations can your cpu perform in the same amount of time it takes to access memory? :-)
Touche. :)