Re: [crash] BUG: unable to handle kernel NULL pointer dereference at (null), last sysfs file: /sys/devices/pci0000:00/0000:00:01.0/local_cpus

From: Rusty Russell
Date: Thu Sep 24 2009 - 04:18:57 EST


On Sat, 19 Sep 2009 01:08:02 am Linus Torvalds wrote:
> [ Side note: looking closer, I think our headers are buggy, and I _know_
> they are confusing. The above inline declaration of cpumask_of_node()
> seems to be then later overridden in <asm-generic/topology.h> by a
> #define!
>
> And if I read that right, that will also override the debugging
> versions that we declared if CONFIG_DEBUG_PER_CPU_MAPS is on. Ingo?
> Rusty? Am I missing something?

What a tangle.

The CONFIG_DEBUG_PER_CPU_MAPS only overrides cpumask_of_node in the NUMA case
(otherwise, it leaves it alone).

And asm-generic/topology.h only defines cpumask_of_node in the !NUMA case.

But there's still redundancy. Ingo...

Subject: x86: remove redundant non-NUMA topology functions

arch/x86/include/asm/topology.h declares inline fns cpu_to_node
and cpumask_of_node for !NUMA, even though they are then declared as macros
by asm-generic/topology.h, which is #included just below.

The macros (which are the same) end up being used; these functions are
just confusing.

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
---
arch/x86/include/asm/topology.h | 10 ----------
1 file changed, 10 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -165,21 +165,11 @@ static inline int numa_node_id(void)
return 0;
}

-static inline int cpu_to_node(int cpu)
-{
- return 0;
-}
-
static inline int early_cpu_to_node(int cpu)
{
return 0;
}

-static inline const struct cpumask *cpumask_of_node(int node)
-{
- return cpu_online_mask;
-}
-
static inline void setup_node_to_cpumask_map(void) { }

#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/