[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/12] xen/arm: add cache coloring initialization



Hi Jan, Wei

On Mon, Sep 26, 2022 at 9:42 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 26.09.2022 08:20, Wei Chen wrote:
> > On 2022/8/26 20:51, Carlo Nonato wrote:
> >> --- a/xen/arch/arm/Kconfig
> >> +++ b/xen/arch/arm/Kconfig
> >> @@ -131,6 +131,22 @@ config ARM64_BTI
> >>        Branch Target Identification support.
> >>        This feature is not supported in Xen.
> >>
> >> +config CACHE_COLORING
> >> +    bool "Last Level Cache (LLC) coloring" if EXPERT
> >> +    default n
>
> No need for this line, btw.
>
> >> +    depends on ARM_64
> >> +
> >> +config MAX_CACHE_COLORS
> >> +    int "Maximum number of cache colors"
> >> +    default 128
> >> +    range 0 65536
> >
> > Just curious. Why select 128 as default vaule here? Is it a classic
> > implmenntation for Arm64 cache? And the same question for the upper
> > bound 65536.
>
> Going beyond that: What is the meaning of the user picking 0 here?
> And isn't 1 merely mapping to the allocator we have, i.e. the
> CACHE_COLORING=n case? IOW shouldn't the lowe bound of the range
> be (at least) 2?

To answer both: I used "range" for two reasons:
 - to forbid negative numbers.
 - struct xen_arch_domainconfig can't be modified freely since it must
   respect some static build assertions on its size, which means that
   I'm bound to uint16_t for the "num_colors" field (see patch #2).
   Also, looking again at this, the range should end at 65535.
0 and 1 maximum colors aren't really meaningful as Jan said.
65536 is just a "big enough" number that shouldn't be possible to ever
reach (it corresponds, in "common conditions", to 4 GiB of cache. See docs or
below for the formula).
128 is also a high value since using 4 KiB pages and 16-ways cache,
it implies a 128 * 4 KiB * 16 = 8 MiB Last Level Cache.
Remember that this isn't the actual number of colors of the platform. It just
needs to be >= the actual value (which is computed from the probed LLC way
size or the command line provided one).

> Jan

Thanks.

- Carlo Nonato



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.