mbox series

[v3,net-next,0/4] ipv4: Namespacify IPv4 address hash table.

Message ID 20241008172906.1326-1-kuniyu@amazon.com (mailing list archive)
Headers show
Series ipv4: Namespacify IPv4 address hash table. | expand

Message

Kuniyuki Iwashima Oct. 8, 2024, 5:29 p.m. UTC
This is a prep of per-net RTNL conversion for RTM_(NEW|DEL|SET)ADDR.

Currently, each IPv4 address is linked to the global hash table, and
this needs to be protected by another global lock or namespacified to
support per-net RTNL.

Adding a global lock will cause deadlock in the rtnetlink path and GC,

  rtnetlink                      check_lifetime
  |- rtnl_net_lock(net)          |- acquire the global lock
  |- acquire the global lock     |- check ifa's netns
  `- put ifa into hash table     `- rtnl_net_lock(net)

so we need to namespacify the hash table.

The IPv6 one is already namespacified, let's follow that.


Changes:
  v3:
    * Patch 4
      * Drop change in inet_addr_hash()

  v2: https://lore.kernel.org/netdev/20241004195958.64396-1-kuniyu@amazon.com/
    * Drop patch 5
    * Patch 4
      * Fix sparse warning (__force u32)

  v1: https://lore.kernel.org/netdev/20241001024837.96425-1-kuniyu@amazon.com/


Kuniyuki Iwashima (4):
  ipv4: Link IPv4 address to per-netns hash table.
  ipv4: Use per-netns hash table in inet_lookup_ifaddr_rcu().
  ipv4: Namespacify IPv4 address GC.
  ipv4: Retire global IPv4 hash table inet_addr_lst.

 include/linux/inetdevice.h |  2 +-
 include/net/netns/ipv4.h   |  2 ++
 net/ipv4/devinet.c         | 69 +++++++++++++++++++++-----------------
 3 files changed, 42 insertions(+), 31 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 10, 2024, 3:40 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 8 Oct 2024 10:29:02 -0700 you wrote:
> This is a prep of per-net RTNL conversion for RTM_(NEW|DEL|SET)ADDR.
> 
> Currently, each IPv4 address is linked to the global hash table, and
> this needs to be protected by another global lock or namespacified to
> support per-net RTNL.
> 
> Adding a global lock will cause deadlock in the rtnetlink path and GC,
> 
> [...]

Here is the summary with links:
  - [v3,net-next,1/4] ipv4: Link IPv4 address to per-netns hash table.
    https://git.kernel.org/netdev/net-next/c/87173021f158
  - [v3,net-next,2/4] ipv4: Use per-netns hash table in inet_lookup_ifaddr_rcu().
    https://git.kernel.org/netdev/net-next/c/49e613194292
  - [v3,net-next,3/4] ipv4: Namespacify IPv4 address GC.
    https://git.kernel.org/netdev/net-next/c/1675f385213e
  - [v3,net-next,4/4] ipv4: Retire global IPv4 hash table inet_addr_lst.
    https://git.kernel.org/netdev/net-next/c/99ee348e6a41

You are awesome, thank you!