[PATCH net 1/2] vxlan: do not modify the shared tunnel info when PMTU triggers an ICMP reply

2021-03-25 Thread Antoine Tenart
t;) Tested-by: Eelco Chaudron Reviewed-by: Eelco Chaudron Signed-off-by: Antoine Tenart --- drivers/net/vxlan.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 666dd201c3d5..53dbc67e8a34 100644 --- a/drivers/net/v

[PATCH net 2/2] geneve: do not modify the shared tunnel info when PMTU triggers an ICMP reply

2021-03-25 Thread Antoine Tenart
t;) Tested-by: Eelco Chaudron Reviewed-by: Eelco Chaudron Signed-off-by: Antoine Tenart --- drivers/net/geneve.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 4ac0373326ef..d5b1e48e0c09 100644 --- a/driver

[PATCH net 0/2] net: do not modify the shared tunnel info when PMTU triggers an ICMP reply

2021-03-25 Thread Antoine Tenart
s was tested manually with OVS and I ran the PTMU selftests with kmemleak enabled (all OK, none was skipped). Thanks! Antoine Antoine Tenart (2): vxlan: do not modify the shared tunnel info when PMTU triggers an ICMP reply geneve: do not modify the shared tunnel info when PMTU trigge

Re: [PATCH net-next] net-sysfs: remove possible sleep from an RCU read-side critical section

2021-03-22 Thread Antoine Tenart
Quoting Matthew Wilcox (2021-03-22 18:44:21) > On Mon, Mar 22, 2021 at 06:41:30PM +0100, Antoine Tenart wrote: > > Quoting Matthew Wilcox (2021-03-22 17:54:39) > > > - rcu_read_lock(); > > > - dev_maps = rcu_dereference(dev->xps_maps[type]); > >

Re: [PATCH net-next] net-sysfs: remove possible sleep from an RCU read-side critical section

2021-03-22 Thread Antoine Tenart
Quoting Antoine Tenart (2021-03-22 18:41:30) > Quoting Matthew Wilcox (2021-03-22 17:54:39) > > On Mon, Mar 22, 2021 at 04:43:29PM +0100, Antoine Tenart wrote: > > > xps_queue_show is mostly made of an RCU read-side critical section and > > > calls bitmap_zalloc with GFP

Re: [PATCH net-next] net-sysfs: remove possible sleep from an RCU read-side critical section

2021-03-22 Thread Antoine Tenart
Quoting Matthew Wilcox (2021-03-22 17:54:39) > On Mon, Mar 22, 2021 at 04:43:29PM +0100, Antoine Tenart wrote: > > xps_queue_show is mostly made of an RCU read-side critical section and > > calls bitmap_zalloc with GFP_KERNEL in the middle of it. That is not > > allowed as th

[PATCH net-next] net-sysfs: remove possible sleep from an RCU read-side critical section

2021-03-22 Thread Antoine Tenart
Fixes: 5478fcd0f483 ("net: embed nr_ids in the xps maps") Reported-by: kernel test robot Suggested-by: Matthew Wilcox Signed-off-by: Antoine Tenart --- Fix sent to net-next as it fixes an issue only in net-next. net/core/net-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -

[PATCH net-next v4 13/13] net: NULL the old xps map entries when freeing them

2021-03-18 Thread Antoine Tenart
In __netif_set_xps_queue, old map entries from the old dev_maps are freed but their corresponding entry in the old dev_maps aren't NULLed. Fix this. Signed-off-by: Antoine Tenart --- net/core/dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/dev.c b/net/core/dev.c

[PATCH net-next v4 12/13] net: fix use after free in xps

2021-03-18 Thread Antoine Tenart
that happens, a map can be freed while its corresponding entry in the old dev_maps table isn't NULLed, leading to: "BUG: KASAN: use-after-free" in different places. This fixes the map freeing logic for unused CPUs/rx-queues, to also NULL the map entries from the old dev_maps table. Si

[PATCH net-next v4 10/13] net-sysfs: move the rtnl unlock up in the xps show helpers

