From: Richard Weinberger <richard@nod.at>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: gregkh@suse.de,
"user-mode-linux-devel@lists.sourceforge.net"
<user-mode-linux-devel@lists.sourceforge.net>
Subject: Is register_cpu() now obligatory?
Date: Mon, 09 Jan 2012 02:00:43 +0100 [thread overview]
Message-ID: <4F0A3C3B.5090700@nod.at> (raw)
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
Hi!
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
---
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index bc49474..f3b43fe 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -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
diff --git a/arch/um/kernel/cpu.c b/arch/um/kernel/cpu.c
new file mode 100644
index 0000000..4914df2
--- /dev/null
+++ b/arch/um/kernel/cpu.c
@@ -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);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next reply other threads:[~2012-01-09 1:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-09 1:00 Richard Weinberger [this message]
2012-01-09 2:36 ` Is register_cpu() now obligatory? Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F0A3C3B.5090700@nod.at \
--to=richard@nod.at \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox