All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Orzel <michal.orzel@amd.com>
To: Carlo Nonato <carlo.nonato@minervasys.tech>,
	<xen-devel@lists.xenproject.org>
Cc: <andrea.bastoni@minervasys.tech>, <marco.solieri@minervasys.tech>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v11 01/12] xen/common: add cache coloring common code
Date: Thu, 5 Dec 2024 09:00:45 +0100	[thread overview]
Message-ID: <201c8fb0-83d5-4647-ba4e-6c8cf60c0ed5@amd.com> (raw)
In-Reply-To: <a5c7fde4-6db2-4c34-b4d2-7c5ec5a4cc0e@amd.com>



On 03/12/2024 10:55, Michal Orzel wrote:
> 
> 
> On 02/12/2024 17:59, Carlo Nonato wrote:
>>
>>
>> Last Level Cache (LLC) coloring allows to partition the cache in smaller
>> chunks called cache colors.
>>
>> Since not all architectures can actually implement it, add a HAS_LLC_COLORING
>> Kconfig option.
>> LLC_COLORS_ORDER Kconfig option has a range maximum of 10 (2^10 = 1024)
>> because that's the number of colors that fit in a 4 KiB page when integers
>> are 4 bytes long.
>>
>> LLC colors are a property of the domain, so struct domain has to be extended.
>>
>> Based on original work from: Luca Miccio <lucmiccio@gmail.com>
>>
>> Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
>> Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
>> Acked-by: Michal Orzel <michal.orzel@amd.com>
> 
> [...]
>>
>> +### llc-coloring (arm64)
>> +> `= <boolean>`
>> +
>> +> Default: `false`
> By default, it is disabled. If CONFIG_ is enabled but ...
> 
> [...]
> 
>> + * -1: not specified (disabled unless llc-size and llc-nr-ways present)
> the user doesn't specify any llc-* options, LLC feature should be disabled.
> In your case llc_coloring_enabled is -1 and due to 'if ( llc_coloring_enabled ... )' checks
> all around the code base, the LLC will be enabled even though it should not.
> 
> You can either set it to 0 if (llc_coloring_enabled < 0) and other llc-* options have not been provided
> (this would require modifying this comment to provide different meaning depending on the context) or
> you could do sth like that:
> 
> diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
> index 2d6aed5fb4ac..560fe03aa86b 100644
> --- a/xen/common/llc-coloring.c
> +++ b/xen/common/llc-coloring.c
> @@ -18,8 +18,10 @@
>   *  0: explicitly disabled through cmdline
>   *  1: explicitly enabled through cmdline
>   */
> -int8_t __ro_after_init llc_coloring_enabled = -1;
> -boolean_param("llc-coloring", llc_coloring_enabled);
> +int8_t __init opt_llc_coloring = -1;
> +boolean_param("llc-coloring", opt_llc_coloring);
> +
> +bool __ro_after_init llc_coloring_enabled = false;
> 
>  static unsigned int __initdata llc_size;
>  size_param("llc-size", llc_size);
> @@ -147,15 +149,17 @@ void __init llc_coloring_init(void)
>  {
>      unsigned int way_size, i;
> 
> -    if ( (llc_coloring_enabled < 0) && (llc_size && llc_nr_ways) )
> +    if ( (opt_llc_coloring < 0) && (llc_size && llc_nr_ways) )
>      {
>          llc_coloring_enabled = true;
>          way_size = llc_size / llc_nr_ways;
>      }
> -    else if ( !llc_coloring_enabled )
> +    else if ( !opt_llc_coloring )
>          return;
>      else
>      {
> +        llc_coloring_enabled = true;
> +
>          way_size = get_llc_way_size();
>          if ( !way_size )
>              panic("LLC probing failed and 'llc-size' or 'llc-nr-ways' missing\n");
> 
> I think that this would be better in terms of readability.
> 
> ~Michal
> 
> 
On top of my previous comments, attempt to build patch 2 with LLC_COLORING enabled results in a few
build errors. In general, this should be avoided to allow bisection. There are 2 issues:
 - error: invalid use of undefined type 'const struct domain'
   You need to include xen/sched.h
 - error: unknown type name 'int8_t'
   You need to include xen/types.h in a header (regardless of whether you stick to int8_t or bool)
 - implicit declaration of function 'isb'

~Michal




  reply	other threads:[~2024-12-05  8:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02 16:59 [PATCH v11 00/12] Arm cache coloring Carlo Nonato
2024-12-02 16:59 ` [PATCH v11 01/12] xen/common: add cache coloring common code Carlo Nonato
2024-12-03  9:55   ` Michal Orzel
2024-12-05  8:00     ` Michal Orzel [this message]
2024-12-09 13:35     ` Jan Beulich
2024-12-02 16:59 ` [PATCH v11 02/12] xen/arm: add initial support for LLC coloring on arm64 Carlo Nonato
2024-12-05  8:04   ` Michal Orzel
2024-12-02 16:59 ` [PATCH v11 03/12] xen/arm: permit non direct-mapped Dom0 construction Carlo Nonato
2024-12-05  9:40   ` Michal Orzel
2024-12-06 18:37     ` Julien Grall
2024-12-07 15:04       ` Michal Orzel
2024-12-09  9:47         ` Carlo Nonato
2024-12-09 19:17         ` Julien Grall
2024-12-12 17:48           ` Carlo Nonato
2024-12-12 18:22             ` Andrea Bastoni
2024-12-13  9:45               ` Michal Orzel
2024-12-13 10:26                 ` Carlo Nonato
2024-12-13 10:56                   ` Michal Orzel
2024-12-13 11:30                     ` Carlo Nonato
2024-12-13 11:33                       ` Carlo Nonato
2024-12-13 11:47                         ` Michal Orzel
2024-12-13 12:45                           ` Carlo Nonato
2024-12-02 16:59 ` [PATCH v11 04/12] xen/arm: add Dom0 cache coloring support Carlo Nonato
2024-12-02 16:59 ` [PATCH v11 05/12] xen: extend domctl interface for cache coloring Carlo Nonato
2024-12-02 16:59 ` [PATCH v11 06/12] tools: add support for cache coloring configuration Carlo Nonato
2024-12-04 14:07   ` Anthony PERARD
2024-12-02 16:59 ` [PATCH v11 07/12] xen/arm: add support for cache coloring configuration via device-tree Carlo Nonato
2024-12-02 16:59 ` [PATCH v11 08/12] xen/page_alloc: introduce preserved page flags macro Carlo Nonato
2024-12-02 17:33   ` Carlo Nonato
2024-12-03  8:54     ` Jan Beulich
2024-12-02 16:59 ` [PATCH v11 09/12] xen: add cache coloring allocator for domains Carlo Nonato
2024-12-09 13:41   ` Jan Beulich
2024-12-02 16:59 ` [PATCH v11 10/12] xen/arm: add Xen cache colors command line parameter Carlo Nonato
2024-12-02 16:59 ` [PATCH v11 11/12] xen/arm: make consider_modules() available for xen relocation Carlo Nonato
2024-12-02 16:59 ` [PATCH v11 12/12] xen/arm: add cache coloring support for Xen image Carlo Nonato
2024-12-02 21:44   ` Julien Grall
2024-12-03 10:08     ` Carlo Nonato
2024-12-03 10:36       ` Julien Grall
2024-12-03 11:37         ` Carlo Nonato
2024-12-04 11:18           ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201c8fb0-83d5-4647-ba4e-6c8cf60c0ed5@amd.com \
    --to=michal.orzel@amd.com \
    --cc=andrea.bastoni@minervasys.tech \
    --cc=andrew.cooper3@citrix.com \
    --cc=carlo.nonato@minervasys.tech \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=marco.solieri@minervasys.tech \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.