All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: yangerkun@huawei.com, agk@redhat.com, dm-devel@redhat.com,
	yangerkun <yangerkun@huaweicloud.com>
Subject: Re: [dm-devel] dm-crypt: add cond_resched() to dmcrypt_write()
Date: Mon, 6 Mar 2023 11:33:44 -0500	[thread overview]
Message-ID: <ZAYV6OekGBVFgjAM@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.21.2303061115140.24847@file01.intranet.prod.int.rdu2.redhat.com>

On Mon, Mar 06 2023 at 11:17P -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> The loop in dmcrypt_write may be running for unbounded amount of time, 
> thus we need cond_resched() in it.
> 
> This commit fixes the following warning:
> 
> [ 3391.153255][   C12] watchdog: BUG: soft lockup - CPU#12 stuck for 23s! [dmcrypt_write/2:2897]
> ...
> [ 3391.258372][   C12] CPU: 12 PID: 2897 Comm: dmcrypt_write/2 Tainted: G             L    5.10.0+ #8
> [ 3391.267288][   C12] Hardware name: Huawei TaiShan 2280 V2/BC82AMDDA, BIOS 1.75 04/26/2021
> [ 3391.275428][   C12] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--)
> [ 3391.282102][   C12] pc : blk_attempt_bio_merge.part.6+0x38/0x158
> [ 3391.288080][   C12] lr : blk_attempt_plug_merge+0xc0/0x1b0
> [ 3391.293540][   C12] sp : ffff8000718abc30
> [ 3391.297530][   C12] x29: ffff8000718abc30 x28: 0000000000000000
> [ 3391.303509][   C12] x27: ffff2020361d9ac0 x26: 0000000000000001
> [ 3391.309488][   C12] x25: 0000000000000001 x24: ffff8000718abd08
> [ 3391.315467][   C12] x23: ffff0020a10dbb00 x22: 0000000000000001
> [ 3391.321445][   C12] x21: ffff8000718abe20 x20: ffff0020a10dbb00
> [ 3391.327424][   C12] x19: ffff0020aed7b040 x18: 0000000000000000
> [ 3391.333402][   C12] x17: 0000000000000000 x16: fffffdffffe00000
> [ 3391.339381][   C12] x15: 0000000000001000 x14: 0000000000000000
> [ 3391.345359][   C12] x13: 0000000000002000 x12: ffff2060011f9070
> [ 3391.351338][   C12] x11: 0000000000000001 x10: 0000000000000002
> [ 3391.357316][   C12] x9 : ffff800010586c38 x8 : ffff202009a7f200
> [ 3391.363294][   C12] x7 : ffff8000718abd00 x6 : ffff20200df33750
> [ 3391.369274][   C12] x5 : 0000000000000001 x4 : 0000000000000000
> [ 3391.375252][   C12] x3 : 0000000000000001 x2 : ffff0020a10dbb00
> [ 3391.381230][   C12] x1 : ffff0020aed7b040 x0 : 0000000000001000
> [ 3391.387210][   C12] Call trace:
> [ 3391.390338][   C12]  blk_attempt_bio_merge.part.6+0x38/0x158
> [ 3391.395970][   C12]  blk_attempt_plug_merge+0xc0/0x1b0
> [ 3391.401085][   C12]  blk_mq_submit_bio+0x398/0x550
> [ 3391.405856][   C12]  submit_bio_noacct+0x308/0x380
> [ 3391.410630][   C12]  dmcrypt_write+0x1e4/0x208 [dm_crypt]
> [ 3391.416005][   C12]  kthread+0x130/0x138
> [ 3391.419911][   C12]  ret_from_fork+0x10/0x18
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Reported-by: yangerkun <yangerkun@huawei.com>
> Fixes: dc2676210c42 ("dm crypt: offload writes to thread")
> Cc: stable@vger.kernel.org
> 
> ---
>  drivers/md/dm-crypt.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> Index: linux-2.6/drivers/md/dm-crypt.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/dm-crypt.c
> +++ linux-2.6/drivers/md/dm-crypt.c
> @@ -1954,6 +1954,7 @@ pop_from_list:
>  			io = crypt_io_from_node(rb_first(&write_tree));
>  			rb_erase(&io->rb_node, &write_tree);
>  			kcryptd_io_write(io);
> +			cond_resched();
>  		} while (!RB_EMPTY_ROOT(&write_tree));
>  		blk_finish_plug(&plug);
>  	}
> 

I suggested the same here:
https://listman.redhat.com/archives/dm-devel/2023-February/053402.html

Yet yangerkun resisted it:
https://listman.redhat.com/archives/dm-devel/2023-February/053410.html

And stuck with their more throttled approach (which looks wrong to me,
shouldn't it be using time_is_after_jiffies!?)
https://listman.redhat.com/archives/dm-devel/2023-March/053473.html

Anyway, I'm inclined to take your patch, I share your views:
https://listman.redhat.com/archives/dm-devel/2023-March/053470.html

Mike

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2023-03-06 16:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 16:17 [dm-devel] [PATCH] dm-crypt: add cond_resched() to dmcrypt_write() Mikulas Patocka
2023-03-06 16:33 ` Mike Snitzer [this message]
2023-03-07  1:16   ` [dm-devel] " yangerkun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZAYV6OekGBVFgjAM@redhat.com \
    --to=snitzer@kernel.org \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=yangerkun@huawei.com \
    --cc=yangerkun@huaweicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.