Re: [RFC PATCH v2 16/20] rcu: Make RCU dynticks counter size configurable

From: Valentin Schneider
Date: Fri Jul 21 2023 - 04:18:50 EST


On 20/07/23 17:30, Valentin Schneider wrote:
> index bdd7eadb33d8f..1ff2aab24e964 100644
> --- a/kernel/rcu/Kconfig
> +++ b/kernel/rcu/Kconfig
> @@ -332,4 +332,37 @@ config RCU_DOUBLE_CHECK_CB_TIME
> Say Y here if you need tighter callback-limit enforcement.
> Say N here if you are unsure.
>
> +config RCU_DYNTICKS_RANGE_BEGIN
> + int
> + depends on !RCU_EXPERT
> + default 31 if !CONTEXT_TRACKING_WORK

You'll note that this should be 30 really, because the lower *2* bits are
taken by the context state (CONTEXT_GUEST has a value of 3).

This highlights the fragile part of this: the Kconfig values are hardcoded,
but they depend on CT_STATE_SIZE, CONTEXT_MASK and CONTEXT_WORK_MAX. The
static_assert() will at least capture any misconfiguration, but having that
enforced by the actual Kconfig ranges would be less awkward.

Do we currently have a way of e.g. making a Kconfig file depend on and use
values generated by a C header?