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

Re: ASSERT in rangeset_remove_range


  • To: Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 9 Nov 2021 15:02:19 +0100
  • 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=yAPD9V9vB+qDkxTtdgPOFyd0MVmFplO5HDEgpCdpTwk=; b=mmDMPjlFjhe7pEN3q/2OyDXTIX/LaBjNN81Ml/4j2Fn9E0G9WOuS2SVInNJ2WiA8XiV26vlHyaO5pdL8hqfe1iyPlJD/6SlBpfFaHkAHRG7Yv0NShQPTuUhFy7f8shRe6XePHCnLGTXOqVHMSN/BnFEvbq4pjwNZaxBCrx8gSrEwhWhq23Ts8qnK5Gx8kinZI4f4OBdWOwpBDZJg0VJdqR1P6e4XhUWTKfIkfUOKX0LF2pJJEkH3eBXrx6ptSBUxnFvhckB38mIrkXPe4mIyoMp0CWAgLeEXImTVr02JzM/5254L08M66YIeSdiq2rzIVcOJdciXfPxZfKG2wDyaQg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R2lAYFf2fb0cMmtAl6JaWIBcJul7K982H1R9GAAlaJl660fKYFXuczQIDNbtF5O6Rc8XObDw8Ki838ZD/mk6nPUkRuzrkD70i77BM0qEO5/WoRvwRSC3FDAkmO8euqwUJh1vJdSxzQ6xZAxxay7g1ajTUZ5LtbPHuQcKyPub9GGZXp2N3wjXPWMKJ48Xq4pwKwgeD1o5aRkUgonZnW5P/jOrvEh56x/bcm8/TadytwHeDFFICOGw9A1u1kg23P1wL7TmOg864tCUIx5g49Bk69cbKk/Hd4jRjNCqT/0RMZrw75cMBbLL+ehZCcHoYrIzgZBPIapEjVBjzFvLmkFvGg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: iwj@xxxxxxxxxxxxxx, Bertrand.Marquis@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, oleksandr_tyshchenko@xxxxxxxx
  • Delivery-date: Tue, 09 Nov 2021 14:02:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.11.2021 12:58, Julien Grall wrote:
> On 08/11/2021 22:45, Stefano Stabellini wrote:
>> I discovered a bug caused by the recent changes to introduce extended
>> regions in make_hypervisor_node (more logs appended):
>>
>>
>> (XEN) d1 BANK[0] 0x00000040000000-0x0000007e800000 (1000MB)
>> (XEN) d1 BANK[1] 0x00000200000000-0x00000200000000 (0MB)
>> (XEN) DEBUG find_unallocated_memory 994 s=40000000 e=7e7fffff
>> (XEN) DEBUG find_unallocated_memory 994 s=200000000 e=1ffffffff
>> (XEN) Assertion 's <= e' failed at rangeset.c:189
>>
>>
>> When a bank of memory is zero in size, then rangeset_remove_range is
>> called with end < start, triggering an ASSERT in rangeset_remove_range.
>>
>> One solution is to avoid creating 0 size banks. The following change
>> does that:
>>
>>
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 49b4eb2b13..3efe542d0f 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -459,9 +459,12 @@ static void __init allocate_memory(struct domain *d, 
>> struct kernel_info *kinfo)
>>           goto fail;
>>   
>>       bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem);
>> -    if ( !allocate_bank_memory(d, kinfo, gaddr_to_gfn(GUEST_RAM1_BASE),
>> +    if ( bank_size > 0 )
>> +    {
>> +        if ( !allocate_bank_memory(d, kinfo, gaddr_to_gfn(GUEST_RAM1_BASE),
>>                                  bank_size) )
>> -        goto fail;
>> +            goto fail;
>> +    }
> 
> I would move the size check in allocate_bank_memory().
> 
>>   
>>       if ( kinfo->unassigned_mem )
>>           goto fail;
>>
>>
>>
>> We have a couple of other options too:
>>
>> - remove the ASSERT in rangeset_remove_range
>> There is an argument that we should simply return error
>> fromrangeset_remove_range, rather than a full assert.
> 
> To be honest, this is a developper mistake to call with end < start. If 
> we were going to return an error then we would completely hide (even in 
> developper) it because we would fallback to not exposing extended regions.
> 
> So I am not sure switch from ASSERT() to a plain check is a good idea. 
> Jan, Andrew, Wei, what do you think?

There might be reasons to convert, but I don't think the situation here
warrants doing so.

Jan




 


Rackspace

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