On 02.08.2026 15:09, Sergii Dmytruk wrote:
> In addition to keeping the state in one place instead of on stack and in
> a static variable, this enables exposing this functionality to other
> units in the future.
>
> Signed-off-by: Sergii Dmytruk <[email protected]>
> ---
>
> Notes:
> v4: was called "x86/mtrr: expose functions for pausing caching"
> v4: no longer makes anything public, just updates implementation
> v4: the state structure is now an output parameter instead of a return
> value
I don't mind it to stay as you have it now, but recently we discussed this
aspect in another context, and I've changed my position: When the struct
can be returned in registers, it's okay to return by value.
> @@ -439,7 +440,7 @@ static DEFINE_SPINLOCK(set_atomicity_lock);
> * has been called.
> */
>
> -static bool prepare_set(void)
> +static void mtrr_pause_caching(struct mtrr_pausing_state *state)
> {
> unsigned long cr4;
Considering the conditional ...
> @@ -461,7 +462,9 @@ static bool prepare_set(void)
> alternative("wbinvd", "", X86_FEATURE_XEN_SELFSNOOP);
... cache flush that's done (and the comment just out of context also
correctly saying "no-fill cache mode"), we're not really pausing caching
in all cases. I'm therefore worried of the new names of the two involved
functions. Andrew, Roger - thoughts? (My inclination would be to suggest
mtrr_{pause,resume}_cache_fill().)
Jan