Re: [PATCH v7 5/8] x86/resctrl: Unwind the errors inside rdt_enable_ctx()

From: Reinette Chatre
Date: Wed Aug 16 2023 - 15:08:43 EST


Hi Babu,

On 8/16/2023 11:17 AM, Moger, Babu wrote:
> At rdt_kill_sb() the fs context is already freed. But, we can call
> rdt_disable_ctx() with no parameter. We will have to depend on other
> parameters to free the enabled features. We can use the same call both in
> rdt_get_tree() (the failure path above) and in rdt_kill_sb().
>
> The function rdt_disable_ctx will look like this.
>
> +static void rdt_disable_ctx(void)
> +{
> + if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L3))
> + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false);
> +
> + if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L2))
> + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false);
> +
> + if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl))
> + set_mba_sc(false);
> +}
>
>

This looks good to me. I think this will end up making
cdp_disable_all() unused so it may be candidate for removal as part
of this change.

Reinette