Re: [PATCH v5 09/15] x86/mtrr: allocate mtrr_value array dynamically

From: Borislav Petkov
Date: Wed Apr 12 2023 - 17:12:13 EST


On Sat, Apr 01, 2023 at 08:36:46AM +0200, Juergen Gross wrote:
> +#ifdef CONFIG_X86_32

TBH, I'm not really crazy about adding more ifdeffery.

Wondering if adding a 32-bit only build object:

obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o legacy.o

to arch/x86/kernel/cpu/mtrr/Makefile and moving all that gunk over
there, out of the way, would be even cleaner...

> + mtrr_value = kcalloc(num_var_ranges, sizeof(*mtrr_value), GFP_KERNEL);
> +
> /*
> * The CPU has no MTRR and seems to not support SMP. They have
> * specific drivers, we use a tricky method to support
> - * suspend/resume for them.
> + * suspend/resume for them. In case above allocation failed we can't
> + * support suspend/resume (handled in mtrr_save()).

Oh well.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette