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

Jamie Lokier
2010-03-08T01:45:43Z

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.

-- Jamie