All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: Fix xps_needed inc/dec mismatch
@ 2018-12-07 10:16 Ross Lagerwall
  2018-12-07 11:01 ` Sabrina Dubroca
  0 siblings, 1 reply; 3+ messages in thread
From: Ross Lagerwall @ 2018-12-07 10:16 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Amritha Nambiar, Ross Lagerwall

xps_needed is incremented only when a new dev map is allocated (in
__netif_set_xps_queue). Therefore it should be decremented only when we
actually have a dev map to destroy. Without this, it may be decremented
too many times which causes netif_reset_xps_queues to return early and
not actually clean up the old dev maps. This results in a crash in
__netif_set_xps_queue when it is called later.

The crash occurred when having multiple ixgbe devices in a host. lldpad
would reconfigure them to be FCoE-capable causing reset_xps_queues /
set_xps_queue to be called several times. The xps_needed count would get
out of sync and eventually the above-mentioned crash would occur.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 net/core/dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index ddc551f24ba2..8aa72e93af9f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2233,11 +2233,12 @@ static void netif_reset_xps_queues(struct net_device *dev, u16 offset,
 	clean_xps_maps(dev, possible_mask, dev_maps, nr_ids, offset, count,
 		       false);
 
-out_no_maps:
 	if (static_key_enabled(&xps_rxqs_needed))
 		static_key_slow_dec_cpuslocked(&xps_rxqs_needed);
 
 	static_key_slow_dec_cpuslocked(&xps_needed);
+
+out_no_maps:
 	mutex_unlock(&xps_map_mutex);
 	cpus_read_unlock();
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: Fix xps_needed inc/dec mismatch
  2018-12-07 10:16 [PATCH] net: Fix xps_needed inc/dec mismatch Ross Lagerwall
@ 2018-12-07 11:01 ` Sabrina Dubroca
  2018-12-07 15:15   ` Ross Lagerwall
  0 siblings, 1 reply; 3+ messages in thread
From: Sabrina Dubroca @ 2018-12-07 11:01 UTC (permalink / raw)
  To: Ross Lagerwall; +Cc: netdev, David S. Miller, Amritha Nambiar

Hi Ross,

2018-12-07, 10:16:21 +0000, Ross Lagerwall wrote:
> xps_needed is incremented only when a new dev map is allocated (in
> __netif_set_xps_queue). Therefore it should be decremented only when we
> actually have a dev map to destroy. Without this, it may be decremented
> too many times which causes netif_reset_xps_queues to return early and
> not actually clean up the old dev maps. This results in a crash in
> __netif_set_xps_queue when it is called later.
> 
> The crash occurred when having multiple ixgbe devices in a host. lldpad
> would reconfigure them to be FCoE-capable causing reset_xps_queues /
> set_xps_queue to be called several times. The xps_needed count would get
> out of sync and eventually the above-mentioned crash would occur.
> 
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

I posted another patchset recently (commits f28c020fb488 and
867d0ad476db in the "net" tree) for issues in XPS, including broken
xps_needed accounting, so your patch won't apply to David's "net"
tree. Could you try it with your use case, and if you still see
issues, fix them on top? You can grab the latest net tree here:

git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git


Thanks,

-- 
Sabrina

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: Fix xps_needed inc/dec mismatch
  2018-12-07 11:01 ` Sabrina Dubroca
@ 2018-12-07 15:15   ` Ross Lagerwall
  0 siblings, 0 replies; 3+ messages in thread
From: Ross Lagerwall @ 2018-12-07 15:15 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: netdev, David S. Miller, Amritha Nambiar

On 12/7/18 11:01 AM, Sabrina Dubroca wrote:
> Hi Ross,
> 
> 2018-12-07, 10:16:21 +0000, Ross Lagerwall wrote:
>> xps_needed is incremented only when a new dev map is allocated (in
>> __netif_set_xps_queue). Therefore it should be decremented only when we
>> actually have a dev map to destroy. Without this, it may be decremented
>> too many times which causes netif_reset_xps_queues to return early and
>> not actually clean up the old dev maps. This results in a crash in
>> __netif_set_xps_queue when it is called later.
>>
>> The crash occurred when having multiple ixgbe devices in a host. lldpad
>> would reconfigure them to be FCoE-capable causing reset_xps_queues /
>> set_xps_queue to be called several times. The xps_needed count would get
>> out of sync and eventually the above-mentioned crash would occur.
>>
>> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> 
> I posted another patchset recently (commits f28c020fb488 and
> 867d0ad476db in the "net" tree) for issues in XPS, including broken
> xps_needed accounting, so your patch won't apply to David's "net"
> tree. Could you try it with your use case, and if you still see
> issues, fix them on top? You can grab the latest net tree here:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
> 

Your two commits fix the issue I was seeing. Thanks!

-- 
Ross Lagerwall

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-07 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-07 10:16 [PATCH] net: Fix xps_needed inc/dec mismatch Ross Lagerwall
2018-12-07 11:01 ` Sabrina Dubroca
2018-12-07 15:15   ` Ross Lagerwall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.