[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/4] xen/arm: do not give memory back to static heap
- To: Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Tue, 26 Nov 2024 13:52:44 +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=/hTtStIm0SWoepj+W/CbKwf2l1KK2PH4O3tUvYRKZLY=; b=h8F5bCJoq4M0jmplVpi6YXdOT17rGQ/bu537u+c5Eo1sZoGWTgHoM+oxJZO9QzZs4zJ1g6p0jBx/pJh8SGB6aB1W5t+NcsIgzDfmH/uyauj5WKCIC8oerReLPaoWl5pgkmwfqlJHMn9enBzoO9aRWZnLeVqlZChn9FZl42Sb2jemjBMhJa8yTgPMsbVksMd/+OIKbg7foCeMCowiYEImHi8LV7uRmSKm94ASZPa5Z1WefZLYOYlsmrJFgetyqQFlHlwZp0RDHyeq3ZUJ/sFI/3Do5eCOmLNIDxxah4EVoipIVrlf0SWkUNp+vc/jkp4IR/lIQ/1RVADfwyIaE+0ssg==
- 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=/hTtStIm0SWoepj+W/CbKwf2l1KK2PH4O3tUvYRKZLY=; b=aqm8GFxQ7L7LCXQhLcWgKDO2OPD6DtY6iAyCyJZDnc4tcSkLtOSHIPwL/6ugmkwU5agARlHvtJk6uPpuJ/rM5YECYhjjE0wSvg01VI2ppdnOAr5WfKkAFRVE/7YzqzVt2vU6FV8wqb/weuAmFarcONLzttoRP6+RSz2rm8YnIXwvstWI3HVaCdEXThNSjLjJzg9JKyFH/wAPPZDCoKIBiUD+MU/iRTObjHJr1rr4NO/hPAyMen1PgkPbf1t/Z5XYuYJzTCLmH/plmBH12Mlhfn5+oS3LV8uEfyjnB/bp/RPs+RfXLc0kpoS15UV5UsKmUOQeFFevOBDUUHDtuhuU9A==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=X+RlBznjauvcapkf43McGJ+F3qnQsGehLnaCIZRQW2viV+ivOSfSotT858KAzn7OlSmh2L7tSUyiJC1Kuz/sy9QDq8mWlDrz9GFw94E1IOlhJ6YBS3faubg6Yx27G45r9lcO565Uo3VqXVdWY4w+A6yJaNpTuHdOh8GGObeg7ZX36YBePmt5L2sIk0gXKGJaM4i7/GrePMM2mpXOdqDvOtsa8B24CT3okFThK0V3ycMTBRcayR7J41fGLzHzPK0QfwryTtYUOQXs9Id9XFBGicZgD7bk5Vy9Vn9dpso0K38MK59PiDxdHwlK7ShOz5KmAltqP7HE8kDdfhhDju/nHQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gy7Z1QnorIMIZ9PgZjVccYaP7QnMezk+3XMq38PGRc0l1QFhPeH7Xhz1VVJU0T3uL0etMkvpboAK0hoewyfCWgQXbtL3kZwJ4gggUuAt9z9yQdGAdbJtCcPXm4/mh6MPFXEKpgfgSOJAxHuK/XVHyqAHI03qKOp9tmlJJEEuKYvEK5Rj1RdA72FBcHVcvyyipSAmb24Keh42X6+QoWEOtW3po5cFzMr2lMl5Hc3w4alP50LwjML41SKotXN5HSIyP03AKhTRoqna37wTtooEl6tzbDfDftOwGqeS9n//S9Q9jeH4eSp5QzvyGYoD0ZrRs8mFAgUjMzaipr6IaYIZzw==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 26 Nov 2024 13:53:15 +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: AQHbOmE/JeWd4mQRXU6E1FRNAbLoQLLIOm6AgAE0ZQCAAAS3gIAAJQWAgAABEICAAAZqAA==
- Thread-topic: [PATCH v2 4/4] xen/arm: do not give memory back to static heap
> On 26 Nov 2024, at 13:29, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 26.11.2024 14:25, Luca Fancellu wrote:
>>> This reads better, thanks. Follow-on question: Is what is statically
>>> configured for the heap guaranteed to never overlap with anything passed
>>> to init_domheap_pages() in those places that you touch?
>>
>> I think so, the places of the check are mainly memory regions related to
>> boot modules,
>> when we add a boot module we also do a check in order to see if it clashes
>> with any
>> reserved regions already defined, which the static heap is part of.
>>
>> Could you explain me why the question?
>
> Well, if there was a chance of overlap, then parts of the free region would
> need to go one way, and the rest the other way.
oh ok, sure of course, thanks for answering.
>
>>>>>> --- a/xen/include/xen/bootfdt.h
>>>>>> +++ b/xen/include/xen/bootfdt.h
>>>>>> @@ -132,7 +132,6 @@ struct bootinfo {
>>>>>> #ifdef CONFIG_STATIC_SHM
>>>>>> struct shared_meminfo shmem;
>>>>>> #endif
>>>>>> - bool static_heap;
>>>>>> };
>>>>>>
>>>>>> #ifdef CONFIG_ACPI
>>>>>> @@ -157,6 +156,10 @@ struct bootinfo {
>>>>>>
>>>>>> extern struct bootinfo bootinfo;
>>>>>>
>>>>>> +#ifdef CONFIG_STATIC_MEMORY
>>>>>> +extern bool static_heap;
>>>>>> +#endif
>>>>>
>>>>> Just to double check Misra-wise: Is there a guarantee that this header
>>>>> will
>>>>> always be included by page-alloc.c, so that the definition of the symbol
>>>>> has an earlier declaration already visible? I ask because this header
>>>>> doesn't look like one where symbols defined in page-alloc.c would normally
>>>>> be declared. And I sincerely hope that this header isn't one of those that
>>>>> end up being included virtually everywhere.
>>>>
>>>> I’ve read again MISRA rule 8.4 and you are right, I should have included
>>>> bootfdt.h in
>>>> page-alloc.c in order to have the declaration visible before defining
>>>> static_heap.
>>>>
>>>> I will include the header in page-alloc.c
>>>
>>> Except that, as said, I don't think that header should be included in this
>>> file.
>>> Instead I think the declaration wants to move elsewhere.
>>
>> Ok sorry, I misunderstood your comment, I thought you were suggesting to
>> have the
>> declaration visible in that file since we are defining there the variable.
>>
>> So Julien suggested that file, it was hosted before in
>> common/device-tree/device-tree.c,
>> see the comment here:
>> https://patchwork.kernel.org/project/xen-devel/patch/20241115105036.218418-6-luca.fancellu@xxxxxxx/#26125054
>>
>> Since it seems you disagree with Julien, could you suggest a more suitable
>> place?
>
> Anything defined in page-alloc.c should by default have its declaration in
> xen/mm.h, imo. Exceptions would need justification.
I would be fine to have the declaration in xen/mm.h, I just need to import
xen/mm.h in bootfdt.h so that it is visible to
“using_static_heap”, @Julien would you be ok with that?
>
> Obviously a possible alternative is to move the definition, not the
> declaration.
>
> Jan
Cheers,
Luca
|