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

Re: [PATCH v3 4/7] vpci: allow queueing of mapping operations


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Thu, 9 Jul 2026 11:10:22 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=7ZVzRQtnUTwP8wpKKwYeg5dC+kJgA+KulGGmLGXjpAc=; b=NroDSzIj98MG/GIwPOzk672FN4RSqexYEbklB/BhTI7ECXQOTDitcFL4KAgCd9fcQtPqDu9rJL7PD4nDbVLidO8IW7WOH+rcJ/9+7A17AjmlVAmgCtRMVzxYFoU5YjAkuWjime5j8Z+kJJ2o4DUXiz3Lu6AiWR9OKYxzpGbmGQK/UgoBZnAApmv0fxprGwdat60m4pt0twy9pnQCKkV2pvQDSlugUkQiXEApMcZdZq7A6y8qSTs1Ssb3Sth5VPWrujoX3foj6pKXmS7YMiJnpQxvWYLd2lETaIAlohXfcX5vKnLgW5ggZRDpUmh4QRPpJ5nOKfVHKjJbwcQVuVvGiQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pR0De8Uv1iSRu2VYz3UeA8o2UMOPiU7vMwkTgMq+4txZUdl1w9mdL7o3/QAZ5AxBtMbh1+MjPTut9c4yp8tTs9v8StTVAW53PMWfCG7IfNJJHOGYlFc548++a8zTp7ovSdkjmjWSNNrpz3nvVIpVALuFORKlPu6OsnzIeFaoiTKaAwZeQ8zGolTWvTfZX4tL169yF8DDkQI4bdaAVUPFRhcG7HnE/T3pn7RAqo1JwxH+rTq9pdRHB/q9NKNl9Sd4Ee6mjDH18zZselIhHbCwcYwq2GlUNRAWVu/taZx+eBTorifvVPV7RScklJeltoiq2oQzWQ1kSeMYaA6ktRxEaQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Jul 2026 15:10:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 4/22/26 07:38, Roger Pau Monné wrote:
> On Thu, Apr 09, 2026 at 02:01:33PM +0000, Mykyta Poturai wrote:
>> diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
>> index b55bacbe6e..e34f7abe6d 100644
>> --- a/xen/include/xen/vpci.h
>> +++ b/xen/include/xen/vpci.h
>> @@ -155,14 +154,23 @@ struct vpci {
>>  };
>>  
>>  #ifdef __XEN__
>> -struct vpci_vcpu {
>> +struct vpci_map_task {
>>      /* Per-vcpu structure to store state while {un}mapping of PCI BARs. */
>> -    const struct pci_dev *pdev;
>> -    struct rangeset *mem[ARRAY_SIZE(((struct vpci_header *)NULL)->bars)];
>> +    struct list_head next;
>> +    struct vpci_bar_map {
>> +        uint64_t addr;
>> +        uint64_t guest_addr;
>> +        struct rangeset *mem;
>> +    } bars[ARRAY_SIZE(((struct vpci_header *)NULL)->bars)];
> 
> I'm a bit puzzled (possibly missing something), but why are you
> keeping this vpci_bar_map array here?  AFAICT map tasks are allocated
> on-demand after this change (by using {alloc,destroy}_map_task()).


Currently, a single mapping operation encompasses all BARs, so it's less
overhead. This is tied to the way modify_bars() populates and queues a mapping
operation: it iterates over the BARs multiple times before queuing it up. I
could see a point in perhaps allocating a map task per BAR. Indeed, in the next
rev of the BAR-write-with-memory-decoding patch, I'm planning to introduce the
ability to map/unmap a single BAR. If we allocate a map task per BAR, however,
we'd have additional overhead with tracking 'const struct pci_dev *pdev' and
'bool map' per BAR instead of per PCI device, along with refactoring of
modify_bars(). Since mapping only a single BAR is still a rather uncommon corner
case, my first thought is that it's not necessarily worth it to make struct
map_task only hold information for a single BAR. You can see a preview of the
next rev of the BAR-write-with-memory-decoding patch at [1] since I haven't yet
sent it out.

[1] 
https://gitlab.com/xen-project/people/stewarthildebrand/xen/-/commit/d20f252670dff2d01c4c0c4b815abb2cae07062e



 


Rackspace

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