All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: Alex LIU <alex.liu@st.com>
Cc: 'UML-dev' <user-mode-linux-devel@lists.sourceforge.net>
Subject: Re: [uml-devel] Question about the kernel thread in UML TT mode
Date: Wed, 18 May 2005 09:31:28 -0400	[thread overview]
Message-ID: <20050518133128.GA3925@ccure.user-mode-linux.org> (raw)
In-Reply-To: <000e01c55b91$039466d0$9eb3c68a@SHZ.ST.COM>

On Wed, May 18, 2005 at 06:04:31PM +0800, Alex LIU wrote:
> But P and Q are different threads and they will be scheduled
> differently,right?

No, they're two different ways of looking at the same thread.  They're 
scheduled somewhat differently, but that's just reflecting the two ways
of looking at it.  If it's runnable on the host, it's runnable inside UML,
but not the other way around.

> Another question:
> when a kernel thread is created in UML, in the function outer_tramp the temp
> thread A will clone the corresponding host thread B and then wait for it to
> stop. The code is following:
> 
> 	t->pid = clone(t->tramp, (void *) t->temp_stack + page_size()/2,
> 		       t->flags, t->tramp_data);
> 	if(t->pid > 0) wait_for_stop(t->pid, SIGSTOP, PTRACE_CONT, NULL);
> 
> And once the host thread B is created it will run new_thread_proc,in the
> function the thread send the signal SIGUSR1 to itself:
> 
> 	os_usr1_process(os_getpid());
> 	change_sig(SIGUSR1, 1);
> 	return(0);
> 
> But I found the thread B will be blocked in the function change_sig(SIGUSR1,
> 1). Why?

It's not blocked there.  That makes it enter the SIGUSR1 handler, which puts
it on its kernel stack.

> And in the function outer_tramp, the thread A see the thread B was stopped
> with a SIGSTOP signal. Why? Since the thread B is blocked by the signal
> SIGUSR1...

The handler calls suspend_new_thread, which stops itself.

				Jeff


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

  parent reply	other threads:[~2005-05-18 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-17  9:38 [uml-devel] Question about the kernel thread in UML TT mode Alex LIU
2005-05-17 15:53 ` Jeff Dike
     [not found]   ` <000e01c55b91$039466d0$9eb3c68a@SHZ.ST.COM>
2005-05-18 13:31     ` Jeff Dike [this message]
     [not found] <000c01c55c59$37dd1e50$9eb3c68a@SHZ.ST.COM>
2005-05-19 13:31 ` Blaisorblade
2005-05-19 14:56   ` Jeff Dike

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=20050518133128.GA3925@ccure.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=alex.liu@st.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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.