public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf docs: arm_spe: Clarify more SPE requirements
@ 2024-03-12 13:25 James Clark
  2024-03-12 19:56 ` Ian Rogers
  0 siblings, 1 reply; 4+ messages in thread
From: James Clark @ 2024-03-12 13:25 UTC (permalink / raw)
  To: linux-perf-users
  Cc: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	linux-kernel

The question of exactly when KPTI needs to be disabled comes up a lot
because it doesn't always need to be done. Add the relevant kernel
function and some examples that describe the behavior.

Also describe the interrupt requirement and that no error message will
be printed if this isn't met.

Signed-off-by: James Clark <james.clark@arm.com>
---
 tools/perf/Documentation/perf-arm-spe.txt | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-arm-spe.txt b/tools/perf/Documentation/perf-arm-spe.txt
index bf03222e9a68..0a3eda482307 100644
--- a/tools/perf/Documentation/perf-arm-spe.txt
+++ b/tools/perf/Documentation/perf-arm-spe.txt
@@ -116,6 +116,15 @@ Depending on CPU model, the kernel may need to be booted with page table isolati
 (kpti=off). If KPTI needs to be disabled, this will fail with a console message "profiling buffer
 inaccessible. Try passing 'kpti=off' on the kernel command line".
 
+For the full criteria that determine whether KPTI needs to be forced off or not, see function
+unmap_kernel_at_el0() in the kernel sources. Common cases where it's not required
+are on the CPUs in kpti_safe_list, or on Arm v8.5+ where FEAT_E0PD is mandatory.
+
+The SPE interrupt must also be described by the firmware. If the module is loaded and KPTI is
+disabled (or isn't required to be disabled) but the SPE PMU still doesn't show in
+/sys/bus/event_source/devices/, then it's possible that the SPE interrupt isn't described by
+ACPI or DT. In this case no warning will be printed by the driver.
+
 Capturing SPE with perf command-line tools
 ------------------------------------------
 
@@ -199,7 +208,8 @@ Common errors
 
  - "Cannot find PMU `arm_spe'. Missing kernel support?"
 
-   Module not built or loaded, KPTI not disabled (see above), or running on a VM
+   Module not built or loaded, KPTI not disabled, interrupt not described by firmware,
+   or running on a VM. See 'Kernel Requirements' above.
 
  - "Arm SPE CONTEXT packets not found in the traces."
 
-- 
2.34.1


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

* Re: [PATCH] perf docs: arm_spe: Clarify more SPE requirements
  2024-03-12 13:25 [PATCH] perf docs: arm_spe: Clarify more SPE requirements James Clark
@ 2024-03-12 19:56 ` Ian Rogers
  2024-03-13  9:41   ` James Clark
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2024-03-12 19:56 UTC (permalink / raw)
  To: James Clark
  Cc: linux-perf-users, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, linux-kernel

