All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stewart Hildebrand <stewart.hildebrand@amd.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Mykyta Poturai" <Mykyta_Poturai@epam.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Michal Orzel <michal.orzel@amd.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v3 4/7] vpci: allow queueing of mapping operations
Date: Thu, 9 Jul 2026 11:10:22 -0400	[thread overview]
Message-ID: <ef345395-bbfe-48b2-85a5-31b8f43ac746@amd.com> (raw)
In-Reply-To: <aeizOTxvSXlLKGHX@macbook.local>

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


  reply	other threads:[~2026-07-09 15:10 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09 14:01 [PATCH v3 0/7] Implement SR-IOV support for PVH Mykyta Poturai
2026-04-09 14:01 ` [PATCH v3 1/7] vpci: rename and export vpci_modify_bars Mykyta Poturai
2026-04-09 14:01 ` [PATCH v3 2/7] vpci: rename and export vpci_guest_mem_bar_{read,write} Mykyta Poturai
2026-04-22 10:27   ` Roger Pau Monné
2026-04-09 14:01 ` [PATCH v3 3/7] vpci: Use pervcpu ranges for BAR mapping Mykyta Poturai
2026-04-22 11:00   ` Roger Pau Monné
2026-04-22 12:04     ` Jan Beulich
2026-04-22 14:20       ` Roger Pau Monné
2026-04-09 14:01 ` [PATCH v3 4/7] vpci: allow queueing of mapping operations Mykyta Poturai
2026-04-22 11:38   ` Roger Pau Monné
2026-07-09 15:10     ` Stewart Hildebrand [this message]
2026-04-09 14:01 ` [PATCH v3 6/7] vpci: add SR-IOV support for DomUs Mykyta Poturai
2026-04-21 14:55   ` Jan Beulich
2026-04-24  6:34     ` Mykyta Poturai
2026-04-09 14:01 ` [PATCH v3 5/7] vpci: add SR-IOV support for PVH Dom0 Mykyta Poturai
2026-04-09 15:27   ` Daniel P. Smith
2026-04-21 14:43   ` Jan Beulich
2026-04-23 10:12     ` Mykyta Poturai
2026-05-04  5:37       ` Jan Beulich
2026-05-06  9:39         ` Mykyta Poturai
2026-05-06 11:54           ` Jan Beulich
2026-05-07 20:40             ` Volodymyr Babchuk
2026-05-08  5:52               ` Jan Beulich
2026-05-08  5:52               ` Jan Beulich
2026-05-11 14:10                 ` Volodymyr Babchuk
2026-05-12  6:20                   ` Jan Beulich
2026-05-12  7:32                     ` Mykyta Poturai
2026-05-12  8:58                       ` Roger Pau Monné
2026-05-12 10:28                         ` Volodymyr Babchuk
2026-05-12 13:22                           ` Roger Pau Monné
2026-05-12 10:44                         ` Jan Beulich
2026-05-12 11:11                           ` Roger Pau Monné
2026-04-22 14:19   ` Roger Pau Monné
2026-04-28 20:05   ` Stewart Hildebrand
2026-04-09 14:01 ` [PATCH v3 7/7] docs: Update SR-IOV support status Mykyta Poturai
2026-04-21 14:56   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef345395-bbfe-48b2-85a5-31b8f43ac746@amd.com \
    --to=stewart.hildebrand@amd.com \
    --cc=Mykyta_Poturai@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.