Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5704624imm; Wed, 12 Sep 2018 09:49:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZND9R1fueYCcmhz0EtSOSyYmD5Se3PLI6cqoL6vrHOw+7JiLFuTq4hRLzETng3FHmC7JkZ X-Received: by 2002:a63:7b1d:: with SMTP id w29-v6mr3328712pgc.249.1536770999412; Wed, 12 Sep 2018 09:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536770999; cv=none; d=google.com; s=arc-20160816; b=j2sjDgOJYaf2tk1SdznPLDDJf0lWaXBKOQHqqx9qMymhdw6ZXjecxn/nTNezLpqiQN wBoWagIwRlWH55kGhCmgbXttmsycSxC7nhrT1TfpxMvexkmrkyCtjutmD5Ayyy05+m3/ sG7bW4dMBAiF4RZomXqpMK1eUbR6S8JIcmJSB+RUG7Nd2OomVDVA3uc6CadJA3wvbWdh DdNxGF0YdltbQUtJr739zZkcOnbUJ0S7ZT0RIJ7RtsDs2/c57dnXuaQ60yybpN+IEx8w 6ahAJUypzol1ivFDf2Sfq0wEyayCmykdelaNyrFt++oEgre4CRchBaGetRSmJ7iIQ/Qy bAoQ== 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:dkim-signature; bh=K1CVjnbT+0YvvGZyi1Hv+/vN7oo0tLKziV4OQUV54Mw=; b=fnZFGFsYE4V41ujhnRrOT3P+I0eNW3jeL0N096BAxyBbfvupFDyPgejtlUhnPaHGLn fA8ZbLnvLN+rQdl4EMg8+B3PG8OQSpq0/0+ILj0CM+/yJ2YIhB2PGtcReEqrrRRLAYx4 6AvlBESVKeWfRJ729hkVcdQJTdHr/xAKlRaHvR2DG2Fqej3q6qtKvgtIN8NEt/dK5+Zj 7wWVtnIBA/xe4HXgdRMw4VNj75HJ6cUFOVOc/LBckPIFpOGBhvSlc/RlHnezjvf78Oqq Zrw+4BVmybD2ftvYsOzAzz9rvZC2JBb9YP7jk0w2R34fj1v/eOQZaFlndsfVEp/Q2rVI U/hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=C8ZMdAFa; 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=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p83-v6si1413460pfa.180.2018.09.12.09.49.43; Wed, 12 Sep 2018 09:49:59 -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; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=C8ZMdAFa; 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=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727996AbeILVxS (ORCPT + 99 others); Wed, 12 Sep 2018 17:53:18 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:1265 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727122AbeILVxS (ORCPT ); Wed, 12 Sep 2018 17:53:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1536770877; x=1568306877; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=4JGLCW49XAc08LPM/hSiqTGjQc1iDV4zirRZMm2v+fU=; b=C8ZMdAFasDvsu8mfPVevqrQktbMA6Ip2iUJafNWcT2Tki1yV8TgVY90U N0vda7asDCJg11hIYfWS+fTmbG+geKV4p+C8BUn5zwEBn+Mmg+GMeiTm8 otTPGMhXWTGvjaqovtAYtSCTeNc+Zs6eQx3vCkzt3Qn1zvmjFMYv2ty1O IcwqHUZoEtzWZSR0vl06QC6GTVasMeTcqc6L7lsED2jDF8nhxZ305ifA/ SYlt64CjQXeODRRTgSI5bvoQAcgMOKZ+I3KP1xotjbmuEDuOuV4U7+OJU 6XRece2QSVn1ePkUOTJf9elJ/WHkc+o9/FbW/mNZ/JHjyZ447NZj6HSXG A==; X-IronPort-AV: E=Sophos;i="5.53,365,1531756800"; d="scan'208";a="93993338" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 13 Sep 2018 00:47:57 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 12 Sep 2018 09:34:18 -0700 Received: from 45t6pc2.ad.shared (HELO [10.86.63.194]) ([10.86.63.194]) by uls-op-cesaip01.wdc.com with ESMTP; 12 Sep 2018 09:47:56 -0700 Subject: Re: [PATCH] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo To: Anup Patel , Palmer Dabbelt , Albert Ou Cc: Christoph Hellwig , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" References: <20180912143822.21948-1-anup@brainfault.org> From: Atish Patra Message-ID: <72961c71-c4e4-7990-da64-a7f1613f2e1c@wdc.com> Date: Wed, 12 Sep 2018 09:47:55 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180912143822.21948-1-anup@brainfault.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/12/18 7:38 AM, Anup Patel wrote: > Currently, /proc/cpuinfo show logical CPU ID as Hart ID which > is in-correct. This patch shows CPU ID and Hart ID separately > in /proc/cpuinfo using cpuid_to_hardid_map(). > > With this patch, contents of /proc/cpuinfo looks as follows: > cpu : 0 > hart : 1 > isa : rv64imafdcsu > mmu : sv48 > > cpu : 1 > hart : 0 > isa : rv64imafdcsu > mmu : sv48 > > cpu : 2 > hart : 3 > isa : rv64imafdcsu > mmu : sv48 > > cpu : 3 > hart : 2 > isa : rv64imafdcsu > mmu : sv48 > > Signed-off-by: Anup Patel > --- > arch/riscv/kernel/cpu.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c > index f0f0ec2737b7..7c1342e242e6 100644 > --- a/arch/riscv/kernel/cpu.c > +++ b/arch/riscv/kernel/cpu.c > @@ -87,7 +87,8 @@ static int c_show(struct seq_file *m, void *v) > NULL); > const char *compat, *isa, *mmu; > > - seq_printf(m, "hart\t: %lu\n", cpu_id); > + seq_printf(m, "cpu\t: %lu\n", cpu_id); > + seq_printf(m, "hart\t: %lu\n", cpuid_to_hardid_map(cpu_id)); > if (!of_property_read_string(node, "riscv,isa", &isa) > && isa[0] == 'r' > && isa[1] == 'v') > The extra hart information will not be parsed by lscpu which will make the cpu information inconsistent between lscpu & /proc/cpuinfo. Should we patch lscpu as well to show correct hart id as well ? Regards, Atish