On Di, 2014-04-22 at 08:16 +0000, Gonglei (Arei) wrote: > > > > > diff --git a/hw/input/ps2.c b/hw/input/ps2.c > > > index 3412079..a754fef 100644 > > > --- a/hw/input/ps2.c > > > +++ b/hw/input/ps2.c > > > @@ -71,7 +71,7 @@ > > > #define MOUSE_STATUS_ENABLED 0x20 > > > #define MOUSE_STATUS_SCALE21 0x10 > > > > > > -#define PS2_QUEUE_SIZE 256 > > > +#define PS2_QUEUE_SIZE 16 /* Keyboard output buffer size */ > > > > > > typedef struct { > > > uint8_t data[PS2_QUEUE_SIZE]; > > > > This changes ps2 vmstate and breaks live migration. > > > Good catch, Gerd. > I got the information in the destination of live migration: > Unknown savevm section type 24 > load of migration failed > > I'm not familiar with the situation of cross-version live migration, could > you give me > some guide ? Thanks.
Keep the data array 256 bytes long, best with a comment that compatibility with older qemu versions requires this. Also the post_load function must handle the case that rptr, wptr & count variables have values which used to be valid for the older qemu versions but are not valid any more with the smaller queue. In the (unlikely) case that count is larger than 16 the best you can do is probably simply throw away the queue. 16 and less queue elements you can move to the start of the data array (so they are within the 16 bytes still used after your patch is merged) and adjust rptr+wptr accordingly. Cc'ing Juan for additional insights. HTH, Gerd