Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62DAAC433EF for ; Wed, 9 Mar 2022 20:30:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.288089.488531 (Exim 4.92) (envelope-from ) id 1nS2wL-0006N2-2F; Wed, 09 Mar 2022 20:29:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 288089.488531; Wed, 09 Mar 2022 20:29:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nS2wK-0006Mv-Uy; Wed, 09 Mar 2022 20:29:44 +0000 Received: by outflank-mailman (input) for mailman id 288089; Wed, 09 Mar 2022 20:29:44 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nS2wK-0006Mp-1k for xen-devel@lists.xenproject.org; Wed, 09 Mar 2022 20:29:44 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nS2wJ-0004VV-KN; Wed, 09 Mar 2022 20:29:43 +0000 Received: from 54-240-197-225.amazon.com ([54.240.197.225] helo=[10.95.155.231]) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nS2wJ-0003Bs-Dg; Wed, 09 Mar 2022 20:29:43 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=r2aU9EIQeY9YmLinym1tZ4AHJ4iTxDziuWTVJWSFMJI=; b=au0QTTuFANrTaE0b1wnt4nm83Y E6D7gcdJ03GWdhQHqtPFAlnECC7nip90Z8tyQVbvcbk8jvu2DQ57np4TNeY70r63rjd9kzPPOv9rt t00Ou4ICUg8tkbQdnaf9wLQ4/pKhzbbQr+ryauR1X2V7UPVWPV7/FQrNwuub4p2bFELE=; Message-ID: <1ccdd08d-b880-b4d0-30a3-ca7c83eccc70@xen.org> Date: Wed, 9 Mar 2022 20:29:40 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 11/36] xen/include: define hypercall parameter for coloring To: Marco Solieri , xen-devel@lists.xenproject.org Cc: Andrew Cooper , George Dunlap , Jan Beulich , Stefano Stabellini , Wei Liu , Marco Solieri , Andrea Bastoni , Luca Miccio , Stefano Stabellini References: <20220304174701.1453977-1-marco.solieri@minervasys.tech> <20220304174701.1453977-12-marco.solieri@minervasys.tech> From: Julien Grall In-Reply-To: <20220304174701.1453977-12-marco.solieri@minervasys.tech> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 04/03/2022 17:46, Marco Solieri wrote: > From: Luca Miccio > > During domU creation process the colors selection has to be passed to > the Xen hypercall. > This is generally done using what Xen calls GUEST_HANDLE_PARAMS. In this > case a simple bitmask for the coloring configuration suffices. > Currently the maximum amount of supported colors is 128. > Add a new parameter that allows us to pass both the colors bitmask > and the number of elements in it. > > Signed-off-by: Luca Miccio > Signed-off-by: Marco Solieri > Signed-off-by: Stefano Stabellini > --- > xen/arch/arm/include/asm/coloring.h | 2 -- > xen/include/public/arch-arm.h | 8 ++++++++ I would prefer if the structure is defined in the same patch that will use it. This would make easier to figure out if the structure is indeed suitable. > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/xen/arch/arm/include/asm/coloring.h b/xen/arch/arm/include/asm/coloring.h > index fdd46448d7..1f7e0dde79 100644 > --- a/xen/arch/arm/include/asm/coloring.h > +++ b/xen/arch/arm/include/asm/coloring.h > @@ -23,8 +23,6 @@ > #ifndef __ASM_ARM_COLORING_H__ > #define __ASM_ARM_COLORING_H__ > > -#define MAX_COLORS_CELLS 4 > - In general, we should avoid moving code that was introduced within the same series. In this case, I am not convinced we should use a static array to communicate the information between the toolstack and Xen. This would make more difficult for the user to tweak update the number of colors. Instead, I think it should be better to expose to the toolstack the number of color supported and allocate a dynamic array. > #ifdef CONFIG_COLORING > #include > > diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h > index 94b31511dd..627cc42164 100644 > --- a/xen/include/public/arch-arm.h > +++ b/xen/include/public/arch-arm.h > @@ -303,6 +303,12 @@ struct vcpu_guest_context { > typedef struct vcpu_guest_context vcpu_guest_context_t; > DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); > > +#define MAX_COLORS_CELLS 4 > +struct color_guest_config { > + uint32_t max_colors; > + uint32_t colors[MAX_COLORS_CELLS]; > +}; This looks like an open-coded version of xenctl_bitmap. Can you have a look to use it? I would expect this will reduce how much code you introduced in the next patch. > + > /* > * struct xen_arch_domainconfig's ABI is covered by > * XEN_DOMCTL_INTERFACE_VERSION. > @@ -335,6 +341,8 @@ struct xen_arch_domainconfig { > * > */ > uint32_t clock_frequency; > + /* IN */ > + struct color_guest_config colors; > }; > #endif /* __XEN__ || __XEN_TOOLS__ */ > -- Julien Grall