All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-thread: add a fast path to the Win32 QemuEvent
Date: Thu, 10 Sep 2015 21:30:14 +0200	[thread overview]
Message-ID: <55F1DA46.6000304@weilnetz.de> (raw)
In-Reply-To: <55F1ABF6.2030900@redhat.com>

Am 10.09.2015 um 18:12 schrieb Paolo Bonzini:
> On 12/08/2015 15:38, Paolo Bonzini wrote:
>> QemuEvents are used heavily by call_rcu.  We do not want them to be slow,
>> but the current implementation does a kernel call on every invocation
>> of qemu_event_* and won't cut it.
>>
>> So, wrap a Win32 manual-reset event with a fast userspace path.  The
>> states and transitions are the same as for the futex and mutex/condvar
>> implementations, but the slow path is different of course.  The idea
>> is to reset the Win32 event lazily, as part of a test-reset-test-wait
>> sequence.  Such a sequence is, indeed, how QemuEvents are used by
>> RCU and other subsystems!
>>
>> The patch includes a formal model of the algorithm.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  docs/win32-qemu-event.promela | 98 +++++++++++++++++++++++++++++++++++++++++++
>>  include/qemu/thread-win32.h   |  1 +
>>  util/qemu-thread-win32.c      | 66 +++++++++++++++++++++++++++--
>>  3 files changed, 161 insertions(+), 4 deletions(-)
>>  create mode 100644 docs/win32-qemu-event.promela
>>
[...]
>>
> 
> Ping?
> 

Hello Paolo,

sorry, I did not notice your patch when it was initially sent.

I have just run several passes of a simple test (booting an fdos
image and running a test sequence which involves TCP / downloads
and compilations under fdos) under wine on my KVM server,
so this was not a typical Windows environment.

Command line:

time wine32 i686-w64-mingw32/i386-softmmu/qemu-system-i386 -fda
metados.img -boot a -net nic,model=pcnet -net user -snapshot

Results without patch:

real	3m8.601s
user	1m33.972s
sys	0m29.736s

real	2m25.502s
user	1m28.168s
sys	0m24.640s

Results with patch:

real	2m27.628s
user	1m27.844s
sys	0m13.304s

real	2m0.043s
user	1m22.728s
sys	0m11.004s

Interpretation:

The real time varies because the test includes user
interactions (pressing enter, starting test,
terminating QEMU after test).

The user time (mainly emulation) does not vary much.

The system time is significantly reduced (less than
50 % in both runs with patch compared to both runs
without patch).

I also had an (unrelated) crash with the unpatched code:

wine: Unhandled page fault on read access to 0x0000004c at address
0x43ed3d (thread 0009), starting debugger...

It happened once in three runs, so this needs separate
investigations.

Would you suggest additional tests?
I'll take your patch in my queue (git://qemu.weilnetz.de/qemu.git wxx).

Regards
Stefan

Tested-by: Stefan Weil <sw@weilnetz.de>

  reply	other threads:[~2015-09-10 19:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 13:38 [Qemu-devel] [PATCH] qemu-thread: add a fast path to the Win32 QemuEvent Paolo Bonzini
2015-09-10 16:12 ` Paolo Bonzini
2015-09-10 19:30   ` Stefan Weil [this message]
2015-09-10 19:36     ` Paolo Bonzini

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=55F1DA46.6000304@weilnetz.de \
    --to=sw@weilnetz.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.