[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] RFC Multi-threaded TCG design document
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] RFC Multi-threaded TCG design document |
Date: |
Wed, 17 Jun 2015 13:58:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 12/06/2015 18:37, Alex Bennée wrote:
> Emulated hardware state
> -----------------------
>
> Currently the hardware emulation has no protection against
> multiple-accesses. However guest systems accessing emulated hardware
> should be carrying out their own locking to prevent multiple CPUs
> confusing the hardware. Of course there is no guarantee the there
> couldn't be a broken guest that doesn't lock so you could get racing
> accesses to the hardware.
>
> There is the class of paravirtualized hardware (VIRTIO) that works in
> a purely mmio mode. Often setting flags directly in guest memory as a
> result of a guest triggered transaction.
>
> DESIGN REQUIREMENTS:
>
> - Access to IO Memory should be serialised by an IOMem mutex
This should simply be the "big QEMU lock", which also protects the I/O
subsystem.
With BQL-free TCG (a subset of multi-threaded TCG), the code in
qemu_mutex_lock_iothread that forces VCPUs to relinquish the mutex can
be dropped.
Paolo
> - The mutex should be recursive (e.g. allowing pid to relock itself)
>
> IO Subsystem
> ------------
>
> The I/O subsystem is heavily used by KVM and has seen a lot of
> improvements to offload I/O tasks to dedicated IOThreads. There should
> be no additional locking required once we reach the Block Driver.
>
> DESIGN REQUIREMENTS:
>
> - The dataplane should continue to be protected by the iothread locks
>
>
> References
> ==========
>
> [1]
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/memory-barriers.txt
> [2] http://thread.gmane.org/gmane.comp.emulators.qemu/334561
> [3] http://thread.gmane.org/gmane.comp.emulators.qemu/335297
>
>
>