On 18/10/2021 12:01, Jan Beulich wrote:
> On 18.10.2021 12:08, Jane Malalane wrote:
>
>>      /*
>>       * Failure here with E2BIG indicates Xen is missing the bugfix to map
>>       * resources larger than 32 frames.
>>       */
>>      if ( !res )
>> -        return fail("    Fail: Map %d - %s\n", errno, strerror(errno));
>> +        return fail("    Fail: Map grant table %d - %s\n", errno, 
>> strerror(errno));
>>  
>> +    /* Put each gref at a unique offset in its frame. */
>> +    for ( unsigned int i = 0; i < nr_frames; i++ )
>> +    {
>> +        unsigned int gref = i * (XC_PAGE_SIZE / sizeof(*gnttab)) + i;
>> +
>> +        refs[i] = gref;
>> +        domids[i] = domid;
>> +
>> +        gnttab[gref].domid = 0;
>> +        gnttab[gref].frame = gfn;
>> +        gnttab[gref].flags = GTF_permit_access;
>> +    }
> To make obvious that you're done with gnttab[], perhaps better unmap it
> here rather than at the bottom?

This is just test code.  We could unmap it earlier, but that makes it
irritating if you ever need to insert printk()'s.

>> @@ -123,8 +162,25 @@ static void test_domain_configurations(void)
>>  
>>          printf("  Created d%u\n", domid);
>>  
>> -        test_gnttab(domid, t->create.max_grant_frames);
>> +        rc = xc_domain_setmaxmem(xch, domid, -1);
> That's an unbelievably large upper bound that you set. Since you
> populate ...
>
>> +        if ( rc )
>> +        {
>> +            fail("  Failed to set max memory for domain: %d - %s\n",
>> +                 errno, strerror(errno));
>> +            goto test_done;
>> +        }
>> +
>> +        rc = xc_domain_populate_physmap_exact(xch, domid, ARRAY_SIZE(ram), 
>> 0, 0, ram);
> ... only a single page, can't you get away with a much smaller value?

Yes, but again, this is test code.

Furthermore, there are other plans for further testing which would mean
1 wouldn't be appropriate here.  All we want is "don't choke on limits
while we're performing testing".

~Andrew


Reply via email to