Skip to contentSkip to conversation

cpus are not properly registered with sysfs (=> cpufreq fails)

x86-64 Pavel Machek 1 participant 1 message Oct 11, 2003

lore
Share & tools
lore
#0 lore raw

Hi!

I found why cpufreq fails on x86-64: cpus are not properly registered. Fix is trivial, but invoves adding 2 files from i386.

Cpufreq actually works with this fix. [It is possible to piggyback cpu-registering code to some existing source file, making for smaller diff. If you want me to do that, let me know, ideally also tell me what file to piggyback at. But I think that would be too ugly.]

Not sure what to do with CONFIG_NUMA there. It might be safer to make it #if 0 for now.

Pavel

Index: arch/x86_64/kernel/Makefile
===================================================================
RCS file: /home/pavel/sf/bitbucket/bkcvs/linux-2.5/arch/x86_64/kernel/Makefile,v retrieving revision 1.27

x86_64/kernel/Makefile +2 -1
diff -u -r1.27 Makefile
@@ -10,6 +10,7 @@
 		setup64.o bluesmoke.o bootflag.o e820.o reboot.o warmreboot.o
 
 obj-$(CONFIG_MTRR)		+= ../../i386/kernel/cpu/mtrr/
+obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_ACPI)		+= acpi/
 obj-$(CONFIG_X86_MSR)		+= msr.o
 obj-$(CONFIG_X86_CPUID)		+= cpuid.o
@@ -23,8 +24,8 @@
 obj-$(CONFIG_DUMMY_IOMMU)	+= pci-nommu.o pci-dma.o
 
 obj-$(CONFIG_MODULES)		+= module.o
+obj-y				+= topology.o
 
 bootflag-y			+= ../../i386/kernel/bootflag.o
 cpuid-$(CONFIG_X86_CPUID)	+= ../../i386/kernel/cpuid.o
 
-obj-$(CONFIG_CPU_FREQ)	+=	cpufreq/
x86_64/kernel/topology.c new file +43 -0

43 lines not on this page · raw message

asm-x86_64/cpu.h new file +24 -0
@@ -0,0 +1,24 @@
+#ifndef _ASM_I386_CPU_H_
+#define _ASM_I386_CPU_H_
+
+#include <linux/device.h>
+#include <linux/cpu.h>
+#include <linux/topology.h>
+
+struct i386_cpu {
+	struct cpu cpu;
+};
+extern struct i386_cpu cpu_devices[NR_CPUS];
+
+
+static inline int arch_register_cpu(int num){
+	struct node *parent = NULL;
+	
+#ifdef CONFIG_NUMA
+	parent = &node_devices[cpu_to_node(num)].node;
+#endif /* CONFIG_NUMA */
+
+	return register_cpu(&cpu_devices[num].cpu, num, parent);
+}
+
+#endif /* _ASM_I386_CPU_H_ */
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]