Re: [RFC PATCH 0/4] perf: Correlating user process data to samples

From: Peter Zijlstra
Date: Fri Apr 12 2024 - 03:13:18 EST



On Fri, Apr 12, 2024 at 12:17:28AM +0000, Beau Belgrave wrote:

> An idea flow would look like this:
> User Task Profile
> do_work(); sample() -> IP + No activity
> ...
> set_activity(123);
> ...
> do_work(); sample() -> IP + activity (123)
> ...
> set_activity(124);
> ...
> do_work(); sample() -> IP + activity (124)

This, start with this, because until I saw this, I was utterly confused
as to what the heck you were on about.

I started by thinking we already have TID in samples so you can already
associate back to user processes and got increasingly confused the
further I went.

What you seem to want to do however is have some task-state included so
you can see what the thread is doing.

Anyway, since we typically run stuff from NMI context, accessing user
data is 'interesting'. As such I would really like to make this work
depend on the call-graph rework that pushes all the user access bits
into return-to-user.