From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAdJs-0007Wb-6m for qemu-devel@nongnu.org; Thu, 02 Jul 2015 08:10:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAdJm-0005nm-Ii for qemu-devel@nongnu.org; Thu, 02 Jul 2015 08:10:20 -0400 Received: from mail-la0-x231.google.com ([2a00:1450:4010:c03::231]:36429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAdJm-0005mm-9j for qemu-devel@nongnu.org; Thu, 02 Jul 2015 08:10:14 -0400 Received: by lagc2 with SMTP id c2so59721021lag.3 for ; Thu, 02 Jul 2015 05:10:13 -0700 (PDT) Message-ID: <55952A1D.2030806@gmail.com> Date: Thu, 02 Jul 2015 15:10:05 +0300 From: Dmitry Osipenko MIME-Version: 1.0 References: <1435785330-7384-1-git-send-email-digetx@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] arm_mptimer: Fix timer shutdown List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Peter Crosthwaite , QEMU Developers Hello Peter, thanks a lot for comment. 02.07.2015 12:27, Peter Maydell пишет: > Thanks; this does look like a bug. This change will mean we > call timer_del() even if the timer was already disabled, > though, so I think it would be slightly better to rearrange > the existing logic something like this: > > if ((old & 1) != (value & 1)) { > if (value & 1) { > if (tb->count == 0 && (tb->control & 2)) { > tb->count = tb->load; > } > timerblock_reload(tb, 1); > } else { > timer_del(tb->timer); > } > } > > thanks > -- PMM > Calling timer_del() twice is safe, but I agree that it would be better to avoid it. I'll send V2. -- Dmitry