From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHpd8-0006ys-H2 for qemu-devel@nongnu.org; Mon, 05 Jun 2017 06:53:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHpd3-0008Q9-UJ for qemu-devel@nongnu.org; Mon, 05 Jun 2017 06:53:02 -0400 Received: from mail.ispras.ru ([83.149.199.45]:48738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHpd3-0008MO-G7 for qemu-devel@nongnu.org; Mon, 05 Jun 2017 06:52:57 -0400 From: "Pavel Dovgalyuk" References: <20170505103822.20641-1-alex.bennee@linaro.org> In-Reply-To: <20170505103822.20641-1-alex.bennee@linaro.org> Date: Mon, 5 Jun 2017 13:52:55 +0300 Message-ID: <001901d2dde9$e34034c0$a9c09e40$@ru> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: ru Subject: Re: [Qemu-devel] [RFC PATCH v1 0/9] BQL and Replay Lock changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?'Alex_Benn=C3=A9e'?= , pbonzini@redhat.com, boost.lists@gmail.com, pavel.dovgaluk@ispras.ru Cc: cota@braap.org, qemu-devel@nongnu.org Alex, Do you have newer fixed version of these patches? Pavel Dovgalyuk > -----Original Message----- > From: Alex Benn=C3=A9e [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=C3=A9e > Subject: [RFC PATCH v1 0/9] BQL and Replay Lock changes >=20 > Hi, >=20 > 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. >=20 > The patch breakdown is as follows: >=20 > - target/arm/arm-powertctl: drop BQL assertions >=20 > 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. >=20 > - cpus: push BQL lock to qemu_*_wait_io_event > - cpus: only take BQL for sleeping threads >=20 > The BQL reduction is done in two stages, mainly to make bisection > easier. >=20 > - 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 >=20 > 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: >=20 > ./arm-softmmu/qemu-system-arm -machine type=3Dvexpress-a9 -m 1024 \ > -display none -smp 1 -kernel ../images/vexpress-kernel.img \ > -dtb ../images/vexpress-v2p-ca9.dtb \ > -append "console=3DttyAMA0" -serial mon:stdio \ > -icount shift=3D7,rr=3Drecord,rrfile=3Dreplay.bin >=20 > ..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. >=20 > And finally: >=20 > - 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 >=20 > 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. >=20 > Any thoughts/comments? Does this seem like a reasonable direction to > go? >=20 > Alex Benn=C3=A9e (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 >=20 > 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 >=20 > -- > 2.11.0