Messages in this thread | | | From | Ignat Korchagin <> | Date | Sun, 13 Feb 2022 20:31:39 +0000 | Subject | Re: [PATCH] ipv6: mcast: use rcu-safe version of ipv6_get_lladdr() |
| |
Stupid me - forgot to reply to all and a discussion between me and David happend off list. Below, is the transcript for posterity:
On Sun, Feb 13, 2022 at 5:53 PM David Ahern <dsahern@gmail.com> wrote: > > On 2/13/22 8:43 AM, Ignat Korchagin wrote: > > On Sun, Feb 13, 2022 at 4:17 PM David Ahern <dsahern@gmail.com> wrote: > >> > >> On 2/12/22 1:46 PM, Ignat Korchagin wrote: > >>> In 8965779d2c0e ("ipv6,mcast: always hold idev->lock before mca_lock") > >>> mld_newpack() was actually migrated from "dev" to "idev' just for this > >>> use case. It seems the most reasonable approach would be to revert > >>> mld_newpack() back to dev and use the original code. > >> > >> > >> pmc already has the reference on idev and idev->dev is the source of dev > >> passed to mld_newpack. There is no reason to go back to the idev -> dev > >> -> idev dance. > > > > I don't know. Three things which make it more reasonable in my opinion: > > * we're already using idev->dev in mld_newpack() - that is we're not > > adding an extra variable here in mld_newpack() - we need it anyway, so > > can use in multiple places > > * it makes the code more consistent with the same code for the same > > reason in igmp6_send() in the same file, which uses "dev" and > > ipv6_get_lladdr() > > * we're making __ipv6_get_lladdr() static again and everything in > > the kernel is now using the public version of ipv6_get_lladdr() - I > > think the extra indirection of idev->dev-idev is a reasonable price to > > pay to avoid customized locking code in the caller, which may backfire > > later again in the same way it backfired this time > > which is why I later said move the locking to __ipv6_get_lladdr. > ipv6_get_lladdr takes a net_dev, looks up the idev and calls > __ipv6_get_lladdr. __ipv6_get_lladdr handles the idev locking needs. > > Users of the get_lladdr API that already have the idev reference use > __ipv6_get_lladdr. That is a common paradigm in the stack.
Ah. I see now. This does make sense as well to me.
> igmp6 code can use some modernization - but that is a net-next change. > This is a -net change.
| |