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

Re: [PATCH v4 1/6] xen: do not free reserved memory into heap


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 18 May 2022 08:30:32 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=yRha0q94rdBud0ylljLnX/WSz4bAkEUpYGAp5fitZfQ=; b=jZLb0e8Iye1SLLhqagH7mSd/fujKUPiyhmg7rlF5n0kHJ1YMCq4mtzHsFLibHvQPuA8xT1Np9okV2ojeVfwN5sKNq0MSX8uY3c0lXYkIZNv947Obcq0elFXffv5JLf9SoYCqwuojx0nyY4UqujsWVP96ApUKetBSLQktYHV8Nvt5oooECZ2FsfwBoWeLK28aTA33vdZBW3YOAFkk/mHM8z0MzGInmLPBVAntF+ln21aOMuh0mBedSc4V7AUW/s2ctLLy+EebnTujUxccE2Mw1YvhQRw5/TzQKDYS4yDbtDXsZCgtl5Wtc5LNvIefTqH2FMTghB9lYqKtcTUDDtpqZQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YtqDS5ax9FQ0f5Qjoy8GNWjYhmjWYrU0ah6R7C7wELArNAONklMNSFWXxYDrtTbFm3VfEH/6JUJdrSJ6wf+LGL6chn8yDkTzHk3UdXDP/3jv96lFyUkr77+zw0HkgpQ3A4w6BssSr15SYi57WXEb+7Kncgjz/iiFyZbFLRmsov6Hbk6vmU6Yizfgd1IwNpdJdkb1pEbhRFNVNO0MiLLY+LNm1mMXpab2/TpRHsvcO4rExjaegyY5qfYaTLwrv4aampHxi87/5ejUPf9jBbL/YSnnYmtRcJiWJKuFtahK+vrtzSQdqT2rkeVckkfPRgaYmm4XOWzyOyUOmNAslhs7cg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Chen <Wei.Chen@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>
  • Delivery-date: Wed, 18 May 2022 06:30:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.05.2022 04:29, Penny Zheng wrote:
> Hi Jan and Julien
> 
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@xxxxxxxx>
>> Sent: Wednesday, May 18, 2022 12:11 AM
>> To: Penny Zheng <Penny.Zheng@xxxxxxx>
>> Cc: Wei Chen <Wei.Chen@xxxxxxx>; Andrew Cooper
>> <andrew.cooper3@xxxxxxxxxx>; George Dunlap <george.dunlap@xxxxxxxxxx>;
>> Julien Grall <julien@xxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; 
>> Wei
>> Liu <wl@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
>> Subject: Re: [PATCH v4 1/6] xen: do not free reserved memory into heap
>>
>> On 10.05.2022 04:27, Penny Zheng wrote:
>>> @@ -2762,6 +2767,12 @@ int __init acquire_domstatic_pages(struct
>>> domain *d, mfn_t smfn,
>>>
>>>      return 0;
>>>  }
>>> +#else
>>> +void free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
>>> +                          bool need_scrub) {
>>> +    ASSERT_UNREACHABLE();
>>> +}
>>>  #endif
>>
>> As before I do not agree that we need this (or similar) stub functions. As
>> already suggested I think that instead Arm wants to #define PGC_reserved (to
>> non-zero) only when !CONFIG_STATIC_MEMORY, just like is already the case
>> on x86.
>>
> 
> Ok, if you do not like the stub function, then what about I putting the 
> #ifdef-array back
> to the common where free_staticmem_pages is used:
> #ifdef CONFIG_STATIC_MEMORY
>       if ( pg->count_info & PGC_reserved )
>           /* Reserved page shall not go back to the heap. */
>           return free_staticmem_pages(pg, 1UL << order, need_scrub);
> #endif

No. Stub functions, when they are really needed, are generally preferable
over #ifdef-ary inside functions (for readability reasons at least). Yet
even better is if stub functions can be avoided altogether.

Jan




 


Rackspace

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