From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF1Nl-0003lk-35 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 08:31:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF1Nc-0002BL-M5 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 08:31:25 -0400 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:54071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF1Nc-0002Au-GT for qemu-devel@nongnu.org; Thu, 29 Aug 2013 08:31:16 -0400 Received: by mail-ea0-f169.google.com with SMTP id k11so205185eaj.28 for ; Thu, 29 Aug 2013 05:31:15 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 29 Aug 2013 14:30:58 +0200 Message-Id: <1377779462-24383-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [RFC PATCH 0/3] Timer thread-safety improvements List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemulist@gmail.com, stefanha@redhat.com These four patches go on top of Stefan's patch introducing a lock for a timerlist's active timers. Patches 1 and 2 fix bugs and probably should simply be squashed into his patch. Patch 3 is an optimization and code simplification. It could even go in _before_ introducing the lock, at Stefan's discretion. Patch 4 (incomplete and not even compiled) is an optimization that avoids taking the lock if timerlist_run_timers does not have any timer ready to fire. I'm posting it just to share the idea and will resend it with more documentation later, once the RCU infrastructure is in. Paolo Bonzini (4): qemu-timer: do del+mod atomically qemu-timer: fix race conditions on freeing the timer qemu-timer: do not take the lock in timer_pending qemu-timer: use RCU to preserve the timers during lockless lookup qemu-timer.c | 96 +++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 34 deletions(-) -- 1.8.3.1