[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>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Tue, 26 Nov 2024 10:56:36 +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=axhAz9D3KM7ys6kROUzf6GB7fq76WSSUy47H5z1h78c=; b=rfLMAaHJJjPmsqOMLy5MRv1KiJq6WYcUbbio2z5TeB7OI6jJFEm9bxMn3F6ElRcgF/Q5n6BZ6MXnQaPmajfZW7beO+3BeHRIrha5c3k9YA0hBEz6IWaxL7S0gDPwcYMYsmV+nHBcMBWwMpDC2rFvl9z42OvGre3pzPu6QEnGKJx+/vJh+bZULeDsGeprkRDjI/KSGUMXWgIlOX2584dc5DtYleECgKRYtrOXMoa/NnaekHG7atS6qBZ1vKIHqTFAv3EORLcXZlyY+gKwXV/dxBCX64M+Cf7wWOpF19pCcaC2niuu+qVGnwiT48E3aKCOJvYjPEdzg7gRyr3gm1HnHA==
  • 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=axhAz9D3KM7ys6kROUzf6GB7fq76WSSUy47H5z1h78c=; b=Whh53p1CM+8CGu6/5amu+Kf755+osTUl6ZLAzg7xWxfXqc47+i8BJ/dD24Z7D7hEIYar+YyIuAvVFAm/cGMQ2PuL2iHcebL2w9BcDDmmR25Oz9PhsgPNJo3N1FYJNaUwXXpVQfE+aWGayHVsqbZatNdb7qpm8klVQQ5Bru/cfRGHwe7nx06sEKUHoZJMyQoclVwSpdp6j2SW/QAqKe1IHM6CLhqjn43ynMBfhY3xcq58dZ8pJIr8TnhFnWhbIWHWSkdhiYDJI+bNRGzrFOlWcLJ+BJhygTRmzfQgnhRefIABGWc2JXzvD1hp2sHyER1Pz+R5owCfmE3NSlqYUqptQQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=o0LTXudQIwlmHHPeT/B4WZsdTgGINxupSUCPrNSCilhUN6GGGNCP1ujblPNRI9QCKpV+enCOhuWmPE9I4cDuf53vRxqDOHio3dRnEQcO5aBH9WBQWIxNoa5vCtY3uxXfCu0UzQHUO8D1Hw+aXEYTQmR6rEOV1PA9XwcNOfMYhIgm6ta25YXoxC1oElBAApMhkUmajg4UcImeHiBWNHqQz2r1f9oPGk92CzHUmxfBeg6EPbESkM64f34GR5qEvuuEEaIDttL5bw10rz/yaOCi3ryy6FpmO9BRL5bJrg6dBJIMbx+kdvGtwQsy3rePU+3vzYbuV6qoc1sdPEEDFbf61Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z/I34G2GzusY5DIep1rW3KZ7S1ntTLvZcv2l1ySuiGOMc04aLFWvU8Evmvh/YwvKKlGivuoadMHuEm2wwW1pdY/Q0qer689VeZH8m5ZqQOVCflKSZsjH2CfwOgh1LH1Q2muFcLEoDOoFjWMROSqhj886RkpSmQW6rzaQlfkR7To6Uy5eQ83NRDuwrgb87VKHkDuAqr6Ixr7Hfk3dVfIpQb61Yh84nl+sIRowM7N7y3AvluXdEoOjnujhKKuyJpyBILhJ9do+VeuA4+9frvPEIDLTdxidwCFXCB+54hGVUt7HZQE/5sExuXalN4Wf6mQnJCoQP1rmBr0sknEg41Yl7Q==
  • 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>, Julien Grall <julien@xxxxxxx>, 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 10:57:03 +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/JeWd4mQRXU6E1FRNAbLoQLLIOm6AgAE0ZQA=
  • Thread-topic: [PATCH v2 4/4] xen/arm: do not give memory back to static heap

Hi Jan,

thanks for your review

> On 25 Nov 2024, at 16:32, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 19.11.2024 09:58, Luca Fancellu wrote:
>> From: Penny Zheng <Penny.Zheng@xxxxxxx>
>> 
>> If Xenheap is statically configured in Device Tree, its size is
>> definite. So, the memory shall not be given back into static heap, like
>> it's normally done in free_init_memory, etc, once the initialization
>> is finished.
> 
> I'm somewhat confused by the use of "back" here? Isn't the change all
> about init-time behavior, i.e. memory that's handed to the allocator for
> the very first time? Else I may be misunderstanding something here, in
> which case I'd like to ask for the description to be refined.

Yes, I’ve tried to rephrase it, do you think this is more clear?

If the Xen heap is statically configured in Device Tree, its size is
definite, so only the defined memory shall be given to the boot
allocator. Have a check where init_domheap_pages() is called
which takes into account if static heap feature is used.

> 
>> --- 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

> 
>> @@ -206,4 +209,13 @@ static inline struct shmem_membank_extra 
>> *bootinfo_get_shmem_extra(void)
>> }
>> #endif
>> 
>> +static inline bool xen_is_using_staticheap(void)
>> +{
>> +#ifdef CONFIG_STATIC_MEMORY
>> +    return static_heap;
>> +#else
>> +    return false;
>> +#endif
>> +}
> 
> As to naming: How about using_static_heap()? The xen_ prefix doesn't look to
> be carrying any useful information, and the then remaining is_ prefix would
> be largely redundant with "using". Plus there surely wants to be a separator
> between "static" and "heap".

yes, sounds a better name, I’ll use it

Cheers,
Luca

 


Rackspace

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