mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] workqueue: missing idr_preload_end() in worker_pool_assign_id()
@ 2013-03-13 17:51 Artem Savkov
  2013-03-13 17:57 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Savkov @ 2013-03-13 17:51 UTC (permalink / raw)
  To: tj; +Cc: akpm, linux-kernel, Artem Savkov

Added missing idr_preload_end() call in worker_pool_assign_id().
Without it preemption stays disabled resulting in lots of "scheduling while
atomic" BUGs during boot.

[    0.167848] BUG: scheduling while atomic: swapper/0/1/0x10000009
[    0.167951] no locks held by swapper/0/1.
[    0.168046] Modules linked in:
[    0.168947] Pid: 1, comm: swapper/0 Not tainted 3.9.0-rc2-next-20130313+ #299
[    0.169054] Call Trace:
[    0.169152]  [<c168369e>] __schedule_bug+0x59/0x6b
[    0.169254]  [<c168d0d8>] __schedule+0x858/0x8e0
[    0.169355]  [<c1066bbb>] __cond_resched+0x1b/0x30
[    0.169457]  [<c168d1d6>] _cond_resched+0x26/0x30
[    0.169555]  [<c168d20e>] wait_for_common+0x2e/0x120
[    0.169659]  [<c1068fc7>] ? try_to_wake_up+0x197/0x280
[    0.169760]  [<c168d317>] wait_for_completion+0x17/0x20
[    0.169860]  [<c105a2c6>] kthread_create_on_node+0x76/0xc0
[    0.169963]  [<c1052400>] ? rescuer_thread+0x220/0x220
[    0.170064]  [<c1090f72>] ? lockdep_init_map+0x92/0x4e0
[    0.170164]  [<c104fbc1>] create_worker+0xd1/0x1a0
[    0.170261]  [<c1052400>] ? rescuer_thread+0x220/0x220
[    0.170367]  [<c19d1fb9>] init_workqueues+0x12c/0x331
[    0.170468]  [<c19d1e8d>] ?  ftrace_define_fields_workqueue_queue_work+0x115/0x115
[    0.170620]  [<c1001222>] do_one_initcall+0x112/0x160
[    0.170723]  [<c19c7ce6>] ? native_smp_prepare_cpus+0x39a/0x3fd
[    0.170829]  [<c19bca94>] kernel_init_freeable+0x83/0x1b8
[    0.170931]  [<c106503b>] ? finish_task_switch+0x3b/0x100
[    0.171035]  [<c1676970>] kernel_init+0x10/0xd0
[    0.171133]  [<c1695b37>] ret_from_kernel_thread+0x1b/0x28
[    0.171234]  [<c1676960>] ? rest_init+0xd0/0xd0

Introduced in "workqueue: convert to idr_alloc()"

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
---
 kernel/workqueue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 8462642..60d58ac 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -463,6 +463,7 @@ static int worker_pool_assign_id(struct worker_pool *pool)
 		if (ret >= 0)
 			pool->id = ret;
 		spin_unlock_irq(&workqueue_lock);
+		idr_preload_end();
 	} while (ret == -EAGAIN);
 
 	return ret < 0 ? ret : 0;
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: missing idr_preload_end() in worker_pool_assign_id()
  2013-03-13 17:51 [PATCH] workqueue: missing idr_preload_end() in worker_pool_assign_id() Artem Savkov
@ 2013-03-13 17:57 ` Tejun Heo
  2013-03-13 21:51   ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2013-03-13 17:57 UTC (permalink / raw)
  To: Artem Savkov
  Cc: akpm, linux-kernel, Stephen Rothwell, viakernel.org, linux-next

(cc'ing Stephen and linux-next)

Hello, Artem.

On Wed, Mar 13, 2013 at 09:51:32PM +0400, Artem Savkov wrote:
> Added missing idr_preload_end() call in worker_pool_assign_id().
> Without it preemption stays disabled resulting in lots of "scheduling while
> atomic" BUGs during boot.
...
> Introduced in "workqueue: convert to idr_alloc()"

That patch doesn't use idr_preload().  It looks like the issue is
introduced during linux-next merge of wq/for-3.10 and idr patches in
-mm.  Stephen, can you please add idr_preload_end() to the merge
patch?

Once the idr patches land in Linus' tree, I'll resolve the conflict
from wq tree side.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: missing idr_preload_end() in worker_pool_assign_id()
  2013-03-13 17:57 ` Tejun Heo
@ 2013-03-13 21:51   ` Stephen Rothwell
  2013-03-13 21:55     ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2013-03-13 21:51 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Artem Savkov, akpm, linux-kernel, viakernel.org, linux-next

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

Hi Tejun,

On Wed, 13 Mar 2013 10:57:45 -0700 Tejun Heo <tj@kernel.org> wrote:
>
> (cc'ing Stephen and linux-next)
> 
> Hello, Artem.
> 
> On Wed, Mar 13, 2013 at 09:51:32PM +0400, Artem Savkov wrote:
> > Added missing idr_preload_end() call in worker_pool_assign_id().
> > Without it preemption stays disabled resulting in lots of "scheduling while
> > atomic" BUGs during boot.
> ...
> > Introduced in "workqueue: convert to idr_alloc()"
> 
> That patch doesn't use idr_preload().  It looks like the issue is
> introduced during linux-next merge of wq/for-3.10 and idr patches in
> -mm.  Stephen, can you please add idr_preload_end() to the merge
> patch?

Oops, sorry about that.  I assume it needs to be added just after the
spin_unlock_irq() but still inside the loop?

> Once the idr patches land in Linus' tree, I'll resolve the conflict
> from wq tree side.

Or you could do what Linus prefers and just tell him how to resolve the
conflict and thereby avoid a back merge or rebase (or provide him with a
separate branch that does the back merge with resolution in addition to
the unmerged branch to pull).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: missing idr_preload_end() in worker_pool_assign_id()
  2013-03-13 21:51   ` Stephen Rothwell
@ 2013-03-13 21:55     ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2013-03-13 21:55 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Artem Savkov, akpm, linux-kernel, viakernel.org, linux-next

Hello,

On Wed, Mar 13, 2013 at 2:51 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>> That patch doesn't use idr_preload().  It looks like the issue is
>> introduced during linux-next merge of wq/for-3.10 and idr patches in
>> -mm.  Stephen, can you please add idr_preload_end() to the merge
>> patch?
>
> Oops, sorry about that.  I assume it needs to be added just after the
> spin_unlock_irq() but still inside the loop?

Yeap. Andrew already has the change, I think.

>> Once the idr patches land in Linus' tree, I'll resolve the conflict
>> from wq tree side.
>
> Or you could do what Linus prefers and just tell him how to resolve the
> conflict and thereby avoid a back merge or rebase (or provide him with a
> separate branch that does the back merge with resolution in addition to
> the unmerged branch to pull).

That part of code is gonna see more changes and I don't wanna build on
top of the deprecated interface, so the back-pull is actually
justified - wq tree actually wants the receive the particular change
to build on top.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-13 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13 17:51 [PATCH] workqueue: missing idr_preload_end() in worker_pool_assign_id() Artem Savkov
2013-03-13 17:57 ` Tejun Heo
2013-03-13 21:51   ` Stephen Rothwell
2013-03-13 21:55     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®