Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp828024img; Fri, 22 Mar 2019 09:22:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7pfcV9EBQ9z5XJew1m2XxlMTrIWCRDrpimaqDMoVat1eMceE1W40qJtIJxGcre7YdxXe3 X-Received: by 2002:a62:1d8c:: with SMTP id d134mr10026177pfd.185.1553271762623; Fri, 22 Mar 2019 09:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271762; cv=none; d=google.com; s=arc-20160816; b=QGu3Rr3sKcnclAq4xt2lByYOx+l6Uf+pEwrPKWtja8Q0g9vgoLIrsAaMd+/7O2u/E4 4EwV0obBAoMy/Qh/s7JGjSv534P7gXcpi3UW9Z8QP2rwZf5A4nxN0z8I9tMPFyaOcPPl +M5BRU6wpKXZBHQxv1IHmDBoj3vEJz1wIcJ/X5SHJOasudqGGhuJ/6ehRPIj6KaVBY+E wFinM9SAymDY4MFeR3pAn5aojoqJKi1SqV/Jo1fW/poJMxlTuRBROhmqp6Zpu+l04uZZ J+MKgJkEllxfKIdMnICYdy383hVnQJPI2FBQAZLsSbMGSC4KFQhZvppTyljZc1QKcmWj qffA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Upyf8W7eWkiToQl+M2Jm3Vkwq2Z4sjCRJWMaTn7df5Q=; b=w7kTobTlhR2uRrPkFIC5aaa7YzQwunEiJjWM4KLtGOv/DVj/tzziAYMGzrYRP1Ga5q VTD9nJskjFF7kvzTVZDgcUetEbAeUZ0Gwn92Z+J8lVnmKuPGMBymk8dY1zyCusNyaoVF 2wGrA23q0lSkQisa968vUC65GkoMEASEEzOZ9PIvDDwVjqjP0knNrLvF6Qb+I/pootvO y2YIxRpa5OfVMJP/lNm+vru5o1CPeJmrjYLRWjalQ6dD/d3WRrFyTdNW0Wl0nv/RvTXz bij6elwKDbHy2AmO4jFotnpjeRndf3iqesVaB9EjfWuvGiLK2dyxP0iQdo/8HPvCpWkf bU0g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hygon.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a61si1482067pla.178.2019.03.22.09.22.27; Fri, 22 Mar 2019 09:22:42 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hygon.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727404AbfCVQVs (ORCPT + 99 others); Fri, 22 Mar 2019 12:21:48 -0400 Received: from [110.188.70.11] ([110.188.70.11]:5237 "EHLO spam1.hygon.cn" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727246AbfCVQVs (ORCPT ); Fri, 22 Mar 2019 12:21:48 -0400 Received: from MK-FE.hygon.cn ([172.23.18.61]) by spam1.hygon.cn with ESMTP id x2MGJ5JE005624; Sat, 23 Mar 2019 00:19:06 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from cncheex01.Hygon.cn ([172.23.18.10]) by MK-FE.hygon.cn with ESMTP id x2MGJ0Pv072954; Sat, 23 Mar 2019 00:19:00 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from [192.168.1.193] (172.23.18.44) by cncheex01.Hygon.cn (172.23.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Sat, 23 Mar 2019 00:19:00 +0800 Subject: Re: [RFC PATCH] x86/cpu/hygon: Fix phys_proc_id calculation logic for multi-die processor To: Borislav Petkov CC: "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" References: <1553251380-7015-1-git-send-email-puwen@hygon.cn> <20190322155449.GE12472@zn.tnic> From: Pu Wen Message-ID: <639a5bc6-f821-ee9d-1594-d02701321192@hygon.cn> Date: Sat, 23 Mar 2019 00:19:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <20190322155449.GE12472@zn.tnic> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.23.18.44] X-ClientProxiedBy: cncheex01.Hygon.cn (172.23.18.10) To cncheex01.Hygon.cn (172.23.18.10) X-MAIL: spam1.hygon.cn x2MGJ5JE005624 X-DNSRBL: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/3/22 23:55, Borislav Petkov wrote: > On Fri, Mar 22, 2019 at 06:43:00PM +0800, Pu Wen wrote: >> Current codes direct use "phys_proc_id = initial_apicid >> bits", which > > Use proper english please - there's no "codes" > >> calc phys_proc_id from initial_apicid by shifting *bits*, will get > > ... or "calc" Okay, will correct the spelling. >> For Hygon family 18h CPU the socket ID should be obtained from ApicId[6]. >> To fix the problem and match ApicID field definition, adjust the shift >> bits to 6 for all Hygon family 18h multi-die CPUs. > > Sounds to me like you're programming the initial APIC ID not > the same way as AMD do... In the same way. >> Reference: >> [1] https://www.amd.com/system/files/TechDocs/54945_PPR_Family_17h_Models_00h-0Fh.pdf >> >> Signed-off-by: Pu Wen >> --- >> arch/x86/kernel/cpu/hygon.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c >> index cf25405..2df6dd9 100644 >> --- a/arch/x86/kernel/cpu/hygon.c >> +++ b/arch/x86/kernel/cpu/hygon.c >> @@ -87,6 +87,9 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) >> if (!err) >> c->x86_coreid_bits = get_count_order(c->x86_max_cores); >> >> + /* Socket ID is ApicId[6] for these processors. */ >> + c->phys_proc_id = c->apicid >> 6; > > That 6 is a magic number, I assume? That 6 is not a magic number. It indicate bit 6 of ApicId. This calculation is the same as the LLC ID calculation in cacheinfo_hygon_init_llc_id(). -- Regards, Pu Wen