From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46914 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrSuT-0000y4-U3 for qemu-devel@nongnu.org; Mon, 21 Feb 2011 05:22:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrSuS-00051o-G1 for qemu-devel@nongnu.org; Mon, 21 Feb 2011 05:22:29 -0500 Received: from david.siemens.de ([192.35.17.14]:30597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrSuS-00051S-3J for qemu-devel@nongnu.org; Mon, 21 Feb 2011 05:22:28 -0500 Message-ID: <4D623CE1.6020107@siemens.com> Date: Mon, 21 Feb 2011 11:22:25 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1298277820-8817-1-git-send-email-pbonzini@redhat.com> <1298277820-8817-8-git-send-email-pbonzini@redhat.com> <4D623556.7050204@siemens.com> <4D623B4B.8020306@redhat.com> In-Reply-To: <4D623B4B.8020306@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 07/21] add assertions on the owner of a QemuMutex List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: "qemu-devel@nongnu.org" On 2011-02-21 11:15, Paolo Bonzini wrote: > On 02/21/2011 10:50 AM, Jan Kiszka wrote: >>>> + /* An EDEADLOCK would arrive after we reset the owner. So this >>>> + assert is for ease of debugging (it lets you see what is the >>>> + actual owner. */ >> >> Don't get this. Why do you want to avoid the proper error detection of >> pthread? > > Because by the time you get to error_exit mutex->owner has been NULL-ed > out already. So it doesn't help to put a breakpoint on error_exit, you > cannot find out which thread was the owner. That's easy, "p " will tell (the structure contains the owner's tid). And for debugging invalid mutex_unlock calls, it's more interesting to track the call path of that thread which incorrectly claimed to hold the lock. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux