All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: clean up /proc/cpuinfo
@ 2014-06-28  1:11 Bjorn Helgaas
  2014-06-28  1:12 ` [PATCH 1/2] arm64: add MIDR to per-CPU information Bjorn Helgaas
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2014-06-28  1:11 UTC (permalink / raw)
  To: linux-arm-kernel

On arm64, /proc/cpuinfo currently looks like:

    Processor       : AArch64 Processor rev 0 (aarch64)
    processor       : 0
    processor       : 1
    ...
    Features        : ...

Compared to most other architectures (including arm), this has an extra
"Processor" header, and the "Features" and other bits only appear once,
so there's no way to have per-CPU features, variants, etc.

These patches make arm64 more consistent with the other architectures
by removing the extra header and printing the CPU ID information for
each CPU.

---

Bjorn Helgaas (2):
      arm64: add MIDR to per-CPU information
      arm64: kernel: update cpuinfo to print all online CPUs features


 arch/arm64/kernel/setup.c |   46 +++++++++++++++++++++++----------------------
 arch/arm64/kernel/smp.c   |    5 +++++
 2 files changed, 28 insertions(+), 23 deletions(-)

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

* [PATCH 1/2] arm64: add MIDR to per-CPU information
  2014-06-28  1:11 [PATCH 0/2] arm64: clean up /proc/cpuinfo Bjorn Helgaas
@ 2014-06-28  1:12 ` Bjorn Helgaas
  2014-06-28  1:12 ` [PATCH 2/2] arm64: kernel: update cpuinfo to print all online CPUs features Bjorn Helgaas
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2014-06-28  1:12 UTC (permalink / raw)
  To: linux-arm-kernel

Save the MIDR of each CPU we bring online instead of assuming they're all
the same.

Based on e8d432c9cf0a ("ARM: kernel: add MIDR to per-CPU information
data").

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/arm64/kernel/setup.c |   13 +++++++------
 arch/arm64/kernel/smp.c   |    5 +++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 46d1125571f6..37cc2bb9f3ae 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -45,6 +45,7 @@
 #include <linux/efi.h>
 
 #include <asm/fixmap.h>
+#include <asm/cpu.h>
 #include <asm/cputype.h>
 #include <asm/elf.h>
 #include <asm/cputable.h>
@@ -417,16 +418,16 @@ static int __init arm64_device_init(void)
 }
 arch_initcall_sync(arm64_device_init);
 
-static DEFINE_PER_CPU(struct cpu, cpu_data);
+DEFINE_PER_CPU(struct cpuinfo_arm, cpu_data);
 
 static int __init topology_init(void)
 {
-	int i;
+	int cpu;
 
-	for_each_possible_cpu(i) {
-		struct cpu *cpu = &per_cpu(cpu_data, i);
-		cpu->hotpluggable = 1;
-		register_cpu(cpu, i);
+	for_each_possible_cpu(cpu) {
+		struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu);
+		cpuinfo->cpu.hotpluggable = 1;
+		register_cpu(&cpuinfo->cpu, cpu);
 	}
 
 	return 0;
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 40f38f46c8e0..c69963496dc6 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -39,6 +39,7 @@
 
 #include <asm/atomic.h>
 #include <asm/cacheflush.h>
+#include <asm/cpu.h>
 #include <asm/cputype.h>
 #include <asm/cpu_ops.h>
 #include <asm/mmu_context.h>
@@ -118,6 +119,10 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
 
 static void smp_store_cpu_info(unsigned int cpuid)
 {
+	struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid);
+
+	cpu_info->cpuid = read_cpuid_id();
+
 	store_cpu_topology(cpuid);
 }
 

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

* [PATCH 2/2] arm64: kernel: update cpuinfo to print all online CPUs features
  2014-06-28  1:11 [PATCH 0/2] arm64: clean up /proc/cpuinfo Bjorn Helgaas
  2014-06-28  1:12 ` [PATCH 1/2] arm64: add MIDR to per-CPU information Bjorn Helgaas
