linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo
@ 2018-09-23 13:37 Anup Patel
  2018-09-25 17:59 ` Atish Patra
  0 siblings, 1 reply; 4+ messages in thread
From: Anup Patel @ 2018-09-23 13:37 UTC (permalink / raw)
  To: Palmer Dabbelt, Albert Ou
  Cc: Atish Patra, Christoph Hellwig, linux-riscv, linux-kernel, Anup Patel

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:
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 <anup@brainfault.org>
---

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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo
  2018-09-23 13:37 [PATCH v2] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo Anup Patel
@ 2018-09-25 17:59 ` Atish Patra
  2018-09-26  4:16   ` Anup Patel
  0 siblings, 1 reply; 4+ messages in thread
From: Atish Patra @ 2018-09-25 17:59 UTC (permalink / raw)
  To: Anup Patel, Palmer Dabbelt, Albert Ou
  Cc: Christoph Hellwig, linux-riscv, linux-kernel

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 <anup@brainfault.org>
> ---
> 
> 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;
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo
  2018-09-25 17:59 ` Atish Patra
@ 2018-09-26  4:16   ` Anup Patel
  2018-09-27 22:28     ` Atish Patra
  0 siblings, 1 reply; 4+ messages in thread
From: Anup Patel @ 2018-09-26  4:16 UTC (permalink / raw)
  To: Atish Patra
  Cc: Palmer Dabbelt, Albert Ou, Christoph Hellwig, linux-riscv,
	linux-kernel@vger.kernel.org List

On Tue, Sep 25, 2018 at 11:29 PM Atish Patra <atish.patra@wdc.com> wrote:
>
> 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.

Thanks for pointing.

>
> I can include this patch in into my series fixing the typo if you want.

Yes, please.

You can also include "RISC-V: Show IPI stats" patch in your series.
This patch was reviewed by Christoph.

Thanks,
Anup

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo
  2018-09-26  4:16   ` Anup Patel
@ 2018-09-27 22:28     ` Atish Patra
  0 siblings, 0 replies; 4+ messages in thread
From: Atish Patra @ 2018-09-27 22:28 UTC (permalink / raw)
  To: Anup Patel
  Cc: Palmer Dabbelt, Albert Ou, Christoph Hellwig, linux-riscv,
	linux-kernel@vger.kernel.org List

On 9/25/18 9:17 PM, Anup Patel wrote:
> On Tue, Sep 25, 2018 at 11:29 PM Atish Patra <atish.patra@wdc.com> wrote:
>>
>> 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.
> 
> Thanks for pointing.
> 
>>
>> I can include this patch in into my series fixing the typo if you want.
> 
> Yes, please.
> 

Great.

> You can also include "RISC-V: Show IPI stats" patch in your series.
> This patch was reviewed by Christoph.
> 

I already had that included as a part of v5.

Regards,
Atish
> Thanks,
> Anup
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-27 22:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-23 13:37 [PATCH v2] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo Anup Patel
2018-09-25 17:59 ` Atish Patra
2018-09-26  4:16   ` Anup Patel
2018-09-27 22:28     ` Atish Patra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).