Re: [RFC PATCH v6 4/5] sched, tracing: add to report task state in symbolic chars

From: Peter Zijlstra
Date: Thu Aug 03 2023 - 04:59:45 EST

On Thu, Aug 03, 2023 at 04:33:51AM -0400, Ze Gao wrote:
> Internal representations of task state are likely to be changed
> or ordered, and reporting them to userspace without exporting
> them as part of API is basically wrong, which can easily break
> a userspace observability tool as kernel evolves. For example,
> perf suffers from this and still reports wrong states as of this
> writing.
> OTOH, some masqueraded states like TASK_REPORT_IDLE and
> TASK_REPORT_MAX are also reported inadvertently, which confuses
> things even more and most userspace tools do not even take them
> into consideration.
> So add a new variable in company with the old raw value to
> report task state in symbolic chars, which are self-explaining
> and no further translation is needed. Of course this does not
> break any userspace tool.
> Note for PREEMPT_ACTIVE, we introduce 'p' to report it and use
> the old conventions for the rest.
> Signed-off-by: Ze Gao <zegao@xxxxxxxxxxx>
> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> Acked-by: Ian Rogers <irogers@xxxxxxxxxx>

I'm not sure you've actually read any of the things I've written. I hate
this. Not going to happen.