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

Re: [PATCH v4 3/3] xen: introduce CONFIG_HAS_DOMAIN_TYPE


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Thu, 7 May 2026 08:48:38 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=HQnsXo8ShLlcSLHfB3gU9u0PBi2v1z/C0PjQy49ENPM=; b=FfjLNfnbLMMj6tv7RUEyOjbrkapi9J3jRfPeGvjEmn7gf5/a14rI/+noOas6a8TcFqQDVCEndodZ9aDnp1Lu/0y9QSfLbbqiG1JC7zGHjmpGJdSX6GS9b6ICgpBwzhuF195uphwHovza9sDMS2vziOCGE1SExB+xPCj+JmR6Bkl0JKeTizU32FTLXpy9mmn2XmCYH7HEk6srtcT8UUvgm2/f78DZmCHKrxJSBHuRgGLoKpXyRvAGmQg0wdj3Re5fX1N/Oiyja997CI7I2wqzM3gooAtp5bC0pMrXQMOJ4R+Ky2oUNOHM4DFcXDovLZ+ai2ic3Cig+V4IS77cZ0SYXQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MByHTuFJfj6xJDWHKN0NGM9U1kI2DLzFWfAqaZmfxPDjJQHJ22BNXfyZi0Uvom9h1y7ZubMv4qQOQeh26uAXnk8RMkyCSw2rjdImmkmwhapf85fqa0mVnJIY+DNMvAGjxEDTEhM9oYsAwW519vemsp0x9yh+i9OqD2UXNy2IIE+v9kIU00i06Q31i6q7fDzFIXlgoVLjZ23LZQTskM9i1SjqFpMKcg1j6XH2h35AmZLEUIgNwVvA3OCf0KPtLIg18oSBZU1+a7qzfDkgsPbC2nYA0YIFRJqgU00EB3cO4SvG4ZO/RjhVtatvcIh4Gl8upBV/rZbizJwuy4FjSgoVzw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Romain Caritey <Romain.Caritey@xxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 07 May 2026 06:49:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 06-May-26 09:44, Oleksii Kurochko wrote:
> 
> 
> On 5/4/26 2:21 PM, Jan Beulich wrote:
>> On 27.04.2026 17:34, Oleksii Kurochko wrote:
>>> As domain type is part of common code now there is no any reason
>>> to have architecture-specific set_domain_type() functions so
>>> it is dropped.
>>>
>>> Change the guard around access of kinfo->type to CONFIG_HAS_DOMAIN_TYPE
>>> for consistency. Also, drop and add some parentheses to be aligned
>>> with the similar if() below.
>>>
>>> x86 with CONFIG_64BIT=y shouldn't use is_{32,64}bit_domain() as
>>> x86 doesn't have support of CONFIG_HAS_DOMAIN_TYPE. Since x86_32 Xen no
>>> longer builds, the fallback is currently only relevant for arm32.
>>>
>>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
>>> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
>>
>> In principle:
>> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Thanks.
> 
>>
>> However, still a few remarks:
>>
>>> --- a/xen/include/xen/domain.h
>>> +++ b/xen/include/xen/domain.h
>>> @@ -13,6 +13,19 @@ struct guest_area {
>>>       void *map;
>>>   };
>>>   
>>> +#ifdef CONFIG_HAS_DOMAIN_TYPE
>>> +enum __packed domain_type {
>>> +    DOMAIN_32BIT,
>>> +    DOMAIN_64BIT,
>>> +};
>>> +#define is_32bit_domain(d) ((d)->type == DOMAIN_32BIT)
>>> +#define is_64bit_domain(d) ((d)->type == DOMAIN_64BIT)
>>> +#elif !defined(CONFIG_64BIT)
>>> +/* At the moment on 32-bit-only platforms all domains are 32-bit. */
>>> +#define is_32bit_domain(d) (true)
>>> +#define is_64bit_domain(d) (false)
>>
>> I think it would be nice if the excess parentheses were dropped from here.
>>
>>> --- a/xen/include/xen/fdt-domain-build.h
>>> +++ b/xen/include/xen/fdt-domain-build.h
>>> @@ -7,6 +7,7 @@
>>>   #include <xen/device_tree.h>
>>>   #include <xen/fdt-kernel.h>
>>>   #include <xen/mm.h>
>>> +#include <xen/sched.h>
>>>   #include <xen/types.h>
>>>   
>>>   struct domain;
>>> @@ -69,6 +70,14 @@ static inline uint32_t alloc_phandle(struct kernel_info 
>>> *kinfo)
>>>       return kinfo->next_phandle >= GUEST_PHANDLE_GIC ? 0 : 
>>> kinfo->next_phandle++;
>>>   }
>>>   
>>> +static inline void set_domain_type(struct domain *d, struct kernel_info 
>>> *kinfo)
>>
>> Pointer-to-const for the 2nd parameter?
> 
> I will apply this comment and comment above.
> 
>>
>>> +{
>>> +#ifdef CONFIG_HAS_DOMAIN_TYPE
>>> +    /* Type must be set before allocate memory */
>>
>> This comment would be more prominent if it lived outside of the #ifdef,
>> perhaps (read on) ahead of the function. I wonder though why it's only
>> a comment, and not e.g. an assertion. If an assertion was possible to
>> add, the comment would want to live next to it. Without an assertion
>> putting it ahead of the function may be better.
>>
>> Depending on how far to go, changes could be made while committing, or a
>> proper v5 may want submitting.
> 
> I think that instead of comment or just after comment the following 
> could be added:
>    ASSERT(!domain_tot_pages(d));
> 
> Jan, Michal, do you see any concern with that ASSERT() or I could add it 
> and keep your Ack-by and R-by.
I don't see any issues with it. You can send a v5 and I'll commit it later on.

~Michal




 


Rackspace

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