From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: [PATCH v2 0/9] 9pfs: readdir optimization
Date: Wed, 18 Dec 2019 15:17:24 +0100 [thread overview]
Message-ID: <cover.1576678644.git.qemu_oss@crudebyte.com> (raw)
As previously mentioned, I was investigating performance issues with 9pfs.
Raw file read/write of 9pfs is actually quite good, provided that client
picked a reasonable high msize (maximum message size). I would recommend
to log a warning on 9p server side if a client attached with a small msize
that would cause performance issues for that reason.
However there other aspects where 9pfs currently performs suboptimally,
especially readdir handling of 9pfs is extremely slow, a simple readdir
request of a guest typically blocks for several hundred milliseconds or
even several seconds, no matter how powerful the underlying hardware is.
The reason for this performance issue: latency.
Currently 9pfs is heavily dispatching a T_readdir request numerous times
between main I/O thread and a background I/O thread back and forth; in fact
it is actually hopping between threads even multiple times for every single
directory entry during T_readdir request handling which leads in total to
huge latencies for a single T_readdir request.
This patch series aims to address this severe performance issue of 9pfs
T_readdir request handling. The actual performance fix is patch 8. I also
provided a convenient benchmark for comparing the performance improvements
by using the 9pfs "synth" driver (see patch 6 for instructions how to run
the benchmark), so no guest OS installation is required to peform this
benchmark A/B comparison. With patch 8 I achieved a performance improvement
of factor 40 on my test machine.
** NOTE: ** These patches are not heavily tested yet, nor thouroughly
reviewed for potential security issues yet. I decided to post them already
though, because I won't have the time in the next few weeks for polishing
them. The benchmark results should demonstrate though that it is worth the
hassle. So any testing/reviews/fixes appreciated!
v1->v2:
* Fixed missing email threading of this patch set.
* Fixed code style issues.
* No need to check for NULL when calling g_free() [patch 4] and
[patch 8].
* No need to initialize static variable with NULL [patch 7].
* Adjustments to commit log messages.
Christian Schoenebeck (9):
tests/virtio-9p: add terminating null in v9fs_string_read()
9pfs: validate count sent by client with T_readdir
hw/9pfs/9p-synth: added directory for readdir test
tests/virtio-9p: added readdir test
tests/virtio-9p: check file names of R_readdir response
9pfs: readdir benchmark
hw/9pfs/9p-synth: avoid n-square issue in synth_readdir()
9pfs: T_readdir latency optimization
hw/9pfs/9p.c: benchmark time on T_readdir request
hw/9pfs/9p-synth.c | 48 ++++++++++-
hw/9pfs/9p-synth.h | 5 ++
hw/9pfs/9p.c | 151 ++++++++++++++++++---------------
hw/9pfs/9p.h | 23 +++++
hw/9pfs/codir.c | 183 +++++++++++++++++++++++++++++++++++++---
hw/9pfs/coth.h | 3 +
tests/virtio-9p-test.c | 186 ++++++++++++++++++++++++++++++++++++++++-
7 files changed, 516 insertions(+), 83 deletions(-)
--
2.20.1
next reply other threads:[~2019-12-18 15:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 14:17 Christian Schoenebeck [this message]
2019-12-18 13:06 ` [PATCH v2 1/9] tests/virtio-9p: add terminating null in v9fs_string_read() Christian Schoenebeck
2020-01-06 11:00 ` Greg Kurz
2019-12-18 13:17 ` [PATCH v2 2/9] 9pfs: validate count sent by client with T_readdir Christian Schoenebeck
2020-01-06 12:30 ` Greg Kurz
2020-01-06 15:10 ` Christian Schoenebeck
2020-01-06 17:49 ` Greg Kurz
2020-01-06 21:43 ` Christian Schoenebeck
2020-01-08 23:53 ` Greg Kurz
2020-01-10 12:03 ` Christian Schoenebeck
2019-12-18 13:23 ` [PATCH v2 3/9] hw/9pfs/9p-synth: added directory for readdir test Christian Schoenebeck
2020-01-09 18:49 ` Greg Kurz
2019-12-18 13:30 ` [PATCH v2 4/9] tests/virtio-9p: added " Christian Schoenebeck
2020-01-06 17:22 ` Greg Kurz
2020-01-07 12:25 ` Christian Schoenebeck
2020-01-07 15:27 ` Greg Kurz
2020-01-08 23:55 ` Greg Kurz
2020-01-10 12:10 ` Christian Schoenebeck
2019-12-18 13:35 ` [PATCH v2 5/9] tests/virtio-9p: check file names of R_readdir response Christian Schoenebeck
2020-01-06 17:07 ` Greg Kurz
2020-01-07 12:28 ` Christian Schoenebeck
2020-01-07 15:29 ` Greg Kurz
2019-12-18 13:43 ` [PATCH v2 6/9] 9pfs: readdir benchmark Christian Schoenebeck
2019-12-18 13:52 ` [PATCH v2 7/9] hw/9pfs/9p-synth: avoid n-square issue in synth_readdir() Christian Schoenebeck
2019-12-18 14:00 ` [PATCH v2 8/9] 9pfs: T_readdir latency optimization Christian Schoenebeck
2019-12-18 14:10 ` [PATCH v2 9/9] hw/9pfs/9p.c: benchmark time on T_readdir request Christian Schoenebeck
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=cover.1576678644.git.qemu_oss@crudebyte.com \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.org \
--cc=qemu-devel@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).