* [PATCH] perf test: Compile named_threads workload with -O0
@ 2026-06-11 11:13 James Clark
2026-06-11 12:38 ` Leo Yan
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: James Clark @ 2026-06-11 11:13 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Leo Yan
Cc: linux-perf-users, linux-kernel, James Clark
The work loop relies on the compiler not optimizing it away, although
named_threads_work is not static for that reason, the compiler could
still do it.
Fix it by compiling without optimization. Also add -fno-inline for
consistency and in case anyone wants to look at callstacks.
Signed-off-by: James Clark <james.clark@linaro.org>
---
One trailing Sashiko fix from the "perf cs-etm: Queue context packets
for frontend" patch series that has been applied already.
---
tools/perf/tests/workloads/Build | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
index 75b377934a0e..7bb4b9829ba2 100644
--- a/tools/perf/tests/workloads/Build
+++ b/tools/perf/tests/workloads/Build
@@ -26,3 +26,4 @@ CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_inlineloop.o = -g -O2
CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
+CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
---
base-commit: 7336514f41e75d44782fee7e0990d4195a3d3161
change-id: 20260611-james-cs-unformatted-per-thread-fix-followup-babf28a4e640
Best regards,
--
James Clark <james.clark@linaro.org>
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] perf test: Compile named_threads workload with -O0
2026-06-11 11:13 [PATCH] perf test: Compile named_threads workload with -O0 James Clark
@ 2026-06-11 12:38 ` Leo Yan
2026-06-11 15:08 ` Arnaldo Carvalho de Melo
2026-06-11 18:54 ` David Laight
2 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2026-06-11 12:38 UTC (permalink / raw)
To: James Clark
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers,
linux-perf-users, linux-kernel
On Thu, Jun 11, 2026 at 12:13:46PM +0100, James Clark wrote:
> The work loop relies on the compiler not optimizing it away, although
> named_threads_work is not static for that reason, the compiler could
> still do it.
>
> Fix it by compiling without optimization. Also add -fno-inline for
> consistency and in case anyone wants to look at callstacks.
>
> Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf test: Compile named_threads workload with -O0
2026-06-11 11:13 [PATCH] perf test: Compile named_threads workload with -O0 James Clark
2026-06-11 12:38 ` Leo Yan
@ 2026-06-11 15:08 ` Arnaldo Carvalho de Melo
2026-06-11 15:11 ` James Clark
2026-06-11 18:54 ` David Laight
2 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-06-11 15:08 UTC (permalink / raw)
To: James Clark
Cc: Namhyung Kim, Ian Rogers, Leo Yan, linux-perf-users, linux-kernel
On Thu, Jun 11, 2026 at 12:13:46PM +0100, James Clark wrote:
> The work loop relies on the compiler not optimizing it away, although
> named_threads_work is not static for that reason, the compiler could
> still do it.
>
> Fix it by compiling without optimization. Also add -fno-inline for
> consistency and in case anyone wants to look at callstacks.
>
> Signed-off-by: James Clark <james.clark@linaro.org>
> ---
> One trailing Sashiko fix from the "perf cs-etm: Queue context packets
> for frontend" patch series that has been applied already.
I'll add a Fixes tag pointing to that cset, also a reported-by sashiko
and a closes, for completeness.
Thanks, applying.
- Arnaldo
> ---
> tools/perf/tests/workloads/Build | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
> index 75b377934a0e..7bb4b9829ba2 100644
> --- a/tools/perf/tests/workloads/Build
> +++ b/tools/perf/tests/workloads/Build
> @@ -26,3 +26,4 @@ CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> CFLAGS_inlineloop.o = -g -O2
> CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> +CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>
> ---
> base-commit: 7336514f41e75d44782fee7e0990d4195a3d3161
> change-id: 20260611-james-cs-unformatted-per-thread-fix-followup-babf28a4e640
>
> Best regards,
> --
> James Clark <james.clark@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf test: Compile named_threads workload with -O0
2026-06-11 15:08 ` Arnaldo Carvalho de Melo
@ 2026-06-11 15:11 ` James Clark
0 siblings, 0 replies; 6+ messages in thread
From: James Clark @ 2026-06-11 15:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Namhyung Kim, Ian Rogers, Leo Yan, linux-perf-users, linux-kernel
On 11/06/2026 4:08 pm, Arnaldo Carvalho de Melo wrote:
> On Thu, Jun 11, 2026 at 12:13:46PM +0100, James Clark wrote:
>> The work loop relies on the compiler not optimizing it away, although
>> named_threads_work is not static for that reason, the compiler could
>> still do it.
>>
>> Fix it by compiling without optimization. Also add -fno-inline for
>> consistency and in case anyone wants to look at callstacks.
>>
>> Signed-off-by: James Clark <james.clark@linaro.org>
>> ---
>> One trailing Sashiko fix from the "perf cs-etm: Queue context packets
>> for frontend" patch series that has been applied already.
>
> I'll add a Fixes tag pointing to that cset, also a reported-by sashiko
> and a closes, for completeness.
>
> Thanks, applying.
>
> - Arnaldo
>
Thanks, makes sense yeah. I probably could have been a bit more thorough.
>> ---
>> tools/perf/tests/workloads/Build | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
>> index 75b377934a0e..7bb4b9829ba2 100644
>> --- a/tools/perf/tests/workloads/Build
>> +++ b/tools/perf/tests/workloads/Build
>> @@ -26,3 +26,4 @@ CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>> CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>> CFLAGS_inlineloop.o = -g -O2
>> CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>> +CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>>
>> ---
>> base-commit: 7336514f41e75d44782fee7e0990d4195a3d3161
>> change-id: 20260611-james-cs-unformatted-per-thread-fix-followup-babf28a4e640
>>
>> Best regards,
>> --
>> James Clark <james.clark@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf test: Compile named_threads workload with -O0
2026-06-11 11:13 [PATCH] perf test: Compile named_threads workload with -O0 James Clark
2026-06-11 12:38 ` Leo Yan
2026-06-11 15:08 ` Arnaldo Carvalho de Melo
@ 2026-06-11 18:54 ` David Laight
2026-06-12 8:24 ` James Clark
2 siblings, 1 reply; 6+ messages in thread
From: David Laight @ 2026-06-11 18:54 UTC (permalink / raw)
To: James Clark
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Leo Yan,
linux-perf-users, linux-kernel
On Thu, 11 Jun 2026 12:13:46 +0100
James Clark <james.clark@linaro.org> wrote:
> The work loop relies on the compiler not optimizing it away, although
> named_threads_work is not static for that reason, the compiler could
> still do it.
Isn't in enough to put barrier() in the loop?
David
>
> Fix it by compiling without optimization. Also add -fno-inline for
> consistency and in case anyone wants to look at callstacks.
>
> Signed-off-by: James Clark <james.clark@linaro.org>
> ---
> One trailing Sashiko fix from the "perf cs-etm: Queue context packets
> for frontend" patch series that has been applied already.
> ---
> tools/perf/tests/workloads/Build | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
> index 75b377934a0e..7bb4b9829ba2 100644
> --- a/tools/perf/tests/workloads/Build
> +++ b/tools/perf/tests/workloads/Build
> @@ -26,3 +26,4 @@ CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> CFLAGS_inlineloop.o = -g -O2
> CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> +CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>
> ---
> base-commit: 7336514f41e75d44782fee7e0990d4195a3d3161
> change-id: 20260611-james-cs-unformatted-per-thread-fix-followup-babf28a4e640
>
> Best regards,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf test: Compile named_threads workload with -O0
2026-06-11 18:54 ` David Laight
@ 2026-06-12 8:24 ` James Clark
0 siblings, 0 replies; 6+ messages in thread
From: James Clark @ 2026-06-12 8:24 UTC (permalink / raw)
To: David Laight
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Leo Yan,
linux-perf-users, linux-kernel
On 11/06/2026 7:54 pm, David Laight wrote:
> On Thu, 11 Jun 2026 12:13:46 +0100
> James Clark <james.clark@linaro.org> wrote:
>
>> The work loop relies on the compiler not optimizing it away, although
>> named_threads_work is not static for that reason, the compiler could
>> still do it.
>
> Isn't in enough to put barrier() in the loop?
>
> David
>
Probably, but I don't think it would make a difference for this specific
test workload, and I don't think that style has ever been used for any
of the Perf tests.
I think Sashiko's comment leading to this was overly pedantic, neither
GCC or Clang optimize this away even with -O2. So in this specific case
it was only fixing a hypothetical which is why I didn't add a fixes tag.
Although I admit there is some chance it could happen with other changes.
However, I think -O0 is the appropriate fix for a workload because it
makes the stacks and order of execution predictable, which is what the
tests look at. And that also has the effect of guaranteeing this isn't
optimized away, so we probably don't need both.
Thanks
James
>>
>> Fix it by compiling without optimization. Also add -fno-inline for
>> consistency and in case anyone wants to look at callstacks.
>>
>> Signed-off-by: James Clark <james.clark@linaro.org>
>> ---
>> One trailing Sashiko fix from the "perf cs-etm: Queue context packets
>> for frontend" patch series that has been applied already.
>> ---
>> tools/perf/tests/workloads/Build | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
>> index 75b377934a0e..7bb4b9829ba2 100644
>> --- a/tools/perf/tests/workloads/Build
>> +++ b/tools/perf/tests/workloads/Build
>> @@ -26,3 +26,4 @@ CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>> CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>> CFLAGS_inlineloop.o = -g -O2
>> CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>> +CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>>
>> ---
>> base-commit: 7336514f41e75d44782fee7e0990d4195a3d3161
>> change-id: 20260611-james-cs-unformatted-per-thread-fix-followup-babf28a4e640
>>
>> Best regards,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-12 8:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 11:13 [PATCH] perf test: Compile named_threads workload with -O0 James Clark
2026-06-11 12:38 ` Leo Yan
2026-06-11 15:08 ` Arnaldo Carvalho de Melo
2026-06-11 15:11 ` James Clark
2026-06-11 18:54 ` David Laight
2026-06-12 8:24 ` James Clark
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.