All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v2 1/2] drivers/vhost/blk: fix a flush hang on requests completed after worker kill
Date: Fri, 13 Nov 2026 20:55:17 +0100	[thread overview]
Message-ID: <179459971758.57567.10597992512423170818.b4-review@b4> (raw)
In-Reply-To: <20261113082744.2334476-2-alexander.ivanov@virtuozzo.com>

I can apply it with these fixes on my side:
- the first sentence says the hang needs vhost_task workers
- the work item is needed because releasing a request takes vq->mutex
  and flush_lock, not because of kvfree()
- dropped the sentence about VHOST_RESET_OWNER

On Fri, 13 Nov 2026 09:27:43 +0100, Alexander Ivanov wrote:
> When the owner is killed, vhost_worker_killed() detaches the worker
> from the virtqueues and runs only the work already queued.

Changed to "With vhost_task workers (not the default kthread ones),
killing the owner makes vhost_worker_killed() detach the worker ...".

Why: vhost_worker_killed() exists only for vhost_task workers. Our
kernel defaults to kthread workers (fork_from_owner_default), and our
QEMU does not ask for a vhost_task. A kthread worker is not killed with
QEMU and completes the requests, so the default setup does not hang.

> completion may run in interrupt context, where forget_request() and
> the kvfree() of the request buffers are not allowed.

Changed to "where a request cannot be released: that takes vq->mutex,
and flush_lock with plain spin_lock()".

Why: kvfree() is allowed there, vfree() defers itself when
in_interrupt().

> requests. Flushing there rather than in release also keeps a stale
> drop work from releasing requests of the next owner after
> VHOST_RESET_OWNER.

Dropped.

Why: the drop work is queued only after the owner was killed, and then
nobody passes vhost_dev_check_owner(), so no VHOST_RESET_OWNER can
follow. The flush is in vhost_blk_drop_backend() because the requests
are freed right after it, which the sentence before already says.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-13 19:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  8:27 [Devel] [PATCH hci-8.1 v2 0/2] drivers/vhost/blk: support VIRTIO_BLK_F_WRITE_ZEROES Alexander Ivanov
2026-11-13  8:27 ` [Devel] [PATCH hci-8.1 v2 1/2] drivers/vhost/blk: fix a flush hang on requests completed after worker kill Alexander Ivanov
2026-11-13  8:34   ` no-reply
2026-11-13 19:55   ` Konstantin Khorenko [this message]
2026-11-13  8:27 ` [Devel] [PATCH hci-8.1 v2 2/2] drivers/vhost/blk: support VIRTIO_BLK_F_WRITE_ZEROES Alexander Ivanov
2026-11-13  8:37   ` no-reply
2026-11-13 19:55   ` Konstantin Khorenko
2026-11-13 19:55 ` [Devel] [PATCH hci-8.1 v2 0/2] " 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=179459971758.57567.10597992512423170818.b4-review@b4 \
    --to=khorenko@virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=devel@openvz.org \
    /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.