mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check
@ 2024-09-04 18:41 Robin Murphy
  2024-09-04 18:41 ` [PATCH 2/2] perf/arm-cmn: Improve format attr printing Robin Murphy
  2024-09-06 12:29 ` [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Will Deacon
  0 siblings, 2 replies; 4+ messages in thread
From: Robin Murphy @ 2024-09-04 18:41 UTC (permalink / raw)
  To: will; +Cc: mark.rutland, linux-arm-kernel, linux-kernel

Checking for NUMA_NO_NODE is a misleading and, on reflection, entirely
unnecessary micro-optimisation. If it ever did happen that an incoming
CPU has no NUMA affinity while the current CPU does, a questionably-
useful PMU migration isn't the biggest thing wrong with that picture...

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---

Just a couple more little tweaks here, paying back some co-development
from the NI driver.

 drivers/perf/arm-cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 0266ff041e0b..62d4782da7e4 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2023,7 +2023,7 @@ static int arm_cmn_pmu_online_cpu(unsigned int cpu, struct hlist_node *cpuhp_nod
 
 	cmn = hlist_entry_safe(cpuhp_node, struct arm_cmn, cpuhp_node);
 	node = dev_to_node(cmn->dev);
-	if (node != NUMA_NO_NODE && cpu_to_node(cmn->cpu) != node && cpu_to_node(cpu) == node)
+	if (cpu_to_node(cmn->cpu) != node && cpu_to_node(cpu) == node)
 		arm_cmn_migrate(cmn, cpu);
 	return 0;
 }
-- 
2.39.2.101.g768bb238c484.dirty


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] perf/arm-cmn: Improve format attr printing
  2024-09-04 18:41 [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Robin Murphy
@ 2024-09-04 18:41 ` Robin Murphy
  2024-09-05 20:12   ` Ilkka Koskinen
  2024-09-06 12:29 ` [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Will Deacon
  1 sibling, 1 reply; 4+ messages in thread
From: Robin Murphy @ 2024-09-04 18:41 UTC (permalink / raw)
  To: will; +Cc: mark.rutland, linux-arm-kernel, linux-kernel

Take full advantage of our formats being stored in bitfield form, and
make the printing even more robust and simple by letting printk do all
the hard work of formatting bitlists.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/perf/arm-cmn.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 62d4782da7e4..397a46410f7c 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1280,15 +1280,11 @@ static ssize_t arm_cmn_format_show(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
 	struct arm_cmn_format_attr *fmt = container_of(attr, typeof(*fmt), attr);
-	int lo = __ffs(fmt->field), hi = __fls(fmt->field);
-
-	if (lo == hi)
-		return sysfs_emit(buf, "config:%d\n", lo);
 
 	if (!fmt->config)
-		return sysfs_emit(buf, "config:%d-%d\n", lo, hi);
+		return sysfs_emit(buf, "config:%*pbl\n", 64, &fmt->field);
 
-	return sysfs_emit(buf, "config%d:%d-%d\n", fmt->config, lo, hi);
+	return sysfs_emit(buf, "config%d:%*pbl\n", fmt->config, 64, &fmt->field);
 }
 
 #define _CMN_FORMAT_ATTR(_name, _cfg, _fld)				\
-- 
2.39.2.101.g768bb238c484.dirty


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] perf/arm-cmn: Improve format attr printing
  2024-09-04 18:41 ` [PATCH 2/2] perf/arm-cmn: Improve format attr printing Robin Murphy
@ 2024-09-05 20:12   ` Ilkka Koskinen
  0 siblings, 0 replies; 4+ messages in thread
From: Ilkka Koskinen @ 2024-09-05 20:12 UTC (permalink / raw)
  To: Robin Murphy; +Cc: will, mark.rutland, linux-arm-kernel, linux-kernel


On Wed, 4 Sep 2024, Robin Murphy wrote:
> Take full advantage of our formats being stored in bitfield form, and
> make the printing even more robust and simple by letting printk do all
> the hard work of formatting bitlists.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>

--Ilkka


> ---
> drivers/perf/arm-cmn.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 62d4782da7e4..397a46410f7c 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1280,15 +1280,11 @@ static ssize_t arm_cmn_format_show(struct device *dev,
> 				   struct device_attribute *attr, char *buf)
> {
> 	struct arm_cmn_format_attr *fmt = container_of(attr, typeof(*fmt), attr);
> -	int lo = __ffs(fmt->field), hi = __fls(fmt->field);
> -
> -	if (lo == hi)
> -		return sysfs_emit(buf, "config:%d\n", lo);
>
> 	if (!fmt->config)
> -		return sysfs_emit(buf, "config:%d-%d\n", lo, hi);
> +		return sysfs_emit(buf, "config:%*pbl\n", 64, &fmt->field);
>
> -	return sysfs_emit(buf, "config%d:%d-%d\n", fmt->config, lo, hi);
> +	return sysfs_emit(buf, "config%d:%*pbl\n", fmt->config, 64, &fmt->field);
> }
>
> #define _CMN_FORMAT_ATTR(_name, _cfg, _fld)				\
> -- 
> 2.39.2.101.g768bb238c484.dirty

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check
  2024-09-04 18:41 [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Robin Murphy
  2024-09-04 18:41 ` [PATCH 2/2] perf/arm-cmn: Improve format attr printing Robin Murphy
@ 2024-09-06 12:29 ` Will Deacon
  1 sibling, 0 replies; 4+ messages in thread
From: Will Deacon @ 2024-09-06 12:29 UTC (permalink / raw)
  To: Robin Murphy
  Cc: catalin.marinas, kernel-team, Will Deacon, mark.rutland,
	linux-arm-kernel, linux-kernel

On Wed, 04 Sep 2024 19:41:54 +0100, Robin Murphy wrote:
> Checking for NUMA_NO_NODE is a misleading and, on reflection, entirely
> unnecessary micro-optimisation. If it ever did happen that an incoming
> CPU has no NUMA affinity while the current CPU does, a questionably-
> useful PMU migration isn't the biggest thing wrong with that picture...
> 
> 

Applied to will (for-next/perf), thanks!

[1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check
      https://git.kernel.org/will/c/f04b611e6650
[2/2] perf/arm-cmn: Improve format attr printing
      https://git.kernel.org/will/c/f32efa3e4bba

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-06 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-04 18:41 [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Robin Murphy
2024-09-04 18:41 ` [PATCH 2/2] perf/arm-cmn: Improve format attr printing Robin Murphy
2024-09-05 20:12   ` Ilkka Koskinen
2024-09-06 12:29 ` [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®