From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIKqr-00072X-Br for qemu-devel@nongnu.org; Tue, 25 Feb 2014 11:27:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIKqi-0001dX-9a for qemu-devel@nongnu.org; Tue, 25 Feb 2014 11:27:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIKqi-0001dF-1y for qemu-devel@nongnu.org; Tue, 25 Feb 2014 11:27:16 -0500 Message-ID: <530CC45C.8010604@redhat.com> Date: Tue, 25 Feb 2014 17:27:08 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1392994280-9675-1-git-send-email-stefanha@redhat.com> <1392994280-9675-2-git-send-email-stefanha@redhat.com> <53076E46.3020109@redhat.com> <20140224155359.GH23185@stefanha-thinkpad.hitronhub.home> <530B77CD.9020502@redhat.com> <20140225161738.GD2374@stefanha-thinkpad.redhat.com> In-Reply-To: <20140225161738.GD2374@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] iothread: stash thread ID away List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Stefan Hajnoczi , "Shergill, Gurinder" , "Vinod, Chegu" , qemu-devel@nongnu.org, Luiz Capitulino Il 25/02/2014 17:17, Stefan Hajnoczi ha scritto: > For the default mutex type (PTHREAD_MUTEX_TIMED_NP) glibc looks safe to > me. The other mutex types are trickier and I haven't audited them. It also depends on the low-level lock implementation. I looked at the C one and it's not safe, the x86-optimized one is hard to follow. I think I was looking at a different race, namely cases where the locking thread uses a fast path, while the unlocking thread plays it safe and uses the slow path instead. Then the slow path can run "asynchronously" from the locking thread, and the locking thread has time to unlock and destroy the mutex. See the other message. Paolo