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

Re: [PATCH] xen/arm: Drop process_shm_chosen()


  • To: "Orzel, Michal" <Michal.Orzel@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Tue, 1 Apr 2025 14:49:05 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=LBoxAhTMvGTHVvXw6TRdNqZ5477E5cRCBeyA5QD0awA=; b=mr+LR2yUDOA0Nf7AUEIwcILw6nmij6vqXEK8NUcDgqKjDn+VOYajVSZFOcnn7veK2orCCqQHlZw5VyWwEaMUAI0QBVVAoVBEA1kOOvM8pGv1xiCXIRjXQCX1aOqLmFSnXkI0Jt5EDYWMt9jWu+ggpjzZXPpnsgLvndoZRcwNZMG560LxSzEFqPP6Y5zF3TPDZIUOBpS04pbqJ8X05wPSSP6Vo8x38p6TjT6NtVB1zOlsb+kJMYYUrDLZVZrfB+1R0Km+z2XqZmGoXDmKnoztTAnzi9kwtTiO0+kQZDegP107ShVstLSnjrr4Z73knS1jOYDTvHcib+7hUm/0LRfnFg==
  • 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=LBoxAhTMvGTHVvXw6TRdNqZ5477E5cRCBeyA5QD0awA=; b=rIqgQ2+RrucAiIzXQ6YmJuIi4PcI6l85kRWnEwLeonrCkv7573bX8rOTFa5v0y6VMYGyGweZSlt8O3M1O4j+PaEdnTVwwJE3Xbm8T6otGMyFIMtajeyIYMweUBEl/5XXcskzCEtojAFblymKkbtH32Lo1nc6TAMKaVS0kPMzUNMErGZtNcUkt85p43POJy6wwf0onUJ4+FDiUlZeovrZslyZKNaz86HkhCbyFWWxaCRvH9YQEoS3Eob7+uIl1Zz7bDAM+t/TvYvdwf+iU6Z3ZLXHTK3yPQvPZnd1vMwz0tA/vS3JjZ7tKmBH/ci0m1s/VtmNT2cTkFoluz6mTanRmA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=jS3vU61gwIWrUyf+iexoekfuvhBfQDhl49izRVqt/UqUayeh4yv/hbZHiqyMO7pLfvClLxRnNsbwfBVkIQoMY5dPZTNIKG8CgHwCGHJF8VPPP4pRwH7yFDpw7U9kU0LRfFviF0jpZ6VXjt1zKBRZ4t1blZExxfWzM7S4Q2EzUEJ//Z/iKuSFz9YYWcfh4WS6t7tY/TzGzXOhxTrOjValL9hb/PHTQpD+JE0WrYew5EwFLHMFsGgf3/r/a9OC8D98/r3THOnusdKkjOCyr4xo9M0yJ0ounmzHqryUxW8RnRkfHPgIiEzSctSnlpNTafdBWw8PgVVLPWldGzWrv/56NQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d24qkDXRrfX4egOHecja84hbUyCOQa2jpbjzi55wsltB8Zw48sCrDS9iK7Uy0PR1GvPYE4WPeBLWuJHOKQKtxKdOjwPJLS7VfRSms/WE5XytpYZcndx4nUXl2xBXj7INTe1mGVVwc7BCl6dEfjOwBV3n8XdjS17BM9fRXWwEfntrt1A97pB8WafOLYSG8gz3a3yu2g1bmMolzNkKjCj3ok5WyPrPpzPMXQ93qaFAnJ4uXwXzxepRSw78HTqvEsEE1o4v/JFAMu3HMKhHH3ccyxoCJgxgIbnZsnzR6piB4putSZDJ9pdT+XB0IMzhFHLn3b9qGyQfnxH8YSPlSfsIHA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 01 Apr 2025 14:49:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHbouXQNh7nKprt5k2iUHPtnXy/N7OOxVgAgAAX+QCAAAdEAA==
  • Thread-topic: [PATCH] xen/arm: Drop process_shm_chosen()

Hi,

