diff mbox series

[v2,1/3] powerpc/numa: Print debug statements only when required

Message ID 20210821102535.169643-2-srikar@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series Updates to powerpc for robust CPU online/offline | expand
Related show

Commit Message

Srikar Dronamraju Aug. 21, 2021, 10:25 a.m. UTC
Currently, a debug message gets printed every time an attempt to
add(remove) a CPU. However this is redundant if the CPU is already added
(removed) from the node.

Cc: linuxppc-dev@lists.ozlabs.org
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
 arch/powerpc/mm/numa.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Laurent Dufour Aug. 23, 2021, 9:21 a.m. UTC | #1
Le 21/08/2021 à 12:25, Srikar Dronamraju a écrit :
> Currently, a debug message gets printed every time an attempt to
> add(remove) a CPU. However this is redundant if the CPU is already added
> (removed) from the node.
> 
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Nathan Lynch <nathanl@linux.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Valentin Schneider <valentin.schneider@arm.com>
> Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Cc: Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
> Cc: Laurent Dufour <ldufour@linux.ibm.com>
> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> ---
>   arch/powerpc/mm/numa.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index f2bf98bdcea2..fbe03f6840e0 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -141,10 +141,11 @@ static void map_cpu_to_node(int cpu, int node)
>   {
>   	update_numa_cpu_lookup_table(cpu, node);
>   
> -	dbg("adding cpu %d to node %d\n", cpu, node);
>   
> -	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node])))
> +	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node]))) {
> +		dbg("adding cpu %d to node %d\n", cpu, node);
>   		cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
> +	}
>   }
>   
>   #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
> @@ -152,13 +153,11 @@ static void unmap_cpu_from_node(unsigned long cpu)
>   {
>   	int node = numa_cpu_lookup_table[cpu];
>   
> -	dbg("removing cpu %lu from node %d\n", cpu, node);
> -
>   	if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) {
>   		cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
> +		dbg("removing cpu %lu from node %d\n", cpu, node);
>   	} else {
> -		printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n",
> -		       cpu, node);
> +		pr_err("WARNING: cpu %lu not found in node %d\n", cpu, node);

Would pr_warn() be more appropriate here (or removing the "WARNING" statement)?

>   	}
>   }
>   #endif /* CONFIG_HOTPLUG_CPU || CONFIG_PPC_SPLPAR */
>
Srikar Dronamraju Aug. 23, 2021, 9:38 a.m. UTC | #2
* Laurent Dufour <ldufour@linux.ibm.com> [2021-08-23 11:21:33]:

> Le 21/08/2021 à 12:25, Srikar Dronamraju a écrit :
> > Currently, a debug message gets printed every time an attempt to
> > add(remove) a CPU. However this is redundant if the CPU is already added
> > (removed) from the node.
> > 
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Cc: Nathan Lynch <nathanl@linux.ibm.com>
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Valentin Schneider <valentin.schneider@arm.com>
> > Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>
> > Cc: Vincent Guittot <vincent.guittot@linaro.org>
> > Cc: Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
> > Cc: Laurent Dufour <ldufour@linux.ibm.com>
> > Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> > ---
> >   arch/powerpc/mm/numa.c | 11 +++++------
> >   1 file changed, 5 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> > index f2bf98bdcea2..fbe03f6840e0 100644
> > --- a/arch/powerpc/mm/numa.c
> > +++ b/arch/powerpc/mm/numa.c
> > @@ -141,10 +141,11 @@ static void map_cpu_to_node(int cpu, int node)
> >   {
> >   	update_numa_cpu_lookup_table(cpu, node);
> > -	dbg("adding cpu %d to node %d\n", cpu, node);
> > -	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node])))
> > +	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node]))) {
> > +		dbg("adding cpu %d to node %d\n", cpu, node);
> >   		cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
> > +	}
> >   }
> >   #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
> > @@ -152,13 +153,11 @@ static void unmap_cpu_from_node(unsigned long cpu)
> >   {
> >   	int node = numa_cpu_lookup_table[cpu];
> > -	dbg("removing cpu %lu from node %d\n", cpu, node);
> > -
> >   	if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) {
> >   		cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
> > +		dbg("removing cpu %lu from node %d\n", cpu, node);
> >   	} else {
> > -		printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n",
> > -		       cpu, node);
> > +		pr_err("WARNING: cpu %lu not found in node %d\n", cpu, node);
> 
> Would pr_warn() be more appropriate here (or removing the "WARNING" statement)?

Its a fair point.

Michael,

Do you want me to resend this patch with s/pr_err/pr_warn for the above
line?

