From: Wei Liu <wei.liu@kernel.org>
To: Ajay Kaher <akaher@vmware.com>
Cc: helgaas@kernel.org, bhelgaas@google.com, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, hpa@zytor.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, rostedt@goodmis.org,
srivatsab@vmware.com, srivatsa@csail.mit.edu,
amakhalov@vmware.com, vsirnapalli@vmware.com,
er.ajay.kaher@gmail.com, willy@infradead.org, namit@vmware.com,
linux-hyperv@vger.kernel.org, kvm@vger.kernel.org,
jailhouse-dev@googlegroups.com, xen-devel@lists.xenproject.org,
acrn-dev@lists.projectacrn.org, Wei Liu <wei.liu@kernel.org>
Subject: Re: [PATCH v2] x86/PCI: Prefer MMIO over PIO on VMware hypervisor
Date: Mon, 12 Sep 2022 15:17:46 +0000 [thread overview]
Message-ID: <Yx9NmjzeiyYsxUPT@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <1662448117-10807-1-git-send-email-akaher@vmware.com>
On Tue, Sep 06, 2022 at 12:38:37PM +0530, Ajay Kaher wrote:
> During boot-time there are many PCI config reads, these could be performed
> either using Port IO instructions (PIO) or memory mapped I/O (MMIO).
>
> PIO are less efficient than MMIO, they require twice as many PCI accesses
> and PIO instructions are serializing. As a result, MMIO should be preferred
> when possible over PIO.
>
> Virtual Machine test result using VMware hypervisor
> 1 hundred thousand reads using raw_pci_read() took:
> PIO: 12.809 seconds
> MMIO: 8.517 seconds (~33.5% faster then PIO)
>
> Currently, when these reads are performed by a virtual machine, they all
> cause a VM-exit, and therefore each one of them induces a considerable
> overhead.
>
> This overhead can be further improved, by mapping MMIO region of virtual
> machine to memory area that holds the values that the “emulated hardware”
> is supposed to return. The memory region is mapped as "read-only” in the
> NPT/EPT, so reads from these regions would be treated as regular memory
> reads. Writes would still be trapped and emulated by the hypervisor.
>
> Virtual Machine test result with above changes in VMware hypervisor
> 1 hundred thousand read using raw_pci_read() took:
> PIO: 12.809 seconds
> MMIO: 0.010 seconds
>
> This helps to reduce virtual machine PCI scan and initialization time by
> ~65%. In our case it reduced to ~18 mSec from ~55 mSec.
>
> MMIO is also faster than PIO on bare-metal systems, but due to some bugs
> with legacy hardware and the smaller gains on bare-metal, it seems prudent
> not to change bare-metal behavior.
>
> Signed-off-by: Ajay Kaher <akaher@vmware.com>
The subject line should be fixed -- you're changing the behaviour for
all hypervisors, not just VMWare. I almost skipped this because of the
subject line.
Thanks,
Wei.
prev parent reply other threads:[~2022-09-12 15:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 7:08 [PATCH v2] x86/PCI: Prefer MMIO over PIO on VMware hypervisor Ajay Kaher
2022-09-07 15:20 ` Vitaly Kuznetsov
2022-09-12 15:17 ` Wei Liu [this message]
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=Yx9NmjzeiyYsxUPT@liuwe-devbox-debian-v2 \
--to=wei.liu@kernel.org \
--cc=acrn-dev@lists.projectacrn.org \
--cc=akaher@vmware.com \
--cc=amakhalov@vmware.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=er.ajay.kaher@gmail.com \
--cc=helgaas@kernel.org \
--cc=hpa@zytor.com \
--cc=jailhouse-dev@googlegroups.com \
--cc=kvm@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namit@vmware.com \
--cc=rostedt@goodmis.org \
--cc=srivatsa@csail.mit.edu \
--cc=srivatsab@vmware.com \
--cc=tglx@linutronix.de \
--cc=vsirnapalli@vmware.com \
--cc=willy@infradead.org \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).