|
|
c6d234 |
commit 93a6d0820430bfe3d09695a1376c07abf6d2214f
|
|
|
c6d234 |
Author: Roland McGrath <roland@hack.frob.com>
|
|
|
c6d234 |
Date: Fri Jun 20 19:50:16 2014 -0700
|
|
|
c6d234 |
|
|
|
c6d234 |
Clean up stack-coloring macros.
|
|
|
c6d234 |
|
|
|
c6d234 |
Conflicts:
|
|
|
c6d234 |
sysdeps/x86_64/nptl/Makefile
|
|
|
c6d234 |
|
|
|
c6d234 |
File change was applied to nptl/sysdeps/x86_64/Makefile instead.
|
|
|
c6d234 |
|
|
|
c6d234 |
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
|
|
|
c6d234 |
index 2c126fd4ae447b25..0fba6ce3474e8b35 100644
|
|
|
c6d234 |
--- a/nptl/allocatestack.c
|
|
|
c6d234 |
+++ b/nptl/allocatestack.c
|
|
|
c6d234 |
@@ -30,6 +30,7 @@
|
|
|
c6d234 |
#include <list.h>
|
|
|
c6d234 |
#include <lowlevellock.h>
|
|
|
c6d234 |
#include <kernel-features.h>
|
|
|
c6d234 |
+#include <stack-aliasing.h>
|
|
|
c6d234 |
|
|
|
c6d234 |
|
|
|
c6d234 |
#ifndef NEED_SEPARATE_REGISTER_STACK
|
|
|
c6d234 |
diff --git a/nptl/stack-aliasing.h b/nptl/stack-aliasing.h
|
|
|
c6d234 |
new file mode 100644
|
|
|
c6d234 |
index 0000000000000000..526b54e18f7e0a27
|
|
|
c6d234 |
--- /dev/null
|
|
|
c6d234 |
+++ b/nptl/stack-aliasing.h
|
|
|
c6d234 |
@@ -0,0 +1,29 @@
|
|
|
c6d234 |
+/* Define macros for stack address aliasing issues for NPTL. Stub version.
|
|
|
c6d234 |
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
|
|
c6d234 |
+ This file is part of the GNU C Library.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
c6d234 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
c6d234 |
+ License as published by the Free Software Foundation; either
|
|
|
c6d234 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
c6d234 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c6d234 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
c6d234 |
+ Lesser General Public License for more details.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
c6d234 |
+ License along with the GNU C Library; if not, see
|
|
|
c6d234 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+/* This is a number of bytes (less than a page) by which to "color" the
|
|
|
c6d234 |
+ starting stack address of new threads. This number is multiplied by the
|
|
|
c6d234 |
+ number of threads created so far and then truncated modulo page size,
|
|
|
c6d234 |
+ to get a roughly even distribution of values for different threads. */
|
|
|
c6d234 |
+#define COLORING_INCREMENT 0
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+/* This is a number of bytes that is an alignment that should be avoided
|
|
|
c6d234 |
+ when choosing the exact size of a new thread's stack. If the size
|
|
|
c6d234 |
+ chosen is aligned to this, an extra page will be added to render the
|
|
|
c6d234 |
+ size off-aligned. */
|
|
|
c6d234 |
+#define MULTI_PAGE_ALIASING 0
|
|
|
c6d234 |
diff --git a/nptl/sysdeps/x86_64/Makefile b/nptl/sysdeps/x86_64/Makefile
|
|
|
c6d234 |
index d34dea709b363d2a..e2c47764e6e38c36 100644
|
|
|
c6d234 |
--- a/nptl/sysdeps/x86_64/Makefile
|
|
|
c6d234 |
+++ b/nptl/sysdeps/x86_64/Makefile
|
|
|
c6d234 |
@@ -18,10 +18,3 @@
|
|
|
c6d234 |
ifeq ($(subdir),csu)
|
|
|
c6d234 |
gen-as-const-headers += tcb-offsets.sym
|
|
|
c6d234 |
endif
|
|
|
c6d234 |
-
|
|
|
c6d234 |
-ifeq ($(subdir),nptl)
|
|
|
c6d234 |
-# P4s have problems with 4M aliasing. We disturb the allocation of stacks
|
|
|
c6d234 |
-# just enough so the subsequent allocations do not use stack address
|
|
|
c6d234 |
-# (mod 4M) == 0.
|
|
|
c6d234 |
-CFLAGS-pthread_create.c += -DMULTI_PAGE_ALIASING=65536
|
|
|
c6d234 |
-endif
|
|
|
c6d234 |
diff --git a/sysdeps/i386/i686/stack-aliasing.h b/sysdeps/i386/i686/stack-aliasing.h
|
|
|
c6d234 |
new file mode 100644
|
|
|
c6d234 |
index 0000000000000000..1e35ceb2061d60f9
|
|
|
c6d234 |
--- /dev/null
|
|
|
c6d234 |
+++ b/sysdeps/i386/i686/stack-aliasing.h
|
|
|
c6d234 |
@@ -0,0 +1,28 @@
|
|
|
c6d234 |
+/* Define macros for stack address aliasing issues for NPTL. i686 version.
|
|
|
c6d234 |
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
|
|
c6d234 |
+ This file is part of the GNU C Library.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
c6d234 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
c6d234 |
+ License as published by the Free Software Foundation; either
|
|
|
c6d234 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
c6d234 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c6d234 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
c6d234 |
+ Lesser General Public License for more details.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
c6d234 |
+ License along with the GNU C Library; if not, see
|
|
|
c6d234 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+/* It turns out that stack coloring is in general not good on P4s. Some
|
|
|
c6d234 |
+ applications will benefit. We will probably have a configuration option
|
|
|
c6d234 |
+ at some point. To enable coloring, set this to 128. */
|
|
|
c6d234 |
+#define COLORING_INCREMENT 0
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+/* What is useful is to avoid the 64k aliasing problem which reliably
|
|
|
c6d234 |
+ happens if all stacks use sizes which are a multiple of 64k. Tell
|
|
|
c6d234 |
+ the stack allocator to disturb this by allocation one more page if
|
|
|
c6d234 |
+ necessary. */
|
|
|
c6d234 |
+#define MULTI_PAGE_ALIASING 65536
|
|
|
c6d234 |
diff --git a/sysdeps/x86_64/stack-aliasing.h b/sysdeps/x86_64/stack-aliasing.h
|
|
|
c6d234 |
new file mode 100644
|
|
|
c6d234 |
index 0000000000000000..2efdacb3b4c44c40
|
|
|
c6d234 |
--- /dev/null
|
|
|
c6d234 |
+++ b/sysdeps/x86_64/stack-aliasing.h
|
|
|
c6d234 |
@@ -0,0 +1 @@
|
|
|
c6d234 |
+#include <sysdeps/i386/i686/stack-aliasing.h>
|