Received: by 10.192.165.156 with SMTP id m28csp1675259imm; Tue, 17 Apr 2018 03:39:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx49aKoIlTBI73maKtbF4m89rOBILr3vpdr57aBOU9NX/aCFzCmjolxuQqvt6P49QvgIniyfm X-Received: by 2002:a17:902:b18c:: with SMTP id s12-v6mr1584450plr.178.1523961541469; Tue, 17 Apr 2018 03:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523961541; cv=none; d=google.com; s=arc-20160816; b=qQOV4qu8lGDsvTJ/n4TkR118iLjOVQJ+8U1JjmqARZTQojo0Xtwsmq/iD1M68192vG I+Zw/C7ZyejdrWhuE2LypKb2D/0ssb776dBtDfvIjYNm6v0UNCFFjDolQk1H+mUGemce eXImauwqiX+NQs82iMfd7XONr4pj0D+jEov0xh4JficlVyJ6ZBm2YTt7uM5yD93WllCG NxdoqsOzgExiQA94EGEqzNKM0pMpOjovjDzoeXv7E4NXckYnevkUk0z6qeZ8VJuhqata BYUpNLx1On1YpOP1W93+DMLGfWat7TXqRPoPl6BJydPYFsX7p8TiOLEVerhnj1jEjiDr mmmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=NO9lwjhwiMMnV6ED3JZV9BKpLzRJFoiyoBNcxxKsdYY=; b=VZRU1BLfbWwEEZjENl+3895ZiJDeP2rqwaZ8HXo/JuuKtPxlpn6l4BRULJcMqzpc1c GEjgwEvx7OGKbhUKVOM7y7JBYz/hR2bLbjw+vz5aFmlIX+QmyBzog3KFMYPNEKGt8E2u pqf3gXoDSJ0zPesLuBgNMcL60e/B1aJh/7TREYMNihDjzA9vQ1sC4FMLRHZsjHiOVz7/ Rij37F06u58eDWleIYS6slw+QBsM2DrZV6i8psmmPuEqKEzJKd9xPNxISsgA1HxX6GrX A0HjONXEcIhrNjpSvwSFL/shYxPBKFX9oSYMVhiYHV8kUq1Bk/KCMIVys7ib9cwiNjL4 ZtoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b126si11591438pgc.579.2018.04.17.03.38.47; Tue, 17 Apr 2018 03:39:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752320AbeDQKQJ (ORCPT + 99 others); Tue, 17 Apr 2018 06:16:09 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:55493 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752004AbeDQKQI (ORCPT ); Tue, 17 Apr 2018 06:16:08 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1f8NeW-00047J-FA; Tue, 17 Apr 2018 12:15:56 +0200 Date: Tue, 17 Apr 2018 12:15:56 +0200 (CEST) From: Thomas Gleixner To: David Wang cc: mingo@redhat.com, hpa@zytor.com, mingo@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, brucechang@via-alliance.com, cooperyan@zhaoxin.com, qiyuanwang@zhaoxin.com, benjaminpan@viatech.com, lukelin@viacpu.com, timguo@zhaoxin.com Subject: Re: [PATCH] x86/centaur: report correct CPU/cache topology In-Reply-To: <1522835579-22893-1-git-send-email-davidwang@zhaoxin.com> Message-ID: References: <1522835579-22893-1-git-send-email-davidwang@zhaoxin.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Apr 2018, David Wang wrote: > This patch is used to support multi-core Centaur CPU. After using this > patch, we can get correct CPU topology and correct cache topology. David. This changelog is pretty useless. First of all, please do not use 'This patch ..'. We all know already that this is a patch. Documentation/process/submitting-patches.rst has a good explanation about writing changelogs. The changelog should explain why it does something. Let me give you an example: Centaur CPUs enumerate the cache topology in the same way as Intel CPUs, but the functionality is unused so far. The Centaur init code also misses to initialize x86_cpuinfo::max_cores so the CPU topology cannot be desribed correctly, Initialize x86_cpuinfo::max_cores and invoke init_intel_cacheinfo() to make CPU and cache topology information available and correct. See? I'm neither using 'this patch' nor 'We/I' as I'm not impersonatimg the code. It's all factual instead. > Signed-off-by: David Wang > --- > arch/x86/kernel/cpu/centaur.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c > index e5ec0f1..713e4db 100644 > --- a/arch/x86/kernel/cpu/centaur.c > +++ b/arch/x86/kernel/cpu/centaur.c > @@ -112,6 +112,19 @@ static void early_init_centaur(struct cpuinfo_x86 *c) > } > } > > +static int centaur_num_cpu_cores(struct cpuinfo_x86 *c) > +{ > + unsigned int eax, ebx, ecx, edx; > + > + if (c->cpuid_level < 4) > + return 1; > + cpuid_count(4, 0, &eax, &ebx, &ecx, &edx); > + if (eax & 0x1f) > + return (eax >> 26) + 1; > + else > + return 1; This is a bad copy of intel_num_cpu_cores(). See for the subtle difference. Please rename the intel function and move it to common.c > static void init_centaur(struct cpuinfo_x86 *c) > { > #ifdef CONFIG_X86_32 > @@ -128,6 +141,13 @@ static void init_centaur(struct cpuinfo_x86 *c) > clear_cpu_cap(c, 0*32+31); > #endif > early_init_centaur(c); > + > + init_intel_cacheinfo(c); > + c->x86_max_cores = centaur_num_cpu_cores(c); > +#ifdef CONFIG_X86_32 > + detect_ht(c); > +#endif Can you please create a stub inline of detect_ht() for the !32bit case and get rid of these #ifdefs in the code. That wants to be a separate patch which also cleans up the existing call sites. Thanks, tglx