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

From: Li, Aubrey
Date: Thu Nov 15 2018 - 19:32:25 EST


On 2018/11/15 23:18, Dave Hansen wrote:
> 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.

Yes, I'm following /proc/$pid/stat format, as I think this interface is
not for the end user, but for developer and user space job scheduler. So
I guess this style might be okay.

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

I checked /proc/$pid/status, all common information to architectures.
That's why I want to open a new interface to CPU specific state.

>
> 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"?
>
I'm open to this interface. Let's wait to see if there are more comments
and suggestions.

Thanks,
-Aubrey