From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejIH7-0000Eq-2n for qemu-devel@nongnu.org; Wed, 07 Feb 2018 00:28:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejIH6-0004eJ-Ch for qemu-devel@nongnu.org; Wed, 07 Feb 2018 00:28:05 -0500 Date: Wed, 7 Feb 2018 13:27:46 +0800 From: Fam Zheng Message-ID: <20180207052746.GA12693@lemon.usersys.redhat.com> References: <20180203153935.8056-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180203153935.8056-1-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com, qemu-block@nongnu.org On Sat, 02/03 10:39, Paolo Bonzini wrote: > There are cases in which a queued coroutine must be restarted from > non-coroutine context (with qemu_co_enter_next). In this cases, > qemu_co_enter_next also needs to be thread-safe, but it cannot use a > CoMutex and so cannot qemu_co_queue_wait. This happens in curl (which > right now is rolling its own list of Coroutines) and will happen in > Fam's NVMe driver as well. > > This series extracts the idea of a polymorphic lockable object > from my "scoped lock guard" proposal, and applies it to CoQueue. > The implementation of QemuLockable is similar to C11 _Generic, but > redone using the preprocessor and GCC builtins for compatibility. > > In general, while a bit on the esoteric side, the functionality used > to emulate _Generic is fairly old in GCC, and the builtins are already > used by include/qemu/atomic.h; the series was tested with Fedora 27 (boot > Damn Small Linux via http) and CentOS 6 (compiled only). > > Paolo > > v4->v5: fix checkpatch complaints Queued, thanks. Fam