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

Re: [PATCH 12/12] xen/arm: add cache coloring support for Xen


  • To: Carlo Nonato <carlo.nonato@xxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 15 Sep 2022 15:25:40 +0200
  • 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=B4Z3F4o351xCf3aEuqf4PpLzBJ1/7waz0/pFnhv+1U4=; b=VUhVYZ0qacMlE3VYUsl8KUwp069paXAYusKC8QPlHO5Fg7FcwRVWzAv90z9g1JcdLKByNrgIBZT1r12Fa/AJatYE56h2Ld2tUhX60cOxzGPvTOmL5SU/XNGKGBiGAvuTM6no+/RmYR5xmtTgRuxPH8QBcqqRgCAecymtoBQuj0Qn0oJR3fYC+l7SOwbOgSj0JfiQvcunrzV68wdafwFNEfhV15nj2VJlYmvIFnwjlkrcmcXoLL5frmgiB6JaZ1Wrawhu5eO9HKWi3UsIC9aBnSBP6mQvGpyPG8+20wWf2lNzlrYogxrE/swrPzVwfQa/ZqeqC63qqjFRAk0Zk9bCEQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UA9lbMFAxiujxIwz+uIFC2wehApq6wpbUaHtMLLb9PTbYid9jgk2/UUSK86/3/jCnb61VrLyzu/4WiHDnL1OGHOheXLOoTF0DyCBPojLSFDaw0uLjbUzZi4s9HO3bfBRcLBofxOzEdUw4/mcS8kjtG2P8RZNMi9yyI1aobpfstQRzT6m5ojfC7Z3c7EeXzIhi5TNuxNzAaubazxxgVpCqjfmqPi6Wu4v84ZFOtrdYmM5Z/khXbrZKeYhn5m2HXhvWGt9A1bonTA+i1TfNN7AqpCGcX+LKmMyB9IZvYE1fWJLsw/q2m0hO6YSbBxgdE5FP4vnUjASVbkPu+S3FIl6SQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, julien@xxxxxxx, stefano.stabellini@xxxxxxx, wl@xxxxxxx, marco.solieri@xxxxxxxxxx, andrea.bastoni@xxxxxxxxxxxxxxx, lucmiccio@xxxxxxxxx, Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 15 Sep 2022 13:25:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.08.2022 14:51, Carlo Nonato wrote:
> --- a/xen/common/vmap.c
> +++ b/xen/common/vmap.c
> @@ -8,6 +8,9 @@
>  #include <xen/types.h>
>  #include <xen/vmap.h>
>  #include <asm/page.h>
> +#ifdef CONFIG_CACHE_COLORING
> +#include <asm/coloring.h>
> +#endif

Even independent of my earlier question towards more code becoming common,
I think there will want to be a xen/coloring.h which takes care of this
abstraction, requiring such #ifdef in just a single place.

> @@ -218,6 +221,28 @@ void *__vmap(const mfn_t *mfn, unsigned int granularity,
>      return va;
>  }
>  
> +#ifdef CONFIG_CACHE_COLORING
> +void * __vmap_colored(const mfn_t *mfn, unsigned int nr, unsigned int align,
> +                      unsigned int flags, enum vmap_region type)

Please no new functions with double underscores as prefix. Only static
symbol names may start with an underscore, and then also only with a
single one.

> +{
> +    void *va = vm_alloc(nr, align, type);
> +    unsigned long cur = (unsigned long)va;
> +    paddr_t pa = mfn_to_maddr(*mfn);
> +
> +    for ( ; va && nr-- ; cur += PAGE_SIZE )
> +    {
> +        pa = next_xen_colored(pa);

This may alter the address, yet the caller expects that the original
address be mapped. I must be missing something?

> +        if ( map_pages_to_xen(cur, maddr_to_mfn(pa), 1, flags) )
> +        {
> +            vunmap(va);
> +            return NULL;
> +        }
> +        pa += PAGE_SIZE;
> +    }
> +    return va;
> +}

Afaics you only consume the first slot of *mfn. What about the other
(nr - 1) ones? And compared to __vmap() there's no "granularity"
parameter, which is what controls the mapping of multiple contiguous
pages.

> --- a/xen/include/xen/vmap.h
> +++ b/xen/include/xen/vmap.h
> @@ -14,6 +14,10 @@ void vm_init_type(enum vmap_region type, void *start, void 
> *end);
>  
>  void *__vmap(const mfn_t *mfn, unsigned int granularity, unsigned int nr,
>               unsigned int align, unsigned int flags, enum vmap_region);
> +#ifdef CONFIG_CACHE_COLORING
> +void *__vmap_colored(const mfn_t *mfn, unsigned int nr, unsigned int align,
> +                     unsigned int flags, enum vmap_region);
> +#endif

I don't think such a declaration really needs putting inside #ifdef.

Jan



 


Rackspace

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