> Gerd Hoffmann <kra...@redhat.com> wrote: > > On Mi, 2014-04-23 at 09:32 +0000, Gonglei (Arei) wrote: > >> > > >> > Hi, Gerd and Juan. > >> > > >> > Thanks for your guides about the confuse live migration about changing > the > >> > keyboard buffer size. > >> > According your suggestion, I got two solutions to address the issue: > >> > > >> > - Keep the data array 256 bytes long, change the > >> > rptr/wptr/count/data array at > >> > post_load(), both > >> > Ps/2 keyboard and mouse. This solution can be compatible with older > qemu > >> > versions, which can > >> > do live migration each other. > >> > > >> > -Change the data array to 16 bytes, still save as PS2_QUEUE_SIZE. Reset > the > >> > rptr/wptr/count at > >> > post_load(), both ps/2 keyboard and mouse. Add > VMSTATE_UNUSED(256-16) in > >> > struct vmstate_ps2_common. > >> > This solution just save the 16 bytes buffer and drop the rest, So we > >> > can't > >> > migrate vm to older qemu versions. > >> > But migration from old qemu to new qemu is ok. > >> > > >> Sorry, the second solution also support cross-version live migration > >> each other. > > > But you loose anything in the buffer when migrating from old -> new. > > Anything bigger than 16bytes, no? And that is the whole point that we > are talking about? Or the 16bytes that we are using can be at any place > on the buffer? If that is the case, I agree that the first option is > better for some versions. Sorry for my missunderstanding. > Actually, in my hundreds of times testing, about the queue buffer value, at the migration dest end the rptr always equal with wptr, the value range is [0, 256), and count value always is 0. So, in the old qemu versions, the 16 bytes data maybe at any place on the buffer. The queue just be realized to a lined container by data array, the rptr/wptr will fill it cyclically.
So, I want to post a normal patch about the first solution, can I? Thanks. Best regards, -Gonglei