diff mbox series

[net-next] net/fungible: Fix local_memory_node error

Message ID 20220308045321.2843-1-dmichail@fungible.com (mailing list archive)
State Accepted
Commit cdba24904e1dd4d5152c80f6f96a0ed187e7f8a4
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/fungible: Fix local_memory_node error | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: dmichail@fungible.com; 1 maintainers not CCed: dmichail@fungible.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Dimitris Michailidis <d.michailidis@fungible.com>' != 'Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>'
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dimitris Michailidis March 8, 2022, 4:53 a.m. UTC
Stephen Rothwell reported the following failure on powerpc:

ERROR: modpost: ".local_memory_node"
[drivers/net/ethernet/fungible/funeth/funeth.ko] undefined!

AFAICS this is because local_memory_node() is a non-inline non-exported
function when CONFIG_HAVE_MEMORYLESS_NODES=y. It is also the wrong API
to get a CPU's memory node. Use cpu_to_mem() in the two spots it's used.

Fixes: ee6373ddf3a9 ("net/funeth: probing and netdev ops")
Fixes: db37bc177dae ("net/funeth: add the data path")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
---
 drivers/net/ethernet/fungible/funeth/funeth_main.c | 2 +-
 drivers/net/ethernet/fungible/funeth/funeth_txrx.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Jakub Kicinski March 9, 2022, 6:14 a.m. UTC | #1
On Mon,  7 Mar 2022 20:53:21 -0800 Dimitris Michailidis wrote:
> Stephen Rothwell reported the following failure on powerpc:
> 
> ERROR: modpost: ".local_memory_node"
> [drivers/net/ethernet/fungible/funeth/funeth.ko] undefined!
> 
> AFAICS this is because local_memory_node() is a non-inline non-exported
> function when CONFIG_HAVE_MEMORYLESS_NODES=y. It is also the wrong API
> to get a CPU's memory node. Use cpu_to_mem() in the two spots it's used.

Can the ids actually not match? I'm asking because nobody else is doing
the cpu -> mem node conversions.

