netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] inet: convert to exit_batch_rtnl
@ 2024-02-08 11:16 Eric Dumazet
  2024-02-08 11:16 ` [PATCH net-next 1/4] ip6mr: use exit_batch_rtnl method Eric Dumazet
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Eric Dumazet @ 2024-02-08 11:16 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: David Ahern, netdev, eric.dumazet, Eric Dumazet

Even if these four modules exit_batch methods do not unregister
devices, it is worth converting them to exit_batch_rtnl
to save rtnl_lock()/rtnl_unlock() pairs in netns dismantles.

Eric Dumazet (4):
  ip6mr: use exit_batch_rtnl method
  ipv6: fib6: use exit_batch_rtnl method
  ipmr: use exit_batch_rtnl method
  ipv4: fib: use exit_batch_rtnl method

 net/ipv4/fib_frontend.c | 8 +++-----
 net/ipv4/ipmr.c         | 7 +++----
 net/ipv6/fib6_rules.c   | 7 +++----
 net/ipv6/ip6mr.c        | 7 +++----
 4 files changed, 12 insertions(+), 17 deletions(-)

-- 
2.43.0.594.gd9cf4e227d-goog


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

* [PATCH net-next 1/4] ip6mr: use exit_batch_rtnl method
  2024-02-08 11:16 [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
@ 2024-02-08 11:16 ` Eric Dumazet
  2024-02-08 11:16 ` [PATCH net-next 2/4] ipv6: fib6: " Eric Dumazet
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2024-02-08 11:16 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: David Ahern, netdev, eric.dumazet, Eric Dumazet

Using exit_batch_rtnl method instead of exit_batch avoids
one rtnl_lock()/rtnl_unlock() pair in netns dismantle.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/ip6mr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 9782c180fee646ab0fad7f0f911254b4b3a592c4..ed2cf29bc9d1bcddbf325860769138ce970f7f18 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1353,20 +1353,19 @@ static void __net_exit ip6mr_net_exit(struct net *net)
 	ip6mr_notifier_exit(net);
 }
 
-static void __net_exit ip6mr_net_exit_batch(struct list_head *net_list)
+static void __net_exit ip6mr_net_exit_batch_rtnl(struct list_head *net_list,
+						 struct list_head *dev_to_kill)
 {
 	struct net *net;
 
-	rtnl_lock();
 	list_for_each_entry(net, net_list, exit_list)
 		ip6mr_rules_exit(net);
-	rtnl_unlock();
 }
 
 static struct pernet_operations ip6mr_net_ops = {
 	.init = ip6mr_net_init,
 	.exit = ip6mr_net_exit,
-	.exit_batch = ip6mr_net_exit_batch,
+	.exit_batch_rtnl = ip6mr_net_exit_batch_rtnl,
 };
 
 int __init ip6_mr_init(void)
-- 
2.43.0.594.gd9cf4e227d-goog


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

* [PATCH net-next 2/4] ipv6: fib6: use exit_batch_rtnl method
  2024-02-08 11:16 [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
  2024-02-08 11:16 ` [PATCH net-next 1/4] ip6mr: use exit_batch_rtnl method Eric Dumazet
@ 2024-02-08 11:16 ` Eric Dumazet
  2024-02-08 11:16 ` [PATCH net-next 3/4] ipmr: " Eric Dumazet
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2024-02-08 11:16 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: David Ahern, netdev, eric.dumazet, Eric Dumazet

Using exit_batch_rtnl method instead of exit_batch avoids
one rtnl_lock()/rtnl_unlock() pair in netns dismantle.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/fib6_rules.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 7523c4baef35e23d39e9537943593107a79ff551..44194332ee09f673d993271f2e1f278bd6f2c5a2 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -493,21 +493,20 @@ static int __net_init fib6_rules_net_init(struct net *net)
 	goto out;
 }
 
-static void __net_exit fib6_rules_net_exit_batch(struct list_head *net_list)
+static void __net_exit fib6_rules_exit_batch_rtnl(struct list_head *net_list,
+						  struct list_head *dev_to_kill)
 {
 	struct net *net;
 
-	rtnl_lock();
 	list_for_each_entry(net, net_list, exit_list) {
 		fib_rules_unregister(net->ipv6.fib6_rules_ops);
 		cond_resched();
 	}
-	rtnl_unlock();
 }
 
 static struct pernet_operations fib6_rules_net_ops = {
 	.init = fib6_rules_net_init,
-	.exit_batch = fib6_rules_net_exit_batch,
+	.exit_batch_rtnl = fib6_rules_exit_batch_rtnl,
 };
 
 int __init fib6_rules_init(void)
-- 
2.43.0.594.gd9cf4e227d-goog


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

