diff mbox

[v5,12/21] vhost-user: document migration log

Message ID 1443111741-4736-13-git-send-email-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Sept. 24, 2015, 4:22 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 docs/specs/vhost-user.txt | 48 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

Comments

Eric Blake Sept. 24, 2015, 4:38 p.m. UTC | #1
On 09/24/2015 10:22 AM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  docs/specs/vhost-user.txt | 48 +++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 46 insertions(+), 2 deletions(-)

> @@ -140,8 +142,7 @@ Multiple queue support
>  
>  Multiple queue is treated as a protocol extension, hence the slave has to
>  implement protocol features first. The multiple queues feature is supported
> -only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set:
> -#define VHOST_USER_PROTOCOL_F_MQ    0
> +only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set.

Should this hunk be in an earlier patch,

> +
> +Protocol features
> +-----------------
> +
> +#define VHOST_USER_PROTOCOL_F_MQ             0
> +#define VHOST_USER_PROTOCOL_F_LOG_SHMFD      1

along with this section (of course, with just bit 0 in that patch)?
Marc-Andre Lureau Sept. 24, 2015, 4:41 p.m. UTC | #2
Hi

----- Original Message -----
> On 09/24/2015 10:22 AM, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  docs/specs/vhost-user.txt | 48
> >  +++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 46 insertions(+), 2 deletions(-)
> 
> > @@ -140,8 +142,7 @@ Multiple queue support
> >  
> >  Multiple queue is treated as a protocol extension, hence the slave has to
> >  implement protocol features first. The multiple queues feature is
> >  supported
> > -only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set:
> > -#define VHOST_USER_PROTOCOL_F_MQ    0
> > +only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set.
> 
> Should this hunk be in an earlier patch,

The series is on top of last Michael PULL request. I just moved the define
in a common section, since now they are 2 and later 3. Does that make sense?

> 
> > +
> > +Protocol features
> > +-----------------
> > +
> > +#define VHOST_USER_PROTOCOL_F_MQ             0
> > +#define VHOST_USER_PROTOCOL_F_LOG_SHMFD      1
> 
> along with this section (of course, with just bit 0 in that patch)?
> 
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 
>
Eric Blake Sept. 24, 2015, 4:47 p.m. UTC | #3
On 09/24/2015 10:41 AM, Marc-André Lureau wrote:

>>> -only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set:
>>> -#define VHOST_USER_PROTOCOL_F_MQ    0
>>> +only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set.
>>
>> Should this hunk be in an earlier patch,
> 
> The series is on top of last Michael PULL request. I just moved the define
> in a common section, since now they are 2 and later 3. Does that make sense?

Sure. My bad for not checking whether it was this series that introduced
bit 0 vs. it being pre-existing from an earlier series.
diff mbox

Patch

diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt
index 4eadad1..e0292a0 100644
--- a/docs/specs/vhost-user.txt
+++ b/docs/specs/vhost-user.txt
@@ -115,11 +115,13 @@  the ones that do:
  * VHOST_GET_FEATURES
  * VHOST_GET_PROTOCOL_FEATURES
  * VHOST_GET_VRING_BASE
+ * VHOST_SET_LOG_BASE (if VHOST_USER_PROTOCOL_F_LOG_SHMFD)
 
 There are several messages that the master sends with file descriptors passed
 in the ancillary data:
 
  * VHOST_SET_MEM_TABLE
+ * VHOST_SET_LOG_BASE (if VHOST_USER_PROTOCOL_F_LOG_SHMFD)
  * VHOST_SET_LOG_FD
  * VHOST_SET_VRING_KICK
  * VHOST_SET_VRING_CALL
@@ -140,8 +142,7 @@  Multiple queue support
 
 Multiple queue is treated as a protocol extension, hence the slave has to
 implement protocol features first. The multiple queues feature is supported
-only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set:
-#define VHOST_USER_PROTOCOL_F_MQ    0
+only when the protocol feature VHOST_USER_PROTOCOL_F_MQ (bit 0) is set.
 
 The max number of queues the slave supports can be queried with message
 VHOST_USER_GET_PROTOCOL_FEATURES. Master should stop when the number of
@@ -152,6 +153,48 @@  queue in the sent message to identify a specified queue. One queue pair
 is enabled initially. More queues are enabled dynamically, by sending
 message VHOST_USER_SET_VRING_ENABLE.
 
+Migration
+---------
+
+During live migration, the master may need to track the modifications
+the slave makes to the memory mapped regions. The client should mark
+the dirty pages in a log. Once it complies to this logging, it may
+declare the VHOST_F_LOG_ALL vhost feature.
+
+All the modifications to memory pointed by vring "descriptor" should
+be marked. Modifications to "used" vring should be marked if
+VHOST_VRING_F_LOG is part of ring's features.
+
+Dirty pages are of size:
+#define VHOST_LOG_PAGE 0x1000
+
+The log memory fd is provided in the ancillary data of
+VHOST_USER_SET_LOG_BASE message when the slave has
+VHOST_USER_PROTOCOL_F_LOG_SHMFD protocol feature.
+
+The size of the log may be computed by using all the known guest
+addresses. The log covers from address 0 to the maximum of guest
+regions. In pseudo-code, to mark page at "addr" as dirty:
+
+page = addr / VHOST_LOG_PAGE
+log[page / 8] |= 1 << page % 8
+
+Use atomic operations, as the log may be concurrently manipulated.
+
+VHOST_USER_SET_LOG_FD is an optional message with an eventfd in
+ancillary data, it may be used to inform the master that the log has
+been modified.
+
+Once the source has finished migration, VHOST_USER_RESET_OWNER message
+will be sent by the source. No further update must be done before the
+destination takes over with new regions & rings.
+
+Protocol features
+-----------------
+
+#define VHOST_USER_PROTOCOL_F_MQ             0
+#define VHOST_USER_PROTOCOL_F_LOG_SHMFD      1
+
 Message types
 -------------
 
@@ -236,6 +279,7 @@  Message types
       Id: 6
       Equivalent ioctl: VHOST_SET_LOG_BASE
       Master payload: u64
+      Slave payload: N/A
 
       Sets the logging base address.