Re: [PATCH] x86/resctrl: Fix uninitialized memory read when last CPU of domain goes offline

From: Ingo Molnar
Date: Sat Mar 30 2024 - 07:12:17 EST



* Reinette Chatre <reinette.chatre@xxxxxxxxx> wrote:

> Hi Ingo,
>
> On 3/29/2024 12:01 AM, Ingo Molnar wrote:
> >
> > * Reinette Chatre <reinette.chatre@xxxxxxxxx> wrote:
> >
> >> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> >> index c99f26ebe7a6..4f9ef35626a7 100644
> >> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> >> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> >> @@ -85,6 +85,10 @@ cpumask_any_housekeeping(const struct cpumask *mask, int exclude_cpu)
> >> if (cpu < nr_cpu_ids && !tick_nohz_full_cpu(cpu))
> >> return cpu;
> >>
> >> + /* Only continue if tick_nohz_full_mask has been initialized. */
> >> + if (!tick_nohz_full_enabled())
> >> + return cpu;
> >> +
> >
> > So we already have this a few lines up:
> >
> > if (!IS_ENABLED(CONFIG_NO_HZ_FULL))
> > return cpu;
> >
> > And we can combine the two checks into a single one, with the patch
> > below, right?
>
> Right. Indeed. Doing so is most appropriate. Thank you very much.
>
> >
> > Untested.
>
> Tested-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
> Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

Please just pick up my optimization to your fix and submit a v2 - you
did all the hard work.

Thanks,

Ingo