> 
> >   	}
> >   }
> >   #endif /* CONFIG_HOTPLUG_CPU || CONFIG_PPC_SPLPAR */
> > 
>
Michael Ellerman Aug. 25, 2021, 1:01 p.m. UTC | #3
Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
> * Laurent Dufour <ldufour@linux.ibm.com> [2021-08-23 11:21:33]:
>> Le 21/08/2021 à 12:25, Srikar Dronamraju a écrit :
>> > Currently, a debug message gets printed every time an attempt to
>> > add(remove) a CPU. However this is redundant if the CPU is already added
>> > (removed) from the node.
>> > 
>> > Cc: linuxppc-dev@lists.ozlabs.org
>> > Cc: Nathan Lynch <nathanl@linux.ibm.com>
>> > Cc: Michael Ellerman <mpe@ellerman.id.au>
>> > Cc: Ingo Molnar <mingo@kernel.org>
>> > Cc: Peter Zijlstra <peterz@infradead.org>
>> > Cc: Valentin Schneider <valentin.schneider@arm.com>
>> > Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>
>> > Cc: Vincent Guittot <vincent.guittot@linaro.org>
>> > Cc: Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
>> > Cc: Laurent Dufour <ldufour@linux.ibm.com>
>> > Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>> > ---
>> >   arch/powerpc/mm/numa.c | 11 +++++------
>> >   1 file changed, 5 insertions(+), 6 deletions(-)
>> > 
>> > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
>> > index f2bf98bdcea2..fbe03f6840e0 100644
>> > --- a/arch/powerpc/mm/numa.c
>> > +++ b/arch/powerpc/mm/numa.c
>> > @@ -141,10 +141,11 @@ static void map_cpu_to_node(int cpu, int node)
>> >   {
>> >   	update_numa_cpu_lookup_table(cpu, node);
>> > -	dbg("adding cpu %d to node %d\n", cpu, node);
>> > -	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node])))
>> > +	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node]))) {
>> > +		dbg("adding cpu %d to node %d\n", cpu, node);
>> >   		cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
>> > +	}
>> >   }
>> >   #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
>> > @@ -152,13 +153,11 @@ static void unmap_cpu_from_node(unsigned long cpu)
>> >   {
>> >   	int node = numa_cpu_lookup_table[cpu];
>> > -	dbg("removing cpu %lu from node %d\n", cpu, node);
>> > -
>> >   	if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) {
>> >   		cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
>> > +		dbg("removing cpu %lu from node %d\n", cpu, node);
>> >   	} else {
>> > -		printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n",
>> > -		       cpu, node);
>> > +		pr_err("WARNING: cpu %lu not found in node %d\n", cpu, node);
>> 
>> Would pr_warn() be more appropriate here (or removing the "WARNING" statement)?
>
> Its a fair point.
>
> Michael,
>
> Do you want me to resend this patch with s/pr_err/pr_warn for the above
> line?

I think what I'd prefer is if we stopped using this custom dbg() stuff
in numa.c, and cleaned up all the messages to use pr_xxx().

Those debug statements only appear if you boot with numa=debug, which is
not documented anywhere and I had completely forgotten existed TBH.

These days there's CONFIG_DYNAMIC_DEBUG for turning on/off messages,
which is much more flexible.

So can we drop the numa=debug bits, and convert all the dbg()s to
pr_debug().

And then do a pass converting all the printk("NUMA: ") to pr_xxx() which
will get "numa:" from pr_fmt().

cheers
Srikar Dronamraju Aug. 26, 2021, 4:47 a.m. UTC | #4
* Michael Ellerman <mpe@ellerman.id.au> [2021-08-25 23:01:42]:

> Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
> > * Laurent Dufour <ldufour@linux.ibm.com> [2021-08-23 11:21:33]:
> >> Le 21/08/2021 à 12:25, Srikar Dronamraju a écrit :
> >> > Currently, a debug message gets printed every time an attempt to
> >> > add(remove) a CPU. However this is redundant if the CPU is already added
> >> > (removed) from the node.
> >> > 
> >
> > Its a fair point.
> >
> > Michael,
> >
> > Do you want me to resend this patch with s/pr_err/pr_warn for the above
> > line?
> 
> I think what I'd prefer is if we stopped using this custom dbg() stuff
> in numa.c, and cleaned up all the messages to use pr_xxx().
> 
> Those debug statements only appear if you boot with numa=debug, which is
> not documented anywhere and I had completely forgotten existed TBH.
> 
> These days there's CONFIG_DYNAMIC_DEBUG for turning on/off messages,
> which is much more flexible.
> 
> So can we drop the numa=debug bits, and convert all the dbg()s to
> pr_debug().
> 
> And then do a pass converting all the printk("NUMA: ") to pr_xxx() which
> will get "numa:" from pr_fmt().
> 
> cheers

Okay, will do the needful.
diff mbox series

Patch

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f2bf98bdcea2..fbe03f6840e0 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -141,10 +141,11 @@  static void map_cpu_to_node(int cpu, int node)
 {
 	update_numa_cpu_lookup_table(cpu, node);
 
-	dbg("adding cpu %d to node %d\n", cpu, node);
 
-	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node])))
+	if (!(cpumask_test_cpu(cpu, node_to_cpumask_map[node]))) {
+		dbg("adding cpu %d to node %d\n", cpu, node);
 		cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
+	}
 }
 
 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
@@ -152,13 +153,11 @@  static void unmap_cpu_from_node(unsigned long cpu)
 {
 	int node = numa_cpu_lookup_table[cpu];
 
-	dbg("removing cpu %lu from node %d\n", cpu, node);
-
 	if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) {
 		cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
+		dbg("removing cpu %lu from node %d\n", cpu, node);
 	} else {
-		printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n",
-		       cpu, node);
+		pr_err("WARNING: cpu %lu not found in node %d\n", cpu, node);
 	}
 }
 #endif /* CONFIG_HOTPLUG_CPU || CONFIG_PPC_SPLPAR */