From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnCOs-0006fQ-SF for qemu-devel@nongnu.org; Thu, 13 Jun 2013 14:37:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnCOp-0002wc-1s for qemu-devel@nongnu.org; Thu, 13 Jun 2013 14:37:34 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:46680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnCOo-0002wU-SG for qemu-devel@nongnu.org; Thu, 13 Jun 2013 14:37:30 -0400 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jun 2013 12:37:29 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id A84B11FF002D for ; Thu, 13 Jun 2013 12:23:16 -0600 (MDT) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5DISHEP029376 for ; Thu, 13 Jun 2013 12:28:18 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5DISHIt012765 for ; Thu, 13 Jun 2013 12:28:17 -0600 From: Anthony Liguori In-Reply-To: <51B9DB71.3020206@redhat.com> References: <1369239012-8180-1-git-send-email-akong@redhat.com> <1369239012-8180-2-git-send-email-akong@redhat.com> <87mwrcct1t.fsf@codemonkey.ws> <20130531123117.GA8400@t430s.nay.redhat.com> <51B99CB1.6020006@suse.de> <51B9BC69.80601@redhat.com> <87wqpyp3ka.fsf@codemonkey.ws> <51B9DB71.3020206@redhat.com> Date: Thu, 13 Jun 2013 13:28:14 -0500 Message-ID: <87hah127cx.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/2] ps2: add support of auto-repeat List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: peter.maydell@linaro.org, lilei@linux.vnet.ibm.com, qemu-devel@nongnu.org, kraxel@redhat.com, Amos Kong , lersek@redhat.com, Andreas =?utf-8?Q?F=C3=A4rber?= Paolo Bonzini writes: > Il 13/06/2013 09:01, Anthony Liguori ha scritto: >> Paolo Bonzini writes: >>=20 >>> Il 13/06/2013 06:19, Andreas F=C3=A4rber ha scritto: >>>> Am 31.05.2013 14:31, schrieb Amos Kong: >>>>> diff --git a/hw/input/ps2.c b/hw/input/ps2.c >>>>> index cdb18e6..fdb9912 100644 >>>>> --- a/hw/input/ps2.c >>>>> +++ b/hw/input/ps2.c >>>>> @@ -615,7 +615,17 @@ static bool ps2_keyboard_repeatstate_needed(void >>>>> *opaque) >>>>> { >>>>> PS2KbdState *s =3D opaque; >>>>>=20=20 >>>>> - return s->repeat_period || s->repeat_delay; >>>>> + return s->repeat_period || s->repeat_delay || s->repeat_key || >>>>> s->repeat_timer; >>>>> +} >>>>> + >>>>> +static int ps2_kbd_repeatstate_load(QEMUFile *f, void *opaque, int >>>>> version_id) >>>>> +{ >>>>> + PS2KbdState *s =3D opaque; >>>>> + qemu_get_timer(f, s->repeat_timer); >>>>> + qemu_mod_timer(s->repeat_timer, qemu_get_clock_ns(vm_clock) + >>>>> + muldiv64(get_ticks_per_sec(), s->repeat_period, >>>>> 1000)); >>>>> + >>>>> + return 0; >>>>> } >>>>>=20=20 >>>>> static bool ps2_keyboard_ledstate_needed(void *opaque) >>>>> @@ -638,9 +648,12 @@ static const VMStateDescription >>>>> vmstate_ps2_keyboard_repeatstate =3D { >>>>> .version_id =3D 3, >>>>> .minimum_version_id =3D 2, >>>>> .minimum_version_id_old =3D 2, >>>>> + .load_state_old =3D ps2_kbd_repeatstate_load, >>>>> .fields =3D (VMStateField[]) { >>>>> VMSTATE_INT32(repeat_period, PS2KbdState), >>>>> VMSTATE_INT32(repeat_delay, PS2KbdState), >>>>> + VMSTATE_INT32(repeat_key, PS2KbdState), >>>>> + VMSTATE_TIMER(repeat_timer, PS2KbdState), >>>> >>>> You can't just add fields here, they'd need to be specific to a new >>>> version 4. Requested was to make it a subsection instead. >>> >>> This is already a subsection, and this patch is just a proposal to be >>> squashed in this series (which adds the subsection). But I think Amos >>> is right and only the period/delay need to be migrated. Otherwise, >>> you'll get an endless stream of repeats on the destination. >>=20 >> Not with seamless migration and spice. > > Which BTW is broken right now in Fedora, though I didn't investigate > who's the culprit. :) > >> Even with a non-seamless VNC reconnect, if it happens behind the scenes >> the release would still be sent. > > Where is the code for that? Are SDL/GTK/whatnot covered as well? What I mean by non-seamless migration is a management tool transparently reconnecting after live migration. I assume virt-manager does this but we certainly have management products that do this. The (remote) user see a blib in the session but if they had a key held down, then the release will certainly still be sent to the other end. Even with GTK/SDL, if a key was depressed it will continue to be depressed which will cause odd behavior with accelerators. At least with key repeat happening it's more obvious to the user that a key is stuck. Regards, Anthony Liguori > > Paolo