* [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2)
@ 2006-03-26 18:03 Blaisorblade
2006-03-26 20:38 ` Jeff Dike
2006-03-26 20:40 ` Jeff Dike
0 siblings, 2 replies; 4+ messages in thread
From: Blaisorblade @ 2006-03-26 18:03 UTC (permalink / raw)
To: user-mode-linux-devel
---------- Forwarded Message ----------
Subject: Re: Why uml-add-tls-support-debug-check-never-works is needed (was:
Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2)
Date: Sunday 26 March 2006 19:43
From: Blaisorblade <blaisorblade@yahoo.it>
To: Jeff Dike <jdike@addtoit.com>
Cc: user-mode-linux-devel@projects.sourceforge.net
On Saturday 25 March 2006 02:17, Jeff Dike wrote:
> On Sat, Mar 25, 2006 at 12:28:09AM +0100, Blaisorblade wrote:
> > BUT, this context switch at the thread born is special: the thread being
> > switched away switches to a new thread not in the body of the new
> > thread's call to switch_to_skas->switch_threads(), but in the body of
> > thread_wait()! At that point, we lose the call to arch_switch_to_skas()!
>
> Yuck yuck yuck. Nice spotting.
>
> There's an obvious one-line fix for this, but I wonder if we ought to
> try some restructuring to avoid this sort of thing in the future.
Code which two people aren't able to understand until two years later _wants_
at least some comments and if possible restructuring. The problem is how, and
I'm not looking at the code right now. Off the top of my head, I get only
silly ideas, since we can't join the end of switch_to_skas() and
fork_handler().
> > Questions and notes:
> >
> > *) Why does arch/um/os-Linux/skas/process.c has still one siglongjmp()
> > call and sigjmp_buf vars, and that has no comments?
>
> I'm tempted to say that I just missed the call somehow. I see no
> reason for that to be different, especially since it's preceded by a
> UML_SIGSETJMP. As for the sigjmp_buf variables, I don't get your
> point. Those haven't changed.
I didn't study softints, but setjmp() is supposed to use jmp_buf's, not
sigjmp_buf's (I know they are (almost) equal in the glibc headers I've seen,
but that equality is not guaranteed).
The fact that the code compiles without warnings can be seen as a bug in
glibc headers.
> > *) Also, why thread_wait and thread_switch are almost identical, yet
> > they're two different functions?
>
> switch_threads? In order to merge them, you'd have to pass in the 1
> and the INIT_JMP_REMOVE_SIGSTACK, which I have conceptual problems
> with. First, that makes the callers know things that they probably
> shouldn't.
If you don't pass 1 and INIT_JMP_REMOVE_SIGSTACK but two further defines like
"JUMP_TO_INITIAL_THREAD" and "JUMP_BACK" (or actually meaningful names) the
caller won't know more than it knows now. Or you can keep the callers intact
- just by making switch_threads() and thread_wait() two inline wrappers.
> Second, the 1 and the INIT_JMP_REMOVE_SIGSTACK have
> completely different meanings. One is a message to the initial thread
> that it has to do something. The 1 is a message to setjmp that is has
> been longjmp-ed to.
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
-------------------------------------------------------
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2)
2006-03-26 18:03 [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2) Blaisorblade
@ 2006-03-26 20:38 ` Jeff Dike
2006-03-26 20:40 ` Jeff Dike
1 sibling, 0 replies; 4+ messages in thread
From: Jeff Dike @ 2006-03-26 20:38 UTC (permalink / raw)
To: Blaisorblade; +Cc: user-mode-linux-devel
On Sun, Mar 26, 2006 at 08:03:57PM +0200, Blaisorblade wrote:
> Code which two people aren't able to understand until two years later _wants_
> at least some comments and if possible restructuring.
I'd say this is more of an oversight than obscure code that the author
doesn't even understand.
> The problem is how, and
> I'm not looking at the code right now. Off the top of my head, I get only
> silly ideas, since we can't join the end of switch_to_skas() and
> fork_handler().
Yeah, I only got silly ideas too. Probably the same ones :-)
> I didn't study softints, but setjmp() is supposed to use jmp_buf's, not
> sigjmp_buf's (I know they are (almost) equal in the glibc headers I've seen,
> but that equality is not guaranteed).
Yes, good point. You didn't have to even look at libc headers - just
pointing at the man page is enough.
> If you don't pass 1 and INIT_JMP_REMOVE_SIGSTACK but two further defines like
> "JUMP_TO_INITIAL_THREAD" and "JUMP_BACK" (or actually meaningful names) the
> caller won't know more than it knows now. Or you can keep the callers intact
> - just by making switch_threads() and thread_wait() two inline
> wrappers.
Yup, that would work, though it probably wouldn't shrink the source -
the merged code will be less than the new function boilerplate and the
calls to it.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2)
2006-03-26 18:03 [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2) Blaisorblade
2006-03-26 20:38 ` Jeff Dike
@ 2006-03-26 20:40 ` Jeff Dike
2006-03-27 22:56 ` [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed Blaisorblade
1 sibling, 1 reply; 4+ messages in thread
From: Jeff Dike @ 2006-03-26 20:40 UTC (permalink / raw)
To: Blaisorblade; +Cc: user-mode-linux-devel
And, BTW, you should probably send the TLS stuff in this week if you
want it to go into 2.6.17 easily.
Jeff
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed
2006-03-26 20:40 ` Jeff Dike
@ 2006-03-27 22:56 ` Blaisorblade
0 siblings, 0 replies; 4+ messages in thread
From: Blaisorblade @ 2006-03-27 22:56 UTC (permalink / raw)
To: Jeff Dike; +Cc: user-mode-linux-devel
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
On Sunday 26 March 2006 22:40, Jeff Dike wrote:
> And, BTW, you should probably send the TLS stuff in this week if you
> want it to go into 2.6.17 easily.
Ok, I've just finished everything (including proper detection of ) and feel
satisfied of the code. However, look at the attached patch - it's a cosmetic
bug which I found while testing TLS, and I'd like you to review it.
Meanwhile, I'm releasing 2.6.16-bb1 with the TLS stuff and this patch
included, plus various other little stuff.
I hope this week I can send TLS in mainline, however we should be able to get
it even if it's a few days past the deadline.
My current problem is that out of a whole week, I can only hack on Wednesday
afternoon, or on the weekend (read sunday afternoon) if I can do that, or
after dinner. I'd have a lot of time on early morning, but you can understand
it goes easily wasted because I must sleep.
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
[-- Attachment #2: uml-fix-mm-usage-in-cpu_idle --]
[-- Type: text/x-diff, Size: 1020 bytes --]
uml idle thread needn't take access to init_mm
From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Comparing this code which is the actual body of the arch-independent cpu_idle(),
it is clear that it's unnecessary to set ->mm and ->active_mm; beyond that, a
kernel thread is not supposed to have ->mm != NULL, only active_mm.
This showed up because I used the assumption (which is IMHO valid) that kernel
thread have their ->mm == NULL, and it failed for this thread.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Index: linux-2.6.16/arch/um/kernel/process_kern.c
===================================================================
--- linux-2.6.16.orig/arch/um/kernel/process_kern.c
+++ linux-2.6.16/arch/um/kernel/process_kern.c
@@ -201,10 +201,6 @@ void default_idle(void)
{
CHOOSE_MODE(uml_idle_timer(), (void) 0);
- atomic_inc(&init_mm.mm_count);
- current->mm = &init_mm;
- current->active_mm = &init_mm;
-
while(1){
/* endless idle loop with no priority at all */
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-27 22:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-26 18:03 [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed (was: Re: Fwd: Proposed additions to the ptrace(2) manpage, take 2) Blaisorblade
2006-03-26 20:38 ` Jeff Dike
2006-03-26 20:40 ` Jeff Dike
2006-03-27 22:56 ` [uml-devel] Fwd: Re: Why uml-add-tls-support-debug-check-never-works is needed Blaisorblade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox