linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hammer thread fixes
@ 2003-03-15 21:03 Ulrich Drepper
  2003-03-15 21:24 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Drepper @ 2003-03-15 21:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel, Andi Kleen


[-- Attachment #1.1: Type: text/plain, Size: 531 bytes --]

The appended two fixes are necessary to get NPTL threads running on
hammer.  The changes should be obvious.  The exit_group syscall isn't
present at all so far and the r10 -> r8 register use is necessary
because syscall parameter #4 (in r10) is already used for the child_tid
parameter.

Linus, please apply.


-- 
--------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------

[-- Attachment #1.2: d-hammer-kernel --]
[-- Type: text/plain, Size: 923 bytes --]

--- ./arch/x86_64/kernel/process.c.ud	2003-03-10 19:00:56.000000000 -0800
+++ ./arch/x86_64/kernel/process.c	2003-03-15 12:52:17.000000000 -0800
@@ -314,7 +314,7 @@
 			err = ia32_child_tls(p, childregs); 
 		else 			
 #endif	 
-			err = do_arch_prctl(p, ARCH_SET_FS, childregs->r10); 
+			err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); 
 		if (err) 
 			goto out;
 	}
--- ./include/asm-x86_64/unistd.h.ud	2003-03-10 19:00:56.000000000 -0800
+++ ./include/asm-x86_64/unistd.h	2003-03-15 12:59:09.000000000 -0800
@@ -520,8 +520,10 @@
 __SYSCALL(__NR_clock_getres, sys_clock_getres)
 #define __NR_clock_nanosleep	230
 __SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
+#define __NR_exit_group		231
+__SYSCALL(__NR_exit_group, sys_exit_group)
 
-#define __NR_syscall_max __NR_clock_nanosleep
+#define __NR_syscall_max __NR_exit_group
 #ifndef __NO_STUBS
 
 /* user-visible error numbers are in the range -1 - -4095 */

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Hammer thread fixes
  2003-03-15 21:03 Hammer thread fixes Ulrich Drepper
@ 2003-03-15 21:24 ` Andi Kleen
  2003-03-15 22:25   ` Ulrich Drepper
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2003-03-15 21:24 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Linus Torvalds, Linux Kernel, Andi Kleen

On Sat, Mar 15, 2003 at 01:03:16PM -0800, Ulrich Drepper wrote:
> The appended two fixes are necessary to get NPTL threads running on
> hammer.  The changes should be obvious.  The exit_group syscall isn't
> present at all so far and the r10 -> r8 register use is necessary
> because syscall parameter #4 (in r10) is already used for the child_tid
> parameter.

It's incorrect like I told you last time. arg 4 is in r10. Linus please don't
apply.

The clone prototype is 

	int clone(int flags, unsigned long newsp, void *parent_tid, void *child_tid) ;

	rax: __NR_clone
	rdi: flags
	rsi: newsp 
	rdx: parent_tid
	r10: child_tid

See appendix A of the x86-64 ABI for details.	 The kernel ABI 
is different from the user space ABI because of the SYSCALL clobbers.

For exit_group please wait for my next merge.

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Hammer thread fixes
  2003-03-15 21:24 ` Andi Kleen
@ 2003-03-15 22:25   ` Ulrich Drepper
  0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Drepper @ 2003-03-15 22:25 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Linus Torvalds, Linux Kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andi Kleen wrote:

> It's incorrect like I told you last time. arg 4 is in r10. Linus please don't
> apply.

Of course is arg 4 in r10.



> The clone prototype is 
> 
> 	int clone(int flags, unsigned long newsp, void *parent_tid, void *child_tid) ;

That's the prototype in process.c.  From the user level it is

int clone(int flags, unsigned long newsp, void *parent_tid, void
*child_tid, void *tlsaddr)


> 
> 	rax: __NR_clone
> 	rdi: flags
> 	rsi: newsp 
> 	rdx: parent_tid
> 	r10: child_tid

You don't get it.  The parameter which is passed on is the TLS address
which does not appear in the parameter list but is passed in the *fifth*
parameter.  TLS address != child_tid!  The patch is correct and
regardless of what ak said, please apply it.  Unlike ak's claims it is
actually tested.  I'm running such a kernel and threads actually work
(unlike with the original kernel).

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+c6g82ijCOnn/RHQRApE+AJ9Aus8jJBg81L2A12ghG89HmfPz1wCgyldz
NUazXDCnqkvJ3qWAGkNbY9U=
=u/Oe
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-15 22:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-15 21:03 Hammer thread fixes Ulrich Drepper
2003-03-15 21:24 ` Andi Kleen
2003-03-15 22:25   ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).