diff options
author | 2016-03-08 14:54:28 +0100 | |
---|---|---|
committer | 2016-03-14 09:13:02 +0000 | |
commit | fe2da0e01a8873c2aa586cf170d276c81174b28e (patch) | |
tree | 566bd90b10741af01223d18e598aee995fdff6ef /vnet/vnet/devices/virtio/vhost-user.c | |
parent | 526b5e85468a7f4becd6c006bcba251ae6da35e2 (diff) |
Better match vhost-user specification for live migration
The specification requires logging of used vring writes to only happen
when VHOST_VRING_F_LOG flag is present in VHOST_USER_SET_VRING_ADDR
message; take that into account.
Change-Id: I9bf4b9eb43a1783b39909b1a3ea1a3bdf50d91a8
Signed-off-by: Yoann Desmouceaux <ydesmouc@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/virtio/vhost-user.c')
-rw-r--r-- | vnet/vnet/devices/virtio/vhost-user.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c index 945f03a1eea..13a8fe1b654 100644 --- a/vnet/vnet/devices/virtio/vhost-user.c +++ b/vnet/vnet/devices/virtio/vhost-user.c @@ -231,6 +231,7 @@ static inline void vhost_user_if_disconnect(vhost_user_intf_t * vui) vui->vrings[q].avail = NULL; vui->vrings[q].used = NULL; vui->vrings[q].log_guest_addr = 0; + vui->vrings[q].log_used = 0; } unmap_all_mem_regions(vui); @@ -259,8 +260,10 @@ always_inline void vhost_user_log_dirty_pages(vhost_user_intf_t * vui, } #define vhost_user_log_dirty_ring(vui, vq, member) \ - vhost_user_log_dirty_pages(vui, vq->log_guest_addr + offsetof(vring_used_t, member), \ - sizeof(vq->used->member)) + if (PREDICT_FALSE(vq->log_used)) { \ + vhost_user_log_dirty_pages(vui, vq->log_guest_addr + offsetof(vring_used_t, member), \ + sizeof(vq->used->member)); \ + } static clib_error_t * vhost_user_socket_read (unix_file_t * uf) { @@ -370,6 +373,7 @@ static clib_error_t * vhost_user_socket_read (unix_file_t * uf) vui->vrings[q].avail = 0; vui->vrings[q].used = 0; vui->vrings[q].log_guest_addr = 0; + vui->vrings[q].log_used = 0; } DBG_SOCK("interface %d disconnected", vui->sw_if_index); @@ -451,6 +455,8 @@ static clib_error_t * vhost_user_socket_read (unix_file_t * uf) } vui->vrings[msg.state.index].log_guest_addr = msg.addr.log_guest_addr; + vui->vrings[msg.state.index].log_used = + (msg.addr.flags & (1 << VHOST_VRING_F_LOG)) ? 1 : 0; /* Spec says: If VHOST_USER_F_PROTOCOL_FEATURES has not been negotiated, the ring is initialized in an enabled state. */ |