Skip to contentSkip to conversation

x86: fix cpumask_of_pcibus() to handle nid of -1

PATCH In review Suresh Siddha 3 participants 3 messages Sep 22, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix cpumask_of_pcibus() to handle nid of -1

On my two socket NHM-EP system, with CONFIG_DEBUG_PER_CPU_MAPS=y I see:

cpumask_of_node(-1): no node_to_cpumask_map!
Pid: 5635, comm: irqbalance Not tainted 2.6.31-07068-g43c1266-dirty #145

  Call Trace:
   [<ffffffff81031033>] cpumask_of_node+0x4f/0x58
   [<ffffffff811b5a8c>] local_cpus_show+0x1f/0x48
   [<ffffffff812c3c65>] dev_attr_show+0x20/0x44
   [<ffffffff810fcade>] sysfs_read_file+0xb2/0x131
   [<ffffffff810b2702>] vfs_read+0xab/0x147
   [<ffffffff810b2862>] sys_read+0x47/0x6f
   [<ffffffff8100af6b>] system_call_fastpath+0x16/0x1b

Fix x86 version of cpumask_of_pcibus() to handle node id of "-1" (default value indicating that I/O isn't tied to any particular node).

---

arch/x86/include/asm/pci.h +3 -1
index f76a162..b101e8c 100644
@@ -143,7 +143,9 @@ static inline int __pcibus_to_node(const struct pci_bus *bus)
 static inline const struct cpumask *
 cpumask_of_pcibus(const struct pci_bus *bus)
 {
-	return cpumask_of_node(__pcibus_to_node(bus));
+	int node = __pcibus_to_node(bus);
+
+	return (node == -1) ? cpu_all_mask : cpumask_of_node(node);
 }
 #endif
 
#1 lore raw
Quoted 25 lines · Suresh Siddha

On my two socket NHM-EP system, with CONFIG_DEBUG_PER_CPU_MAPS=y I see:

cpumask_of_node(-1): no node_to_cpumask_map!
Pid: 5635, comm: irqbalance Not tainted 2.6.31-07068-g43c1266-dirty #145

  Call Trace:
   [<ffffffff81031033>] cpumask_of_node+0x4f/0x58
   [<ffffffff811b5a8c>] local_cpus_show+0x1f/0x48
   [<ffffffff812c3c65>] dev_attr_show+0x20/0x44
   [<ffffffff810fcade>] sysfs_read_file+0xb2/0x131
   [<ffffffff810b2702>] vfs_read+0xab/0x147
   [<ffffffff810b2862>] sys_read+0x47/0x6f
   [<ffffffff8100af6b>] system_call_fastpath+0x16/0x1b

Fix x86 version of cpumask_of_pcibus() to handle node id of "-1" (default value indicating that I/O isn't tied to any particular node).

---

arch/x86/include/asm/pci.h +0 -0
index f76a162..b101e8c 100644

arch/x86/include/asm/pci.h static inline int __pcibus_to_node(const struct pci_bus *bus) · line 151

Quoted 10 lines
arch/x86/include/asm/pci.h +3 -1
@@ -143,7 +143,9 @@ static inline int __pcibus_to_node(const struct pci_bus *bus)
 static inline const struct cpumask *
 cpumask_of_pcibus(const struct pci_bus *bus)
 {
-	return cpumask_of_node(__pcibus_to_node(bus));
+	int node = __pcibus_to_node(bus);
+
+	return (node == -1) ? cpu_all_mask : cpumask_of_node(node);
 }
 #endif
 

cpu_all_mask or cpu_online_mask?

YH

#2 lore raw
In reply to Suresh Siddha
Quoted 13 lines · Suresh Siddha

On my two socket NHM-EP system, with CONFIG_DEBUG_PER_CPU_MAPS=y I see:

cpumask_of_node(-1): no node_to_cpumask_map!
Pid: 5635, comm: irqbalance Not tainted 2.6.31-07068-g43c1266-dirty #145

  Call Trace:
   [<ffffffff81031033>] cpumask_of_node+0x4f/0x58
   [<ffffffff811b5a8c>] local_cpus_show+0x1f/0x48
   [<ffffffff812c3c65>] dev_attr_show+0x20/0x44
   [<ffffffff810fcade>] sysfs_read_file+0xb2/0x131
   [<ffffffff810b2702>] vfs_read+0xab/0x147
   [<ffffffff810b2862>] sys_read+0x47/0x6f
   [<ffffffff8100af6b>] system_call_fastpath+0x16/0x1b
Quoted 3 lines

Fix x86 version of cpumask_of_pcibus() to handle node id of "-1" (default value indicating that I/O isn't tied to any particular node).

This is already fixed in -mm with x86-default-pcibus-cpumask-to-all-cpus-if-it-lacks-affinity.patch and is awaiting inclusion via Jesse Barnes' tree.