netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	David Ahern <dsahern@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>
Subject: [PATCH v2 net-next 0/4] ipv4: Namespacify IPv4 address hash table.
Date: Fri, 4 Oct 2024 12:59:54 -0700	[thread overview]
Message-ID: <20241004195958.64396-1-kuniyu@amazon.com> (raw)

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:
  v2:
    * Drop patch 5
    * Fix sparse warning in patch 4, (__force u32)

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


Kuniyuki Iwashima (4):
  ipv4: Link IPv4 address to per-net hash table.
  ipv4: Use per-net 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         | 73 +++++++++++++++++++++-----------------
 3 files changed, 43 insertions(+), 34 deletions(-)

-- 
2.30.2


             reply	other threads:[~2024-10-04 20:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-04 19:59 Kuniyuki Iwashima [this message]
2024-10-04 19:59 ` [PATCH v2 net-next 1/4] ipv4: Link IPv4 address to per-netns hash table Kuniyuki Iwashima
2024-10-04 19:59 ` [PATCH v2 net-next 2/4] ipv4: Use per-netns hash table in inet_lookup_ifaddr_rcu() Kuniyuki Iwashima
2024-10-04 19:59 ` [PATCH v2 net-next 3/4] ipv4: Namespacify IPv4 address GC Kuniyuki Iwashima
2024-10-04 19:59 ` [PATCH v2 net-next 4/4] ipv4: Retire global IPv4 hash table inet_addr_lst Kuniyuki Iwashima
2024-10-08 11:10   ` Paolo Abeni
2024-10-08 11:21     ` Eric Dumazet
2024-10-08 17:09       ` Kuniyuki Iwashima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241004195958.64396-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).