From: Chao Gao <chao.gao@intel.com>
To: xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Chao Gao <chao.gao@intel.com>
Subject: [PATCH 0/4] mitigate the per-pCPU blocking list may be too long
Date: Wed, 26 Apr 2017 08:52:43 +0800 [thread overview]
Message-ID: <1493167967-74144-1-git-send-email-chao.gao@intel.com> (raw)
VT-d PI introduces a per-pCPU blocking list to track the blocked vCPU
running on the pCPU. Theoretically, there are 32K domain on single
host, 128 vCPUs per domain. If all vCPUs are blocked on the same pCPU,
4M vCPUs are in the same list. Travelling this issue consumes too
much time. We have discussed this issue in [1,2,3].
To mitigate this issue, we proposed the following two method [3]:
1. Evenly distributing all the blocked vCPUs among all pCPUs.
2. Don't put the blocked vCPUs which won't be woken by the wakeup
interrupt into the per-pCPU list.
PATCH 1/4 tracks the event, adding entry to PI blocking list. With the
patch, some data can be acquired to help to validate the following
patches.
Patch 2/4 randomly distritbutes entries (vCPUs) among all oneline
pCPUs, which can theoretically decrease the maximum of #entry
in the list by N times. N is #pCPU.
Patch 3/4 adds a refcount to vcpu's pi_desc. If the pi_desc is
recorded in one IRTE, the refcount increase by 1 and If the pi_desc is
cleared in one IRTE, the refcount decrease by 1.
In Patch 4/4, one vCPU is added to PI blocking list only if its
pi_desc is referred by at least one IRTE.
I tested this series in the following scene:
* One 128 vCPUs guest and assign a NIC to it
* all 128 vCPUs are pinned to one pCPU.
* use xentrace to collect events for 5 minutes
I compared the maximum of #entry in one list and #event (adding entry to
PI blocking list) with and without the three latter patches. Here
is the result:
-------------------------------------------------------------
| | | |
| Items | Maximum of #entry | #event |
| | | |
-------------------------------------------------------------
| | | |
|W/ the patches | 6 | 22740 |
| | | |
-------------------------------------------------------------
| | | |
|W/O the patches| 128 | 46481 |
| | | |
-------------------------------------------------------------
This is a very simple test. But with this patch series,
maximum of #entry has largely decreased and #adding entry to
PI blocking list reduces about half. From this aspect, this
patch series takes effect.
[1] https://lists.gt.net/xen/devel/422661?search_string=VT-d%20posted-interrupt%20core%20logic%20handling;#422661
[2] https://lists.gt.net/xen/devel/422567?search_string=%20The%20length%20of%20the%20list%20depends;#422567
[3] https://lists.gt.net/xen/devel/472749?search_string=enable%20vt-d%20pi%20by%20default;#472749
Chao Gao (4):
xentrace: add TRC_HVM_VT_D_PI_BLOCK
VT-d PI: Randomly Distribute entries to all online pCPUs' pi blocking
list
VT-d PI: Add reference count to pi_desc
VT-d PI: Don't add vCPU to PI blocking list for a case
tools/xentrace/formats | 1 +
xen/arch/x86/hvm/vmx/vmx.c | 90 +++++++++++++++++++++++++++++-----
xen/drivers/passthrough/io.c | 2 +-
xen/drivers/passthrough/vtd/intremap.c | 60 ++++++++++++++++++++++-
xen/include/asm-x86/hvm/domain.h | 6 +++
xen/include/asm-x86/hvm/trace.h | 1 +
xen/include/asm-x86/hvm/vmx/vmcs.h | 3 ++
xen/include/asm-x86/iommu.h | 2 +-
xen/include/asm-x86/msi.h | 2 +-
xen/include/public/trace.h | 1 +
10 files changed, 151 insertions(+), 17 deletions(-)
--
1.8.3.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-04-26 0:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 0:52 Chao Gao [this message]
2017-04-26 0:52 ` [PATCH 1/4] xentrace: add TRC_HVM_VT_D_PI_BLOCK Chao Gao
2017-04-26 0:52 ` [PATCH 2/4] VT-d PI: Randomly Distribute entries to all online pCPUs' pi blocking list Chao Gao
2017-04-26 0:52 ` [PATCH 3/4] VT-d PI: Add reference count to pi_desc Chao Gao
2017-04-26 0:52 ` [PATCH 4/4] VT-d PI: Don't add vCPU to PI blocking list for a case Chao Gao
2017-04-26 8:19 ` [PATCH 0/4] mitigate the per-pCPU blocking list may be too long Jan Beulich
2017-04-26 3:30 ` Chao Gao
2017-04-26 10:52 ` Jan Beulich
2017-04-26 16:39 ` George Dunlap
2017-04-27 0:43 ` Chao Gao
2017-04-27 9:44 ` George Dunlap
2017-04-27 5:02 ` Chao Gao
2017-05-02 5:45 ` Chao Gao
2017-05-03 10:08 ` George Dunlap
2017-05-03 10:21 ` Jan Beulich
2017-05-08 16:15 ` Chao Gao
2017-05-08 8:39 ` Jan Beulich
2017-05-08 16:38 ` Chao Gao
2017-05-08 9:13 ` George Dunlap
2017-05-08 9:24 ` Jan Beulich
2017-05-08 17:37 ` Chao Gao
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=1493167967-74144-1-git-send-email-chao.gao@intel.com \
--to=chao.gao@intel.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).