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

Re: [PATCH v5 07/14] vpci/header: handle p2m range sets per BAR


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 12 Jan 2022 16:18:45 +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=mHaYzXr1GQDK+jFvjYBQu0MrgcTWt7mFD5ZYk/Mex1I=; b=f8HYBctL2zAixIn6olTifNEPlzndNcf/zXLmqd69Ve+gx+EK+s1P3lgoSPuKB7m9NWnEQMB0aL/rZak55dqYojVlA88/RasaSCD3kF4Vz773D3o6/Xc5kugLE8sRA604DrGd74nbiKHIv+nV2qd25JYdtfa/Hssq0VAn9LqWB8ncvFAMbfSAYIkmymGg3dPKmfll5YcZNA+bFAI22Nu3N6dohEfDGyW7xkRVXicLC0hz+aTE+O298w2sU0G2GoQCHBWdbUi5phvElbPHhuY+U2o5qID7CFPnNVRrp6LS7rbusU5+w1ZR3aG+1dMYfh7tj11LQI9cLsQJWSZOXE/e+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d6Doq2G5KFTuk4bbKmwgk1ptmAn5XlLSAjyO72vgJZI+RByZgIjrBQG5+GsDba2cKdudUBxFmnZkwFN2SzHdXz5Ngbu/LILFHmWEhLAKxlEycmnSPqpBe4WzXmP8KsI/v0QNXUW2H+Elml5S5GeoO81dz7Rqc9dS4yy5eh4+Es3axLyiYF8oowdgrLZ8vN6I8yAFRuBHquJwGznUfSwI1hbeeTzuLCiWhj6nv+ctxeTNE+FSqLtT40ZirKlKgImQHdazCzqpICh5psbR+RIBNn0+NXGBlkzYb/A4Aju2ROwE1ekVoG6XdPtsd85QkDrR7gnf4BLcyFOzjdmAjN+OUg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, Artem_Mygaiev@xxxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, paul@xxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • Delivery-date: Wed, 12 Jan 2022 15:18:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.01.2022 16:15, Roger Pau Monné wrote:
> On Thu, Nov 25, 2021 at 01:02:44PM +0200, Oleksandr Andrushchenko wrote:
>> --- a/xen/drivers/vpci/header.c
>> +++ b/xen/drivers/vpci/header.c
>> @@ -137,45 +137,86 @@ bool vpci_process_pending(struct vcpu *v)
>>          return false;
>>  
>>      spin_lock(&pdev->vpci_lock);
>> -    if ( !pdev->vpci_cancel_pending && v->vpci.mem )
>> +    if ( !pdev->vpci )
>> +    {
>> +        spin_unlock(&pdev->vpci_lock);
>> +        return false;
>> +    }
>> +
>> +    if ( !pdev->vpci_cancel_pending && v->vpci.map_pending )
>>      {
>>          struct map_data data = {
>>              .d = v->domain,
>>              .map = v->vpci.cmd & PCI_COMMAND_MEMORY,
>>          };
>> -        int rc = rangeset_consume_ranges(v->vpci.mem, map_range, &data);
>> +        struct vpci_header *header = &pdev->vpci->header;
>> +        unsigned int i;
>>  
>> -        if ( rc == -ERESTART )
>> +        for ( i = 0; i < ARRAY_SIZE(header->bars); i++ )
>>          {
>> -            spin_unlock(&pdev->vpci_lock);
>> -            return true;
>> -        }
>> +            struct vpci_bar *bar = &header->bars[i];
>> +            int rc;
>> +
> 
> You should check bar->mem != NULL here, there's no need to allocate a
> rangeset for non-mappable BARs.

There's a NULL check ...

>> +            if ( rangeset_is_empty(bar->mem) )
>> +                continue;

... inside rangeset_is_empty() (to help callers like this one).

Jan




 


Rackspace

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