> Fixes: ee6373ddf3a9 ("net/funeth: probing and netdev ops")
> Fixes: db37bc177dae ("net/funeth: add the data path")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
> ---
>  drivers/net/ethernet/fungible/funeth/funeth_main.c | 2 +-
>  drivers/net/ethernet/fungible/funeth/funeth_txrx.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/fungible/funeth/funeth_main.c b/drivers/net/ethernet/fungible/funeth/funeth_main.c
> index c58b10c216ef..67dd02ed1fa3 100644
> --- a/drivers/net/ethernet/fungible/funeth/funeth_main.c
> +++ b/drivers/net/ethernet/fungible/funeth/funeth_main.c
> @@ -253,7 +253,7 @@ static struct fun_irq *fun_alloc_qirq(struct funeth_priv *fp, unsigned int idx,
>  	int cpu, res;
>  
>  	cpu = cpumask_local_spread(idx, node);
> -	node = local_memory_node(cpu_to_node(cpu));
> +	node = cpu_to_mem(cpu);
>  
>  	irq = kzalloc_node(sizeof(*irq), GFP_KERNEL, node);
>  	if (!irq)
> diff --git a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
> index 7aed0561aeac..04c9f91b7489 100644
> --- a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
> +++ b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
> @@ -239,7 +239,7 @@ static inline void fun_txq_wr_db(const struct funeth_txq *q)
>  
>  static inline int fun_irq_node(const struct fun_irq *p)
>  {
> -	return local_memory_node(cpu_to_node(cpumask_first(&p->affinity_mask)));
> +	return cpu_to_mem(cpumask_first(&p->affinity_mask));
>  }
>  
>  int fun_rxq_napi_poll(struct napi_struct *napi, int budget);
Dimitris Michailidis March 9, 2022, 9:46 a.m. UTC | #2
On Tue, Mar 8, 2022 at 10:14 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Mon,  7 Mar 2022 20:53:21 -0800 Dimitris Michailidis wrote:
> > Stephen Rothwell reported the following failure on powerpc:
> >
> > ERROR: modpost: ".local_memory_node"
> > [drivers/net/ethernet/fungible/funeth/funeth.ko] undefined!
> >
> > AFAICS this is because local_memory_node() is a non-inline non-exported
> > function when CONFIG_HAVE_MEMORYLESS_NODES=y. It is also the wrong API
> > to get a CPU's memory node. Use cpu_to_mem() in the two spots it's used.
>
> Can the ids actually not match? I'm asking because nobody else is doing
> the cpu -> mem node conversions.

They can differ if CONFIG_HAVE_MEMORYLESS_NODES=y and the machine has
memoryless nodes. That config is only offered by IA64 and powerpc so I
guess there are just a few machines where they can differ. It is true
that cpu_to_mem() calls aren't common but the related call
numa_mem_id(), the special case for the local CPU, is easier to find.
For example, page pools's default preferred node is numa_mem_id()
rather than numa_node_id().

> > Fixes: ee6373ddf3a9 ("net/funeth: probing and netdev ops")
> > Fixes: db37bc177dae ("net/funeth: add the data path")
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
> > ---
> >  drivers/net/ethernet/fungible/funeth/funeth_main.c | 2 +-
> >  drivers/net/ethernet/fungible/funeth/funeth_txrx.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/fungible/funeth/funeth_main.c b/drivers/net/ethernet/fungible/funeth/funeth_main.c
> > index c58b10c216ef..67dd02ed1fa3 100644
> > --- a/drivers/net/ethernet/fungible/funeth/funeth_main.c
> > +++ b/drivers/net/ethernet/fungible/funeth/funeth_main.c
> > @@ -253,7 +253,7 @@ static struct fun_irq *fun_alloc_qirq(struct funeth_priv *fp, unsigned int idx,
> >       int cpu, res;
> >
> >       cpu = cpumask_local_spread(idx, node);
> > -     node = local_memory_node(cpu_to_node(cpu));
> > +     node = cpu_to_mem(cpu);
> >
> >       irq = kzalloc_node(sizeof(*irq), GFP_KERNEL, node);
> >       if (!irq)
> > diff --git a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
> > index 7aed0561aeac..04c9f91b7489 100644
> > --- a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
> > +++ b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
> > @@ -239,7 +239,7 @@ static inline void fun_txq_wr_db(const struct funeth_txq *q)
> >
> >  static inline int fun_irq_node(const struct fun_irq *p)
> >  {
> > -     return local_memory_node(cpu_to_node(cpumask_first(&p->affinity_mask)));
> > +     return cpu_to_mem(cpumask_first(&p->affinity_mask));
> >  }
> >
> >  int fun_rxq_napi_poll(struct napi_struct *napi, int budget);
>
patchwork-bot+netdevbpf@kernel.org March 9, 2022, 11:30 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon,  7 Mar 2022 20:53:21 -0800 you wrote:
> Stephen Rothwell reported the following failure on powerpc:
> 
> ERROR: modpost: ".local_memory_node"
> [drivers/net/ethernet/fungible/funeth/funeth.ko] undefined!
> 
> AFAICS this is because local_memory_node() is a non-inline non-exported
> function when CONFIG_HAVE_MEMORYLESS_NODES=y. It is also the wrong API
> to get a CPU's memory node. Use cpu_to_mem() in the two spots it's used.
> 
> [...]

Here is the summary with links:
  - [net-next] net/fungible: Fix local_memory_node error
    https://git.kernel.org/netdev/net-next/c/cdba24904e1d

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/fungible/funeth/funeth_main.c b/drivers/net/ethernet/fungible/funeth/funeth_main.c
index c58b10c216ef..67dd02ed1fa3 100644
--- a/drivers/net/ethernet/fungible/funeth/funeth_main.c
+++ b/drivers/net/ethernet/fungible/funeth/funeth_main.c
@@ -253,7 +253,7 @@  static struct fun_irq *fun_alloc_qirq(struct funeth_priv *fp, unsigned int idx,
 	int cpu, res;
 
 	cpu = cpumask_local_spread(idx, node);
-	node = local_memory_node(cpu_to_node(cpu));
+	node = cpu_to_mem(cpu);
 
 	irq = kzalloc_node(sizeof(*irq), GFP_KERNEL, node);
 	if (!irq)
diff --git a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
index 7aed0561aeac..04c9f91b7489 100644
--- a/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
+++ b/drivers/net/ethernet/fungible/funeth/funeth_txrx.h
@@ -239,7 +239,7 @@  static inline void fun_txq_wr_db(const struct funeth_txq *q)
 
 static inline int fun_irq_node(const struct fun_irq *p)
 {
-	return local_memory_node(cpu_to_node(cpumask_first(&p->affinity_mask)));
+	return cpu_to_mem(cpumask_first(&p->affinity_mask));
 }
 
 int fun_rxq_napi_poll(struct napi_struct *napi, int budget);