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

Re: [PATCH 4/9] xen/arm: static memory initialization


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 5 Jul 2021 09:50:39 +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-SenderADCheck; bh=K4VFUC7j4ITjPhqjm08Uxuw/7MzYYMilatT3HOIvgcs=; b=kMqcHWNO0YJ4Dv91ZvbZFhZH00dknkQrYUYkAVRFAVpRfx36LkMnIkMV3y5OrCPVsAZ+XCpm+hGbfmvCjydWvQ22GsKVW4ifD4jH422VKQprZosSsKf/tHseyN2aOFK2QBQDoaqcQ6sANQcE7CLGTxM/im9q14EoeeyH3MfBxj7uPKPFvl4oFZp73oWj/8yvnpwgP0JC6M4wE34sVLMxrt8Pb0fnBnl8T55FCoksSrAiApxjmwhZBVQOlp2I/1Sd3RxCZr3FcALirJKmpPzG52l3tk3bAwf+2dfM7U3WT9P3UBZ6HCTuxgDntsbcPsIE7er+Ks66seuVVdUIaMl3Hg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Law7G9xve01VCz72no8K/eLehy7F0cF3OShdPrjv9/e5mzp2iW70+kHB+zmks0Ksd4pim5DwsCJhzjDjTbHJ6qZ8vuzJpfAevLOJ4Cr3vrVJcZU7UcaIvbhJJWI6c8psBHkVsPD0n45xoSkE4R+Ruja9g4t9F16XeS18bdFiycQzE0kBZRptPwasmnpx/3OaSEl7GbEq52wFqRd+wloEnQ40sVae3KpkumOmsF6HDaDOKd5BzGY/wRCntryVb3sf/la69y1tAFG7Lrbu9rW3uHzXZlsswiqFIcGNbpxLvSKc4GALR5Xm1uR2KDD5KTvyRKS+uJumM8HQQo0or+jNow==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Mon, 05 Jul 2021 07:50:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.07.2021 09:14, Penny Zheng wrote:
>> From: Penny Zheng
>> Sent: Monday, July 5, 2021 1:22 PM
>>
>>> From: Julien Grall <julien@xxxxxxx>
>>> Sent: Thursday, July 1, 2021 1:46 AM
>>>
>>> On 10/06/2021 10:35, Jan Beulich wrote:
>>>> On 07.06.2021 04:43, Penny Zheng wrote:
>>>>> @@ -1512,6 +1530,38 @@ static void free_heap_pages(
>>>>>       spin_unlock(&heap_lock);
>>>>>   }
>>>>>
>>>>> +#ifdef CONFIG_STATIC_ALLOCATION
>>>>> +/* Equivalent of free_heap_pages to free nr_mfns pages of static
>>>>> +memory. */ void __init free_staticmem_pages(struct page_info *pg,
>>> unsigned long nr_mfns,
>>>>> +                                 bool need_scrub) {
>>>>> +    mfn_t mfn = page_to_mfn(pg);
>>>>> +    unsigned long i;
>>>>> +
>>>>> +    for ( i = 0; i < nr_mfns; i++ )
>>>>> +    {
>>>>> +        switch ( pg[i].count_info & PGC_state )
>>>>> +        {
>>>>> +        case PGC_state_inuse:
>>>>> +            BUG_ON(pg[i].count_info & PGC_broken);
>>>>> +            /* Mark it free and reserved. */
>>>>> +            pg[i].count_info = PGC_state_free | PGC_reserved;
>>>>> +            break;
>>>>> +
>>>>> +        default:
>>>>> +            printk(XENLOG_ERR
>>>>> +                   "Page state shall be only in PGC_state_inuse. "
>>>>
>>>> Why? A page (static or not) can become broken while in use. IOW I
>>>> don't think you can avoid handling PGC_state_offlining here. At
>>>> which point this code will match free_heap_pages()'es, and hence
>>>> likely will want folding as well.
>>>>
>>
>> Yeah, I was following the logic in free_heap_pages.
>> Hmmm, I could not think of any scenario that will lead to 
>> PGC_state_offlining,
>> that's why I was not including it at the first place.
>> For broken issue, tbh, I just copy the bug_on from free_heap_pages, after
>> quite a time thinking, I also could not find any scenario when a page(static 
>> or
>> not) can become broken while in use. ;/

I'm, afraid I don't understand. Using page_to_mfn(), expensive or not,
in ASSERT() is quite fine. The (expensive) expression won't be evaluated
in release builds. This is specifically different from BUG_ON().

Jan




 


Rackspace

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