Re: [PATCH v2 4/5] x86/cpu: Add CPU type to struct cpuinfo_topology

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/22/2024 07:03, Borislav Petkov wrote:
On Tue, Oct 22, 2024 at 01:57:20PM +0200, Borislav Petkov wrote:
diff --git a/arch/x86/kernel/cpu/topology_common.c b/arch/x86/kernel/cpu/topology_common.c
index 9a6069e7133c..38220b64c6b3 100644
--- a/arch/x86/kernel/cpu/topology_common.c
+++ b/arch/x86/kernel/cpu/topology_common.c
@@ -27,6 +27,23 @@ void topology_set_dom(struct topo_scan *tscan, enum x86_topology_domains dom,
  	}
  }
+const char *get_topology_cpu_type_name(struct cpuinfo_x86 *c)
+{
+	enum x86_topology_cpu_type type;
+
+	if (c->x86_vendor == X86_VENDOR_INTEL)
+		type = get_intel_cpu_type(c);
+	if (c->x86_vendor == X86_VENDOR_AMD)
+		type = get_amd_cpu_type(c);
+
+	if (type == TOPO_CPU_TYPE_PERFORMANCE)
+		return "performance";
+	else if (type == TOPO_CPU_TYPE_EFFICIENCY)
+		return "efficiency";
+	else
+		return "unknown";
+}

I guess you still need topology_cpu_type() in your next patch but that's easy
- you simply call it in get_topology_cpu_type_name().

The point being debugfs will dump the name of the core type and not some magic
number which no one knows.

Yeah; makes sense.  I'll pull your suggestions in.





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux