mbox series

[0/4] net: drop netif_attrmask_next*()

Message ID 20221002151702.3932770-1-yury.norov@gmail.com (mailing list archive)
Headers show
Series net: drop netif_attrmask_next*() | expand

Message

Yury Norov Oct. 2, 2022, 3:16 p.m. UTC
netif_attrmask_next_and() generates warnings if CONFIG_DEBUG_PER_CPU_MAPS
is enabled. It is used in a single place. netif_attrmask_next() is not
used at all. With some rework of __netif_set_xps_queue(), we can drop
both functions, switch the code to well-tested bitmap API and fix the
warning.

Yury Norov (4):
  net: move setup code out of mutex in __netif_set_xps_queue()
  net: merge XPS_CPU_DEV_MAPS_SIZE and XPS_RXQ_DEV_MAPS_SIZE macros
  net: initialize online_mask unconditionally in __netif_set_xps_queue()
  net: fix opencoded for_each_and_bit() in __netif_set_xps_queue()

 include/linux/netdevice.h | 53 ++-------------------------------------
 net/core/dev.c            | 34 +++++++++++++------------
 2 files changed, 20 insertions(+), 67 deletions(-)

Comments

Jakub Kicinski Oct. 3, 2022, 4:50 p.m. UTC | #1
On Sun,  2 Oct 2022 08:16:58 -0700 Yury Norov wrote:
> netif_attrmask_next_and() generates warnings if CONFIG_DEBUG_PER_CPU_MAPS
> is enabled.

Could you describe the nature of the warning? Is it a false positive 
or a legit warning?

If the former perhaps we should defer until after the next merge window.

> It is used in a single place. netif_attrmask_next() is not
> used at all. With some rework of __netif_set_xps_queue(), we can drop
> both functions, switch the code to well-tested bitmap API and fix the
> warning.
Yury Norov Oct. 3, 2022, 6:11 p.m. UTC | #2
On Mon, Oct 03, 2022 at 09:50:48AM -0700, Jakub Kicinski wrote:
> On Sun,  2 Oct 2022 08:16:58 -0700 Yury Norov wrote:
> > netif_attrmask_next_and() generates warnings if CONFIG_DEBUG_PER_CPU_MAPS
> > is enabled.
> 
> Could you describe the nature of the warning? Is it a false positive 
> or a legit warning?
> 
> If the former perhaps we should defer until after the next merge window.

The problem is that netif_attrmask_next_and() is called with
n == nr_cpu_ids-1, which triggers cpu_max_bits_warn() after this:

https://lore.kernel.org/netdev/20220926103437.322f3c6c@kernel.org/

Underlying bitmap layer handles this correctly, so this wouldn't make
problems for people. But this is not a false-positive.

Thanks,
Yury
Jakub Kicinski Oct. 3, 2022, 11:25 p.m. UTC | #3
On Mon, 3 Oct 2022 11:11:05 -0700 Yury Norov wrote:
> On Mon, Oct 03, 2022 at 09:50:48AM -0700, Jakub Kicinski wrote:
> > On Sun,  2 Oct 2022 08:16:58 -0700 Yury Norov wrote:  
> > > netif_attrmask_next_and() generates warnings if CONFIG_DEBUG_PER_CPU_MAPS
> > > is enabled.  
> > 
> > Could you describe the nature of the warning? Is it a false positive 
> > or a legit warning?
> > 
> > If the former perhaps we should defer until after the next merge window.  
> 
> The problem is that netif_attrmask_next_and() is called with
> n == nr_cpu_ids-1, which triggers cpu_max_bits_warn() after this:
> 
> https://lore.kernel.org/netdev/20220926103437.322f3c6c@kernel.org/

I see. Is that patch merged and on it's way? Perhaps we can just revert
it and try again after the merge window?

