summaryrefslogtreecommitdiff
path: root/elf/dl-tunables.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2017-06-30 22:58:39 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2017-06-30 22:58:39 +0530
commit28cfa3a48e59f9c6b9bc25a003a4ede435841382 (patch)
treeec2c7a24f4fd2a0d8b4e2ead2dabc36b6b3c3cf9 /elf/dl-tunables.c
parentab85da15301c552e3ea4577a6432aa028bee9295 (diff)
tunables, aarch64: New tunable to override cpu
Add a new tunable (glibc.tune.cpu) to override CPU identification on aarch64. This is useful in two cases: one where it is desirable to pretend to be another CPU for purposes of testing or because routines written for that CPU are beneficial for specific workloads and second where the underlying kernel does not support emulation of MRS to get the MIDR of the CPU. * elf/dl-tunables.h (tunable_is_name): Move from... * elf/dl-tunables.c (is_name): ... here. (parse_tunables, __tunables_init): Adjust. * manual/tunables.texi: Document glibc.tune.cpu. * sysdeps/aarch64/dl-tunables.list: New file. * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (struct cpu_list): New type. (cpu_list): New list of CPU names and their MIDR. (get_midr_from_mcpu): New function. (init_cpu_features): Override MIDR if necessary.
Diffstat (limited to 'elf/dl-tunables.c')
-rw-r--r--elf/dl-tunables.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index b3c1392ce4..44c160cac5 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -33,22 +33,6 @@
# define GLIBC_TUNABLES "GLIBC_TUNABLES"
#endif
-/* Compare environment or tunable names, bounded by the name hardcoded in
- glibc. */
-static bool
-is_name (const char *orig, const char *envname)
-{
- for (;*orig != '\0' && *envname != '\0'; envname++, orig++)
- if (*orig != *envname)
- break;
-
- /* The ENVNAME is immediately followed by a value. */
- if (*orig == '\0' && *envname == '=')
- return true;
- else
- return false;
-}
-
#if TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring
static char *
tunables_strdup (const char *in)
@@ -235,7 +219,7 @@ parse_tunables (char *tunestr, char *valstring)
{
tunable_t *cur = &tunable_list[i];
- if (is_name (cur->name, name))
+ if (tunable_is_name (cur->name, name))
{
/* If we are in a secure context (AT_SECURE) then ignore the tunable
unless it is explicitly marked as secure. Tunable values take
@@ -318,7 +302,7 @@ __tunables_init (char **envp)
&prev_envp)) != NULL)
{
#if TUNABLES_FRONTEND == TUNABLES_FRONTEND_valstring
- if (is_name (GLIBC_TUNABLES, envname))
+ if (tunable_is_name (GLIBC_TUNABLES, envname))
{
char *new_env = tunables_strdup (envname);
if (new_env != NULL)
@@ -341,7 +325,7 @@ __tunables_init (char **envp)
const char *name = cur->env_alias;
/* We have a match. Initialize and move on to the next line. */
- if (is_name (name, envname))
+ if (tunable_is_name (name, envname))
{
/* For AT_SECURE binaries, we need to check the security settings of
the tunable and decide whether we read the value and also whether
@@ -356,7 +340,7 @@ __tunables_init (char **envp)
while (*ep != NULL)
{
- if (is_name (name, *ep))
+ if (tunable_is_name (name, *ep))
{
char **dp = ep;