Re: [Qemu-devel] [PATCH] Inter-VM shared memory PCI device

Alexander Graf
2010-03-08T09:48:44Z

Am 08.03.2010 um 02:45 schrieb Jamie Lokier <jamie@shareable.org>:

> Paul Brook wrote:
>>> Support an inter-vm shared memory device that maps a shared-memory
>>> object
>>> as a PCI device in the guest. This patch also supports interrupts
>>> between
>>> guest by communicating over a unix domain socket. This patch
>>> applies to
>>> the qemu-kvm repository.
>>
>> No. All new devices should be fully qdev based.
>>
>> I suspect you've also ignored a load of coherency issues,
>> especially when not
>> using KVM. As soon as you have shared memory in more than one host
>> thread/process you have to worry about memory barriers.
>
> Yes. Guest-observable behaviour is likely to be quite different on
> different hosts, expecially beteen x86 and non-x86 hosts, which is not
> good at all for emulation.
>
> Memory barriers performed by the guest would help, but would not
> remove the fact that behaviour would vary beteen different host types
> if a guest doesn't call them. I.e. you could accidentally have some
> guests working fine for years on x86 hosts, which gain subtle
> memory corruption as soon as you run them on a different host.
>
> This is acceptable when recompiling code for different architectures,
> but it's asking for trouble with binary guest images which aren't
> supposed to depend on host architecture.
>
> However, coherence could be made host-type-independent by the host
> mapping and unampping pages, so that each page is only mapped into one
> guest (or guest CPU) at a time. Just like some clustering filesystems
> do to maintain coherence.

Or we could put in some code that tells the guest the host shm
architecture and only accept x86 on x86 for now. If anyone cares for
other combinations, they're free to implement them.

Seriously, we're looking at an interface designed for kvm here. Let's
please keep it as simple and fast as possible for the actual use case,
not some theoretically possible ones.

Alex