Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-12 Thread Peter Xu
On Tue, Mar 12, 2019 at 01:22:18PM +0100, Paolo Bonzini wrote: > On 12/03/19 13:14, Peter Xu wrote: > >> You're right. However, the DMAR FlatView only has three sections so I > >> suspect it's not a big deal if we keep it per-device. You'd still have > >> O(n) flatviews when the IOMMU is present

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-12 Thread Paolo Bonzini
On 12/03/19 13:14, Peter Xu wrote: >> You're right. However, the DMAR FlatView only has three sections so I >> suspect it's not a big deal if we keep it per-device. You'd still have >> O(n) flatviews when the IOMMU is present and DMAR is enabled, but they >> would have a constant number of sectio

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-12 Thread Peter Xu
On Tue, Mar 12, 2019 at 12:42:07PM +0100, Paolo Bonzini wrote: > On 12/03/19 04:23, Peter Xu wrote: > > On Mon, Mar 11, 2019 at 03:07:43PM +0100, Paolo Bonzini wrote: > >> On 11/03/19 14:48, Sergio Lopez wrote: > The initialization is O(n^2) because the guest initializes one device at > a

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-12 Thread Paolo Bonzini
On 12/03/19 04:23, Peter Xu wrote: > On Mon, Mar 11, 2019 at 03:07:43PM +0100, Paolo Bonzini wrote: >> On 11/03/19 14:48, Sergio Lopez wrote: The initialization is O(n^2) because the guest initializes one device at a time, so you rebuild the FlatView first with 0 devices, then 1, then >>>

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-11 Thread Peter Xu
On Mon, Mar 11, 2019 at 03:07:43PM +0100, Paolo Bonzini wrote: > On 11/03/19 14:48, Sergio Lopez wrote: > >> The initialization is O(n^2) because the guest initializes one device at > >> a time, so you rebuild the FlatView first with 0 devices, then 1, then > >> 2, etc. This is very hard to fix, i

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-11 Thread Sergio Lopez
Paolo Bonzini writes: > On 11/03/19 14:48, Sergio Lopez wrote: >>> The initialization is O(n^2) because the guest initializes one device at >>> a time, so you rebuild the FlatView first with 0 devices, then 1, then >>> 2, etc. This is very hard to fix, if at all possible. >>> >>> However, each

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-11 Thread Paolo Bonzini
On 11/03/19 14:48, Sergio Lopez wrote: >> The initialization is O(n^2) because the guest initializes one device at >> a time, so you rebuild the FlatView first with 0 devices, then 1, then >> 2, etc. This is very hard to fix, if at all possible. >> >> However, each FlatView creation should be O(n)

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-11 Thread Sergio Lopez
Paolo Bonzini writes: > On 11/03/19 10:26, Sergio Lopez wrote: >> I guess this is a consequence of having to reset/rebuild the Flatview >> when altering the PCI BAR regions. >> >> Is this a known issue we're already working on? > > What version of QEMU is this? This upstream as of 6cb4f6db4f43

Re: [Qemu-devel] Flatview rendering scalability issue

2019-03-11 Thread Paolo Bonzini
On 11/03/19 10:26, Sergio Lopez wrote: > I guess this is a consequence of having to reset/rebuild the Flatview > when altering the PCI BAR regions. > > Is this a known issue we're already working on? What version of QEMU is this? The initialization is O(n^2) because the guest initializes one dev

[Qemu-devel] Flatview rendering scalability issue

2019-03-11 Thread Sergio Lopez
Hi, Thanks to Q35/PCIe, we can now assign a large number of PCI devices to a single VM, but it seems that Flatview rendering scales poorly (worse than linear) when it has to deal with a large number of Memory Regions. I've measured to cost of the pci_default_write_config() call at virtio_write_co