This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BZ #10686] Reserve new TLS field for x86 and x86_64


Ian Taylor asked in BZ #10686 for a private TLS field:

"In http://gcc.gnu.org/wiki/SplitStacks I describe an enhancement to gcc to support discontiguous stacks. This is useful for permitting a large number of threads to flexibly share stack space. It is possible to have many more threads executing when they do not all have to simultaneously have the maximum required stack space. This is naturally most useful when using a 32-bit address space.
I'm working on adding this to gcc.

I think the best approach to make this efficient on x86 and x86_64 will be to store the current stack limit, less some appropriate offset, in the TCB header. Therefore, I would like to request a new field in the TCB header, at a fixed offset, for x86 and x86_64. The field should have type void * or uintptr_t."

On advise of Richard Henderson he's using the last field of the tm fields.

Here's a patch to document this.

Ok to commit?

Andreas

2013-05-14  Andreas Jaeger  <aj@suse.de>

	[BZ #10686]
	* sysdeps/x86_64/tls.h (struct tcbhead_t): Add __private_ss field.
	* sysdeps/i386/tls.h (struct tcbhead_t): Likewise.

diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index 1405f60..3d18b1d 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -59,7 +59,9 @@ typedef struct
   int __unused1;
 #endif
   /* Reservation of some values for the TM ABI.  */
-  void *__private_tm[5];
+  void *__private_tm[4];
+  /* GCC split stack support.  */
+  void *__private_ss;
 } tcbhead_t;

 # define TLS_MULTIPLE_THREADS_IN_TCB 1
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index 3d67dbc..61df1af 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -69,7 +69,9 @@ typedef struct
 # endif
   int rtld_must_xmm_save;
   /* Reservation of some values for the TM ABI.  */
-  void *__private_tm[5];
+  void *__private_tm[4];
+  /* GCC split stack support.  */
+  void *__private_ss;
   long int __unused2;
   /* Have space for the post-AVX register size.  */
   __128bits rtld_savespace_sse[8][4] __attribute__ ((aligned (32)));

--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]