Patchwork [2/2] Fix a race condition in E1000 device live migration. One of data-transfer related flags not in migrated fields list.

login
register
mail settings
Submitter Dmitry Fleytman
Date Oct. 15, 2012, 4:48 p.m.
Message ID <1350319733-7306-3-git-send-email-dmitry@daynix.com>
Download mbox | patch
Permalink /patch/191601/
State New
Headers show

Comments

Dmitry Fleytman - Oct. 15, 2012, 4:48 p.m.
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
---
 hw/e1000.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Stefan Hajnoczi - Oct. 16, 2012, 8:32 a.m.
On Mon, Oct 15, 2012 at 06:48:53PM +0200, Dmitry Fleytman wrote:

The commit message is very long but the commit description is empty.
Please keep the message short and add the rest into the description.

> Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
> ---
>  hw/e1000.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/e1000.c b/hw/e1000.c
> index 1e66ecf..efbe0c9 100644
> --- a/hw/e1000.c
> +++ b/hw/e1000.c
> @@ -92,7 +92,7 @@ typedef struct E1000State_st {
>  
>      uint32_t rxbuf_size;
>      uint32_t rxbuf_min_shift;
> -    int check_rxov;
> +    uint32_t check_rxov;
>      uint32_t rx_init_done;
>      struct e1000_tx {
>          unsigned char header[256];
> @@ -1120,6 +1120,7 @@ static const VMStateDescription vmstate_e1000 = {
>          VMSTATE_UNUSED(4), /* Was mmio_base.  */
>          VMSTATE_UINT32(rxbuf_size, E1000State),
>          VMSTATE_UINT32(rxbuf_min_shift, E1000State),
> +        VMSTATE_UINT32(check_rxov, E1000State),

This breaks old -> new migration.  Please see docs/migration.txt on
VMSTATE and versions.  It might also be useful to use git-blame(1) on
some existing devices to see how people have modified the VMSTATE
without breaking migration (this is something I don't know much about).

Stefan
Kevin Wolf - Oct. 16, 2012, 9:43 a.m.
Am 16.10.2012 10:32, schrieb Stefan Hajnoczi:
> On Mon, Oct 15, 2012 at 06:48:53PM +0200, Dmitry Fleytman wrote:
> 
> The commit message is very long but the commit description is empty.
> Please keep the message short and add the rest into the description.
> 
>> Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
>> ---
>>  hw/e1000.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/e1000.c b/hw/e1000.c
>> index 1e66ecf..efbe0c9 100644
>> --- a/hw/e1000.c
>> +++ b/hw/e1000.c
>> @@ -92,7 +92,7 @@ typedef struct E1000State_st {
>>  
>>      uint32_t rxbuf_size;
>>      uint32_t rxbuf_min_shift;
>> -    int check_rxov;
>> +    uint32_t check_rxov;
>>      uint32_t rx_init_done;
>>      struct e1000_tx {
>>          unsigned char header[256];
>> @@ -1120,6 +1120,7 @@ static const VMStateDescription vmstate_e1000 = {
>>          VMSTATE_UNUSED(4), /* Was mmio_base.  */
>>          VMSTATE_UINT32(rxbuf_size, E1000State),
>>          VMSTATE_UINT32(rxbuf_min_shift, E1000State),
>> +        VMSTATE_UINT32(check_rxov, E1000State),
> 
> This breaks old -> new migration.  Please see docs/migration.txt on
> VMSTATE and versions.  It might also be useful to use git-blame(1) on
> some existing devices to see how people have modified the VMSTATE
> without breaking migration (this is something I don't know much about).

I think you'll want to use subsections anyway because they also fix the
new -> old case as good as they can: If the common case works correctly,
you can use a subsection to send the new state only in the special case.

Kevin

Patch

diff --git a/hw/e1000.c b/hw/e1000.c
index 1e66ecf..efbe0c9 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -92,7 +92,7 @@  typedef struct E1000State_st {
 
     uint32_t rxbuf_size;
     uint32_t rxbuf_min_shift;
-    int check_rxov;
+    uint32_t check_rxov;
     uint32_t rx_init_done;
     struct e1000_tx {
         unsigned char header[256];
@@ -1120,6 +1120,7 @@  static const VMStateDescription vmstate_e1000 = {
         VMSTATE_UNUSED(4), /* Was mmio_base.  */
         VMSTATE_UINT32(rxbuf_size, E1000State),
         VMSTATE_UINT32(rxbuf_min_shift, E1000State),
+        VMSTATE_UINT32(check_rxov, E1000State),
         VMSTATE_UINT32(rx_init_done, E1000State),
         VMSTATE_UINT32(eecd_state.val_in, E1000State),
         VMSTATE_UINT16(eecd_state.bitnum_in, E1000State),