Re: [PATCH v1 00/21] refactor Kconfig to consolidate KEXEC and CRASH options

From: Michael Ellerman
Date: Wed Jun 14 2023 - 23:27:03 EST


Eric DeVolder <eric.devolder@xxxxxxxxxx> writes:
> On 6/13/23 15:21, Kees Cook wrote:
>> On Mon, Jun 12, 2023 at 01:27:52PM -0400, Eric DeVolder wrote:
>>> The Kconfig is refactored to consolidate KEXEC and CRASH options from
>>> various arch/<arch>/Kconfig files into new file kernel/Kconfig.kexec.
>>
>> This looks very nice!
>>
> Thank you Kees!
>
>>> [...]
>>> - The boolean ARCH_HAS_<option> in effect allows the arch to determine
>>> when the feature is allowed. Archs which don't have the feature
>>> simply do not provide the corresponding ARCH_HAS_<option>.
>>> For each arch, where there previously were KEXEC and/or CRASH
>>> options, these have been replaced with the corresponding boolean
>>> ARCH_HAS_<option>, and an appropriate def_bool statement.
>>>
>>> For example, if the arch supports KEXEC_FILE, then the
>>> ARCH_HAS_KEXEC_FILE simply has a 'def_bool y'. This permits the
>>> KEXEC_FILE option to be available.
>>>
>>> If the arch has a 'depends on' statement in its original coding
>>> of the option, then that expression becomes part of the def_bool
>>> expression. For example, arm64 had:
>>>
>>> config KEXEC
>>> depends on PM_SLEEP_SMP
>>>
>>> and in this solution, this converts to:
>>>
>>> config ARCH_HAS_KEXEC
>>> def_bool PM_SLEEP_SMP
>>>
>>>
>>> - In order to account for the differences in the config coding for
>>> the three common options, the ARCH_SUPPORTS_<option> is used.
>>> This options has a 'depends on <option>' statement to couple it
>>> to the main option, and from there can insert the differences
>>> from the common option and the arch original coding of that option.
>>>
>>> For example, a few archs enable CRYPTO and CRYTPO_SHA256 for
>>> KEXEC_FILE. These require a ARCH_SUPPORTS_KEXEC_FILE and
>>> 'select CRYPTO' and 'select CRYPTO_SHA256' statements.
>>
>> Naming nit: "HAS" and "SUPPORTS" feel very similar, and looking at
>> existing configs, "ARCH_SUPPORTS_..." is already used for doing this
>> kind of bare "bool" management. e.g. see ARCH_SUPPORTS_INT128
>>
>> It looks like you need to split "depends" and "select" so the options
>> can be chosen separately from the "selectable" configs.
>>
>> How about naming this ARCH_SELECTS_<option>, since that's what it's
>> there for?
>>
> I'm OK with this. Let's see if others agree?

Yeah please rename one or both of them. At a glance the difference
between HAS and SUPPORTS is very non-obvious.

I like Kees' suggestion to use ARCH_SUPPORTS and ARCH_SELECTS.

cheers