From: Greg Kurz <groug@kaod.org>
To: qemu-devel@nongnu.org
Cc: Daniel Henrique Barboza <danielhb@linux.ibm.com>,
qemu-ppc@nongnu.org, Greg Kurz <groug@kaod.org>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 0/6] spapr: Fix visibility and traversal of DR connectors
Date: Fri, 18 Dec 2020 11:33:54 +0100 [thread overview]
Message-ID: <20201218103400.689660-1-groug@kaod.org> (raw)
Setting a high maxmem value seriously degrades the guest's boot
time, from 3 seconds for 1T up to more than 3 minutes for 8T.
All this time is spent during initial machine setup and CAS,
preventing use of the QEMU monitor in the meantime.
Profiling reveals:
% cumulative self self total
time seconds seconds calls s/call s/call name
85.48 24.08 24.08 566117 0.00 0.00 object_get_canonical_path_component
13.67 27.93 3.85 57623944 0.00 0.00 strstart
-----------------------------------------------
0.00 0.00 1/566117 host_memory_backend_get_name [270]
1.41 0.22 33054/566117 drc_realize <cycle 1> [23]
22.67 3.51 533062/566117 object_get_canonical_path <cycle 1> [3]
[2] 98.7 24.08 3.73 566117 object_get_canonical_path_component [2]
3.73 0.00 55802324/57623944 strstart [19]
-----------------------------------------------
12 object_property_set_link <cycle 1> [1267]
33074 device_set_realized <cycle 1> [138]
231378 object_get_child_property <cycle 1> [652]
[3] 93.0 0.01 26.18 264464 object_get_canonical_path <cycle 1> [3]
22.67 3.51 533062/566117 object_get_canonical_path_component [2]
264464 object_get_root <cycle 1> [629]
-----------------------------------------------
This is because an 8T maxmem means QEMU can create up to 32768
LMB DRC objects, each tracking the hot-plug/unplug state of 256M
of contiguous RAM. These objects are all created during machine
init for the machine lifetime. Their realize path involves
several calls to object_get_canonical_path_component(), which
itself traverses all properties of the parent node. This results
in a quadratic operation. Worse, the full list of DRCs is traversed
7 times during the boot process, eg. to populate the device tree,
calling object_get_canonical_path_component() on each DRC again.
Yet even more costly quadratic traversals.
Modeling DR connectors as individual devices raises some
concerns, as already discussed a year ago in this thread:
https://patchew.org/QEMU/20191017205953.13122-1-cheloha@linux.vnet.ibm.com/
First, having so many devices to track the DRC states is excessive
and can cause scalability issues in various ways. This bites again
with this quadratic traversal issue. Second, DR connectors are really
PAPR internals that shouldn't be exposed at all in the composition
tree.
This series converts DR connectors to be simple unparented
objects tracked in a separate hash table, rather than
actual devices exposed in the QOM tree. This doesn't address
the overall concern on scalability, but this brings linear
traversal of the DR connectors. The time penalty with a
8T maxmem is reduced to less than 1 second, and we get
a much shorter 'info qom-tree' output.
This is transparent to migration.
Greg Kurz (6):
spapr: Call spapr_drc_reset() for all DRCs at CAS
spapr: Fix reset of transient DR connectors
spapr: Introduce spapr_drc_reset_all()
spapr: Use spapr_drc_reset_all() at machine reset
spapr: Add drc_ prefix to the DRC realize and unrealize functions
spapr: Model DR connectors as simple objects
include/hw/ppc/spapr_drc.h | 18 +++-
hw/ppc/spapr.c | 15 +--
hw/ppc/spapr_drc.c | 181 +++++++++++++++++--------------------
hw/ppc/spapr_hcall.c | 33 ++-----
hw/ppc/spapr_pci.c | 2 +-
5 files changed, 106 insertions(+), 143 deletions(-)
--
2.26.2
next reply other threads:[~2020-12-18 10:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 10:33 Greg Kurz [this message]
2020-12-18 10:33 ` [PATCH 1/6] spapr: Call spapr_drc_reset() for all DRCs at CAS Greg Kurz
2020-12-21 18:24 ` Daniel Henrique Barboza
2020-12-28 7:20 ` David Gibson
2020-12-18 10:33 ` [PATCH 2/6] spapr: Fix reset of transient DR connectors Greg Kurz
2020-12-21 20:34 ` Daniel Henrique Barboza
2020-12-28 7:24 ` David Gibson
2020-12-18 10:33 ` [PATCH 3/6] spapr: Introduce spapr_drc_reset_all() Greg Kurz
2020-12-21 20:35 ` Daniel Henrique Barboza
2020-12-28 7:26 ` David Gibson
2020-12-18 10:33 ` [PATCH 4/6] spapr: Use spapr_drc_reset_all() at machine reset Greg Kurz
2020-12-21 20:36 ` Daniel Henrique Barboza
2020-12-28 7:29 ` David Gibson
2020-12-18 10:33 ` [PATCH 5/6] spapr: Add drc_ prefix to the DRC realize and unrealize functions Greg Kurz
2020-12-21 20:37 ` Daniel Henrique Barboza
2020-12-28 7:31 ` David Gibson
2020-12-18 10:34 ` [PATCH 6/6] spapr: Model DR connectors as simple objects Greg Kurz
2020-12-21 20:45 ` Daniel Henrique Barboza
2020-12-28 8:28 ` David Gibson
2021-01-06 18:15 ` Greg Kurz
2021-02-08 6:30 ` David Gibson
2020-12-22 10:14 ` [PATCH 0/6] spapr: Fix visibility and traversal of DR connectors Daniel Henrique Barboza
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=20201218103400.689660-1-groug@kaod.org \
--to=groug@kaod.org \
--cc=danielhb@linux.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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).