Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4080824imm; Tue, 25 Sep 2018 10:59:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV60q5c61c4sxW4tk7e2am1JNpRnPD8CS10e4yRH86A/hWgU2p5P9rTE5K8HHYJ+ZuqlRevZG X-Received: by 2002:a63:f252:: with SMTP id d18-v6mr2081890pgk.2.1537898391621; Tue, 25 Sep 2018 10:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537898391; cv=none; d=google.com; s=arc-20160816; b=f9KkFKNVekv4V/o0nbWH8Xjl+z48UfubTs3L0mYlj5LnPUrnwHT1qa4/Yns+N4xN46 N2hYVUoEZzHLRIpBXKRk83bMnigaeoYw/TOzs2TzhS5+rzbhJooZBKiIFm7IHzqKhxxg Q8YkFwcf237iyyJ8KMkJEU2DmzBCf2hbNwC8ui7YUXH7JL7W+0j6daRzY6g3feIucMtV ea50y8byeV97iVjHBepGFhrXN/ZiucsBobQQlmi51ouejcEi17BXPfOx2ySW0eSpQrdR h1ZRj8R4MasDRt2ca48QWRh/Ro6osRKm2sofJUv4FNSM3zWWrBJ2HnuJpz2fba/lnPUh hn+w== 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=N6jg1MSorkmXGmMCUZY9UF/Fh1SjiBoTDpsqany3y7Q=; b=LBpOHFqwLlmWcH8j1dYpa9nwXIzzLf1G/nb0TNL4Ksll1ExAE4KXAOPjZOeV0Y6qvI IgXTy7eGQSQ7+oJ2F3hn/R3BGXODo+fJJTQgMDS8kNZZXWY1ddgcx5MAUY7IQGxv8v+L dAntbRjKrqazeLmx8WA/WMXX46dUABbvgZozuk4zzvzToEukODauhaBN5Kz+nyLbmSQS 2K/jf7wAMOA4Q+h9qEhv17pXsMDcxFMbkgD3Z7/UjJ9ImYrzGEYOJyCUPkq36A8acK0q l55z8+Tr/LzdpOQKEWYIXEg3M0kp9NxYuAixDp2pVjZcUbxBQyL1gsuaJWF9zdBu1U+3 byKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=AIt4OHiB; 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 d30-v6si2982126pld.452.2018.09.25.10.59.36; Tue, 25 Sep 2018 10:59:51 -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=AIt4OHiB; 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 S1727370AbeIZAHz (ORCPT + 99 others); Tue, 25 Sep 2018 20:07:55 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:59903 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbeIZAHz (ORCPT ); Tue, 25 Sep 2018 20:07:55 -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=1537898356; x=1569434356; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=oMORr6Kizmx+pFnLR4tO58Zyb5lS31vTL3ABJutV9n0=; b=AIt4OHiBdBq1xmrTTLKLxTCGeshoDb4RBv3DDVJ86qodtdQ0NkbMbGtb H/e0LCLkarx6bRC3qHE7bqAGkb9iK5d/RxvcyQyhxiMD3tkh7T/dwTuBL NMc1Py283W6lzkpjXYlK+UmPtHNCYhuh63cf+lDrYMUC07tP5R9yH5oxo hb6/w3plFylNAOdq/5e7MgIgLYLgdjctRfJeNWhoEstbr1dscrUJHhgtV cyTICQmJDKPOHr8gXJXpA3/qdgcr9oB2jby7viW8KsLPCA1RCHIz4w97A mZyF3TeRsVOc4o1S0HL5TfVbT3b4usdyZapsEMYNCh1rw2x3cITPdimem w==; X-IronPort-AV: E=Sophos;i="5.54,303,1534780800"; d="scan'208";a="194779829" 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; 26 Sep 2018 01:59:15 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 25 Sep 2018 10:45:04 -0700 Received: from c02v91rdhtd5.sdcorp.global.sandisk.com (HELO [10.196.159.148]) ([10.196.159.148]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Sep 2018 10:59:15 -0700 Subject: Re: [PATCH v2] 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: <20180923133737.22693-1-anup@brainfault.org> From: Atish Patra Message-ID: Date: Tue, 25 Sep 2018 10:59:15 -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: <20180923133737.22693-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/23/18 6:37 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(). > I noticed it should be cpuid_to_hartid_map instead of cpuid_to_hardid_map. It was a typo in my smp cleanup patch series. Sorry for the inconvenience here. I can include this patch in into my series fixing the typo if you want. Regards, Atish > With this patch, contents of /proc/cpuinfo looks as follows: > processor : 0 > hart : 1 > isa : rv64imafdc > mmu : sv48 > > processor : 1 > hart : 0 > isa : rv64imafdc > mmu : sv48 > > processor : 2 > hart : 2 > isa : rv64imafdc > mmu : sv48 > > processor : 3 > hart : 3 > isa : rv64imafdc > mmu : sv48 > > Signed-off-by: Anup Patel > --- > > Changes since v1: > - Show logical CPU ID as "processor" attribute in /proc/cpuinfo > > arch/riscv/kernel/cpu.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c > index 36b6ddb19b4d..392c7c19c4a3 100644 > --- a/arch/riscv/kernel/cpu.c > +++ b/arch/riscv/kernel/cpu.c > @@ -81,7 +81,7 @@ static void print_isa(struct seq_file *f, const char *orig_isa) > #endif > > /* Print the base ISA, as we already know it's legal. */ > - seq_puts(f, "isa\t: "); > + seq_puts(f, "isa\t\t: "); > seq_write(f, isa, 5); > isa += 5; > > @@ -96,6 +96,7 @@ static void print_isa(struct seq_file *f, const char *orig_isa) > isa++; > } > } > + seq_puts(f, "\n"); > > /* > * If we were given an unsupported ISA in the device tree then print > @@ -116,7 +117,7 @@ static void print_mmu(struct seq_file *f, const char *mmu_type) > return; > #endif > > - seq_printf(f, "mmu\t: %s\n", mmu_type+6); > + seq_printf(f, "mmu\t\t: %s\n", mmu_type+6); > } > > static void *c_start(struct seq_file *m, loff_t *pos) > @@ -144,14 +145,15 @@ 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, "processor\t: %lu\n", cpu_id); > + seq_printf(m, "hart\t\t: %lu\n", cpuid_to_hardid_map(cpu_id)); > if (!of_property_read_string(node, "riscv,isa", &isa)) > print_isa(m, isa); > if (!of_property_read_string(node, "mmu-type", &mmu)) > print_mmu(m, mmu); > if (!of_property_read_string(node, "compatible", &compat) > && strcmp(compat, "riscv")) > - seq_printf(m, "uarch\t: %s\n", compat); > + seq_printf(m, "uarch\t\t: %s\n", compat); > seq_puts(m, "\n"); > > return 0; >