Re: [PATCH v2 0/3] KVM: x86: KVM_MEM_PCI_HOLE memory
From: Vitaly Kuznetsov
Date: Tue Sep 01 2020 - 10:44:59 EST
Peter Xu <peterx@xxxxxxxxxx> writes:
> On Fri, Aug 07, 2020 at 04:12:29PM +0200, Vitaly Kuznetsov wrote:
>> When testing Linux kernel boot with QEMU q35 VM and direct kernel boot
>> I observed 8193 accesses to PCI hole memory. When such exit is handled
>> in KVM without exiting to userspace, it takes roughly 0.000001 sec.
>> Handling the same exit in userspace is six times slower (0.000006 sec) so
>> the overal; difference is 0.04 sec. This may be significant for 'microvm'
>> ideas.
>
> Sorry to comment so late, but just curious... have you looked at what's those
> 8000+ accesses to PCI holes and what they're used for? What I can think of are
> some port IO reads (e.g. upon vendor ID field) during BIOS to scan the devices
> attached. Though those should be far less than 8000+, and those should also be
> pio rather than mmio.
And sorry for replying late)
We explicitly want MMIO instead of PIO to speed things up, afaiu PIO
requires two exits per device (and we exit all the way to
QEMU). Julia/Michael know better about the size of the space.
>
> If this is only an overhead for virt (since baremetal mmios should be fast),
> I'm also thinking whether we can make it even better to skip those pci hole
> reads. Because we know we're virt, so it also gives us possibility that we may
> provide those information in a better way than reading PCI holes in the guest?
This means let's invent a PV interface and if we decide to go down this
road, I'd even argue for abandoning PCI completely. E.g. we can do
something similar to Hyper-V's Vmbus.
--
Vitaly