> Underlying bitmap layer handles this correctly, so this wouldn't make
> problems for people. But this is not a false-positive.
Yury Norov Oct. 4, 2022, 12:07 a.m. UTC | #4
On Mon, Oct 03, 2022 at 04:25:56PM -0700, Jakub Kicinski wrote:
> On Mon, 3 Oct 2022 11:11:05 -0700 Yury Norov wrote:
> > On Mon, Oct 03, 2022 at 09:50:48AM -0700, Jakub Kicinski wrote:
> > > On Sun,  2 Oct 2022 08:16:58 -0700 Yury Norov wrote:  
> > > > netif_attrmask_next_and() generates warnings if CONFIG_DEBUG_PER_CPU_MAPS
> > > > is enabled.  
> > > 
> > > Could you describe the nature of the warning? Is it a false positive 
> > > or a legit warning?
> > > 
> > > If the former perhaps we should defer until after the next merge window.  
> > 
> > The problem is that netif_attrmask_next_and() is called with
> > n == nr_cpu_ids-1, which triggers cpu_max_bits_warn() after this:
> > 
> > https://lore.kernel.org/netdev/20220926103437.322f3c6c@kernel.org/
> 
> I see. Is that patch merged and on it's way?

This patch is already in pull request.

> Perhaps we can just revert it and try again after the merge window?

I don't understand this. To me it looks fairly normal - the check has
been fixed and merged (likely) in -rc1. After that we have 2 month to
spot, fix and test all issues discovered with correct cpumask_check().

I'm not insisting in moving this series in -rc1. Let's give it review
and careful testing, and merge in -rc2, 3 or whatever is appropriate.

Regarding cpumask_check() patch - I'd like to have it in -rc1 because
it will give people enough time to test their code...

Would it work?

Thanks,
Yury
Jakub Kicinski Oct. 4, 2022, 12:29 a.m. UTC | #5
On Mon, 3 Oct 2022 17:07:31 -0700 Yury Norov wrote:
> > I see. Is that patch merged and on it's way?  
> 
> This patch is already in pull request.
> 
> > Perhaps we can just revert it and try again after the merge window?  
> 
> I don't understand this. To me it looks fairly normal - the check has
> been fixed and merged (likely) in -rc1. After that we have 2 month to
> spot, fix and test all issues discovered with correct cpumask_check().
> 
> I'm not insisting in moving this series in -rc1. Let's give it review
> and careful testing, and merge in -rc2, 3 or whatever is appropriate.
> 
> Regarding cpumask_check() patch - I'd like to have it in -rc1 because
> it will give people enough time to test their code...

AFAIU you can keep the cpumask_check() patch, we just need to revert
the netdev patch from your earlier series?

If so I strongly prefer that we revert the broken cleanup rather than
try to pile on more re-factoring. The trees are not going anywhere, we 
can queue the patches for 6.2.
Yury Norov Oct. 4, 2022, 12:43 a.m. UTC | #6
On Mon, Oct 3, 2022 at 5:29 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Mon, 3 Oct 2022 17:07:31 -0700 Yury Norov wrote:
> > > I see. Is that patch merged and on it's way?
> >
> > This patch is already in pull request.
> >
> > > Perhaps we can just revert it and try again after the merge window?
> >
> > I don't understand this. To me it looks fairly normal - the check has
> > been fixed and merged (likely) in -rc1. After that we have 2 month to
> > spot, fix and test all issues discovered with correct cpumask_check().
> >
> > I'm not insisting in moving this series in -rc1. Let's give it review
> > and careful testing, and merge in -rc2, 3 or whatever is appropriate.
> >
> > Regarding cpumask_check() patch - I'd like to have it in -rc1 because
> > it will give people enough time to test their code...
>
> AFAIU you can keep the cpumask_check() patch, we just need to revert
> the netdev patch from your earlier series?

Yeah, I meant the "net: fix cpu_max_bits_warn() usage in
netif_attrmask_next{,_and}".

> If so I strongly prefer that we revert the broken cleanup rather than
> try to pile on more re-factoring.

What do you mean by broken cleanup? Netdev patch is acked by you,
and this series didn't receive negative feedback so far.

> The trees are not going anywhere, we can queue the patches for 6.2.

Sure, 6.2 is OK as well, but I think any 6.1-rc would be more appropriate.