> On 1 Apr 2025, at 16:22, Orzel, Michal <Michal.Orzel@xxxxxxx> wrote:
> 
> 
> 
> On 01/04/2025 14:57, Bertrand Marquis wrote:
>> 
>> 
>> Hi Michal,
>> 
>>> On 1 Apr 2025, at 11:09, Michal Orzel <michal.orzel@xxxxxxx> wrote:
>>> 
>>> There's no benefit in having process_shm_chosen() next to process_shm().
>>> The former is just a helper to pass "/chosen" node to the latter for
>>> hwdom case. Drop process_shm_chosen() and instead use process_shm()
>>> passing NULL as node parameter, which will result in searching for and
>>> using /chosen to find shm node (the DT full path search is done in
>>> process_shm() to avoid expensive lookup if !CONFIG_STATIC_SHM). This
>>> will simplify future handling of hw/control domain separation.
>>> 
>>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
>>> ---
>>> xen/arch/arm/domain_build.c             |  2 +-
>>> xen/arch/arm/include/asm/static-shmem.h | 14 --------------
>>> xen/arch/arm/static-shmem.c             |  4 ++++
>>> 3 files changed, 5 insertions(+), 15 deletions(-)
>>> 
>>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>>> index 2b5b4331834f..7f9e17e1de4d 100644
>>> --- a/xen/arch/arm/domain_build.c
>>> +++ b/xen/arch/arm/domain_build.c
>>> @@ -2325,7 +2325,7 @@ int __init construct_hwdom(struct kernel_info *kinfo)
>>>    else
>>>        allocate_memory(d, kinfo);
>>> 
>>> -    rc = process_shm_chosen(d, kinfo);
>>> +    rc = process_shm(d, kinfo, NULL);
>>>    if ( rc < 0 )
>>>        return rc;
>>> 
>>> diff --git a/xen/arch/arm/include/asm/static-shmem.h 
>>> b/xen/arch/arm/include/asm/static-shmem.h
>>> index fd0867c4f26b..94eaa9d500f9 100644
>>> --- a/xen/arch/arm/include/asm/static-shmem.h
>>> +++ b/xen/arch/arm/include/asm/static-shmem.h
>>> @@ -18,14 +18,6 @@ int make_resv_memory_node(const struct kernel_info 
>>> *kinfo, int addrcells,
>>> int process_shm(struct domain *d, struct kernel_info *kinfo,
>>>                const struct dt_device_node *node);
>>> 
>>> -static inline int process_shm_chosen(struct domain *d,
>>> -                                     struct kernel_info *kinfo)
>>> -{
>>> -    const struct dt_device_node *node = dt_find_node_by_path("/chosen");
>>> -
>>> -    return process_shm(d, kinfo, node);
>>> -}
>>> -
>>> int process_shm_node(const void *fdt, int node, uint32_t address_cells,
>>>                     uint32_t size_cells);
>>> 
>>> @@ -74,12 +66,6 @@ static inline int process_shm(struct domain *d, struct 
>>> kernel_info *kinfo,
>>>    return 0;
>>> }
>>> 
>>> -static inline int process_shm_chosen(struct domain *d,
>>> -                                     struct kernel_info *kinfo)
>>> -{
>>> -    return 0;
>>> -}
>>> -
>>> static inline void init_sharedmem_pages(void) {};
>>> 
>>> static inline int remove_shm_from_rangeset(const struct kernel_info *kinfo,
>>> diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
>>> index c74fa13d4847..cda90105923d 100644
>>> --- a/xen/arch/arm/static-shmem.c
>>> +++ b/xen/arch/arm/static-shmem.c
>>> @@ -297,6 +297,10 @@ int __init process_shm(struct domain *d, struct 
>>> kernel_info *kinfo,
>>> {
>>>    struct dt_device_node *shm_node;
>>> 
>>> +    /* Hwdom case - shm node under /chosen */
>>> +    if ( !node )
>>> +        node = dt_find_node_by_path("/chosen");
>>> +
>> 
>> I would have 2 questions here:
>> - what if a NULL pointer is passed, wouldn't you wrongly look in the main 
>> device tree ?
> Do you mean from hwdom or domU path? In the former it is expected. In the 
> latter
> it would be a bug given that there are several dozens of things that operate 
> on
> this node being a /chosen/domU@X node before we pass node to process_shm().
> 
>> - isn't there a NULL case to be handled if dt_find_node_by_path does not 
>> find a result ?
> It wasn't validated before this change. It would be catched in early boot code
> so no worries.

Then an ASSERT on NULL would be good.

> 
>> 
>> Couldn't the condition also check for the domain to be the hwdom ?
> I could although we have so many /chosen and hwdom asserts in the tree in the
> dom0 creation that I find it not necessary.

There are never to many asserts but ok :-)

With an ASSERT added for the NULL case you can add my R-b.

Cheers
Bertrand

> 
> ~Michal





 


Rackspace

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