From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upb2T-0000Jw-TW for qemu-devel@nongnu.org; Thu, 20 Jun 2013 05:20:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Upb2R-0007Yt-9R for qemu-devel@nongnu.org; Thu, 20 Jun 2013 05:20:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upb2R-0007Yp-1q for qemu-devel@nongnu.org; Thu, 20 Jun 2013 05:20:19 -0400 Message-ID: <51C2C905.1060207@redhat.com> Date: Thu, 20 Jun 2013 11:19:01 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1371675569-6516-1-git-send-email-pingfank@linux.vnet.ibm.com> <1371675569-6516-3-git-send-email-pingfank@linux.vnet.ibm.com> <20130620073924.GA14255@stefanha-thinkpad.redhat.com> <51C2BA6B.2050706@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/2] QEMUBH: make AioContext's bh re-entrant List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Kevin Wolf , Anthony Liguori , Liu Ping Fan , qemu-devel@nongnu.org, Stefan Hajnoczi Il 20/06/2013 11:12, liu ping fan ha scritto: >> Right. You need to order ->idle writes before ->scheduled writes, and >> add memory barriers, or alternatively use two bits in ->scheduled so >> that you can assign both atomically. >> > I think just shift the position of smp_rmb/wmb in _schedule and _poll, > we can acheive this (callbacks will not refer to ->idle) Yes, but you also need to swap ->idle and ->scheduled assignments (aio_bh_poll reads scheduled before idle; qemu_bh_schedule* must write idle before scheduled). Paolo