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

Re: [PATCH 09/36] xen/arch: add default colors selection function


  • To: Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Mar 2022 08:28:15 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jyxxv8GTl8y+hQQym9L9nFDOc5vItDRJsUKCqsZ7LDM=; b=HpKK3+YKKkO6t7AA1IUNrgeVoiBmpdFtk1YZU9pDZJaX8oVuY+b+/VyrvKNY2Gk8+VyPe9KNc3q4yGaoLMdvUfyvd3BIQutMieu0Ay8x8Dgpaz9Eln41fkNVX0zaFf7DTsXAvKLLe9XmAvzCTyZbOtRKvLZZ2uGYqL/HdDxlcBlYtx8OZeE+6iUx7blH6OiiVXRmS27jNuB4gON1KpofQDBWEkmdUbBvu95goidqUgyG4nZL82ra2Tk+OwiLddx03sRqpl6/PogHdKRPIIbaVqEodGJQB8GZu/ACvwFE7kTIq9+tMG/9H+apwh+DOdJzPmqxoD/Npm8Yhz+RQ/t40Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZcJ+da8/bRRh0P2Dp3xtWAlNMnZs9T6ubSqTISduIgE/70l8zxOxfZcH99f3aR0Rc1TSemFkLNyMiuaLMlOecuAqweLJ6f2wY2Rw+i4DlacVWob3jVbSBuQjovvDt2arqFwU+8QrkXtKW0UXBE1AlEfJJHt3Zet/pChvY/b7hgP1fvYAyMtTI3irUSxbyFuTWFl9yWkeSWsaU8oKfIoyzwR4F6BRs7sZViV5a5ZGRS2H+HR54GQNufhGV7cYgjXKZRB63/YeR/VwkFw++JAVJxy5JN3NBsWmuM9nOTd505QlJ6zKmLB6VWZcGu1hrTsRn6uh4MI0CCqCCLt+yV3/wQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Marco Solieri <marco.solieri@xxxxxxxxxx>, Andrea Bastoni <andrea.bastoni@xxxxxxxxxxxxxxx>, Luca Miccio <lucmiccio@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 07 Mar 2022 07:28:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.03.2022 18:46, Marco Solieri wrote:
> From: Luca Miccio <lucmiccio@xxxxxxxxx>
> 
> When cache coloring support is enabled, a color assignment is needed for
> every domain. Introduce a function computing a default configuration
> with a safe and common value -- the dom0 color selection.
> 
> Do not access directly the array of color indices of dom0. Instead make
> use of the dom0 color configuration as a bitmask.
> Add a helper function that converts the color configuration bitmask into
> the indices array.
> 
> Signed-off-by: Luca Miccio <lucmiccio@xxxxxxxxx>
> Signed-off-by: Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx>

Nit (but relevant because it might be misguiding people just glancing over
the series): Did you mean "xen/arm:" rather than "xen/arch:" in the title
here as well as in that of the next patch?

Jan

> ---
>  xen/arch/arm/coloring.c             | 36 +++++++++++++++++++++++++++++
>  xen/arch/arm/include/asm/coloring.h |  7 ++++++
>  2 files changed, 43 insertions(+)
> 
> diff --git a/xen/arch/arm/coloring.c b/xen/arch/arm/coloring.c
> index af75b536a7..f6e6d09477 100644
> --- a/xen/arch/arm/coloring.c
> +++ b/xen/arch/arm/coloring.c
> @@ -143,6 +143,42 @@ static __init uint64_t calculate_addr_col_mask(uint64_t 
> llc_way_size)
>      return addr_col_mask;
>  }
>  
> +static int copy_mask_to_list(
> +    uint32_t *col_mask, uint32_t *col_list, uint64_t col_num)
> +{
> +    unsigned int i, k, c;
> +
> +    if ( !col_list )
> +        return -EINVAL;
> +
> +    for ( i = 0, k = 0; i < MAX_COLORS_CELLS; i++ )
> +        for ( c = 0; k < col_num && c < 32; c++ )
> +            if ( col_mask[i] & (1 << (c + (i*32))) )
> +                col_list[k++] = c + (i * 32);
> +
> +    return 0;
> +}
> +
> +uint32_t *setup_default_colors(uint32_t *col_num)
> +{
> +    uint32_t *col_list;
> +
> +    if ( dom0_col_num )
> +    {
> +        *col_num = dom0_col_num;
> +        col_list = xzalloc_array(uint32_t, dom0_col_num);
> +        if ( !col_list )
> +        {
> +            printk(XENLOG_ERR "setup_default_colors: Alloc failed\n");
> +            return NULL;
> +        }
> +        copy_mask_to_list(dom0_col_mask, col_list, dom0_col_num);
> +        return col_list;
> +    }
> +
> +    return NULL;
> +}
> +
>  bool __init coloring_init(void)
>  {
>      int i;
> diff --git a/xen/arch/arm/include/asm/coloring.h 
> b/xen/arch/arm/include/asm/coloring.h
> index 70e1dbd09b..8f24acf082 100644
> --- a/xen/arch/arm/include/asm/coloring.h
> +++ b/xen/arch/arm/include/asm/coloring.h
> @@ -27,6 +27,13 @@
>  
>  #ifdef CONFIG_COLORING
>  bool __init coloring_init(void);
> +
> +/*
> + * Return an array with default colors selection and store the number of
> + * colors in @param col_num. The array selection will be equal to the dom0
> + * color configuration.
> + */
> +uint32_t *setup_default_colors(uint32_t *col_num);
>  #else /* !CONFIG_COLORING */
>  static inline bool __init coloring_init(void)
>  {




 


Rackspace

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