@ 2014-06-28  1:12 ` Bjorn Helgaas
  2014-06-29  8:51 ` [PATCH 0/2] arm64: clean up /proc/cpuinfo Catalin Marinas
  2014-06-30  9:13 ` Mark Rutland
  3 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2014-06-28  1:12 UTC (permalink / raw)
  To: linux-arm-kernel

Update the /proc/cpuinfo show function so that it shows the CPU ID of each
CPU instead of using the ID of the CPU that happens to be running the code.

Based on b4b8f770eb10 ("ARM: kernel: update cpuinfo to print all online
CPUs features").

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/arm64/kernel/setup.c |   33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 37cc2bb9f3ae..dd301ceaa655 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -448,10 +448,8 @@ static const char *hwcap_str[] = {
 
 static int c_show(struct seq_file *m, void *v)
 {
-	int i;
-
-	seq_printf(m, "Processor\t: %s rev %d (%s)\n",
-		   cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
+	int i, j;
+	u32 cpuid;
 
 	for_each_online_cpu(i) {
 		/*
@@ -461,23 +459,24 @@ static int c_show(struct seq_file *m, void *v)
 		 */
 #ifdef CONFIG_SMP
 		seq_printf(m, "processor\t: %d\n", i);
+		cpuid = per_cpu(cpu_data, i).cpuid;
+#else
+		cpuid = read_cpuid_id();
 #endif
-	}
 
-	/* dump out the processor features */
-	seq_puts(m, "Features\t: ");
+		/* dump out the processor features */
+		seq_puts(m, "Features\t: ");
 
-	for (i = 0; hwcap_str[i]; i++)
-		if (elf_hwcap & (1 << i))
-			seq_printf(m, "%s ", hwcap_str[i]);
+		for (i = 0; hwcap_str[i]; i++)
+			if (elf_hwcap & (1 << i))
+				seq_printf(m, "%s ", hwcap_str[i]);
 
-	seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
-	seq_printf(m, "CPU architecture: AArch64\n");
-	seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15);
-	seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff);
-	seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
-
-	seq_puts(m, "\n");
+		seq_printf(m, "\nCPU implementer\t: 0x%02x\n", cpuid >> 24);
+		seq_printf(m, "CPU architecture: AArch64\n");
+		seq_printf(m, "CPU variant\t: 0x%x\n", (cpuid >> 20) & 15);
+		seq_printf(m, "CPU part\t: 0x%03x\n", (cpuid >> 4) & 0xfff);
+		seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
+	}
 
 	seq_printf(m, "Hardware\t: %s\n", machine_name);
 

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

* [PATCH 0/2] arm64: clean up /proc/cpuinfo
  2014-06-28  1:11 [PATCH 0/2] arm64: clean up /proc/cpuinfo Bjorn Helgaas
  2014-06-28  1:12 ` [PATCH 1/2] arm64: add MIDR to per-CPU information Bjorn Helgaas
  2014-06-28  1:12 ` [PATCH 2/2] arm64: kernel: update cpuinfo to print all online CPUs features Bjorn Helgaas
@ 2014-06-29  8:51 ` Catalin Marinas
  2014-06-30  9:13 ` Mark Rutland
  3 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2014-06-29  8:51 UTC (permalink / raw)
  To: linux-arm-kernel

Bjorn,

On 28 Jun 2014, at 02:11, Bjorn Helgaas <bhelgaas@google.com> wrote:
> Bjorn Helgaas (2):
>      arm64: add MIDR to per-CPU information
>      arm64: kernel: update cpuinfo to print all online CPUs features

Have you looked at Mark Rutland?s recent cpuinfo patches? There is
some overlap and I think they address some of your issues.

Thanks,

Catalin

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

* [PATCH 0/2] arm64: clean up /proc/cpuinfo
  2014-06-28  1:11 [PATCH 0/2] arm64: clean up /proc/cpuinfo Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2014-06-29  8:51 ` [PATCH 0/2] arm64: clean up /proc/cpuinfo Catalin Marinas
@ 2014-06-30  9:13 ` Mark Rutland
  2014-06-30 15:19   ` Bjorn Helgaas
  3 siblings, 1 reply; 6+ messages in thread
From: Mark Rutland @ 2014-06-30  9:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bjorn,

On Sat, Jun 28, 2014 at 02:11:58AM +0100, Bjorn Helgaas wrote:
> On arm64, /proc/cpuinfo currently looks like:
> 
>     Processor       : AArch64 Processor rev 0 (aarch64)
>     processor       : 0
>     processor       : 1
>     ...
>     Features        : ...
> 
> Compared to most other architectures (including arm), this has an extra
> "Processor" header, and the "Features" and other bits only appear once,
> so there's no way to have per-CPU features, variants, etc.
> 
> These patches make arm64 more consistent with the other architectures
> by removing the extra header and printing the CPU ID information for
> each CPU.

This looks very much like the series I've been working on [1,2,3], that
reports the MIDR information and performs some additional sanity
checking (expecting CPUs to have identical hwcap features).

Did you need this for any reason it particular, or was this just a clean
up?

Does my series look OK to you?

Cheers,
Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/255389.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/264387.html
[3] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/266973.html

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

* [PATCH 0/2] arm64: clean up /proc/cpuinfo
  2014-06-30  9:13 ` Mark Rutland
@ 2014-06-30 15:19   ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2014-06-30 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 30, 2014 at 3:13 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> Hi Bjorn,
>
> On Sat, Jun 28, 2014 at 02:11:58AM +0100, Bjorn Helgaas wrote:
>> On arm64, /proc/cpuinfo currently looks like:
>>
>>     Processor       : AArch64 Processor rev 0 (aarch64)
>>     processor       : 0
>>     processor       : 1
>>     ...
>>     Features        : ...
>>
>> Compared to most other architectures (including arm), this has an extra
>> "Processor" header, and the "Features" and other bits only appear once,
>> so there's no way to have per-CPU features, variants, etc.
>>
>> These patches make arm64 more consistent with the other architectures
>> by removing the extra header and printing the CPU ID information for
>> each CPU.
>
> This looks very much like the series I've been working on [1,2,3], that
> reports the MIDR information and performs some additional sanity
> checking (expecting CPUs to have identical hwcap features).
>
> Did you need this for any reason it particular, or was this just a clean
> up?

I want this because /proc/cpuinfo on arm64 is needlessly different
from other arches, which causes problems for code that parses it.

> Does my series look OK to you?

Yep, yours looks fine to me.  Thanks, I wasn't aware of your previous work.

> Cheers,
> Mark.
>
> [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/255389.html
> [2] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/264387.html
> [3] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/266973.html

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

end of thread, other threads:[~2014-06-30 15:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-28  1:11 [PATCH 0/2] arm64: clean up /proc/cpuinfo Bjorn Helgaas
2014-06-28  1:12 ` [PATCH 1/2] arm64: add MIDR to per-CPU information Bjorn Helgaas
2014-06-28  1:12 ` [PATCH 2/2] arm64: kernel: update cpuinfo to print all online CPUs features Bjorn Helgaas
2014-06-29  8:51 ` [PATCH 0/2] arm64: clean up /proc/cpuinfo Catalin Marinas
2014-06-30  9:13 ` Mark Rutland
2014-06-30 15:19   ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.