All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gary Thomas <gary@mlbassoc.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] linux-user NPTL problem with signals
Date: Thu, 24 Sep 2009 08:52:25 -0600	[thread overview]
Message-ID: <4ABB87A9.9060706@mlbassoc.com> (raw)
In-Reply-To: <4ABA9868.8070707@mlbassoc.com>

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
------------------------------------------------------------

  reply	other threads:[~2009-09-24 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 21:51 [Qemu-devel] linux-user NPTL problem with signals Gary Thomas
2009-09-24 14:52 ` Gary Thomas [this message]
2009-09-27 14:13   ` Jamie Lokier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ABB87A9.9060706@mlbassoc.com \
    --to=gary@mlbassoc.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.