* [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain()
@ 2024-08-06 10:26 Uros Bizjak
2024-08-08 15:28 ` Simon Horman
2024-08-28 14:53 ` Pablo Neira Ayuso
0 siblings, 2 replies; 5+ messages in thread
From: Uros Bizjak @ 2024-08-06 10:26 UTC (permalink / raw)
To: netfilter-devel, coreteam, netdev, linux-kernel
Cc: Uros Bizjak, Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Compiling nf_tables_api.c results in several sparse warnings:
nf_tables_api.c:2740:23: warning: incorrect type in assignment (different address spaces)
nf_tables_api.c:2752:38: warning: incorrect type in assignment (different address spaces)
nf_tables_api.c:2798:21: warning: incorrect type in argument 1 (different address spaces)
Add __percpu annotation to *stats pointer to fix these warnings.
Found by GCC's named address space checks.
There were no changes in the resulting object files.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
---
net/netfilter/nf_tables_api.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 481ee78e77bc..805227131f10 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2642,7 +2642,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
struct nft_table *table = ctx->table;
struct nft_chain *chain = ctx->chain;
struct nft_chain_hook hook = {};
- struct nft_stats *stats = NULL;
+ struct nft_stats __percpu *stats = NULL;
struct nft_hook *h, *next;
struct nf_hook_ops *ops;
struct nft_trans *trans;
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain()
2024-08-06 10:26 [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain() Uros Bizjak
@ 2024-08-08 15:28 ` Simon Horman
2024-08-28 14:53 ` Pablo Neira Ayuso
1 sibling, 0 replies; 5+ messages in thread
From: Simon Horman @ 2024-08-08 15:28 UTC (permalink / raw)
To: Uros Bizjak
Cc: netfilter-devel, coreteam, netdev, linux-kernel,
Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Tue, Aug 06, 2024 at 12:26:58PM +0200, Uros Bizjak wrote:
> Compiling nf_tables_api.c results in several sparse warnings:
>
> nf_tables_api.c:2740:23: warning: incorrect type in assignment (different address spaces)
> nf_tables_api.c:2752:38: warning: incorrect type in assignment (different address spaces)
> nf_tables_api.c:2798:21: warning: incorrect type in argument 1 (different address spaces)
>
> Add __percpu annotation to *stats pointer to fix these warnings.
>
> Found by GCC's named address space checks.
>
> There were no changes in the resulting object files.
>
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> ---
> net/netfilter/nf_tables_api.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index 481ee78e77bc..805227131f10 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -2642,7 +2642,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
> struct nft_table *table = ctx->table;
> struct nft_chain *chain = ctx->chain;
> struct nft_chain_hook hook = {};
> - struct nft_stats *stats = NULL;
> + struct nft_stats __percpu *stats = NULL;
> struct nft_hook *h, *next;
> struct nf_hook_ops *ops;
> struct nft_trans *trans;
Thanks, I agree that users of this local variable expect it
to be annotated as __percpu.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain()
2024-08-06 10:26 [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain() Uros Bizjak
2024-08-08 15:28 ` Simon Horman
@ 2024-08-28 14:53 ` Pablo Neira Ayuso
2024-08-28 19:29 ` Uros Bizjak
1 sibling, 1 reply; 5+ messages in thread
From: Pablo Neira Ayuso @ 2024-08-28 14:53 UTC (permalink / raw)
To: Uros Bizjak
Cc: netfilter-devel, coreteam, netdev, linux-kernel, Jozsef Kadlecsik,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Tue, Aug 06, 2024 at 12:26:58PM +0200, Uros Bizjak wrote:
> Compiling nf_tables_api.c results in several sparse warnings:
>
> nf_tables_api.c:2740:23: warning: incorrect type in assignment (different address spaces)
> nf_tables_api.c:2752:38: warning: incorrect type in assignment (different address spaces)
> nf_tables_api.c:2798:21: warning: incorrect type in argument 1 (different address spaces)
>
> Add __percpu annotation to *stats pointer to fix these warnings.
>
> Found by GCC's named address space checks.
>
> There were no changes in the resulting object files.
I never replied to this.
I can see this is getting things better, but still more sparse
warnings show up related tho nft_stats. I'd prefer those are fixed at
ones, would you give it a look?
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> ---
> net/netfilter/nf_tables_api.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index 481ee78e77bc..805227131f10 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -2642,7 +2642,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
> struct nft_table *table = ctx->table;
> struct nft_chain *chain = ctx->chain;
> struct nft_chain_hook hook = {};
> - struct nft_stats *stats = NULL;
> + struct nft_stats __percpu *stats = NULL;
> struct nft_hook *h, *next;
> struct nf_hook_ops *ops;
> struct nft_trans *trans;
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain()
2024-08-28 14:53 ` Pablo Neira Ayuso
@ 2024-08-28 19:29 ` Uros Bizjak
2024-08-28 21:51 ` Pablo Neira Ayuso
0 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2024-08-28 19:29 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: netfilter-devel, coreteam, netdev, linux-kernel, Jozsef Kadlecsik,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Wed, Aug 28, 2024 at 4:53 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> On Tue, Aug 06, 2024 at 12:26:58PM +0200, Uros Bizjak wrote:
> > Compiling nf_tables_api.c results in several sparse warnings:
> >
> > nf_tables_api.c:2740:23: warning: incorrect type in assignment (different address spaces)
> > nf_tables_api.c:2752:38: warning: incorrect type in assignment (different address spaces)
> > nf_tables_api.c:2798:21: warning: incorrect type in argument 1 (different address spaces)
> >
> > Add __percpu annotation to *stats pointer to fix these warnings.
> >
> > Found by GCC's named address space checks.
> >
> > There were no changes in the resulting object files.
>
> I never replied to this.
>
> I can see this is getting things better, but still more sparse
> warnings show up related tho nft_stats. I'd prefer those are fixed at
> ones, would you give it a look?
Yes, I have a follow-up patch that also fixes the remaining warnings,
but it depends on a patch [1] that is on the way to mainline through
the mm tree.
I can post the complete patch that uses percpu variants of ERR_PTR,
IS_ERR and PTR_ERR where needed if this dependency can temporarily be
tolerated.
[1] https://lore.kernel.org/lkml/20240818210235.33481-1-ubizjak@gmail.com/
Thanks,
Uros.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain()
2024-08-28 19:29 ` Uros Bizjak
@ 2024-08-28 21:51 ` Pablo Neira Ayuso
0 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2024-08-28 21:51 UTC (permalink / raw)
To: Uros Bizjak
Cc: netfilter-devel, coreteam, netdev, linux-kernel, Jozsef Kadlecsik,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Wed, Aug 28, 2024 at 09:29:14PM +0200, Uros Bizjak wrote:
> On Wed, Aug 28, 2024 at 4:53 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >
> > On Tue, Aug 06, 2024 at 12:26:58PM +0200, Uros Bizjak wrote:
> > > Compiling nf_tables_api.c results in several sparse warnings:
> > >
> > > nf_tables_api.c:2740:23: warning: incorrect type in assignment (different address spaces)
> > > nf_tables_api.c:2752:38: warning: incorrect type in assignment (different address spaces)
> > > nf_tables_api.c:2798:21: warning: incorrect type in argument 1 (different address spaces)
> > >
> > > Add __percpu annotation to *stats pointer to fix these warnings.
> > >
> > > Found by GCC's named address space checks.
> > >
> > > There were no changes in the resulting object files.
> >
> > I never replied to this.
> >
> > I can see this is getting things better, but still more sparse
> > warnings show up related tho nft_stats. I'd prefer those are fixed at
> > ones, would you give it a look?
>
> Yes, I have a follow-up patch that also fixes the remaining warnings,
> but it depends on a patch [1] that is on the way to mainline through
> the mm tree.
>
> I can post the complete patch that uses percpu variants of ERR_PTR,
> IS_ERR and PTR_ERR where needed if this dependency can temporarily be
> tolerated.
>
> [1] https://lore.kernel.org/lkml/20240818210235.33481-1-ubizjak@gmail.com/
Thanks for explaining.
Post the patch to netfilter-devel@vger.kernel.org explaining the
dependency so it sits there and I remember about it while it gets
upstream.
If there is any issue and this patch does not reach mm tree, let me
know.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-28 21:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-06 10:26 [PATCH] netfilter: nf_tables: Add __percpu annotation to *stats pointer in nf_tables_updchain() Uros Bizjak
2024-08-08 15:28 ` Simon Horman
2024-08-28 14:53 ` Pablo Neira Ayuso
2024-08-28 19:29 ` Uros Bizjak
2024-08-28 21:51 ` Pablo Neira Ayuso
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).