From patchwork Wed May 24 13:29:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 20558 Received: (qmail 104073 invoked by alias); 24 May 2017 13:29:42 -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 103900 invoked by uid 89); 24 May 2017 13:29:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2460, HX-Received:10.55.147.3, xxx X-HELO: mail-qk0-f173.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FsfTPO55mSpPO0GyHW7e53sz5unlbLIA9CBWwGb5II4=; b=WTb6fzWncr55o00SbsdP2W4GRwaPzUuXvWnIW1Bnv+N3lUieH3ZvR/WIJ6R7AnCWkj XsgKV08v2e9N9Ml0F8iXwgWEg1E77tLFku3oYk85nSb34HsfLbylNs4Etznd7JEs258W OzaoNEnHSlhJVVxUDT85eQhXsWeVk3W2EwtvgdspU42/KoPkTo/hOMwPJpt0TLIkPWcX aNv+bCQucorz6MHtN+9e1rorUfZ3O0Piwk/Yoc304XDREZ8ME1t1Xhr4P5cx3LQOOJ3v 9J58Oj7ktx858p1BcaZfHWOsN257aErhrezf3B7NTbwat7MY6bbvaYcoZWBj5UNRr6tP MDSA== X-Gm-Message-State: AODbwcB1+cBvzh6dAfzsqpS2Fqy1FrvK+Q4UJMmsQTPfuDIW36HVxxx8 aWHrMInNa84cLL1Sb0UwlVs+34rxvQ== X-Received: by 10.55.147.3 with SMTP id v3mr29512255qkd.165.1495632581251; Wed, 24 May 2017 06:29:41 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20170524030339.GA8933@gmail.com> From: "H.J. Lu" Date: Wed, 24 May 2017 06:29:40 -0700 Message-ID: Subject: Re: [PATCH] x86: Use __get_cpu_features to get cpu_features To: Siddhesh Poyarekar Cc: GNU C Library On Tue, May 23, 2017 at 10:09 PM, Siddhesh Poyarekar wrote: > On Wednesday 24 May 2017 08:33 AM, H.J. Lu wrote: >> Remove is_intel, is_amd and max_cpuid macros. Use __get_cpu_features >> to get cpu_features instead. > > LGTM. > This is what I checked in. Thanks. From a8b869ab948080c7821825503ad6a7fadfd77706 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 23 May 2017 19:56:43 -0700 Subject: [PATCH] x86: Use __get_cpu_features to get cpu_features Remove is_intel, is_amd and max_cpuid macros. Use __get_cpu_features to get cpu_features instead. * sysdeps/x86/cacheinfo.c (is_intel): Removed. (is_amd): Likewise. (max_cpuid): Likewise. (__cache_sysconf): Use __get_cpu_features to get cpu_features. (init_cacheinfo): Likewise. --- sysdeps/x86/cacheinfo.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c index 1ccbe41..4594a2f 100644 --- a/sysdeps/x86/cacheinfo.c +++ b/sysdeps/x86/cacheinfo.c @@ -23,10 +23,6 @@ #include #include -#define is_intel GLRO(dl_x86_cpu_features).kind == arch_kind_intel -#define is_amd GLRO(dl_x86_cpu_features).kind == arch_kind_amd -#define max_cpuid GLRO(dl_x86_cpu_features).max_cpuid - static const struct intel_02_cache_info { unsigned char idx; @@ -436,10 +432,12 @@ long int attribute_hidden __cache_sysconf (int name) { - if (is_intel) - return handle_intel (name, max_cpuid); + const struct cpu_features *cpu_features = __get_cpu_features (); + + if (cpu_features->kind == arch_kind_intel) + return handle_intel (name, cpu_features->max_cpuid); - if (is_amd) + if (cpu_features->kind == arch_kind_amd) return handle_amd (name); // XXX Fill in more vendors. @@ -489,8 +487,10 @@ init_cacheinfo (void) long int shared = -1; unsigned int level; unsigned int threads = 0; + const struct cpu_features *cpu_features = __get_cpu_features (); + int max_cpuid = cpu_features->max_cpuid; - if (is_intel) + if (cpu_features->kind == arch_kind_intel) { data = handle_intel (_SC_LEVEL1_DCACHE_SIZE, max_cpuid); @@ -691,8 +691,7 @@ intel_bug_no_cache_info: shared += core; } } - /* This spells out "AuthenticAMD". */ - else if (is_amd) + else if (cpu_features->kind == arch_kind_amd) { data = handle_amd (_SC_LEVEL1_DCACHE_SIZE); long int core = handle_amd (_SC_LEVEL2_CACHE_SIZE); -- 2.9.4