HomeFreeBSD

arm64: write PID in CONTEXTIDR_EL1 on ctx switch

Description

arm64: write PID in CONTEXTIDR_EL1 on ctx switch

Debug and trace features such as Statistical Profiling Extension (SPE)
use the CONTEXTIDR_EL1 register to get the PID of the current process.

Add a sysctl switch to toggle writing the current PID into this register
in the thread switcher.

To make use of the feature, the following sysctl switch must be set:

sysctl machdep.pid_in_contextidr=1

Kernel code can also toggle the sysctl by writing directly to the global
var behind the sysctl arm64_pid_in_contextidr:

extern bool arm64_pid_in_contextidr;

Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46192

Details

Provenance
zachary.leaf_arm.comAuthored on Jul 31 2024, 8:23 AM
andrewCommitted on Mon, Sep 9, 4:03 PM
Reviewer
andrew
Differential Revision
D46192: arm64: write PID in CONTEXTIDR_EL1 on ctx switch
Parents
rG610348a90467: arm64: add additional MDCR_EL2 fields
Branches
Unknown
Tags
Unknown
Reverted By
rG5a800e965345: Revert "arm64: write PID in CONTEXTIDR_EL1 on ctx switch"