public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: Alberto Garcia <berto@igalia.com>,
	Jorge Merlino <jorge.merlino@canonical.com>,
	Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, Hanna Czenczek <hreitz@redhat.com>
Subject: [PATCH v2 0/1] Fix race condition in throttle_group_restart_queue()
Date: Thu, 12 Mar 2026 12:08:41 +0100	[thread overview]
Message-ID: <cover.1773313028.git.berto@igalia.com> (raw)

Hi,

here's version two of the patch. The important change is that now
throttle_group_restart_tgm() is protected by tg->lock and there's new
logic there.

Note that in case (2) it is theoretically possible for two different
tgms to run throttle_group_restart_queue() in parallel, but I think
this is safe because the actual restart of the queue is once more
protected by the lock.

The alternative that I initially considered (doing nothing if another
tgm is waiting for a timer) is probably not a good idea because
throttle_group_restart_tgm() is used by callers who want to drain a
tgm so I think that the requests should be processed immediately:

    if (qatomic_fetch_inc(&tgm->io_limits_disabled) == 0) {
        throttle_group_restart_tgm(tgm);
    }

Once more, please test this carefully to see if it solves issue #3194.
I have only run the basic qemu iotests and I haven't touched this code
in a long time :)

Regards,

Berto

Alberto Garcia (1):
  throttle-group: Fix race condition in throttle_group_restart_queue()

 block/throttle-groups.c | 70 +++++++++++++++++++++++++++++++----------
 1 file changed, 54 insertions(+), 16 deletions(-)

-- 
2.47.3



             reply	other threads:[~2026-03-12 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 11:08 Alberto Garcia [this message]
2026-03-12 11:08 ` [PATCH v2 1/1] throttle-group: Fix race condition in throttle_group_restart_queue() Alberto Garcia

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=cover.1773313028.git.berto@igalia.com \
    --to=berto@igalia.com \
    --cc=hreitz@redhat.com \
    --cc=jorge.merlino@canonical.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox