linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Copying TLS/user register data per perf-sample?
@ 2024-04-04 19:26 Beau Belgrave
  2024-04-09 23:32 ` Namhyung Kim
  2024-04-10 13:06 ` Masami Hiramatsu
  0 siblings, 2 replies; 7+ messages in thread
From: Beau Belgrave @ 2024-04-04 19:26 UTC (permalink / raw)
  To: Namhyung Kim, Masami Hiramatsu; +Cc: linux-trace-kernel, linux-kernel

Hello,

I'm looking into the possibility of capturing user data that is pointed
to by a user register (IE: fs/gs for TLS on x86/64) for each sample via
perf_events.

I was hoping to find a way to do this similar to PERF_SAMPLE_STACK_USER.
I think it could even use roughly the same ABI in the perf ring buffer.
Or it may be possible by some kprobe linked to the perf sample function.

This would allow a profiler to collect TLS (or other values) on x64. In
the Open Telemetry profiling SIG [1], we are trying to find a fast way
to grab a tracing association quickly on a per-thread basis. The team
at Elastic has a bespoke way to do this [2], however, I'd like to see a
more general way to achieve this. The folks I've been talking with seem
open to the idea of just having a TLS value for this we could capture
upon each sample. We could then just state, Open Telemetry SDKs should
have a TLS value for span correlation. However, we need a way to sample
the TLS value(s) when a sampling event is generated.

Is this already possible via some other means? It'd be great to be able
to do this directly at the perf_event sample via the ABI or a probe.

Thanks,
-Beau

1. https://opentelemetry.io/blog/2024/profiling/
2. https://www.elastic.co/blog/continuous-profiling-distributed-tracing-correlation

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

end of thread, other threads:[~2024-04-11 15:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04 19:26 Copying TLS/user register data per perf-sample? Beau Belgrave
2024-04-09 23:32 ` Namhyung Kim
2024-04-10 15:37   ` Beau Belgrave
2024-04-10 13:06 ` Masami Hiramatsu
2024-04-10 15:35   ` Beau Belgrave
2024-04-11 15:55     ` Masami Hiramatsu
2024-04-11 15:58       ` Beau Belgrave

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).