From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtx6f-0002rC-4z for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:19:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xtx6Z-0004Oe-0O for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:19:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtx6Y-0004Nd-Or for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:19:22 -0500 Message-ID: <1417087153.3722.31.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Thu, 27 Nov 2014 12:19:13 +0100 In-Reply-To: <54770809.1000507@huawei.com> References: <1417079052-9372-1-git-send-email-kraxel@redhat.com> <5476EE1B.4090302@huawei.com> <1417086243.3722.26.camel@nilsson.home.kraxel.org> <54770809.1000507@huawei.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RfC PATCH] hid: handle full ptr queues in post_load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gonglei Cc: "qemu-devel@nongnu.org" , "Dr. David Alan Gilbert" On Do, 2014-11-27 at 19:16 +0800, Gonglei wrote: > On 2014/11/27 19:04, Gerd Hoffmann wrote: > > > Hi, > > > >>> + evt = s->ptr.queue[(s->head+s->n) & QUEUE_MASK]; > >> > >> s->n is QUEUE_LENGTH, can we directly delete it? > >> evt = s->ptr.queue[s->head & QUEUE_MASK] > > > > I prefer to make clear in the code that we want the last ring element > > not the first and leave in the "+n", even if we could take it out. > > > OK. > > Another question, whether or not we handle this scenario > before calling hid_set_next_idle(s) ? Maybe it is safer, because > hid_idle_timer will call hid_pointer_event(), callback function > of hs->event(hs). Not needed, the timer will not called before vmload is completely finished. cheers, Gerd