From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Cam Macdonell <cam@cs.ualberta.ca>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [PATCH v5 4/5] Inter-VM shared memory PCI device
Date: Tue, 11 May 2010 10:51:02 -0500 [thread overview]
Message-ID: <4BE97CE6.6000001@codemonkey.ws> (raw)
In-Reply-To: <4BE96F50.1040506@redhat.com>
On 05/11/2010 09:53 AM, Avi Kivity wrote:
> On 05/11/2010 05:17 PM, Cam Macdonell wrote:
>>
>>> The master is the shared memory area. It's a completely separate
>>> entity
>>> that is represented by the backing file (or shared memory server
>>> handing out
>>> the fd to mmap). It can exists independently of any guest.
>> I think the master/peer idea would be necessary if we were sharing
>> guest memory (sharing guest A's memory with guest B). Then if the
>> master (guest A) dies, perhaps something needs to happen to preserve
>> the memory contents.
>
> Definitely. But we aren't...
Then transparent live migration is impossible. IMHO, that's a
fundamental mistake that we will regret down the road.
>> But since we're sharing host memory, the
>> applications in the guests can race to determine the master by
>> grabbing a lock at offset 0 or by using lowest VM ID.
>>
>> Looking at it another way, it is the applications using shared memory
>> that may or may not need a master, the Qemu processes don't need the
>> concept of a master since the memory belongs to the host.
>
> Exactly. Furthermore, even in a master/slave relationship, there will
> be different masters for different sub-areas, it would be a pity to
> expose all this in the hardware abstraction. This way we have an
> external device, and PCI HBAs which connect to it - just like a
> multi-tailed SCSI disk.
To support transparent live migration, it's necessary to do two things:
1) Preserve the memory contents of the PCI BAR after disconnected from a
shared memory segment
2) Synchronize any changes made to the PCI BAR with the shared memory
segment upon reconnect/initial connection.
N.B. savevm/loadvm both constitute disconnect and reconnect events
respectively.
Supporting (1) is easy since we just need to memcpy() the contents of
the shared memory segment to a temporary RAM area upon disconnect.
Supporting (2) is easy when the shared memory segment is viewed as owned
by the guest since it has the definitive copy of the data. IMHO, this
is what role=master means. However, if we want to support a model where
the guest does not have a definitive copy of the data, upon reconnect,
we need to throw away the guest's changes and make the shared memory
segment appear to simultaneously update to the guest. This is what
role=peer means.
For role=peer, it's necessary to signal to the guest when it's not
connected. This means prior to savevm it's necessary to indicate to the
guest that it's been disconnected.
I think it's important that we build this mechanism in from the start
because as I've stated in the past, I don't think role=peer is going to
be the dominant use-case. I actually don't think that shared memory
between guests is all that interesting compared to shared memory to an
external process on the host.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2010-05-11 15:51 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-21 17:53 [Qemu-devel] [PATCH v5 0/5] PCI Shared Memory device Cam Macdonell
2010-04-21 17:53 ` [Qemu-devel] [PATCH v5 1/5] Device specification for shared memory PCI device Cam Macdonell
2010-04-21 17:53 ` [Qemu-devel] [PATCH v5 2/5] Support adding a file to qemu's ram allocation Cam Macdonell
2010-04-21 17:53 ` [Qemu-devel] [PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds Cam Macdonell
2010-04-21 17:53 ` [Qemu-devel] [PATCH v5 4/5] Inter-VM shared memory PCI device Cam Macdonell
2010-04-21 18:00 ` [Qemu-devel] [PATCH v5 5/5] shared memory server for inter-VM shared memory Cam Macdonell
2010-05-05 16:57 ` [Qemu-devel] [PATCH v5 4/5] RESEND: Inter-VM shared memory PCI device Cam Macdonell
2010-05-06 17:32 ` [Qemu-devel] Re: [PATCH v5 4/5] " Anthony Liguori
2010-05-06 17:59 ` Cam Macdonell
2010-05-10 11:59 ` Avi Kivity
2010-05-10 15:22 ` Cam Macdonell
2010-05-10 15:28 ` Avi Kivity
2010-05-10 15:38 ` Anthony Liguori
2010-05-10 16:20 ` Cam Macdonell
2010-05-10 16:52 ` Anthony Liguori
2010-05-18 16:58 ` Cam Macdonell
2010-05-18 17:27 ` Avi Kivity
2010-05-10 16:59 ` Avi Kivity
2010-05-10 17:25 ` Anthony Liguori
2010-05-10 17:43 ` Cam Macdonell
2010-05-10 17:52 ` Anthony Liguori
2010-05-10 18:01 ` Cam Macdonell
2010-05-11 7:59 ` Avi Kivity
2010-05-11 13:10 ` Anthony Liguori
2010-05-11 14:03 ` Avi Kivity
2010-05-11 14:17 ` Cam Macdonell
2010-05-11 14:53 ` Avi Kivity
2010-05-11 15:51 ` Anthony Liguori [this message]
2010-05-11 16:39 ` Cam Macdonell
2010-05-11 17:05 ` Anthony Liguori
2010-05-11 17:50 ` Cam Macdonell
2010-05-11 18:13 ` Avi Kivity
2010-05-12 15:32 ` Cam Macdonell
2010-05-12 15:48 ` Avi Kivity
2010-05-11 18:09 ` Avi Kivity
2010-05-11 7:55 ` Avi Kivity
2010-05-10 15:41 ` Cam Macdonell
2010-05-10 16:40 ` Avi Kivity
2010-05-10 16:48 ` Cam Macdonell
2010-05-12 15:49 ` Avi Kivity
2010-05-12 16:14 ` Cam Macdonell
2010-05-12 16:45 ` Avi Kivity
2010-05-10 23:17 ` Cam Macdonell
2010-05-11 8:03 ` Avi Kivity
2010-05-13 21:10 ` Cam Macdonell
2010-05-15 6:05 ` Avi Kivity
2010-05-10 10:43 ` [Qemu-devel] Re: [PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds Avi Kivity
2010-05-10 15:13 ` Cam Macdonell
2010-05-10 15:17 ` Avi Kivity
2010-05-10 10:39 ` [Qemu-devel] Re: [PATCH v5 2/5] Support adding a file to qemu's ram allocation Avi Kivity
2010-05-10 15:32 ` Cam Macdonell
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=4BE97CE6.6000001@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=cam@cs.ualberta.ca \
--cc=kvm@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).