On 29.01.2024 18:18, Carlo Nonato wrote:
> --- a/xen/common/llc-coloring.c
> +++ b/xen/common/llc-coloring.c
> @@ -9,6 +9,9 @@
> #include <xen/llc-coloring.h>
> #include <xen/param.h>
>
> +#define XEN_DEFAULT_COLOR 0
> +#define XEN_DEFAULT_NUM_COLORS 1
> +
> bool __ro_after_init llc_coloring_enabled;
> boolean_param("llc-coloring", llc_coloring_enabled);
>
> @@ -21,6 +24,9 @@ static unsigned int __ro_after_init max_nr_colors =
> CONFIG_NR_LLC_COLORS;
> static unsigned int __initdata dom0_colors[CONFIG_NR_LLC_COLORS];
> static unsigned int __initdata dom0_num_colors;
>
> +static unsigned int __ro_after_init xen_colors[CONFIG_NR_LLC_COLORS];
So unlike for Dom0 here you use the static buffer at runtime.
> +static unsigned int __ro_after_init xen_num_colors;
Taken together, I don't see the value in having XEN_DEFAULT_COLOR:
One can't simply change it and XEN_DEFAULT_NUM_COLORS to have Xen have,
say, 4 colors by default. I think you want to have xen_colors[] have
an initializer, with XEN_DEFAULT_COLOR dropped and XEN_DEFAULT_NUM_COLORS
moved. Or you actually allocate the runtime buffer if a command line
option is found, and just use ARRAY_SIZE() as the default count.
Jan