From: "Alex Bennée" <alex.bennee@linaro.org>
To: Pavel Dovgalyuk <dovgaluk@ispras.ru>
Cc: pbonzini@redhat.com, boost.lists@gmail.com,
pavel.dovgaluk@ispras.ru, cota@braap.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH v1 0/9] BQL and Replay Lock changes
Date: Tue, 06 Jun 2017 10:34:05 +0100 [thread overview]
Message-ID: <87wp8pcvea.fsf@linaro.org> (raw)
In-Reply-To: <001901d2dde9$e34034c0$a9c09e40$@ru>
Pavel Dovgalyuk <dovgaluk@ispras.ru> writes:
> Alex,
>
> Do you have newer fixed version of these patches?
I was waiting to see if there where any other review comments for the
rest of the RFC series before re-spinning.
>
> Pavel Dovgalyuk
>
>
>> -----Original Message-----
>> From: Alex Bennée [mailto:alex.bennee@linaro.org]
>> Sent: Friday, May 05, 2017 1:38 PM
>> To: pbonzini@redhat.com; boost.lists@gmail.com; pavel.dovgaluk@ispras.ru
>> Cc: cota@braap.org; qemu-devel@nongnu.org; Alex Bennée
>> Subject: [RFC PATCH v1 0/9] BQL and Replay Lock changes
>>
>> Hi,
>>
>> This RFC does two principle things. It continues the push to reduce
>> the BQL lock contention to a minimum by dropping the BQL for most of
>> the run loop - eventually only holding it for timer processing and
>> sleeping. The second part is an attempt to fix the breakage caused to
>> record/replay by the previous work reducing the BQL in 2.9.
>>
>> The patch breakdown is as follows:
>>
>> - target/arm/arm-powertctl: drop BQL assertions
>>
>> This just fixes a bogus assert. The async work doesn't need BQL
>> protection as it is all done in the context of the vCPU (meaning
>> nothing else should be messing with it). However going forward we will
>> need to audit all the async work calls to make sure they are fine to
>> run outside of the BQL.
>>
>> - cpus: push BQL lock to qemu_*_wait_io_event
>> - cpus: only take BQL for sleeping threads
>>
>> The BQL reduction is done in two stages, mainly to make bisection
>> easier.
>>
>> - replay/replay-internal.c: track holding of replay_lock
>> - replay: make locking visible outside replay code
>> - replay: push replay_mutex_lock up the call tree
>>
>> There is still more work to do here but essentially replay_lock now
>> replaces the BQL in keeping synchronisation between main-loop and the
>> TCG thread - it is no longer a fine lock for the replay log but a
>> gross lock that keeps batches of updates together. So far I have been
>> testing with the simple testcase:
>>
>> ./arm-softmmu/qemu-system-arm -machine type=vexpress-a9 -m 1024 \
>> -display none -smp 1 -kernel ../images/vexpress-kernel.img \
>> -dtb ../images/vexpress-v2p-ca9.dtb \
>> -append "console=ttyAMA0" -serial mon:stdio \
>> -icount shift=7,rr=record,rrfile=replay.bin
>>
>> ..and that works fine. However more complex testing with more devices
>> to exercise the async events code is needed here. One change that
>> needs some careful care is we are now not dropping the replay_mutex
>> lock between events.
>>
>> And finally:
>>
>> - scripts/qemu-gdb: add simple tcg lock status helper
>> - util/qemu-thread-*: add qemu_lock, locked and unlock trace events
>> - scripts/analyse-locks-simpletrace.py: script to analyse lock times
>>
>> These are helpers I wrote while debugging the locking. The GDB helper
>> is fairly dump but does attempt to show where locks are held. The
>> qemu-lock tracing is a little hacky but could prove useful in doing
>> more detailed lock analysis.
>>
>> Any thoughts/comments? Does this seem like a reasonable direction to
>> go?
>>
>> Alex Bennée (9):
>> target/arm/arm-powertctl: drop BQL assertions
>> cpus: push BQL lock to qemu_*_wait_io_event
>> cpus: only take BQL for sleeping threads
>> replay/replay-internal.c: track holding of replay_lock
>> replay: make locking visible outside replay code
>> replay: push replay_mutex_lock up the call tree
>> scripts/qemu-gdb: add simple tcg lock status helper
>> util/qemu-thread-*: add qemu_lock, locked and unlock trace events
>> scripts/analyse-locks-simpletrace.py: script to analyse lock times
>>
>> cpus-common.c | 13 ++---
>> cpus.c | 57 ++++++++++++++++++---
>> docs/replay.txt | 19 +++++++
>> include/qemu/thread.h | 7 ++-
>> include/sysemu/replay.h | 16 ++++++
>> kvm-all.c | 4 --
>> replay/replay-char.c | 21 +++-----
>> replay/replay-events.c | 18 ++-----
>> replay/replay-internal.c | 22 +++++++-
>> replay/replay-internal.h | 5 +-
>> replay/replay-time.c | 10 ++--
>> replay/replay.c | 40 +++++++--------
>> scripts/analyse-locks-simpletrace.py | 99 ++++++++++++++++++++++++++++++++++++
>> scripts/qemu-gdb.py | 3 +-
>> scripts/qemugdb/tcg.py | 46 +++++++++++++++++
>> stubs/replay.c | 15 ++++++
>> target/arm/arm-powerctl.c | 8 ---
>> target/i386/hax-all.c | 2 -
>> util/main-loop.c | 23 +++++++--
>> util/qemu-thread-posix.c | 11 +++-
>> util/trace-events | 5 ++
>> vl.c | 2 +
>> 22 files changed, 353 insertions(+), 93 deletions(-)
>> create mode 100755 scripts/analyse-locks-simpletrace.py
>> create mode 100644 scripts/qemugdb/tcg.py
>>
>> --
>> 2.11.0
--
Alex Bennée
prev parent reply other threads:[~2017-06-06 9:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-05 10:38 [Qemu-devel] [RFC PATCH v1 0/9] BQL and Replay Lock changes Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 1/9] target/arm/arm-powertctl: drop BQL assertions Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 2/9] cpus: push BQL lock to qemu_*_wait_io_event Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 3/9] cpus: only take BQL for sleeping threads Alex Bennée
2017-05-05 15:15 ` Paolo Bonzini
2017-05-05 15:28 ` Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 4/9] replay/replay-internal.c: track holding of replay_lock Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 5/9] replay: make locking visible outside replay code Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 6/9] replay: push replay_mutex_lock up the call tree Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 7/9] scripts/qemu-gdb: add simple tcg lock status helper Alex Bennée
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 8/9] util/qemu-thread-*: add qemu_lock, locked and unlock trace events Alex Bennée
2017-05-05 15:17 ` Paolo Bonzini
2017-05-05 15:59 ` Alex Bennée
2017-05-06 8:19 ` Paolo Bonzini
2017-05-08 17:52 ` Stefan Hajnoczi
2017-05-09 13:50 ` Alex Bennée
2017-05-09 13:55 ` Paolo Bonzini
2017-05-05 10:38 ` [Qemu-devel] [RFC PATCH v1 9/9] scripts/analyse-locks-simpletrace.py: script to analyse lock times Alex Bennée
2017-05-05 15:38 ` [Qemu-devel] [RFC PATCH v1 0/9] BQL and Replay Lock changes no-reply
2017-05-10 13:51 ` Pavel Dovgalyuk
2017-05-10 15:24 ` Alex Bennée
2017-05-11 11:23 ` Pavel Dovgalyuk
2017-06-05 10:52 ` Pavel Dovgalyuk
2017-06-06 9:34 ` Alex Bennée [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=87wp8pcvea.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=boost.lists@gmail.com \
--cc=cota@braap.org \
--cc=dovgaluk@ispras.ru \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--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).