This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH][aarch64] Fix glibc.tune.cpu tunable handling
- From: Steve Ellcey <sellcey at cavium dot com>
- To: libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 01 Sep 2017 12:40:50 -0700
- Subject: [PATCH][aarch64] Fix glibc.tune.cpu tunable handling
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- Reply-to: sellcey at cavium dot com
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
While working on a gcc patch I realized that the glibc tunable
'glibc.tune.cpu' was not working on aarch64. I tracked it down to
get_midr_from_mcpu and at first I thought I should remove the '== 0'
from the if statement because tunable_is_name returns true/false, not
-1/0/1 like strcmp. But then I realized we shouldn't be using
tunable_is_name at all because we are comparing two null terminated
strings and tunable_is_name is trying to compare a null terminated
string with a '=' terminated string which is not what we have.
I tested this by running a program that calls memcpy and checking what
memcpy gets run after setting glibc.tune.cpu to generic, thunderx,
and falkor.
OK to checkin?
Steve Ellcey
sellcey@cavium.com
2017-09-01 Steve Ellcey <sellcey@cavium.com>
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (get_midr_from_mcpu):
Use strcmp instead of tunable_is_name.
diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/
linux/aarch64/cpu-features.c
index 18f5e60..0c7e13f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
@@ -37,7 +37,7 @@ static uint64_t
get_midr_from_mcpu (const char *mcpu)
{
for (int i = 0; i < sizeof (cpu_list) / sizeof (struct cpu_list); i++)
- if (tunable_is_name (mcpu, cpu_list[i].name) == 0)
+ if (strcmp (mcpu, cpu_list[i].name) == 0)
return cpu_list[i].midr;
return UINT64_MAX;