Re: [PATCH v3 2/2] proc: add /proc/<pid>/arch_state

From: Dave Hansen
Date: Thu Nov 15 2018 - 10:18:24 EST


On 11/14/18 3:00 PM, Aubrey Li wrote:
> +void arch_thread_state(struct seq_file *m, struct task_struct *task)
> +{
> + /*
> + * Report AVX-512 Hi16_ZMM registers usage
> + */
> + if (task->thread.fpu.hi16zmm_usage)
> + seq_putc(m, '1');
> + else
> + seq_putc(m, '0');
> + seq_putc(m, '\n');
> +}

Am I reading this right that this file just dumps out a plain 0 or 1
based on the internal kernel state? BTW, there's no example of the
output in the changelog, so it's rather hard to tell if my guess is
right. (Hint, hint).

If so, I'd really prefer you not do this. We have /proc/$pid/stat to
stand as a disaster in this regard. It is essentially
non-human-readable gibberish because it's impossible to tell what the
values mean without a decoder ring.

If we go down this road, we need a file along the lines of
/proc/$pid/status.

But, either way, this is a new ABI that we need to consider carefully.
It needs documentation. For instance, will this really mean "Hi16_ZMM
user" from now until the end of time? Or, does it just mean "group me
with other tasks that have this bit set"?