Is register_cpu() now obligatory?
Richard Weinberger
maintainerHi!
In Linus' tree as of today UML is broken.
It's crashing because get_cpu_device() in topology_add_dev() returns a device with an invalid kobj (address is 0x10).
The code seems to assume that each arch has to register their CPUs using register_cpu().
Is this a regression or was UML always faulty because it did not register it's CPU?
The below patch fixes the issue for UML.
Thanks,
//richard
---
arch/um/kernel/Makefile +1 -1
@@ -12,7 +12,7 @@ clean-files := obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \ physmem.o process.o ptrace.o reboot.o sigio.o \ signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \ - um_arch.o umid.o skas/ + um_arch.o umid.o cpu.o skas/ obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o obj-$(CONFIG_GPROF) += gprof_syms.o
arch/um/kernel/cpu.c new file +19 -0
@@ -0,0 +1,19 @@ +#include <linux/init.h> +#include <linux/device.h> +#include <linux/cpu.h> +#include <linux/percpu.h> + +static DEFINE_PER_CPU(struct cpu, cpu_devices); + +static int __init topology_init (void ) +{ +int cpu; + +for_each_possible_cpu (cpu) { +struct cpu *c = &per_cpu (cpu_devices, cpu); +register_cpu (c, cpu); + } + +return 0 ; +} +subsys_initcall (topology_init);
Quoted 10 lines · Richard Weinberger
Hi!
In Linus' tree as of today UML is broken.
It's crashing becauseget_cpu_device()intopology_add_dev()returns a device with an invalid kobj (address is0x10).The code seems to assume that each arch has to register their CPUs using
register_cpu().Is this a regression or was UML always faulty because it did not register it's CPU?
See Linus's comment yesterday:
https://lkml.org/lkml/2012/1/7/114
Quoted 45 lines
The below patch fixes the issue for UML.
Thanks,
//richard---
arch/um/kernel/Makefile +1
-1@@ -12,7 +12,7 @@ clean-files := obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \ physmem.o process.o ptrace.o reboot.o sigio.o \ signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \ - um_arch.o umid.o skas/ + um_arch.o umid.o cpu.o skas/ obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o obj-$(CONFIG_GPROF) += gprof_syms.oarch/um/kernel/cpu.c new file +19
-0@@ -0,0 +1,19 @@ +#include <linux/init.h> +#include <linux/device.h> +#include <linux/cpu.h> +#include <linux/percpu.h> + +static DEFINE_PER_CPU(struct cpu, cpu_devices); + +static int __init topology_init (void ) +{ +int cpu; + +for_each_possible_cpu (cpu) { +struct cpu *c = &per_cpu (cpu_devices, cpu); +register_cpu (c, cpu); + } + +return 0 ; +} +subsys_initcall (topology_init);
Signature · 2 lines
~Randy *** Remember to use Documentation/SubmitChecklist when testing your code ***