From: no-reply@sashiko.virtuozzo.com
To: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>,
khorenko@virtuozzo.com, alexander.ivanov@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v3 4/8] dm-qcow2: add per-qio work infrastructure
Date: Fri, 13 Nov 2026 11:30:30 +0000 [thread overview]
Message-ID: <010701a1d4ac6557-67522198-e0b4-4278-a290-6e2d71c88751-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261113111126.793039-5-andrey.zhadchenko@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dm-qcow2: concurrent qio preparers hold partial splits while
sleeping in mempool_alloc()
- [Low] dm-qcow2: redundant qio->state init in
qcow2_submit_embedded_qio()
--
commit f0e3abee17282a35ee80199fc8894df280f02698
Author: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
dm-qcow2: add per-qio work infrastructure
This commit adds a work_struct and a state field to struct qio. It uses them to queue qio preparation (prepare_one_embedded_qio()) as a per-request work item. Previously this ran inside the main qcow2->worker.
> diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
> index b9daa258285e..496fbcc61348 100644
> --- a/drivers/md/dm-qcow2-map.c
> +++ b/drivers/md/dm-qcow2-map.c
> @@ -4710,7 +4702,7 @@ static void qcow2_submit_embedded_qio(struct qcow2_target *tgt, struct qio *qio)
>
> if (blk_rq_bytes(rq)) {
> queue_list_id = QLIST_EMBEDDED;
> - worker = &qcow2->worker;
> + worker = &qio->worker;
> } else {
[Severity: Medium]
As reported by no-reply@sashiko.virtuozzo.com on v2 [1], can concurrent
preparers deadlock on qio_pool under memory pressure?
Every data request now gets its own work item on tgt->wq, which is
WQ_UNBOUND, so many of them can run at once. Each one runs
do_qio_work() -> prepare_one_embedded_qio() -> qcow2_split_qio_to_list()
-> split_and_chain_qio(), which calls qcow2_alloc_qio() on the shared
512-element qio_pool. That is a blocking mempool_alloc(GFP_NOIO).
The splits are kept on a local list and are released only after the whole
request has been split. Several preparers can each hold part of the
reserve while sleeping in mempool_alloc() for more. None of them can make
progress, and the device hangs. Before this patch only one preparer ran
at a time, inside qcow2->worker.
Would a non-blocking first pass, with a serialized sleeping fallback as
dm-crypt does, avoid this?
> @@ -4726,7 +4718,10 @@ static void qcow2_submit_embedded_qio(struct qcow2_target *tgt, struct qio *qio)
> qio->qcow2 = qcow2;
> qio->queue_list_id = queue_list_id;
> qio->ref_index = ref_index;
> - list_add_tail(&qio->link, &qcow2->qios[qio->queue_list_id]);
> + if (queue_list_id == QLIST_EMBEDDED)
> + qio->state = QIO_STATE_START;
> + else
> + list_add_tail(&qio->link, &qcow2->qios[qio->queue_list_id]);
> }
> spin_unlock_irqrestore(&qcow2->deferred_lock, flags);
[Severity: Low]
This isn't a bug, but is this qio->state assignment needed?
qcow2_init_qio() already sets qio->state = QIO_STATE_START before the qio
is submitted, and QIO_STATE_START is the only state. Dropping it would
also remove the if/else inside the deferred_lock section, leaving just
the list_add_tail() for the non-embedded case.
[1] https://lore.kernel.org/r/010701a1c556541f-a3b013d6-70e1-45b6-bfc1-37c018cdf88f-000000@eu-central-1.amazonses.com
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261113111126.793039-1-andrey.zhadchenko@virtuozzo.com?part=4
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-13 11:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 11:11 [Devel] [PATCH hci-8.1 v3 0/8] dm-qcow2: per-qio fast path Andrey Zhadchenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 1/8] dm-qcow2: repeat md page lookup if it was inserted in parallel Andrey Zhadchenko
2026-11-13 11:22 ` no-reply
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 2/8] dm-qcow2: prepare process_one_qio() for fastpath Andrey Zhadchenko
2026-11-13 11:26 ` no-reply
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 3/8] dm-qcow2: count fast path writes in parse_metadata() Andrey Zhadchenko
2026-11-13 11:27 ` no-reply
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 4/8] dm-qcow2: add per-qio work infrastructure Andrey Zhadchenko
2026-11-13 11:30 ` no-reply [this message]
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 5/8] dm-qcow2: implement per-qio fast processing Andrey Zhadchenko
2026-11-13 11:31 ` no-reply
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 6/8] dm-qcow2: add fast_path module parameter Andrey Zhadchenko
2026-11-13 11:31 ` no-reply
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 7/8] dm-qcow2: process fast path qios in per-cpu batches on a workqueue Andrey Zhadchenko
2026-11-13 11:33 ` no-reply
2026-11-13 19:48 ` Konstantin Khorenko
2026-11-13 11:11 ` [Devel] [PATCH hci-8.1 v3 8/8] dm-qcow2: declare DM_TARGET_NOWAIT Andrey Zhadchenko
2026-11-13 11:33 ` no-reply
2026-11-13 19:48 ` [Devel] [PATCH hci-8.1 v3 0/8] dm-qcow2: per-qio fast path Konstantin Khorenko
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=010701a1d4ac6557-67522198-e0b4-4278-a290-6e2d71c88751-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=alexander.ivanov@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.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.