From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqpgO-0005Bl-2T for qemu-devel@nongnu.org; Thu, 24 Sep 2009 10:52:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqpgM-0005BU-Dz for qemu-devel@nongnu.org; Thu, 24 Sep 2009 10:52:31 -0400 Received: from [199.232.76.173] (port=38338 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqpgM-0005BR-6F for qemu-devel@nongnu.org; Thu, 24 Sep 2009 10:52:30 -0400 Received: from hermes.mlbassoc.com ([76.76.67.137]:40187 helo=mail.chez-thomas.org) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqpgL-0001iI-Q5 for qemu-devel@nongnu.org; Thu, 24 Sep 2009 10:52:29 -0400 Message-ID: <4ABB87A9.9060706@mlbassoc.com> Date: Thu, 24 Sep 2009 08:52:25 -0600 From: Gary Thomas MIME-Version: 1.0 Subject: Re: [Qemu-devel] linux-user NPTL problem with signals References: <4ABA9868.8070707@mlbassoc.com> In-Reply-To: <4ABA9868.8070707@mlbassoc.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 09/23/2009 03:51 PM, Gary Thomas wrote: > I'm running a multi-threaded program (linux-user on i386). I > have a problem with signals; when one arrives, the running > thread abruptly changes :-( > > Anyone have any ideas about this? > I've tracked this down to the fact that there should be a unique value for the GS segment register (at least) per thread. This doesn't seem to be the case and when a signal is dispatched, the GS segment register is updated with [probably] the most recent value created by a new thread, not the running thread. Hence, I see this: qemu: got signal 17, pthread: 0x62289840 queue_signal: sig=17, pthread: 0x62289840 qemu: process signal 17 setup_sigcontext.757 (pthread: 0x62289840) - GS: 0x33/0x43e6f110 do_sigreturn, pthread: 0x62289840 restore_sigcontext.973 (pthread: 0x62289840) - GS: 0x33/0x43e6f110 cpu_x86_load_seg_cache.727 - pthread: 0x62289840, GS: 0x33/0x454c3b70 restore_sigcontext.975 (pthread: 0x62289840) - GS: 0x33/0x454c3b70 The GS values printed are the 'selector' and 'base' respectively. The 'base' value happens to be the Linux pthread_self() [for the emulated process]. You can see that this is switching threads but the system has not really switched threads... Any help? -- ------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------