diff mbox

[02/11] migration: Move self_announce_delay() to misc.h

Message ID 20170601212921.30241-3-quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela June 1, 2017, 9:29 p.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/net/virtio-net.c         |  1 +
 include/migration/misc.h    | 10 ++++++++++
 include/migration/vmstate.h | 10 ----------
 migration/savevm.c          |  1 +
 4 files changed, 12 insertions(+), 10 deletions(-)

Comments

Peter Xu June 12, 2017, 9:22 a.m. UTC | #1
On Thu, Jun 01, 2017 at 11:29:12PM +0200, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>
Laurent Vivier June 12, 2017, 10:31 a.m. UTC | #2
On 01/06/2017 23:29, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/net/virtio-net.c         |  1 +
>  include/migration/misc.h    | 10 ++++++++++
>  include/migration/vmstate.h | 10 ----------
>  migration/savevm.c          |  1 +
>  4 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 9a3d769..91eddaf 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -25,6 +25,7 @@
>  #include "qapi/qmp/qjson.h"
>  #include "qapi-event.h"
>  #include "hw/virtio/virtio-access.h"
> +#include "migration/misc.h"
>  
>  #define VIRTIO_NET_VM_VERSION    11
>  
> diff --git a/include/migration/misc.h b/include/migration/misc.h
> index d7892b7..60486d4 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -26,4 +26,14 @@ void blk_mig_init(void);
>  static inline void blk_mig_init(void) {}
>  #endif
>  
> +#define SELF_ANNOUNCE_ROUNDS 5
> +
> +static inline
> +int64_t self_announce_delay(int round)
> +{
> +    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
> +    /* delay 50ms, 150ms, 250ms, ... */
> +    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
> +}
> +

It seems it is not used in a migration purpose by virtio-net, so it
should be moved out of include/migration, perhaps in include/qemu/timer.h ?

Thanks,
Laurent
Juan Quintela June 12, 2017, 10:35 a.m. UTC | #3
Laurent Vivier <lvivier@redhat.com> wrote:
> On 01/06/2017 23:29, Juan Quintela wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  hw/net/virtio-net.c         |  1 +
>>  include/migration/misc.h    | 10 ++++++++++
>>  include/migration/vmstate.h | 10 ----------
>>  migration/savevm.c          |  1 +
>>  4 files changed, 12 insertions(+), 10 deletions(-)
>> 
>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index 9a3d769..91eddaf 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -25,6 +25,7 @@
>>  #include "qapi/qmp/qjson.h"
>>  #include "qapi-event.h"
>>  #include "hw/virtio/virtio-access.h"
>> +#include "migration/misc.h"
>>  
>>  #define VIRTIO_NET_VM_VERSION    11
>>  
>> diff --git a/include/migration/misc.h b/include/migration/misc.h
>> index d7892b7..60486d4 100644
>> --- a/include/migration/misc.h
>> +++ b/include/migration/misc.h
>> @@ -26,4 +26,14 @@ void blk_mig_init(void);
>>  static inline void blk_mig_init(void) {}
>>  #endif
>>  
>> +#define SELF_ANNOUNCE_ROUNDS 5
>> +
>> +static inline
>> +int64_t self_announce_delay(int round)
>> +{
>> +    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
>> +    /* delay 50ms, 150ms, 250ms, ... */
>> +    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
>> +}
>> +
>
> It seems it is not used in a migration purpose by virtio-net, so it
> should be moved out of include/migration, perhaps in include/qemu/timer.h ?

There are some series from Vlad that touched this, but I need to move it
_anyways_ because I move migration.h to be internal to migration/.

I already asked him to move them to net/<anywhere>

Later, Juan.
Laurent Vivier June 12, 2017, 10:43 a.m. UTC | #4
On 12/06/2017 12:35, Juan Quintela wrote:
> Laurent Vivier <lvivier@redhat.com> wrote:
>> On 01/06/2017 23:29, Juan Quintela wrote:
>>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>>> ---
>>>  hw/net/virtio-net.c         |  1 +
>>>  include/migration/misc.h    | 10 ++++++++++
>>>  include/migration/vmstate.h | 10 ----------
>>>  migration/savevm.c          |  1 +
>>>  4 files changed, 12 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>>> index 9a3d769..91eddaf 100644
>>> --- a/hw/net/virtio-net.c
>>> +++ b/hw/net/virtio-net.c
>>> @@ -25,6 +25,7 @@
>>>  #include "qapi/qmp/qjson.h"
>>>  #include "qapi-event.h"
>>>  #include "hw/virtio/virtio-access.h"
>>> +#include "migration/misc.h"
>>>  
>>>  #define VIRTIO_NET_VM_VERSION    11
>>>  
>>> diff --git a/include/migration/misc.h b/include/migration/misc.h
>>> index d7892b7..60486d4 100644
>>> --- a/include/migration/misc.h
>>> +++ b/include/migration/misc.h
>>> @@ -26,4 +26,14 @@ void blk_mig_init(void);
>>>  static inline void blk_mig_init(void) {}
>>>  #endif
>>>  
>>> +#define SELF_ANNOUNCE_ROUNDS 5
>>> +
>>> +static inline
>>> +int64_t self_announce_delay(int round)
>>> +{
>>> +    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
>>> +    /* delay 50ms, 150ms, 250ms, ... */
>>> +    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
>>> +}
>>> +
>>
>> It seems it is not used in a migration purpose by virtio-net, so it
>> should be moved out of include/migration, perhaps in include/qemu/timer.h ?
> 
> There are some series from Vlad that touched this, but I need to move it
> _anyways_ because I move migration.h to be internal to migration/.
> 
> I already asked him to move them to net/<anywhere>
> 
> Later, Juan.
> 

ok, so:

Reviewed-by: Laurent Vivier <lvivier@redhat.com>
diff mbox

Patch

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9a3d769..91eddaf 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -25,6 +25,7 @@ 
 #include "qapi/qmp/qjson.h"
 #include "qapi-event.h"
 #include "hw/virtio/virtio-access.h"
+#include "migration/misc.h"
 
 #define VIRTIO_NET_VM_VERSION    11
 
diff --git a/include/migration/misc.h b/include/migration/misc.h
index d7892b7..60486d4 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -26,4 +26,14 @@  void blk_mig_init(void);
 static inline void blk_mig_init(void) {}
 #endif
 
+#define SELF_ANNOUNCE_ROUNDS 5
+
+static inline
+int64_t self_announce_delay(int round)
+{
+    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
+    /* delay 50ms, 150ms, 250ms, ... */
+    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
+}
+
 #endif
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 6689562..b95c9bb 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -1018,8 +1018,6 @@  extern const VMStateInfo vmstate_info_qtailq;
 #define VMSTATE_END_OF_LIST()                                         \
     {}
 
-#define SELF_ANNOUNCE_ROUNDS 5
-
 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                        void *opaque, int version_id);
 void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
@@ -1051,14 +1049,6 @@  void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
 void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
 void vmstate_register_ram_global(struct MemoryRegion *memory);
 
-static inline
-int64_t self_announce_delay(int round)
-{
-    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
-    /* delay 50ms, 150ms, 250ms, ... */
-    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
-}
-
 void dump_vmstate_json_to_file(FILE *out_fp);
 
 bool vmstate_check_only_migratable(const VMStateDescription *vmsd);
diff --git a/migration/savevm.c b/migration/savevm.c
index 9c320f5..d683877 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -36,6 +36,7 @@ 
 #include "qemu/timer.h"
 #include "migration/migration.h"
 #include "migration/snapshot.h"
+#include "migration/misc.h"
 #include "ram.h"
 #include "qemu-file-channel.h"
 #include "qemu-file.h"