From patchwork Thu Jun 28 18:22:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 28111 Received: (qmail 121202 invoked by alias); 28 Jun 2018 18:22:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 121170 invoked by uid 89); 28 Jun 2018 18:22:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=influence, overriding, IFUNC X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RT8MPai2XbEVZYSBbixaYEgo6psg/crT8p5qMsOvGpI=; b=JngzRfs4tX/xFi4bQAoFijIdCrNk/wDvaY+A2qKHCldWgl8TSiSkkJOJmlUB6iUruUExIm9XvExyS6zcq2wSh241VwlzTbZAs1d7pK1nNrX0S2hpVvRqWmF5AHNrrReW8u5DeT7cB/P+Sou+JstGlzupOWLby02tUfGCpJmyF6c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Cc: nd@arm.com, Siddhesh Poyarekar , Adhemerval Zanella To: GNU C Library From: Szabolcs Nagy Subject: [PATCH 1/2] aarch64: Remove HWCAP_CPUID from HWCAP_IMPORTANT Message-ID: <7c7515de-c512-e399-fae6-60df57440e9a@arm.com> Date: Thu, 28 Jun 2018 19:22:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Return-Path: szabolcs.nagy@arm.com Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) This partially reverts commit f82e9672ad89ea1ef40bbe1af71478e255e87c5e Author: Siddhesh Poyarekar aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK The idea was to make it possible to disable cpuid based ifunc resolution in glibc by changing the hwcap mask which the user could already control. However the hwcap mask has an orthogonal role: it specifies additional library search paths for the dynamic linker. So "cpuid" got added to the search paths when it was set in the default mask (HWCAP_IMPORTANT), which is not useful behaviour, the hwcap masking should not be reused in the cpu features code. Meanwhile there is a tunable to set the cpu explicitly so it is possible to disable the cpuid based dispatch without using a hwcap mask: GLIBC_TUNABLES=glibc.tune.cpu=generic 2018-06-28 Szabolcs Nagy * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (init_cpu_features): Use dl_hwcap without masking. * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h (HWCAP_IMPORTANT): Remove HWCAP_CPUID. --- sysdeps/unix/sysv/linux/aarch64/cpu-features.c | 5 +---- sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index 203f839408..39eba0186f 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -53,9 +53,6 @@ get_midr_from_mcpu (const char *mcpu) static inline void init_cpu_features (struct cpu_features *cpu_features) { - uint64_t hwcap_mask = GET_HWCAP_MASK(); - uint64_t hwcap = GLRO (dl_hwcap) & hwcap_mask; - register uint64_t midr = UINT64_MAX; #if HAVE_TUNABLES @@ -69,7 +66,7 @@ init_cpu_features (struct cpu_features *cpu_features) allows it. */ if (midr == UINT64_MAX) { - if (hwcap & HWCAP_CPUID) + if (GLRO (dl_hwcap) & HWCAP_CPUID) asm volatile ("mrs %0, midr_el1" : "=r"(midr)); else midr = 0; diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h index 6887713149..c0dcce15a2 100644 --- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h @@ -27,9 +27,8 @@ /* We cannot provide a general printing function. */ #define _dl_procinfo(type, word) -1 -/* HWCAP_CPUID should be available by default to influence IFUNC as well as - library search. */ -#define HWCAP_IMPORTANT HWCAP_CPUID +/* No additional library search paths. */ +#define HWCAP_IMPORTANT 0 static inline const char * __attribute__ ((unused))