On Tue, Mar 12, 2024 at 6:25 AM James Clark <james.clark@arm.com> wrote:
>
> The question of exactly when KPTI needs to be disabled comes up a lot
> because it doesn't always need to be done. Add the relevant kernel
> function and some examples that describe the behavior.
>
> Also describe the interrupt requirement and that no error message will
> be printed if this isn't met.
>
> Signed-off-by: James Clark <james.clark@arm.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/Documentation/perf-arm-spe.txt | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/Documentation/perf-arm-spe.txt b/tools/perf/Documentation/perf-arm-spe.txt
> index bf03222e9a68..0a3eda482307 100644
> --- a/tools/perf/Documentation/perf-arm-spe.txt
> +++ b/tools/perf/Documentation/perf-arm-spe.txt
> @@ -116,6 +116,15 @@ Depending on CPU model, the kernel may need to be booted with page table isolati
>  (kpti=off). If KPTI needs to be disabled, this will fail with a console message "profiling buffer
>  inaccessible. Try passing 'kpti=off' on the kernel command line".
>
> +For the full criteria that determine whether KPTI needs to be forced off or not, see function
> +unmap_kernel_at_el0() in the kernel sources. Common cases where it's not required
> +are on the CPUs in kpti_safe_list, or on Arm v8.5+ where FEAT_E0PD is mandatory.
> +
> +The SPE interrupt must also be described by the firmware. If the module is loaded and KPTI is
> +disabled (or isn't required to be disabled) but the SPE PMU still doesn't show in
> +/sys/bus/event_source/devices/, then it's possible that the SPE interrupt isn't described by
> +ACPI or DT. In this case no warning will be printed by the driver.
> +
>  Capturing SPE with perf command-line tools
>  ------------------------------------------
>
> @@ -199,7 +208,8 @@ Common errors
>
>   - "Cannot find PMU `arm_spe'. Missing kernel support?"
>
> -   Module not built or loaded, KPTI not disabled (see above), or running on a VM
> +   Module not built or loaded, KPTI not disabled, interrupt not described by firmware,
> +   or running on a VM. See 'Kernel Requirements' above.
>
>   - "Arm SPE CONTEXT packets not found in the traces."
>
> --
> 2.34.1
>

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

* Re: [PATCH] perf docs: arm_spe: Clarify more SPE requirements
  2024-03-12 19:56 ` Ian Rogers
@ 2024-03-13  9:41   ` James Clark
  2024-03-15 20:32     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: James Clark @ 2024-03-13  9:41 UTC (permalink / raw)
  To: Ian Rogers
  Cc: linux-perf-users, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, linux-kernel



On 12/03/2024 19:56, Ian Rogers wrote:
> On Tue, Mar 12, 2024 at 6:25 AM James Clark <james.clark@arm.com> wrote:
>>
>> The question of exactly when KPTI needs to be disabled comes up a lot
>> because it doesn't always need to be done. Add the relevant kernel
>> function and some examples that describe the behavior.
>>
>> Also describe the interrupt requirement and that no error message will
>> be printed if this isn't met.
>>
>> Signed-off-by: James Clark <james.clark@arm.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>
> 
> Thanks,
> Ian
> 

Thanks for the review

>> ---
>>  tools/perf/Documentation/perf-arm-spe.txt | 12 +++++++++++-
>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/Documentation/perf-arm-spe.txt b/tools/perf/Documentation/perf-arm-spe.txt
>> index bf03222e9a68..0a3eda482307 100644
>> --- a/tools/perf/Documentation/perf-arm-spe.txt
>> +++ b/tools/perf/Documentation/perf-arm-spe.txt
>> @@ -116,6 +116,15 @@ Depending on CPU model, the kernel may need to be booted with page table isolati
>>  (kpti=off). If KPTI needs to be disabled, this will fail with a console message "profiling buffer
>>  inaccessible. Try passing 'kpti=off' on the kernel command line".
>>
>> +For the full criteria that determine whether KPTI needs to be forced off or not, see function
>> +unmap_kernel_at_el0() in the kernel sources. Common cases where it's not required
>> +are on the CPUs in kpti_safe_list, or on Arm v8.5+ where FEAT_E0PD is mandatory.
>> +
>> +The SPE interrupt must also be described by the firmware. If the module is loaded and KPTI is
>> +disabled (or isn't required to be disabled) but the SPE PMU still doesn't show in
>> +/sys/bus/event_source/devices/, then it's possible that the SPE interrupt isn't described by
>> +ACPI or DT. In this case no warning will be printed by the driver.
>> +
>>  Capturing SPE with perf command-line tools
>>  ------------------------------------------
>>
>> @@ -199,7 +208,8 @@ Common errors
>>
>>   - "Cannot find PMU `arm_spe'. Missing kernel support?"
>>
>> -   Module not built or loaded, KPTI not disabled (see above), or running on a VM
>> +   Module not built or loaded, KPTI not disabled, interrupt not described by firmware,
>> +   or running on a VM. See 'Kernel Requirements' above.
>>
>>   - "Arm SPE CONTEXT packets not found in the traces."
>>
>> --
>> 2.34.1
>>
> 

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

* Re: [PATCH] perf docs: arm_spe: Clarify more SPE requirements
  2024-03-13  9:41   ` James Clark
@ 2024-03-15 20:32     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-03-15 20:32 UTC (permalink / raw)
  To: James Clark
  Cc: Ian Rogers, linux-perf-users, Peter Zijlstra, Ingo Molnar,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter, linux-kernel

On Wed, Mar 13, 2024 at 09:41:54AM +0000, James Clark wrote:
> 
> 
> On 12/03/2024 19:56, Ian Rogers wrote:
> > On Tue, Mar 12, 2024 at 6:25 AM James Clark <james.clark@arm.com> wrote:
> >>
> >> The question of exactly when KPTI needs to be disabled comes up a lot
> >> because it doesn't always need to be done. Add the relevant kernel
> >> function and some examples that describe the behavior.
> >>
> >> Also describe the interrupt requirement and that no error message will
> >> be printed if this isn't met.
> >>
> >> Signed-off-by: James Clark <james.clark@arm.com>
> > 
> > Reviewed-by: Ian Rogers <irogers@google.com>
 
> Thanks for the review

Thanks, applied to perf-tools-next,

- Arnaldo
 
> >> ---
> >>  tools/perf/Documentation/perf-arm-spe.txt | 12 +++++++++++-
> >>  1 file changed, 11 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/tools/perf/Documentation/perf-arm-spe.txt b/tools/perf/Documentation/perf-arm-spe.txt
> >> index bf03222e9a68..0a3eda482307 100644
> >> --- a/tools/perf/Documentation/perf-arm-spe.txt
> >> +++ b/tools/perf/Documentation/perf-arm-spe.txt
> >> @@ -116,6 +116,15 @@ Depending on CPU model, the kernel may need to be booted with page table isolati
> >>  (kpti=off). If KPTI needs to be disabled, this will fail with a console message "profiling buffer
> >>  inaccessible. Try passing 'kpti=off' on the kernel command line".
> >>
> >> +For the full criteria that determine whether KPTI needs to be forced off or not, see function
> >> +unmap_kernel_at_el0() in the kernel sources. Common cases where it's not required
> >> +are on the CPUs in kpti_safe_list, or on Arm v8.5+ where FEAT_E0PD is mandatory.
> >> +
> >> +The SPE interrupt must also be described by the firmware. If the module is loaded and KPTI is
> >> +disabled (or isn't required to be disabled) but the SPE PMU still doesn't show in
> >> +/sys/bus/event_source/devices/, then it's possible that the SPE interrupt isn't described by
> >> +ACPI or DT. In this case no warning will be printed by the driver.
> >> +
> >>  Capturing SPE with perf command-line tools
> >>  ------------------------------------------
> >>
> >> @@ -199,7 +208,8 @@ Common errors
> >>
> >>   - "Cannot find PMU `arm_spe'. Missing kernel support?"
> >>
> >> -   Module not built or loaded, KPTI not disabled (see above), or running on a VM
> >> +   Module not built or loaded, KPTI not disabled, interrupt not described by firmware,
> >> +   or running on a VM. See 'Kernel Requirements' above.
> >>
> >>   - "Arm SPE CONTEXT packets not found in the traces."
> >>
> >> --
> >> 2.34.1
> >>
> > 

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

end of thread, other threads:[~2024-03-15 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-12 13:25 [PATCH] perf docs: arm_spe: Clarify more SPE requirements James Clark
2024-03-12 19:56 ` Ian Rogers
2024-03-13  9:41   ` James Clark
2024-03-15 20:32     ` Arnaldo Carvalho de Melo

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