neighbour: Convert RTM_GETNEIGHTBL and RTM_SETNEIGHTBL to RCU.
Subsystems (4)
cover neighbour: Convert RTM_GETNEIGHTBL and RTM_SETNEIGHTBL to RCU.
Patch 1 & 2 are prep for RCU conversion for RTM_GETNEIGHTBL.
Patch 3 & 4 converts RTM_GETNEIGHTBL and RTM_SETNEIGHTBL to RCU.
Patch 5 converts the neighbour table rwlock to the plain spinlock.
Kuniyuki Iwashima (5):
neighbour: Use RCU list helpers for neigh_parms.list writers.
neighbour: Annotate access to neigh_parms fields.
neighbour: Convert RTM_GETNEIGHTBL to RCU.
neighbour: Convert RTM_SETNEIGHTBL to RCU.
neighbour: Convert rwlock of struct neigh_table to spinlock.
include/net/neighbour.h | 17 ++++-- net/atm/clip.c | 4 +- net/core/neighbour.c | 131 ++++++++++++++++++++-------------------- net/ipv4/arp.c | 4 +- net/ipv6/ndisc.c | 8 +-- 5 files changed, 87 insertions(+), 77 deletions(-)
Signature · 1 line
2.51.0.915.g61a8936c21-goog
PATCH 1/5 neighbour: Use RCU list helpers for neigh_parms.list writers.
We will convert RTM_GETNEIGHTBL to RCU soon, where we traverse tbl->parms_list under RCU in neightbl_dump_info().
Let's use RCU list helper for neigh_parms in neigh_parms_alloc() and neigh_parms_release().
neigh_table_init() uses the plain list_add() for the default neigh_parm that is embedded in the table and not yet published.
Note that neigh_parms_release() already uses call_rcu() to free neigh_parms.
--- net/core/neighbour.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/neighbour.c +2 -2
@@ -1764,7 +1764,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, }write_lock_bh (&tbl->lock); -list_add (&p->list, &tbl->parms.list); +list_add_rcu (&p->list, &tbl->parms.list);write_unlock_bh (&tbl->lock);neigh_parms_data_state_cleanall (p);
@@ -1786,7 +1786,7 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)if (!parms || parms == &tbl->parms)return ;write_lock_bh (&tbl->lock); -list_del (&parms->list); +list_del_rcu (&parms->list); parms->dead =1 ;write_unlock_bh (&tbl->lock);netdev_put (parms->dev, &parms->dev_tracker);
Signature · 1 line
2.51.0.915.g61a8936c21-goog
Re: [PATCH v1 net-next 1/5] neighbour: Use RCU list helpers for neigh_parms.list writers.
Quoted 7 lines · Kuniyuki Iwashima
We will convert
RTM_GETNEIGHTBLto RCU soon, where we traversetbl->parms_listunder RCU inneightbl_dump_info().Let's use RCU list helper for
neigh_parmsinneigh_parms_alloc()andneigh_parms_release().
Quoted 7 lines
neigh_table_init()uses the plainlist_add()for the defaultneigh_parmthat is embedded in the table and not yet published.Note that
neigh_parms_release()already usescall_rcu()to freeneigh_parms.Signed-off-by Kuniyuki Iwashima <[email protected]>
PATCH 2/5 neighbour: Annotate access to neigh_parms fields.
In reply to Kuniyuki IwashimaNEIGH_VAR() is read locklessly in the fast path, and IPv6 ndisc uses NEIGH_VAR_SET() locklessly.
The next patch will convert neightbl_dump_info() to RCU.
Let's annotate accesses to neigh_param with READ_ONCE() and WRITE_ONCE().
Note that ndisc_ifinfo_sysctl_change() uses &NEIGH_VAR() and we cannot use '&' with READ_ONCE(), so NEIGH_VAR_PTR() is introduced.
Note also that NEIGH_VAR_INIT() does not need WRITE_ONCE() as it is before parms is published. Also, the only user hippi_neigh_setup_dev() is no longer called since commit e3804cbebb67 ("net: remove COMPAT_NET_DEV_OPS"), which looks wrong, but probably no one uses HIPPI and RoadRunner.
--- include/net/neighbour.h | 15 ++++++++++++--- net/core/neighbour.c | 17 ++++++----------- net/ipv6/ndisc.c | 8 ++++---- 3 files changed, 22 insertions(+), 18 deletions(-)
include/net/neighbour.h +12 -3
@@ -92,15 +92,17 @@ struct neigh_parms {static inline void neigh_var_set (struct neigh_parms *p,int index,int val) {set_bit (index, p->data_state); - p->data[index] = val; +WRITE_ONCE (p->data[index], val); } -#define NEIGH_VAR (p, attr) ((p)->data[NEIGH_VAR_ ## attr]) +#define __NEIGH_VAR (p, attr) ((p)->data[NEIGH_VAR_ ## attr]) +#define NEIGH_VAR (p, attr) READ_ONCE(__NEIGH_VAR(p, attr)) +#define NEIGH_VAR_PTR (p, attr) (&(__NEIGH_VAR(p, attr)))/* In ndo_neigh_setup, NEIGH_VAR_INIT should be used. * In other cases, NEIGH_VAR_SET should be used. */ -#define NEIGH_VAR_INIT (p, attr, val) (NEIGH_VAR(p, attr) = val) +#define NEIGH_VAR_INIT (p, attr, val) (__NEIGH_VAR(p, attr) = val)#define NEIGH_VAR_SET (p, attr, val) neigh_var_set(p, NEIGH_VAR_ ## attr, val)static inline void neigh_parms_data_state_setall (struct neigh_parms *p)
@@ -378,6 +380,13 @@ struct net *neigh_parms_net(const struct neigh_parms *parms)unsigned long neigh_rand_reach_time (unsigned long base); +static inline void neigh_set_reach_time (struct neigh_parms *p) +{ +unsigned long base =NEIGH_VAR (p,BASE_REACHABLE_TIME ); + +WRITE_ONCE (p->reachable_time,neigh_rand_reach_time (base)); +} +void pneigh_enqueue (struct neigh_table *tbl,struct neigh_parms *p,struct sk_buff *skb); struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net,
net/core/neighbour.c +6 -11
@@ -995,8 +995,7 @@ static void neigh_periodic_work(struct work_struct *work)WRITE_ONCE (tbl->last_rand, jiffies);list_for_each_entry (p, &tbl->parms_list, list) - p->reachable_time = -neigh_rand_reach_time (NEIGH_VAR (p,BASE_REACHABLE_TIME )); +neigh_set_reach_time (p); }if (atomic_read (&tbl->entries) <READ_ONCE (tbl->gc_thresh1))
@@ -1749,8 +1748,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,if (p) { p->tbl = tbl;refcount_set (&p->refcnt,1 ); - p->reachable_time = -neigh_rand_reach_time (NEIGH_VAR (p,BASE_REACHABLE_TIME )); +neigh_set_reach_time (p); p->qlen =0 ;netdev_hold (dev, &p->dev_tracker,GFP_KERNEL ); p->dev = dev;
@@ -1810,8 +1808,7 @@ void neigh_table_init(int index, struct neigh_table *tbl)list_add (&tbl->parms.list, &tbl->parms_list);write_pnet (&tbl->parms.net, &init_net);refcount_set (&tbl->parms.refcnt,1 ); - tbl->parms.reachable_time = -neigh_rand_reach_time (NEIGH_VAR (&tbl->parms,BASE_REACHABLE_TIME )); +neigh_set_reach_time (&tbl->parms); tbl->parms.qlen =0 ; tbl->stats = alloc_percpu(struct neigh_statistics);
@@ -2194,7 +2191,7 @@ static int neightbl_fill_parms(struct sk_buff *skb, struct neigh_parms *parms) NEIGH_VAR(parms, MCAST_PROBES)) ||nla_put_u32 (skb,NDTPA_MCAST_REPROBES ,NEIGH_VAR (parms,MCAST_REPROBES )) || -nla_put_msecs (skb,NDTPA_REACHABLE_TIME , parms->reachable_time, +nla_put_msecs (skb,NDTPA_REACHABLE_TIME ,READ_ONCE (parms->reachable_time),NDTPA_PAD ) ||nla_put_msecs (skb,NDTPA_BASE_REACHABLE_TIME , NEIGH_VAR(parms, BASE_REACHABLE_TIME), NDTPA_PAD) ||
@@ -2475,8 +2472,7 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh,* only be effective after the next time neigh_periodic_work * decides to recompute it (can be multiple minutes) */ - p->reachable_time = -neigh_rand_reach_time (NEIGH_VAR (p,BASE_REACHABLE_TIME )); +neigh_set_reach_time (p);break ;case NDTPA_GC_STALETIME : NEIGH_VAR_SET(p, GC_STALETIME,
@@ -3721,8 +3717,7 @@ static int neigh_proc_base_reachable_time(const struct ctl_table *ctl, int write* only be effective after the next time neigh_periodic_work * decides to recompute it */ - p->reachable_time = -neigh_rand_reach_time (NEIGH_VAR (p,BASE_REACHABLE_TIME )); +neigh_set_reach_time (p); }return ret; }
net/ipv6/ndisc.c +4 -4
@@ -1449,7 +1449,7 @@ static enum skb_drop_reason ndisc_router_discovery(struct sk_buff *skb) BASE_REACHABLE_TIME, rtime);NEIGH_VAR_SET (in6_dev->nd_parms,GC_STALETIME ,3 * rtime); - in6_dev->nd_parms->reachable_time =neigh_rand_reach_time (rtime); +neigh_set_reach_time (in6_dev->nd_parms); in6_dev->tstamp = jiffies; send_ifinfo_notify = true; }
@@ -1948,9 +1948,9 @@ int ndisc_ifinfo_sysctl_change(const struct ctl_table *ctl, int write, void *buf ret =-1 ;if (write && ret ==0 && dev && (idev =in6_dev_get (dev)) !=NULL ) { -if (ctl->data == &NEIGH_VAR (idev->nd_parms,BASE_REACHABLE_TIME )) - idev->nd_parms->reachable_time = -neigh_rand_reach_time (NEIGH_VAR (idev->nd_parms,BASE_REACHABLE_TIME )); +if (ctl->data ==NEIGH_VAR_PTR (idev->nd_parms,BASE_REACHABLE_TIME )) +neigh_set_reach_time (idev->nd_parms); +WRITE_ONCE (idev->tstamp, jiffies);inet6_ifinfo_notify (RTM_NEWLINK , idev);in6_dev_put (idev);
Signature · 1 line
2.51.0.915.g61a8936c21-goog
Re: [PATCH v1 net-next 2/5] neighbour: Annotate access to neigh_parms fields.
Quoted 11 lines · Kuniyuki Iwashima
NEIGH_VAR()is read locklessly in the fast path, and IPv6 ndisc usesNEIGH_VAR_SET()locklessly.The next patch will convert
neightbl_dump_info()to RCU.Let's annotate accesses to
neigh_paramwithREAD_ONCE()andWRITE_ONCE().Note that
ndisc_ifinfo_sysctl_change()uses&NEIGH_VAR()and we cannot use '&' withREAD_ONCE(), soNEIGH_VAR_PTR()is introduced.
Quoted 6 lines
Note also that
NEIGH_VAR_INIT()does not needWRITE_ONCE()as it is before parms is published. Also, the only userhippi_neigh_setup_dev()is no longer called since commite3804cbebb67("net: removeCOMPAT_NET_DEV_OPS"), which looks wrong, but probably no one uses HIPPI and RoadRunner.Signed-off-by Kuniyuki Iwashima <[email protected]>
PATCH 3/5 neighbour: Convert RTM_GETNEIGHTBL to RCU.
In reply to Kuniyuki Iwashimaneightbl_dump_info() calls these functions for each neigh_tables[] entry:
1. neightbl_fill_info() for tbl->parms
2. neightbl_fill_param_info() for tbl->parms_list (except tbl->parms)
Both functions rely on the table lock (read_lock_bh(&tbl->lock)) and RTNL is not needed.
Let's fetch the table under RCU and convert RTM_GETNEIGHTBL to RCU.
Note that the first entry of tbl->parms_list is tbl->parms.list and embedded in neigh_table, so list_next_entry() is safe.
--- net/core/neighbour.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
net/core/neighbour.c +9 -14
@@ -2176,7 +2176,7 @@ static int neightbl_fill_parms(struct sk_buff *skb, struct neigh_parms *parms)return -ENOBUFS ; if ((parms->dev && - nla_put_u32(skb, NDTPA_IFINDEX, parms->dev->ifindex)) || + nla_put_u32(skb, NDTPA_IFINDEX, READ_ONCE(parms->dev->ifindex))) || nla_put_u32(skb, NDTPA_REFCNT, refcount_read(&parms->refcnt)) || nla_put_u32(skb, NDTPA_QUEUE_LENBYTES, NEIGH_VAR(parms, QUEUE_LEN_BYTES)) ||
@@ -2228,8 +2228,6 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,return -EMSGSIZE ; ndtmsg =nlmsg_data (nlh); - -read_lock_bh (&tbl->lock); ndtmsg->ndtm_family = tbl->family; ndtmsg->ndtm_pad1 =0 ; ndtmsg->ndtm_pad2 =0 ;
@@ -2255,11 +2253,9 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, .ndtc_proxy_qlen = READ_ONCE(tbl->proxy_queue.qlen), }; -rcu_read_lock (); nht =rcu_dereference (tbl->nht); ndc.ndtc_hash_rnd = nht->hash_rnd[0 ]; ndc.ndtc_hash_mask = ((1 << nht->hash_shift) -1 ); -rcu_read_unlock ();if (nla_put (skb,NDTA_CONFIG ,sizeof (ndc), &ndc)) goto nla_put_failure;
@@ -2297,12 +2293,10 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,if (neightbl_fill_parms (skb, &tbl->parms) <0 ) goto nla_put_failure; -read_unlock_bh (&tbl->lock);nlmsg_end (skb, nlh);return 0 ; nla_put_failure: -read_unlock_bh (&tbl->lock);nlmsg_cancel (skb, nlh);return -EMSGSIZE ; }
@@ -2321,8 +2315,6 @@ static int neightbl_fill_param_info(struct sk_buff *skb,return -EMSGSIZE ; ndtmsg =nlmsg_data (nlh); - -read_lock_bh (&tbl->lock); ndtmsg->ndtm_family = tbl->family; ndtmsg->ndtm_pad1 =0 ; ndtmsg->ndtm_pad2 =0 ;
@@ -2331,11 +2323,9 @@ static int neightbl_fill_param_info(struct sk_buff *skb, neightbl_fill_parms(skb, parms) < 0) goto errout; -read_unlock_bh (&tbl->lock);nlmsg_end (skb, nlh);return 0 ; errout: -read_unlock_bh (&tbl->lock);nlmsg_cancel (skb, nlh);return -EMSGSIZE ; }
@@ -2575,10 +2565,12 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb) family = ((struct rtgenmsg *)nlmsg_data (nlh))->rtgen_family; +rcu_read_lock (); +for (tidx =0 ; tidx <NEIGH_NR_TABLES ; tidx++) {struct neigh_parms *p; - tbl =rcu_dereference_rtnl (neigh_tables[tidx]); + tbl =rcu_dereference (neigh_tables[tidx]);if (!tbl)continue ;
@@ -2592,7 +2584,7 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb) nidx =0 ; p =list_next_entry (&tbl->parms, list); -list_for_each_entry_from (p, &tbl->parms_list, list) { +list_for_each_entry_from_rcu (p, &tbl->parms_list, list) {if (!net_eq (neigh_parms_net (p), net))continue ;
@@ -2612,6 +2604,8 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb) neigh_skip =0 ; } out: +rcu_read_unlock (); + cb->args[0 ] = tidx; cb->args[1 ] = nidx;
@@ -3913,7 +3907,8 @@ static const struct rtnl_msg_handler neigh_rtnl_msg_handlers[] __initconst = { {.msgtype = RTM_DELNEIGH, .doit = neigh_delete}, {.msgtype = RTM_GETNEIGH, .doit = neigh_get, .dumpit = neigh_dump_info, .flags = RTNL_FLAG_DOIT_UNLOCKED | RTNL_FLAG_DUMP_UNLOCKED}, - {.msgtype = RTM_GETNEIGHTBL, .dumpit = neightbl_dump_info}, + {.msgtype = RTM_GETNEIGHTBL, .dumpit = neightbl_dump_info, + .flags = RTNL_FLAG_DUMP_UNLOCKED}, {.msgtype = RTM_SETNEIGHTBL, .doit = neightbl_set}, };
Signature · 1 line
2.51.0.915.g61a8936c21-goog
Re: [PATCH v1 net-next 3/5] neighbour: Convert RTM_GETNEIGHTBL to RCU.
Quoted 10 lines · Kuniyuki Iwashima
neightbl_dump_info()calls these functions for each neigh_tables[] entry:1.
neightbl_fill_info()fortbl->parms
2.neightbl_fill_param_info()fortbl->parms_list(excepttbl->parms)Both functions rely on the table lock (
read_lock_bh(&tbl->lock)) and RTNL is not needed.
Quoted 7 lines
Let's fetch the table under RCU and convert
RTM_GETNEIGHTBLto RCU.Note that the first entry of
tbl->parms_lististbl->parms.listand embedded inneigh_table, solist_next_entry()is safe.Signed-off-by Kuniyuki Iwashima <[email protected]>---
PATCH 4/5 neighbour: Convert RTM_SETNEIGHTBL to RCU.
In reply to Kuniyuki Iwashimaneightbl_set() fetches neigh_tables[] and updates attributes under write_lock_bh(&tbl->lock), so RTNL is not needed.
neigh_table_clear() synchronises RCU only, and rcu_dereference_rtnl() protects nothing here.
If we released RCU after fetching neigh_tables[], there would be no synchronisation to block neigh_table_clear() further, so RCU is held until the end of the function.
Another option would be to protect neigh_tables[] user with SRCU and add synchronize_srcu() in neigh_table_clear().
But, holding RCU should be fine as we hold write_lock_bh() for the rest of neightbl_set() anyway.
Let's perform RTM_SETNEIGHTBL under RCU and drop RTNL.
--- net/core/neighbour.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
net/core/neighbour.c +14 -5
@@ -2362,9 +2362,9 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack) {struct net *net =sock_net (skb->sk); +struct nlattr *tb[NDTA_MAX +1 ];struct neigh_table *tbl;struct ndtmsg *ndtmsg; -struct nlattr *tb[NDTA_MAX +1 ];bool found = false;int err, tidx;
@@ -2380,20 +2380,27 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, ndtmsg =nlmsg_data (nlh); +rcu_read_lock (); +for (tidx =0 ; tidx <NEIGH_NR_TABLES ; tidx++) { - tbl =rcu_dereference_rtnl (neigh_tables[tidx]); + tbl =rcu_dereference (neigh_tables[tidx]);if (!tbl)continue ; +if (ndtmsg->ndtm_family && tbl->family != ndtmsg->ndtm_family)continue ; +if (nla_strcmp (tb[NDTA_NAME ], tbl->id) ==0 ) { found = true;break ; } } -if (!found) -return -ENOENT ; +if (!found) { +rcu_read_unlock (); + err = -ENOENT ; + goto errout; + }/* * We acquire tbl->lock to be nice to the periodic timers and
@@ -2519,6 +2526,7 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, errout_tbl_lock:write_unlock_bh (&tbl->lock); +rcu_read_unlock (); errout:return err; }
@@ -3909,7 +3917,8 @@ static const struct rtnl_msg_handler neigh_rtnl_msg_handlers[] __initconst = { .flags = RTNL_FLAG_DOIT_UNLOCKED | RTNL_FLAG_DUMP_UNLOCKED}, {.msgtype = RTM_GETNEIGHTBL, .dumpit = neightbl_dump_info, .flags = RTNL_FLAG_DUMP_UNLOCKED}, - {.msgtype = RTM_SETNEIGHTBL, .doit = neightbl_set}, + {.msgtype = RTM_SETNEIGHTBL, .doit = neightbl_set, + .flags = RTNL_FLAG_DOIT_UNLOCKED}, };static int __init neigh_init (void )
Signature · 1 line
2.51.0.915.g61a8936c21-goog
Re: [PATCH v1 net-next 4/5] neighbour: Convert RTM_SETNEIGHTBL to RCU.
Quoted 14 lines · Kuniyuki Iwashima
neightbl_set()fetches neigh_tables[] and updates attributes underwrite_lock_bh(&tbl->lock), so RTNL is not needed.
neigh_table_clear()synchronises RCU only, andrcu_dereference_rtnl()protects nothing here.If we released RCU after fetching neigh_tables[], there would be no synchronisation to block
neigh_table_clear()further, so RCU is held until the end of the function.Another option would be to protect neigh_tables[] user with SRCU and add
synchronize_srcu()inneigh_table_clear().
Quoted 7 lines
But, holding RCU should be fine as we hold
write_lock_bh()for the rest ofneightbl_set()anyway.Let's perform
RTM_SETNEIGHTBLunder RCU and drop RTNL.Signed-off-by Kuniyuki Iwashima <[email protected]>---
PATCH 5/5 neighbour: Convert rwlock of struct neigh_table to spinlock.
In reply to Kuniyuki IwashimaOnly neigh_for_each() and neigh_seq_start/stop() are on the reader side of neigh_table.lock.
Let's convert rwlock to the plain spinlock.
--- include/net/neighbour.h | 2 +- net/atm/clip.c | 4 +-- net/core/neighbour.c | 68 +++++++++++++++++++++-------------------- net/ipv4/arp.c | 4 +-- 4 files changed, 40 insertions(+), 38 deletions(-)
include/net/neighbour.h +1 -1
@@ -238,7 +238,7 @@ struct neigh_table {atomic_t gc_entries;struct list_head gc_list;struct list_head managed_list; -rwlock_t lock; +spinlock_t lock;unsigned long last_rand;struct neigh_statistics __percpu *stats;struct neigh_hash_table __rcu *nht;
net/atm/clip.c +2 -2
@@ -168,10 +168,10 @@ static int neigh_check_cb(struct neighbour *n)static void idle_timer_check (struct timer_list *unused) { -write_lock (&arp_tbl.lock); +spin_lock (&arp_tbl.lock);__neigh_for_each_release (&arp_tbl, neigh_check_cb);mod_timer (&idle_timer, jiffies +CLIP_CHECK_INTERVAL *HZ ); -write_unlock (&arp_tbl.lock); +spin_unlock (&arp_tbl.lock); }static int clip_arp_rcv (struct sk_buff *skb)
net/core/neighbour.c +35 -33
240 lines not on this page · raw message
net/ipv4/arp.c +2 -2
@@ -1217,10 +1217,10 @@ int arp_invalidate(struct net_device *dev, __be32 ip, bool force) err =neigh_update (neigh,NULL ,NUD_FAILED ,NEIGH_UPDATE_F_OVERRIDE |NEIGH_UPDATE_F_ADMIN ,0 ); -write_lock_bh (&tbl->lock); +spin_lock_bh (&tbl->lock);neigh_release (neigh);neigh_remove_one (neigh); -write_unlock_bh (&tbl->lock); +spin_unlock_bh (&tbl->lock); }return err;
Signature · 1 line
2.51.0.915.g61a8936c21-goog
Re: [PATCH v1 net-next 5/5] neighbour: Convert rwlock of struct neigh_table to spinlock.
Quoted 8 lines · Kuniyuki Iwashima
Only
neigh_for_each()and neigh_seq_start/stop() are on the reader side of neigh_table.lock.Let's convert rwlock to the plain spinlock.
Signed-off-by Kuniyuki Iwashima <[email protected]>
Do we still need _bh prefix ?
Re: [PATCH v1 net-next 5/5] neighbour: Convert rwlock of struct neigh_table to spinlock.
Quoted 6 lines · Eric Dumazet
Quoted 4 lines · Kuniyuki Iwashima
Only
neigh_for_each()and neigh_seq_start/stop() are on the reader side of neigh_table.lock.
Quoted 6 lines
Quoted 4 lines
Let's convert rwlock to the plain spinlock.
Signed-off-by Kuniyuki Iwashima <[email protected]>Do we still need
_bhprefix ?
Yes, I think _bh is just for IPv6 ndisc calling neigh_update().
Eric Dumazet
Reviewed-byRe: [PATCH v1 net-next 5/5] neighbour: Convert rwlock of struct neigh_table to spinlock.
Quoted 8 lines · Kuniyuki Iwashima
Quoted 6 lines · Eric Dumazet
Quoted 4 lines · Kuniyuki Iwashima
Only
neigh_for_each()and neigh_seq_start/stop() are on the reader side of neigh_table.lock.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Let's convert rwlock to the plain spinlock.
Signed-off-by Kuniyuki Iwashima <[email protected]>Do we still need
_bhprefix ?Yes, I think
_bhis just for IPv6 ndisc callingneigh_update().
OK, this is presumably to protect tbl->gc_list.
This list could use a separate spinlock, given neigh_forced_gc() can spin for up to 1ms.
Thanks !
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 22 Oct 2025 05:39:44 +0000 you wrote:
Patch 1 & 2 are prep for RCU conversion for
RTM_GETNEIGHTBL.Patch 3 & 4 converts
RTM_GETNEIGHTBLandRTM_SETNEIGHTBLto RCU.Patch 5 converts the neighbour table rwlock to the plain spinlock.
[...]
Here is the summary with links:
- [v1,net-next,1/5] neighbour: Use RCU list helpers for neigh_parms.list writers.
https://git.kernel.org/netdev/net-next/c/06d6322280d9 - [v1,net-next,2/5] neighbour: Annotate access to neigh_parms fields. https://git.kernel.org/netdev/net-next/c/35d7c7087033 - [v1,net-next,3/5] neighbour: Convert RTM_GETNEIGHTBL to RCU. https://git.kernel.org/netdev/net-next/c/4ae34be50064 - [v1,net-next,4/5] neighbour: Convert RTM_SETNEIGHTBL to RCU. https://git.kernel.org/netdev/net-next/c/55a6046b48a8 - [v1,net-next,5/5] neighbour: Convert rwlock of struct neigh_table to spinlock. https://git.kernel.org/netdev/net-next/c/3064d0fe02af
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html