From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBPPU-0006aA-IM for qemu-devel@nongnu.org; Mon, 19 Aug 2013 09:22:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBPPC-0004Y5-2u for qemu-devel@nongnu.org; Mon, 19 Aug 2013 09:22:16 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:60015) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBPPB-0004Xu-RT for qemu-devel@nongnu.org; Mon, 19 Aug 2013 09:21:57 -0400 Received: by mail-wi0-f170.google.com with SMTP id hi8so3755396wib.3 for ; Mon, 19 Aug 2013 06:21:57 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <52121BCA.6090804@redhat.com> Date: Mon, 19 Aug 2013 15:21:14 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <5209E6A1.6060308@siemens.com> <520A467E.6000406@redhat.com> <520A4897.3090407@siemens.com> In-Reply-To: <520A4897.3090407@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Using aio_poll for timer carrier threads List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , qemu-devel , liu ping fan , Alex Bligh , MORITA Kazutaka , Richard Henderson Il 13/08/2013 16:54, Jan Kiszka ha scritto: >> > Using an AioContext lock for timers is somewhat complicated for lock >> > ordering, because context A could try to modify a timer from context B, >> > at the same time when context B is modifying a timer from context A. >> > This would cause a deadlock. > That's like MMIO access on device A triggers MMIO access on B and vice > versa - why should we need this, so why should we support this? I think > the typical case is that timers (and their lists) and data structures > they access have a fairly close relation, thus can reuse the same lock. Yes, that's true. Still it would have to be documented, and using too-coarse locks risks having many BQLs, which multiplies the complexity (fine-grained locking at least keeps critical sections small and limits the amount of nested locking). I like Stefan's patches to make the timer list thread-safe, especially if we can optimize it (with RCU?) to make the read side lockless. Paolo