2021-03-18 Thread Antoine Tenart
want this device to be freed while we use it (now that the rtnl lock isn't protecting it in the whole function). Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/net/core/net-sysfs.c b/ne

[PATCH net-next v4 11/13] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-03-18 Thread Antoine Tenart
Most of the xps_cpus_show and xps_rxqs_show functions share the same logic. Having it in two different functions does not help maintenance. This patch moves their common logic into a new function, xps_queue_show, to improve this. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 125

[PATCH net-next v4 05/13] net: embed nr_ids in the xps maps

2021-03-18 Thread Antoine Tenart
Embed nr_ids (the number of cpu for the xps cpus map, and the number of rxqs for the xps cpus map) in dev_maps. That will help not accessing out of bound memory if those values change after dev_maps was allocated. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- include/linux

[PATCH net-next v4 04/13] net: embed num_tc in the xps maps

2021-03-18 Thread Antoine Tenart
- Checks can be made before accessing the maps so we know the values retrieved will make sense. We also update __netif_set_xps_queue to conditionally copy old maps from dev_maps in the new one only if the number of traffic classes from both maps match. Signed-off-by: Antoine Tenart --

[PATCH net-next v4 02/13] net-sysfs: store the return of get_netdev_queue_index in an unsigned int

2021-03-18 Thread Antoine Tenart
In net-sysfs, get_netdev_queue_index returns an unsigned int. Some of its callers use an unsigned long to store the returned value. Update the code to be consistent, this should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 11 +++ 1 file changed, 7

[PATCH net-next v4 00/13] net: xps: improve the xps maps handling

2021-03-18 Thread Antoine Tenart
se dev_maps->nr_ids to allocate the mask in xps_queue_show but still default to nr_cpu_ids/dev->num_rx_queues in xps_queue_show when dev_maps hasn't been allocated yet for backward compatibility.:w Antoine Tenart (13): net-sysfs: convert xps_cpus_show to bitmap_zalloc net-sysf

[PATCH net-next v4 01/13] net-sysfs: convert xps_cpus_show to bitmap_zalloc

2021-03-18 Thread Antoine Tenart
Use bitmap_zalloc instead of zalloc_cpumask_var in xps_cpus_show to align with xps_rxqs_show. This will improve maintenance and allow us to factorize the two functions. The function should behave the same. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 12 ++-- 1 file changed

[PATCH net-next v4 07/13] net: move the xps maps to an array

2021-03-18 Thread Antoine Tenart
. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- drivers/net/virtio_net.c | 2 +- include/linux/netdevice.h | 17 + net/core/dev.c| 73 +-- net/core/net-sysfs.c | 6 ++-- 4 files changed, 46 insertions(+), 52 deletions

[PATCH net-next v4 06/13] net: remove the xps possible_mask

2021-03-18 Thread Antoine Tenart
Remove the xps possible_mask. It was an optimization but we can just loop from 0 to nr_ids now that it is embedded in the xps dev_maps. That simplifies the code a bit. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 40

[PATCH net-next v4 03/13] net-sysfs: make xps_cpus_show and xps_rxqs_show consistent

2021-03-18 Thread Antoine Tenart
Make the implementations of xps_cpus_show and xps_rxqs_show to converge, as the two share the same logic but diverted over time. This should not modify their behaviour but will help future changes and improve maintenance. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 33

[PATCH net-next v4 08/13] net: add an helper to copy xps maps to the new dev_maps

2021-03-18 Thread Antoine Tenart
This patch adds an helper, xps_copy_dev_maps, to copy maps from dev_maps to new_dev_maps at a given index. The logic should be the same, with an improved code readability and maintenance. Signed-off-by: Antoine Tenart --- net/core/dev.c | 45 + 1 file

[PATCH net-next v4 09/13] net: improve queue removal readability in __netif_set_xps_queue

2021-03-18 Thread Antoine Tenart
Improve the readability of the loop removing tx-queue from unused CPUs/rx-queues in __netif_set_xps_queue. The change should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/dev.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/core/dev.c b

Re: [PATCH net-next v3 15/16] net/mlx5e: take the rtnl lock when calling netif_set_xps_queue

2021-03-17 Thread Antoine Tenart
Quoting Saeed Mahameed (2021-03-12 21:54:18) > On Fri, 2021-03-12 at 16:04 +0100, Antoine Tenart wrote: > > netif_set_xps_queue must be called with the rtnl lock taken, and this > > is > > now enforced using ASSERT_RTNL(). mlx5e_attach_netdev was taking the > > lock

Re: [PATCH net-next v3 15/16] net/mlx5e: take the rtnl lock when calling netif_set_xps_queue

2021-03-15 Thread Antoine Tenart
Quoting Maxim Mikityanskiy (2021-03-15 15:53:02) > On 2021-03-15 10:38, Antoine Tenart wrote: > > Quoting Saeed Mahameed (2021-03-12 21:54:18) > >> There is a reason why it is conditional: > >> we had a bug in the past of double locking here: > >> > >>

Re: [PATCH net-next v3 15/16] net/mlx5e: take the rtnl lock when calling netif_set_xps_queue

2021-03-15 Thread Antoine Tenart
Quoting Saeed Mahameed (2021-03-12 21:54:18) > On Fri, 2021-03-12 at 16:04 +0100, Antoine Tenart wrote: > > netif_set_xps_queue must be called with the rtnl lock taken, and this > > is > > now enforced using ASSERT_RTNL(). mlx5e_attach_netdev was taking the > > lock

[PATCH net-next v3 15/16] net/mlx5e: take the rtnl lock when calling netif_set_xps_queue

2021-03-12 Thread Antoine Tenart
netif_set_xps_queue must be called with the rtnl lock taken, and this is now enforced using ASSERT_RTNL(). mlx5e_attach_netdev was taking the lock conditionally, fix this by taking the rtnl lock all the time. Signed-off-by: Antoine Tenart --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c

[PATCH net-next v3 16/16] virtio_net: take the rtnl lock when calling virtnet_set_affinity

2021-03-12 Thread Antoine Tenart
e the rtnl lock when calling virtnet_set_affinity when the rtnl lock isn't taken already. Signed-off-by: Antoine Tenart --- drivers/net/virtio_net.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index dde9bbcc5ff0..54d2277f6c98 10

[PATCH net-next v3 14/16] net: NULL the old xps map entries when freeing them

2021-03-12 Thread Antoine Tenart
In __netif_set_xps_queue, old map entries from the old dev_maps are freed but their corresponding entry in the old dev_maps aren't NULLed. Fix this. Signed-off-by: Antoine Tenart --- net/core/dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/dev.c b/net/core/dev.c

[PATCH net-next v3 13/16] net: fix use after free in xps

2021-03-12 Thread Antoine Tenart
ned-off-by: Antoine Tenart --- net/core/dev.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 052797ca65f6..748e377c7fe3 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2460,7 +2460,7 @@ static DEFINE_MUTEX(xps

[PATCH net-next v3 08/16] net: move the xps maps to an array

2021-03-12 Thread Antoine Tenart
. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- drivers/net/virtio_net.c | 2 +- include/linux/netdevice.h | 17 + net/core/dev.c| 73 +-- net/core/net-sysfs.c | 6 ++-- 4 files changed, 46 insertions(+), 52 deletions

[PATCH net-next v3 12/16] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-03-12 Thread Antoine Tenart
Most of the xps_cpus_show and xps_rxqs_show functions share the same logic. Having it in two different functions does not help maintenance. This patch moves their common logic into a new function, xps_queue_show, to improve this. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 125

[PATCH net-next v3 09/16] net: add an helper to copy xps maps to the new dev_maps

2021-03-12 Thread Antoine Tenart
This patch adds an helper, xps_copy_dev_maps, to copy maps from dev_maps to new_dev_maps at a given index. The logic should be the same, with an improved code readability and maintenance. Signed-off-by: Antoine Tenart --- net/core/dev.c | 45 + 1 file

[PATCH net-next v3 10/16] net: improve queue removal readability in __netif_set_xps_queue

2021-03-12 Thread Antoine Tenart
Improve the readability of the loop removing tx-queue from unused CPUs/rx-queues in __netif_set_xps_queue. The change should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/dev.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/core/dev.c b

[PATCH net-next v3 11/16] net-sysfs: move the rtnl unlock up in the xps show helpers

2021-03-12 Thread Antoine Tenart
want this device to be freed while we use it (now that the rtnl lock isn't protecting it in the whole function). Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/net/core/net-sysfs.c b/ne

[PATCH net-next v3 07/16] net: remove the xps possible_mask

2021-03-12 Thread Antoine Tenart
Remove the xps possible_mask. It was an optimization but we can just loop from 0 to nr_ids now that it is embedded in the xps dev_maps. That simplifies the code a bit. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 40

[PATCH net-next v3 06/16] net: assert the rtnl lock is held when calling __netif_set_xps_queue

2021-03-12 Thread Antoine Tenart
Add ASSERT_RTNL at the top of __netif_set_xps_queue and add a comment about holding the rtnl lock before the function. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core

[PATCH net-next v3 05/16] net: embed nr_ids in the xps maps

2021-03-12 Thread Antoine Tenart
Embed nr_ids (the number of cpu for the xps cpus map, and the number of rxqs for the xps cpus map) in dev_maps. That will help not accessing out of bound memory if those values change after dev_maps was allocated. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- include/linux

[PATCH net-next v3 04/16] net: embed num_tc in the xps maps

2021-03-12 Thread Antoine Tenart
- Checks can be made before accessing the maps so we know the values retrieved will make sense. We also update __netif_set_xps_queue to conditionally copy old maps from dev_maps in the new one only if the number of traffic classes from both maps match. Signed-off-by: Antoine Tenart --

[PATCH net-next v3 02/16] net-sysfs: store the return of get_netdev_queue_index in an unsigned int

2021-03-12 Thread Antoine Tenart
In net-sysfs, get_netdev_queue_index returns an unsigned int. Some of its callers use an unsigned long to store the returned value. Update the code to be consistent, this should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 11 +++ 1 file changed, 7

[PATCH net-next v3 01/16] net-sysfs: convert xps_cpus_show to bitmap_zalloc

2021-03-12 Thread Antoine Tenart
Use bitmap_zalloc instead of zalloc_cpumask_var in xps_cpus_show to align with xps_rxqs_show. This will improve maintenance and allow us to factorize the two functions. The function should behave the same. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 12 ++-- 1 file changed

[PATCH net-next v3 03/16] net-sysfs: make xps_cpus_show and xps_rxqs_show consistent

2021-03-12 Thread Antoine Tenart
Make the implementations of xps_cpus_show and xps_rxqs_show to converge, as the two share the same logic but diverted over time. This should not modify their behaviour but will help future changes and improve maintenance. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 33

[PATCH net-next v3 00/16] net: xps: improve the xps maps handling

2021-03-12 Thread Antoine Tenart
tches to improve readability and avoid introducing issues in between patches. - Use dev_maps->nr_ids to allocate the mask in xps_queue_show but still default to nr_cpu_ids/dev->num_rx_queues in xps_queue_show when dev_maps hasn't been allocated yet for backward compati

Re: [PATCH net-next v2 09/12] net-sysfs: remove the rtnl lock when accessing the xps maps

2021-02-09 Thread Antoine Tenart
Quoting Antoine Tenart (2021-02-09 10:12:11) > > As the sb_dev pointer is protected by the rtnl lock, we'll have to keep > the lock. I'll move that patch at the end of the series (it'll be easier > to add the get_device/put_device logic with the xps_queue_show

Re: [PATCH net-next v2 09/12] net-sysfs: remove the rtnl lock when accessing the xps maps

2021-02-09 Thread Antoine Tenart
Quoting Alexander Duyck (2021-02-08 23:20:58) > On Mon, Feb 8, 2021 at 9:19 AM Antoine Tenart wrote: > > @@ -1328,17 +1328,12 @@ static ssize_t xps_cpus_show(struct netdev_queue > > *queue, > > > > index = get_netdev_queue_index(queue); > &

Re: [PATCH net-next v2 07/12] net: remove the xps possible_mask

2021-02-09 Thread Antoine Tenart
Quoting Alexander Duyck (2021-02-08 22:43:39) > On Mon, Feb 8, 2021 at 9:19 AM Antoine Tenart wrote: > > > > -static void clean_xps_maps(struct net_device *dev, const unsigned long > > *mask, > > +static void clean_xps_maps(struct net_device *dev, > >

[PATCH net-next v2 12/12] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-02-08 Thread Antoine Tenart
Most of the xps_cpus_show and xps_rxqs_show functions share the same logic. Having it in two different functions does not help maintenance. This patch moves their common logic into a new function, xps_queue_show, to improve this. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 98

[PATCH net-next v2 10/12] net: add an helper to copy xps maps to the new dev_maps

2021-02-08 Thread Antoine Tenart
This patch adds an helper, xps_copy_dev_maps, to copy maps from dev_maps to new_dev_maps at a given index. The logic should be the same, with an improved code readability and maintenance. Signed-off-by: Antoine Tenart --- net/core/dev.c | 45 + 1 file

[PATCH net-next v2 11/12] net: improve queue removal readability in __netif_set_xps_queue

2021-02-08 Thread Antoine Tenart
Improve the readability of the loop removing tx-queue from unused CPUs/rx-queues in __netif_set_xps_queue. The change should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/dev.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/core/dev.c b

[PATCH net-next v2 04/12] net: embed num_tc in the xps maps

2021-02-08 Thread Antoine Tenart
- Checks can be made before accessing the maps so we know the values retrieved will make sense. We also update __netif_set_xps_queue to conditionally copy old maps from dev_maps in the new one only if the number of traffic classes from both maps match. Signed-off-by: Antoine Tenart --

[PATCH net-next v2 07/12] net: remove the xps possible_mask

2021-02-08 Thread Antoine Tenart
Remove the xps possible_mask. It was an optimization but we can just loop from 0 to nr_ids now that it is embedded in the xps dev_maps. That simplifies the code a bit. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 43

[PATCH net-next v2 08/12] net: move the xps maps to an array

2021-02-08 Thread Antoine Tenart
. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- drivers/net/virtio_net.c | 2 +- include/linux/netdevice.h | 17 + net/core/dev.c| 73 +-- net/core/net-sysfs.c | 6 ++-- 4 files changed, 46 insertions(+), 52 deletions

[PATCH net-next v2 05/12] net: embed nr_ids in the xps maps

2021-02-08 Thread Antoine Tenart
Embed nr_ids (the number of cpu for the xps cpus map, and the number of rxqs for the xps cpus map) in dev_maps. That will help not accessing out of bound memory if those values change after dev_maps was allocated. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- include/linux

[PATCH net-next v2 06/12] net: assert the rtnl lock is held when calling __netif_set_xps_queue

2021-02-08 Thread Antoine Tenart
Add ASSERT_RTNL at the top of __netif_set_xps_queue and add a comment about holding the rtnl lock before the function. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core

[PATCH net-next v2 09/12] net-sysfs: remove the rtnl lock when accessing the xps maps

2021-02-08 Thread Antoine Tenart
Now that nr_ids and num_tc are stored in the xps dev_maps, which are RCU protected, we do not have the need to protect the xps_cpus_show and xps_rxqs_show functions with the rtnl lock. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 26 -- 1 file changed, 4

[PATCH net-next v2 03/12] net-sysfs: make xps_cpus_show and xps_rxqs_show consistent

2021-02-08 Thread Antoine Tenart
Make the implementations of xps_cpus_show and xps_rxqs_show to converge, as the two share the same logic but diverted over time. This should not modify their behaviour but will help future changes and improve maintenance. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 33

[PATCH net-next v2 02/12] net-sysfs: store the return of get_netdev_queue_index in an unsigned int

2021-02-08 Thread Antoine Tenart
In net-sysfs, get_netdev_queue_index returns an unsigned int. Some of its callers use an unsigned long to store the returned value. Update the code to be consistent, this should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 11 +++ 1 file changed, 7

[PATCH net-next v2 01/12] net-sysfs: convert xps_cpus_show to bitmap_zalloc

2021-02-08 Thread Antoine Tenart
Use bitmap_zalloc instead of zalloc_cpumask_var in xps_cpus_show to align with xps_rxqs_show. This will improve maintenance and allow us to factorize the two functions. The function should behave the same. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 12 ++-- 1 file changed

[PATCH net-next v2 00/12] net: xps: improve the xps maps handling

2021-02-08 Thread Antoine Tenart
r_cpu_ids/dev->num_rx_queues in xps_queue_show when dev_maps hasn't been allocated yet for backward compatibility. Antoine Tenart (12): net-sysfs: convert xps_cpus_show to bitmap_zalloc net-sysfs: store the return of get_netdev_queue_index in an unsigned int net-sysfs: make

[PATCH net-next 08/11] net: assert the rtnl lock is held when calling __netif_set_xps_queue

2021-01-28 Thread Antoine Tenart
Add ASSERT_RTNL at the top of __netif_set_xps_queue and add a comment about holding the rtnl lock before the function. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core

[PATCH net-next 06/11] net: improve queue removal readability in __netif_set_xps_queue

2021-01-28 Thread Antoine Tenart
Improve the readability of the loop removing tx-queue from unused CPUs/rx-queues in __netif_set_xps_queue. The change should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/dev.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/core/dev.c b

[PATCH net-next 07/11] net: xps: embed nr_ids in dev_maps

2021-01-28 Thread Antoine Tenart
Embed nr_ids (the number of cpu for the xps cpus map, and the number of rxqs for the xps cpus map) in dev_maps. That will help not accessing out of bound memory if those values change after dev_maps was allocated. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- include/linux

[PATCH net-next 09/11] net: remove the xps possible_mask

2021-01-28 Thread Antoine Tenart
Remove the xps possible_mask. It was an optimization but we can just loop from 0 to nr_ids now that it is embedded in the xps dev_maps. That simplifies the code a bit. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 43

[PATCH net-next 05/11] net: add an helper to copy xps maps to the new dev_maps

2021-01-28 Thread Antoine Tenart
This patch adds an helper, xps_copy_dev_maps, to copy maps from dev_maps to new_dev_maps at a given index. The logic should be the same, with an improved code readability and maintenance. Signed-off-by: Antoine Tenart --- net/core/dev.c | 45 + 1 file

[PATCH net-next 11/11] net: move the xps maps to an array

2021-01-28 Thread Antoine Tenart
. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- drivers/net/virtio_net.c | 2 +- include/linux/netdevice.h | 17 + net/core/dev.c| 73 +-- net/core/net-sysfs.c | 13 +++ 4 files changed, 48 insertions(+), 57 deletions

[PATCH net-next 10/11] net-sysfs: remove the rtnl lock when accessing the xps maps

2021-01-28 Thread Antoine Tenart
Now that nr_ids and num_tc are stored in the xps dev_maps, which are RCU protected, we do not have the need to protect the xps_queue_show function with the rtnl lock. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/net

[PATCH net-next 03/11] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-01-28 Thread Antoine Tenart
, xps_queue_show, to improve maintenance. While the rtnl lock could be held in the new xps_queue_show, it is still held in xps_cpus_show and xps_rxqs_show as this is an important information when looking at those two functions. This does not add complexity. Signed-off-by: Antoine Tenart --- net/core/net

[PATCH net-next 02/11] net-sysfs: store the return of get_netdev_queue_index in an unsigned int

2021-01-28 Thread Antoine Tenart
In net-sysfs, get_netdev_queue_index returns an unsigned int. Some of its callers use an unsigned long to store the returned value. Update the code to be consistent, this should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 11 +++ 1 file changed, 7

[PATCH net-next 04/11] net: embed num_tc in the xps maps

2021-01-28 Thread Antoine Tenart
- Checks can be made before accessing the maps so we know the values retrieved will make sense. We also update __netif_set_xps_queue to conditionally copy old maps from dev_maps in the new one only if the number of traffic classes from both maps match. Signed-off-by: Antoine Tenart --

[PATCH net-next 00/11] net: xps: improve the xps maps handling

2021-01-28 Thread Antoine Tenart
Thanks! Antoine [1] https://lore.kernel.org/netdev/20210106180428.722521-1-aten...@kernel.org/ Antoine Tenart (11): net-sysfs: convert xps_cpus_show to bitmap_zalloc net-sysfs: store the return of get_netdev_queue_index in an unsigned int net-sysfs: move the xps cpus/rxqs retrieval in a

[PATCH net-next 01/11] net-sysfs: convert xps_cpus_show to bitmap_zalloc

2021-01-28 Thread Antoine Tenart
Use bitmap_zalloc instead if zalloc_cpumask_var in xps_cpus_show to align with xps_rxqs_show. This will improve maintenance and allow us to factorize the two functions. The function should behave the same. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 12 ++-- 1 file changed

Re: [PATCH net 3/3] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-01-08 Thread Antoine Tenart
Quoting Alexander Duyck (2021-01-08 23:04:57) > On Fri, Jan 8, 2021 at 10:58 AM Antoine Tenart wrote: > > > > Quoting Alexander Duyck (2021-01-08 17:33:01) > > > On Fri, Jan 8, 2021 at 1:07 AM Antoine Tenart wrote: > > > > > > > > Quoting Alexan

Re: [PATCH net 3/3] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-01-08 Thread Antoine Tenart
Quoting Alexander Duyck (2021-01-08 17:33:01) > On Fri, Jan 8, 2021 at 1:07 AM Antoine Tenart wrote: > > > > Quoting Alexander Duyck (2021-01-07 17:38:35) > > > On Thu, Jan 7, 2021 at 12:54 AM Antoine Tenart wrote: > > > > > > > > Quoting Alexan

Re: [PATCH net 3/3] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-01-08 Thread Antoine Tenart
Quoting Alexander Duyck (2021-01-07 17:38:35) > On Thu, Jan 7, 2021 at 12:54 AM Antoine Tenart wrote: > > > > Quoting Alexander Duyck (2021-01-06 20:54:11) > > > On Wed, Jan 6, 2021 at 10:04 AM Antoine Tenart wrote: > > > > That would require to hold rcu_rea

Re: [PATCH net 3/3] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-01-07 Thread Antoine Tenart
Quoting Alexander Duyck (2021-01-06 20:54:11) > On Wed, Jan 6, 2021 at 10:04 AM Antoine Tenart wrote: > > +/* Should be called with the rtnl lock held. */ > > +static int xps_queue_show(struct net_device *dev, unsigned long **mask, > > + uns

[PATCH net 1/3] net-sysfs: convert xps_cpus_show to bitmap_zalloc

2021-01-06 Thread Antoine Tenart
Use bitmap_zalloc instead if zalloc_cpumask_var in xps_cpus_show to align with xps_rxqs_show. This will improve maintenance and allow us to factorize the two functions. The function should behave the same. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 12 ++-- 1 file changed

[PATCH net 0/3] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-01-06 Thread Antoine Tenart
looks better and is easier to review. Thanks! Antoine [1] https://lore.kernel.org/netdev/160875219353.1783433.8066935261216141538@kwain.local/ Antoine Tenart (3): net-sysfs: convert xps_cpus_show to bitmap_zalloc net-sysfs: store the return of get_netdev_queue_index in an unsigned int

[PATCH net 2/3] net-sysfs: store the return of get_netdev_queue_index in an unsigned int

2021-01-06 Thread Antoine Tenart
In net-sysfs, get_netdev_queue_index returns an unsigned int. Some of its callers use an unsigned long to store the returned value. Update the code to be consistent, this should only be cosmetic. Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 11 +++ 1 file changed, 7

[PATCH net 3/3] net-sysfs: move the xps cpus/rxqs retrieval in a common function

2021-01-06 Thread Antoine Tenart
, xps_queue_show, to improve maintenance. While the rtnl lock could be held in the new xps_queue_show, it is still held in xps_cpus_show and xps_rxqs_show as this is an important information when looking at those two functions. This does not add complexity. Signed-off-by: Antoine Tenart --- net/core/net

[PATCH net v3 1/4] net-sysfs: take the rtnl lock when storing xps_cpus

2020-12-23 Thread Antoine Tenart
_queue, netdev_set_num_tc and netdev_reset_tc should be mutually exclusive. We do that by taking the rtnl lock in xps_cpus_store. Fixes: 184c449f91fe ("net: Add support for XPS with QoS via traffic classes") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 6 ++ 1 file changed,

[PATCH net v3 3/4] net-sysfs: take the rtnl lock when storing xps_rxqs

2020-12-23 Thread Antoine Tenart
_queue, netdev_set_num_tc and netdev_reset_tc should be mutually exclusive. We do that by taking the rtnl lock in xps_rxqs_store. Fixes: 8af2c06ff4b1 ("net-sysfs: Add interface for Rx queue(s) map per Tx queue") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 7 +++ 1 file

[PATCH net v3 4/4] net-sysfs: take the rtnl lock when accessing xps_rxqs_map and num_tc

2020-12-23 Thread Antoine Tenart
("net-sysfs: Add interface for Rx queue(s) map per Tx queue") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 62ca2f2c0ee6..daf502c13d6d 100644

[PATCH net v3 2/4] net-sysfs: take the rtnl lock when accessing xps_cpus_map and num_tc

2020-12-23 Thread Antoine Tenart
;net: Add support for XPS with QoS via traffic classes") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 7cc15dec1717..65886bfbf822 100644

[PATCH net v3 0/4] net-sysfs: fix race conditions in the xps code

2020-12-23 Thread Antoine Tenart
Thanks! Antoine Antoine Tenart (4): net-sysfs: take the rtnl lock when storing xps_cpus net-sysfs: take the rtnl lock when accessing xps_cpus_map and num_tc net-sysfs: take the rtnl lock when storing xps_rxqs net-sysfs: take the rtnl lock when accessing xps_rxqs_map and num_tc net/

Re: [PATCH net v2 1/3] net: fix race conditions in xps by locking the maps and dev->tc_num

2020-12-23 Thread Antoine Tenart
Quoting Jakub Kicinski (2020-12-23 21:43:15) > On Wed, 23 Dec 2020 21:35:15 +0100 Antoine Tenart wrote: > > > > - For net-next, to resend patches 2 and 3 from v2 (they'll have to be > > > > slightly reworked, to take into account the review from Alexander a

Re: [PATCH net v2 1/3] net: fix race conditions in xps by locking the maps and dev->tc_num

2020-12-23 Thread Antoine Tenart
Quoting Jakub Kicinski (2020-12-23 21:11:10) > On Wed, 23 Dec 2020 20:36:33 +0100 Antoine Tenart wrote: > > Quoting Jakub Kicinski (2020-12-23 19:27:29) > > > On Tue, 22 Dec 2020 08:12:28 -0800 Alexander Duyck wrote: > > > > On Tue, Dec 22, 2020 at 1:21 AM

Re: [PATCH net v2 1/3] net: fix race conditions in xps by locking the maps and dev->tc_num

2020-12-23 Thread Antoine Tenart
Hi Jakub, Quoting Jakub Kicinski (2020-12-23 19:27:29) > On Tue, 22 Dec 2020 08:12:28 -0800 Alexander Duyck wrote: > > On Tue, Dec 22, 2020 at 1:21 AM Antoine Tenart wrote: > > > > > If I understood correctly, as things are a bit too complex now, you > > >

Re: [PATCH net v2 1/3] net: fix race conditions in xps by locking the maps and dev->tc_num

2020-12-22 Thread Antoine Tenart
Hello Alexander, Jakub, Quoting Alexander Duyck (2020-12-22 00:21:57) > > Looking over this patch it seems kind of obvious that extending the > xps_map_mutex is making things far more complex then they need to be. > > Applying the rtnl_mutex would probably be much simpler. Although as I > think

Re: [PATCH net v2 2/3] net: move the xps cpus retrieval out of net-sysfs

2020-12-22 Thread Antoine Tenart
Hi Alexander, Quoting Alexander Duyck (2020-12-21 23:33:15) > > One thing I might change is to actually bump this patch up in the > patch set as I think it would probably make things a bit cleaner to > read as you are going to be moving the other functions to this pattern > as well. Right. If it

[PATCH net v2 3/3] net: move the xps rxqs retrieval out of net-sysfs

2020-12-21 Thread Antoine Tenart
s to keep xps_cpus_show and xps_rxqs_show synced as their logic is the same (as in __netif_set_xps_queue, the function allocating and setting them up). Fixes: 8af2c06ff4b1 ("net-sysfs: Add interface for Rx queue(s) map per Tx queue") Signed-off-by: Antoine Tenart --- include/linux/netdevic

[PATCH net v2 2/3] net: move the xps cpus retrieval out of net-sysfs

2020-12-21 Thread Antoine Tenart
e xps_map mutex is defined and used. Fixes: 184c449f91fe ("net: Add support for XPS with QoS via traffic classes") Signed-off-by: Antoine Tenart --- include/linux/netdevice.h | 8 ++ net/core/dev.c| 59 +++ net/c

[PATCH net v2 0/3] net-sysfs: fix race conditions in the xps code

2020-12-21 Thread Antoine Tenart
. I updated its commit log to describe both races. Thanks! Antoine Antoine Tenart (3): net: fix race conditions in xps by locking the maps and dev->tc_num net: move the xps cpus retrieval out of net-sysfs net: move the xps rxqs retrieval out of net-sysfs include/linux/netdevice.h | 9 +

[PATCH net v2 1/3] net: fix race conditions in xps by locking the maps and dev->tc_num

2020-12-21 Thread Antoine Tenart
This is why the patch is a little bit longer, and moves netdev_unbind_sb_channel up in the file. Fixes: 184c449f91fe ("net: Add support for XPS with QoS via traffic classes") Signed-off-by: Antoine Tenart --- net/core/dev.c | 122 -

Re: [PATCH net 1/4] net-sysfs: take the rtnl lock when storing xps_cpus

2020-12-19 Thread Antoine Tenart
Hi Jakub, Alexander, Quoting Alexander Duyck (2020-12-19 02:41:08) > On Fri, Dec 18, 2020 at 4:30 PM Jakub Kicinski wrote: > > > > Two things: (a) is the datapath not exposed to a similar problem? > > __get_xps_queue_idx() uses dev->tc_num in a very similar fashion. > > I think we are shielded f

Re: [PATCH net 1/4] net-sysfs: take the rtnl lock when storing xps_cpus

2020-12-18 Thread Antoine Tenart
oss > # install riscv cross compiling tool for clang build > # apt-get install binutils-riscv64-linux-gnu > # > https://github.com/0day-ci/linux/commit/f989c3dcbe4d9abd1c6c48b34f08c6c0cd9d44b3 > git remote add linux-review https://github.com/0day-ci/l

Re: [PATCH net] net: mvpp2: Add TCAM entry to drop flow control pause frames

2020-12-17 Thread Antoine Tenart
Quoting stef...@marvell.com (2020-12-17 18:45:06) > From: Stefan Chulski > > Issue: > Flow control frame used to pause GoP(MAC) was delivered to the CPU > and created a load on the CPU. Since XOFF/XON frames are used only > by MAC, these frames should be dropped inside MAC. > > Fix: > According

Re: [PATCH net] net: mvpp2: prs: fix PPPoE with ipv6 packet parse

2020-12-17 Thread Antoine Tenart
Hi Stefan, Quoting stef...@marvell.com (2020-12-17 18:23:11) > From: Stefan Chulski > > Current PPPoE+IPv6 entry is jumping to 'next-hdr' > field and not to 'DIP' field as done for IPv4. > > Fixes: db9d7d36eecc ("net: mvpp2: Split the PPv2 driver to a dedicated > directory") That's not the co

[PATCH net 1/4] net-sysfs: take the rtnl lock when storing xps_cpus

2020-12-17 Thread Antoine Tenart
in a concurrent thread. With the right timing an oops is triggered. Fixes: 184c449f91fe ("net: Add support for XPS with QoS via traffic classes") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/net/core/net-sysfs.c b/n

[PATCH net 2/4] net-sysfs: take the rtnl lock when accessing xps_cpus_map and num_tc

2020-12-17 Thread Antoine Tenart
;net: Add support for XPS with QoS via traffic classes") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 7cc15dec1717..65886bfbf822 100644

[PATCH net 3/4] net-sysfs: take the rtnl lock when storing xps_rxqs

2020-12-17 Thread Antoine Tenart
o xps_rxqs in a concurrent thread. With the right timing an oops is triggered. Fixes: 8af2c06ff4b1 ("net-sysfs: Add interface for Rx queue(s) map per Tx queue") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/net/core/n

[PATCH net 0/4] net-sysfs: fix race conditions in the xps code

2020-12-17 Thread Antoine Tenart
is given in each of the commit logs. Thanks! Antoine Antoine Tenart (4): net-sysfs: take the rtnl lock when storing xps_cpus net-sysfs: take the rtnl lock when accessing xps_cpus_map and num_tc net-sysfs: take the rtnl lock when storing xps_rxqs net-sysfs: take the rtnl lock when access

[PATCH net 4/4] net-sysfs: take the rtnl lock when accessing xps_rxqs_map and num_tc

2020-12-17 Thread Antoine Tenart
("net-sysfs: Add interface for Rx queue(s) map per Tx queue") Signed-off-by: Antoine Tenart --- net/core/net-sysfs.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 62ca2f2c0ee6..daf502c13d6d 100644

  1   2   3   4   5   6   7   8   >