All of lore.kernel.org
 help / color / mirror / Atom feed
* block: BUG: using smp_processor_id() in preemptible [00000000] code
@ 2011-07-26  4:49 Ming Lei
  2011-07-26  5:26 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lei @ 2011-07-26  4:49 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Linux Kernel Mailing List

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

Hi,

The bug is observed in -next-20110725, follows the stack trace[1], and
seems the attachment patch can fix the bug.



[1], stack trace

[   22.247222] BUG: using smp_processor_id() in preemptible [00000000]
code: kjournald/514
[   22.255737] caller is __make_request+0x1b8/0x308
[   22.260681] [<c0019f44>] (unwind_backtrace+0x0/0xe8) from
[<c024b4cc>] (debug_smp_processor_id+0xbc/0xf0)
[   22.270751] [<c024b4cc>] (debug_smp_processor_id+0xbc/0xf0) from
[<c0223d14>] (__make_request+0x1b8/0x308)
[   22.280944] [<c0223d14>] (__make_request+0x1b8/0x308) from
[<c02215ac>] (generic_make_request+0x4dc/0x558)
[   22.291107] [<c02215ac>] (generic_make_request+0x4dc/0x558) from
[<c022173c>] (submit_bio+0x114/0x138)
[   22.300903] [<c022173c>] (submit_bio+0x114/0x138) from [<c011f504>]
(submit_bh+0x148/0x16c)
[   22.309692] [<c011f504>] (submit_bh+0x148/0x16c) from [<c0121ed8>]
(__sync_dirty_buffer+0x88/0xd8)
[   22.319122] [<c0121ed8>] (__sync_dirty_buffer+0x88/0xd8) from
[<c01aff78>] (journal_commit_transaction+0x1198/0
x1688)
[   22.330322] [<c01aff78>] (journal_commit_transaction+0x1198/0x1688)
from [<c01b4034>] (kjournald+0xb4/0x224)
[   22.340667] [<c01b4034>] (kjournald+0xb4/0x224) from [<c0069ea0>]
(kthread+0x8c/0x94)
[   22.348937] [<c0069ea0>] (kthread+0x8c/0x94) from [<c00137f8>]
(kernel_thread_exit+0x0/0x8)


thanks,
-- 
Ming Lei

[-- Attachment #2: fix_blk_bug_smp_processor_id.patch --]
[-- Type: text/x-patch, Size: 449 bytes --]

diff --git a/block/blk-core.c b/block/blk-core.c
index f8cb099..7e98677 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1282,8 +1282,10 @@ get_rq:
 	init_request_from_bio(req, bio);
 
 	if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) ||
-	    bio_flagged(bio, BIO_CPU_AFFINE))
-		req->cpu = smp_processor_id();
+	    bio_flagged(bio, BIO_CPU_AFFINE)) {
+		req->cpu = get_cpu();
+		put_cpu();
+	}
 
 	plug = current->plug;
 	if (plug) {

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

* Re: block: BUG: using smp_processor_id() in preemptible [00000000] code
  2011-07-26  4:49 block: BUG: using smp_processor_id() in preemptible [00000000] code Ming Lei
@ 2011-07-26  5:26 ` Jens Axboe
  2011-07-26  6:22   ` Ming Lei
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2011-07-26  5:26 UTC (permalink / raw)
  To: Ming Lei; +Cc: Linux Kernel Mailing List

On 2011-07-26 06:49, Ming Lei wrote:
> Hi,
> 
> The bug is observed in -next-20110725, follows the stack trace[1], and
> seems the attachment patch can fix the bug.

Does this work, too? We don't necessarily need the CPU stable, but
spewing debug output isn't very nice.

diff --git a/block/blk-core.c b/block/blk-core.c
index f8cb099..f925581 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1283,7 +1283,7 @@ get_rq:
 
 	if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) ||
 	    bio_flagged(bio, BIO_CPU_AFFINE))
-		req->cpu = smp_processor_id();
+		req->cpu = raw_smp_processor_id();
 
 	plug = current->plug;
 	if (plug) {

-- 
Jens Axboe


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

* Re: block: BUG: using smp_processor_id() in preemptible [00000000] code
  2011-07-26  5:26 ` Jens Axboe
@ 2011-07-26  6:22   ` Ming Lei
  2011-07-26 13:04     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lei @ 2011-07-26  6:22 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Linux Kernel Mailing List

Hi,

On Tue, Jul 26, 2011 at 1:26 PM, Jens Axboe <jaxboe@fusionio.com> wrote:
> On 2011-07-26 06:49, Ming Lei wrote:
>> Hi,
>>
>> The bug is observed in -next-20110725, follows the stack trace[1], and
>> seems the attachment patch can fix the bug.
>
> Does this work, too? We don't necessarily need the CPU stable, but
> spewing debug output isn't very nice.

This does work, thanks,

> diff --git a/block/blk-core.c b/block/blk-core.c
> index f8cb099..f925581 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -1283,7 +1283,7 @@ get_rq:
>
>        if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) ||
>            bio_flagged(bio, BIO_CPU_AFFINE))
> -               req->cpu = smp_processor_id();
> +               req->cpu = raw_smp_processor_id();
>
>        plug = current->plug;
>        if (plug) {
>
> --
> Jens Axboe
>
>


thanks,
-- 
Ming Lei

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

* Re: block: BUG: using smp_processor_id() in preemptible [00000000] code
  2011-07-26  6:22   ` Ming Lei
@ 2011-07-26 13:04     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2011-07-26 13:04 UTC (permalink / raw)
  To: Ming Lei; +Cc: Linux Kernel Mailing List

On 2011-07-26 08:22, Ming Lei wrote:
> Hi,
> 
> On Tue, Jul 26, 2011 at 1:26 PM, Jens Axboe <jaxboe@fusionio.com> wrote:
>> On 2011-07-26 06:49, Ming Lei wrote:
>>> Hi,
>>>
>>> The bug is observed in -next-20110725, follows the stack trace[1], and
>>> seems the attachment patch can fix the bug.
>>
>> Does this work, too? We don't necessarily need the CPU stable, but
>> spewing debug output isn't very nice.
> 
> This does work, thanks,

Great, thanks for reporting and testing.

-- 
Jens Axboe


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

end of thread, other threads:[~2011-07-26 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26  4:49 block: BUG: using smp_processor_id() in preemptible [00000000] code Ming Lei
2011-07-26  5:26 ` Jens Axboe
2011-07-26  6:22   ` Ming Lei
2011-07-26 13:04     ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.