* [PATCH net-next 3/4] ipmr: use exit_batch_rtnl method
  2024-02-08 11:16 [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
  2024-02-08 11:16 ` [PATCH net-next 1/4] ip6mr: use exit_batch_rtnl method Eric Dumazet
  2024-02-08 11:16 ` [PATCH net-next 2/4] ipv6: fib6: " Eric Dumazet
@ 2024-02-08 11:16 ` Eric Dumazet
  2024-02-08 11:53   ` Eric Dumazet
                     ` (2 more replies)
  2024-02-08 11:16 ` [PATCH net-next 4/4] ipv4: fib: " Eric Dumazet
  2024-02-08 17:54 ` [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
  4 siblings, 3 replies; 9+ messages in thread
From: Eric Dumazet @ 2024-02-08 11:16 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: David Ahern, netdev, eric.dumazet, Eric Dumazet

Using exit_batch_rtnl method instead of exit_batch avoids
one rtnl_lock()/rtnl_unlock() pair in netns dismantle.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/ipmr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 3622298365105d99c0277f1c1616fb5fc63cdc2d..708c79c465e7212d24d2eb74165b227b9bde1c5f 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -3119,20 +3119,19 @@ static void __net_exit ipmr_net_exit(struct net *net)
 	ipmr_notifier_exit(net);
 }
 
-static void __net_exit ipmr_net_exit_batch(struct list_head *net_list)
+static void __net_exit ipmr_exit_batch_rtnl(struct list_head *net_list,
+					    struct list_head *dev_to_kill)
 {
 	struct net *net;
 
-	rtnl_lock();
 	list_for_each_entry(net, net_list, exit_list)
 		ipmr_rules_exit(net);
-	rtnl_unlock();
 }
 
 static struct pernet_operations ipmr_net_ops = {
 	.init = ipmr_net_init,
 	.exit = ipmr_net_exit,
-	.exit_batch = ipmr_net_exit_batch,
+	.exit_batch = ipmr_exit_batch_rtnl,
 };
 
 int __init ip_mr_init(void)
-- 
2.43.0.594.gd9cf4e227d-goog


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

* [PATCH net-next 4/4] ipv4: fib: use exit_batch_rtnl method
  2024-02-08 11:16 [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
                   ` (2 preceding siblings ...)
  2024-02-08 11:16 ` [PATCH net-next 3/4] ipmr: " Eric Dumazet
@ 2024-02-08 11:16 ` Eric Dumazet
  2024-02-08 17:54 ` [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
  4 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2024-02-08 11:16 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: David Ahern, netdev, eric.dumazet, Eric Dumazet

Using exit_batch_rtnl method instead of exit_batch avoids
one rtnl_lock()/rtnl_unlock() pair in netns dismantle.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/fib_frontend.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 390f4be7f7bec20f33aa80e9bf12d5e2f3760562..b5f52639aeda382ac959d3207a18d0d088bcb297 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1631,21 +1631,19 @@ static void __net_exit fib_net_exit(struct net *net)
 	nl_fib_lookup_exit(net);
 }
 
-static void __net_exit fib_net_exit_batch(struct list_head *net_list)
+static void __net_exit fib_net_exit_batch_rtnl(struct list_head *net_list,
+					       struct list_head *dev_to_kill)
 {
 	struct net *net;
 
-	rtnl_lock();
 	list_for_each_entry(net, net_list, exit_list)
 		ip_fib_net_exit(net);
-
-	rtnl_unlock();
 }
 
 static struct pernet_operations fib_net_ops = {
 	.init = fib_net_init,
 	.exit = fib_net_exit,
-	.exit_batch = fib_net_exit_batch,
+	.exit_batch_rtnl = fib_net_exit_batch_rtnl,
 };
 
 void __init ip_fib_init(void)
-- 
2.43.0.594.gd9cf4e227d-goog


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

* Re: [PATCH net-next 3/4] ipmr: use exit_batch_rtnl method
  2024-02-08 11:16 ` [PATCH net-next 3/4] ipmr: " Eric Dumazet
@ 2024-02-08 11:53   ` Eric Dumazet
  2024-02-09  8:01   ` kernel test robot
  2024-02-09 12:26   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2024-02-08 11:53 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: David Ahern, netdev, eric.dumazet

On Thu, Feb 8, 2024 at 12:16 PM Eric Dumazet <edumazet@google.com> wrote:
>
> Using exit_batch_rtnl method instead of exit_batch avoids
> one rtnl_lock()/rtnl_unlock() pair in netns dismantle.
>



>
>  static struct pernet_operations ipmr_net_ops = {
>         .init = ipmr_net_init,
>         .exit = ipmr_net_exit,
> -       .exit_batch = ipmr_net_exit_batch,
> +       .exit_batch = ipmr_exit_batch_rtnl,
>  };

Oh well, I thought I fixed this error, I must have missed a step.

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

* Re: [PATCH net-next 0/4] inet: convert to exit_batch_rtnl
  2024-02-08 11:16 [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
                   ` (3 preceding siblings ...)
  2024-02-08 11:16 ` [PATCH net-next 4/4] ipv4: fib: " Eric Dumazet
@ 2024-02-08 17:54 ` Eric Dumazet
  4 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2024-02-08 17:54 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: David Ahern, netdev, eric.dumazet

On Thu, Feb 8, 2024 at 12:16 PM Eric Dumazet <edumazet@google.com> wrote:
>
> Even if these four modules exit_batch methods do not unregister
> devices, it is worth converting them to exit_batch_rtnl
> to save rtnl_lock()/rtnl_unlock() pairs in netns dismantles.
>

Please ignore the whole series, more work is needed.

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

* Re: [PATCH net-next 3/4] ipmr: use exit_batch_rtnl method
  2024-02-08 11:16 ` [PATCH net-next 3/4] ipmr: " Eric Dumazet
  2024-02-08 11:53   ` Eric Dumazet
@ 2024-02-09  8:01   ` kernel test robot
  2024-02-09 12:26   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-02-09  8:01 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: oe-kbuild-all, David Ahern, netdev, eric.dumazet, Eric Dumazet

Hi Eric,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/ip6mr-use-exit_batch_rtnl-method/20240208-192057
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240208111646.535705-4-edumazet%40google.com
patch subject: [PATCH net-next 3/4] ipmr: use exit_batch_rtnl method
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20240209/202402091528.IEa4ESwN-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240209/202402091528.IEa4ESwN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402091528.IEa4ESwN-lkp@intel.com/

All errors (new ones prefixed by >>):

>> net/ipv4/ipmr.c:3134:23: error: initialization of 'void (*)(struct list_head *)' from incompatible pointer type 'void (*)(struct list_head *, struct list_head *)' [-Werror=incompatible-pointer-types]
    3134 |         .exit_batch = ipmr_exit_batch_rtnl,
         |                       ^~~~~~~~~~~~~~~~~~~~
   net/ipv4/ipmr.c:3134:23: note: (near initialization for 'ipmr_net_ops.exit_batch')
   cc1: some warnings being treated as errors


vim +3134 net/ipv4/ipmr.c

  3130	
  3131	static struct pernet_operations ipmr_net_ops = {
  3132		.init = ipmr_net_init,
  3133		.exit = ipmr_net_exit,
> 3134		.exit_batch = ipmr_exit_batch_rtnl,
  3135	};
  3136	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH net-next 3/4] ipmr: use exit_batch_rtnl method
  2024-02-08 11:16 ` [PATCH net-next 3/4] ipmr: " Eric Dumazet
  2024-02-08 11:53   ` Eric Dumazet
  2024-02-09  8:01   ` kernel test robot
@ 2024-02-09 12:26   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-02-09 12:26 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: llvm, oe-kbuild-all, David Ahern, netdev, eric.dumazet, Eric Dumazet

Hi Eric,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/ip6mr-use-exit_batch_rtnl-method/20240208-192057
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240208111646.535705-4-edumazet%40google.com
patch subject: [PATCH net-next 3/4] ipmr: use exit_batch_rtnl method
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240209/202402092023.Upwn6RGF-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240209/202402092023.Upwn6RGF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402092023.Upwn6RGF-lkp@intel.com/

All errors (new ones prefixed by >>):

>> net/ipv4/ipmr.c:3134:16: error: incompatible function pointer types initializing 'void (*)(struct list_head *)' with an expression of type 'void (struct list_head *, struct list_head *)' [-Wincompatible-function-pointer-types]
    3134 |         .exit_batch = ipmr_exit_batch_rtnl,
         |                       ^~~~~~~~~~~~~~~~~~~~
   1 error generated.


vim +3134 net/ipv4/ipmr.c

  3130	
  3131	static struct pernet_operations ipmr_net_ops = {
  3132		.init = ipmr_net_init,
  3133		.exit = ipmr_net_exit,
> 3134		.exit_batch = ipmr_exit_batch_rtnl,
  3135	};
  3136	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-02-09 12:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 11:16 [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet
2024-02-08 11:16 ` [PATCH net-next 1/4] ip6mr: use exit_batch_rtnl method Eric Dumazet
2024-02-08 11:16 ` [PATCH net-next 2/4] ipv6: fib6: " Eric Dumazet
2024-02-08 11:16 ` [PATCH net-next 3/4] ipmr: " Eric Dumazet
2024-02-08 11:53   ` Eric Dumazet
2024-02-09  8:01   ` kernel test robot
2024-02-09 12:26   ` kernel test robot
2024-02-08 11:16 ` [PATCH net-next 4/4] ipv4: fib: " Eric Dumazet
2024-02-08 17:54 ` [PATCH net-next 0/4] inet: convert to exit_batch_rtnl Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).