Re: [PATCH V8 06/44] mm/pkeys: Add Kconfig options for PKS

Dave Hansen
2022-02-14T21:29:03Z

On 2/8/22 21:34, Ira Weiny wrote:
>>> In other words, there are two things that must happen before the code
>>> gets compiled in:
>>>
>>> 1. Arch support
>>> 2. One or more features to use the arch support
>> Yes. I really think we are both say the same thing with different words.
> Is the following more clear?
>
> <commit>
>
> PKS is only useful to kernel consumers and is only available on some
> architectures. If no kernel consumers are configured or PKS support is
> not available the PKS code can be eliminated from the compile.
>
> Define a Kconfig structure which allows kernel consumers to detect
> architecture support (ARCH_HAS_SUPERVISOR_PKEYS) and, if available,
> indicate that PKS should be compiled in (ARCH_ENABLE_SUPERVISOR_PKEYS).
>
> In this patch ARCH_ENABLE_SUPERVISOR_PKEYS remains off until the first
> kernel consumer sets it.

It's a bit more clear. I wish it was more clear about the problem. I
think it would be well-served to add some specifics and clarify the
*problem*. Maybe something like:

== Problem ==

PKS support is provided by core x86 architecture code. Its consumers,
however, may be far-flung device drivers like NVDIMM support. The PKS
core architecture code is dead weight without a consumer.

--- maybe add one example ---

== Solution ==

Avoid even compiling in the core PKS code if there are no consumers.

== Details ==