qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Ari Sundholm <ari@tuxera.com>
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [PATCH v3] block/blklogwrites: Protect mutable driver state with a mutex.
Date: Fri, 19 Jan 2024 18:47:34 +0100	[thread overview]
Message-ID: <Zaq1tkw1E2RFZm1n@redhat.com> (raw)
In-Reply-To: <20240119162913.2620245-1-ari@tuxera.com>

Am 19.01.2024 um 17:29 hat Ari Sundholm geschrieben:
> During the review of a fix for a concurrency issue in blklogwrites,
> it was found that the driver needs an additional fix when enabling
> multiqueue, which is a new feature introduced in QEMU 9.0, as the
> driver state may be read and written by multiple threads at the same
> time, which was not the case when the driver was originally written.
> 
> Fix the multi-threaded scenario by introducing a mutex to protect the
> mutable fields in the driver state, and always having the mutex locked
> by the current thread when accessing them. Also use the mutex and a
> CoQueue to ensure that the super block is not being written to by
> multiple threads concurrently and updates are properly serialized.
> 
> Additionally, add the const qualifier to a few BDRVBlkLogWritesState
> pointer targets in contexts where the driver state is not written to.
> 
> Signed-off-by: Ari Sundholm <ari@tuxera.com>
> 
> v1->v2: Ensure that the super block is not written to concurrently.
> v2->v3: Use a CoQueue instead of a condition variable, as the latter
> does not make the currently executing coroutine yield on entering a
> wait.
> ---
>  block/blklogwrites.c | 85 +++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 77 insertions(+), 8 deletions(-)

For your next series, please put the changelog between versions below
the "---" marker so that git am doesn't consider it part of the commit
message.

Thanks, applied to the block branch.

Kevin



      reply	other threads:[~2024-01-19 17:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 18:46 [PATCH] block/blklogwrites: Fix a bug when logging "write zeroes" operations megari
2024-01-10 13:39 ` Kevin Wolf
2024-01-10 15:21   ` Ari Sundholm
2024-01-10 17:21     ` Kevin Wolf
2024-01-11 12:34     ` [PATCH] block/blklogwrites: Protect mutable driver state with a mutex Ari Sundholm via
     [not found]     ` <20240110195005.1263619-1-ari@tuxera.com>
2024-01-11 14:06       ` Kevin Wolf
2024-01-11 14:53         ` Ari Sundholm
2024-01-11 16:32     ` [PATCH v2] " Ari Sundholm via
2024-01-18 19:18       ` Kevin Wolf
2024-01-19 16:55         ` Ari Sundholm
2024-01-19 17:41           ` Kevin Wolf
2024-01-19 16:29     ` [PATCH v3] " Ari Sundholm via
2024-01-19 17:47       ` Kevin Wolf [this message]

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=Zaq1tkw1E2RFZm1n@redhat.com \
    --to=kwolf@redhat.com \
    --cc=ari@tuxera.com \
    --cc=hreitz@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;
as well as URLs for NNTP newsgroup(s).