From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOqPt-0004do-5r for qemu-devel@nongnu.org; Fri, 20 Feb 2015 11:27:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOqPo-000641-71 for qemu-devel@nongnu.org; Fri, 20 Feb 2015 11:27:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOqPn-00063t-Vy for qemu-devel@nongnu.org; Fri, 20 Feb 2015 11:26:56 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1KGQtXG009117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 20 Feb 2015 11:26:55 -0500 From: Paolo Bonzini Date: Fri, 20 Feb 2015 17:26:49 +0100 Message-Id: <1424449612-18215-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH RFC 0/3] iothread: release iothread around aio_poll List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: famz@redhat.com, stefanha@redhat.com Right now, iothreads are relying on a "contention callback" to release the AioContext (e.g. for block device operations or to do bdrv_drain_all). This is necessary because aio_poll needs to be called within an aio_context_acquire. This series drops this requirement for aio_poll, with two effects: 1) it makes it possible to remove the "contention callback" in RFifoLock (and possibly to convert it to a normal GRecMutex, which is why I am not including a patch to remove callbacks from RFifoLock). 2) it makes it possible to start work around making critical sections for the block layer fine-grained. In order to do this, some data is moved from AioContext to local storage. Stack allocation has size limitations, so thread-local storage is used instead. There are no reentrancy problems because the data is only live throughout a small part of aio_poll, and in particular not during the invocation of callbacks. Comments? Paolo Paolo Bonzini (3): aio-posix: move pollfds to thread-local storage AioContext: acquire/release AioContext during aio_poll iothread: release iothread around aio_poll aio-posix.c | 86 ++++++++++++++++++++++++++++++++++++++++------------- aio-win32.c | 8 +++++ async.c | 10 +------ include/block/aio.h | 18 +++++------ iothread.c | 11 ++----- tests/test-aio.c | 21 +++++++------ 6 files changed, 96 insertions(+), 58 deletions(-) -- 2.3.0