Re: [PATCH] hotplug: fix oops when adding cpu.

2015-06-17 Thread t...@kernel.org
Hello,

On Wed, Jun 17, 2015 at 06:04:06PM +0800, songxium...@inspur.com wrote:
> Subject: [PATCH] hotplug: fix oops when adding cpu
> From: SongXiumiao 
> 
> If memory is not in node0 and a cpu is logically hotadded, the kernel oopses. 
> 
> By analysing the bug function call trace,we find that create_worker function 
> will alloc the memory from node0.Because node0 is offline,the allocation is 
> failed.Then we add a condition to ensure the node is online and 
> system can alloc memory from a node that is online. 
> 
> Here's the backtrace:
> [root@localhost ~]# echo 1 > /sys/devices/system/cpu/cpu90/online
...
> [  225.755126] BUG: unable to handle kernel paging request at 1b08
> [  225.762931] IP: [] __alloc_pages_nodemask+0xb7/0x940
> [  225.770247] PGD 449bb0067 PUD 46110e067 PMD 0
> [  225.775248] Oops:  [#1] SMP
> [  225.778875] Modules linked in: xt_CHECKSUM ip6t_rpfilter ip6t_REJECT 
> nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT nf_reject_ipv4 
> nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntracd
> [  225.868198] CPU: 43 PID: 5400 Comm: bash Not tainted 
> 4.0.0-rc4-bug-fixed-remove #16
> [  225.876754] Hardware name: Insyde Brickland/Type2 - Board Product Name1, 
> BIOS Brickland.05.04.15.0024 02/28/2015
> [  225.888122] task: 88045a3d8da0 ti: 88044612 task.ti: 
> 88044612
> [  225.896484] RIP: 0010:[]  [] 
> __alloc_pages_nodemask+0xb7/0x940
...
> [  226.002904] Call Trace:
> [  226.019173]  [] new_slab+0xa7/0x460
> [  226.024826]  [] __slab_alloc+0x310/0x470
> [  226.043812]  [] kmem_cache_alloc_node_trace+0x91/0x250
> [  226.051299]  [] alloc_worker+0x21/0x50
> [  226.057236]  [] create_worker+0x53/0x1e0
> [  226.063357]  [] alloc_unbound_pwq+0x2a2/0x510
> [  226.069974]  [] wq_update_unbound_numa+0x1b4/0x220
> [  226.077076]  [] workqueue_cpu_up_callback+0x308/0x3d0
> [  226.084468]  [] notifier_call_chain+0x4e/0x80
> [  226.091084]  [] __raw_notifier_call_chain+0xe/0x10
> [  226.098189]  [] cpu_notify+0x23/0x50
...
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 586ad91..22d194c 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -3253,7 +3253,8 @@ static struct worker_pool *get_unbound_pool(const 
> struct workqueue_attrs *attrs)
> if (wq_numa_enabled) {
> for_each_node(node) {
> if (cpumask_subset(pool->attrs->cpumask,
> -wq_numa_possible_cpumask[node])) {
> + wq_numa_possible_cpumask[node])
> +&& node_online(node)) {
> pool->node = node;
> break;

Umm... can you please talk with the fujitsu guys?  They're working on
the same problem and this isn't the full solution.  What happens if
the node goes down after pool is initialized?

Thanks.

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


Re: [PATCH] hotplug: fix oops when adding cpu.

2015-06-17 Thread t...@kernel.org
Hello,

On Wed, Jun 17, 2015 at 06:04:06PM +0800, songxium...@inspur.com wrote:
 Subject: [PATCH] hotplug: fix oops when adding cpu
 From: SongXiumiao songxium...@inspur.com
 
 If memory is not in node0 and a cpu is logically hotadded, the kernel oopses. 
 
 By analysing the bug function call trace,we find that create_worker function 
 will alloc the memory from node0.Because node0 is offline,the allocation is 
 failed.Then we add a condition to ensure the node is online and 
 system can alloc memory from a node that is online. 
 
 Here's the backtrace:
 [root@localhost ~]# echo 1  /sys/devices/system/cpu/cpu90/online
...
 [  225.755126] BUG: unable to handle kernel paging request at 1b08
 [  225.762931] IP: [81182597] __alloc_pages_nodemask+0xb7/0x940
 [  225.770247] PGD 449bb0067 PUD 46110e067 PMD 0
 [  225.775248] Oops:  [#1] SMP
 [  225.778875] Modules linked in: xt_CHECKSUM ip6t_rpfilter ip6t_REJECT 
 nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT nf_reject_ipv4 
 nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntracd
 [  225.868198] CPU: 43 PID: 5400 Comm: bash Not tainted 
 4.0.0-rc4-bug-fixed-remove #16
 [  225.876754] Hardware name: Insyde Brickland/Type2 - Board Product Name1, 
 BIOS Brickland.05.04.15.0024 02/28/2015
 [  225.888122] task: 88045a3d8da0 ti: 88044612 task.ti: 
 88044612
 [  225.896484] RIP: 0010:[81182597]  [81182597] 
 __alloc_pages_nodemask+0xb7/0x940
...
 [  226.002904] Call Trace:
 [  226.019173]  [811d3957] new_slab+0xa7/0x460
 [  226.024826]  [81678c75] __slab_alloc+0x310/0x470
 [  226.043812]  [811d46c1] kmem_cache_alloc_node_trace+0x91/0x250
 [  226.051299]  [8108dd31] alloc_worker+0x21/0x50
 [  226.057236]  [8108ff23] create_worker+0x53/0x1e0
 [  226.063357]  [81092092] alloc_unbound_pwq+0x2a2/0x510
 [  226.069974]  [810924b4] wq_update_unbound_numa+0x1b4/0x220
 [  226.077076]  [81092828] workqueue_cpu_up_callback+0x308/0x3d0
 [  226.084468]  [8109784e] notifier_call_chain+0x4e/0x80
 [  226.091084]  [8109796e] __raw_notifier_call_chain+0xe/0x10
 [  226.098189]  [810774f3] cpu_notify+0x23/0x50
...
 diff --git a/kernel/workqueue.c b/kernel/workqueue.c
 index 586ad91..22d194c 100644
 --- a/kernel/workqueue.c
 +++ b/kernel/workqueue.c
 @@ -3253,7 +3253,8 @@ static struct worker_pool *get_unbound_pool(const 
 struct workqueue_attrs *attrs)
 if (wq_numa_enabled) {
 for_each_node(node) {
 if (cpumask_subset(pool-attrs-cpumask,
 -wq_numa_possible_cpumask[node])) {
 + wq_numa_possible_cpumask[node])
 + node_online(node)) {
 pool-node = node;
 break;

Umm... can you please talk with the fujitsu guys?  They're working on
the same problem and this isn't the full solution.  What happens if
the node goes down after pool is initialized?

Thanks.

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