From: Stefan Hajnoczi <stefanha@redhat.com>
To: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Hanna Reitz <hreitz@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>,
qemu-devel@nongnu.org
Subject: Re: [PATCH 0/2] virtio-blk and scsi: replace dataplane_{start/stopping/started}
Date: Mon, 8 Aug 2022 11:52:39 -0400 [thread overview]
Message-ID: <YvExR5byISBIB/G5@fedora> (raw)
In-Reply-To: <20220808094147.612472-1-eesposit@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1548 bytes --]
On Mon, Aug 08, 2022 at 05:41:45AM -0400, Emanuele Giuseppe Esposito wrote:
> The way the dataplane stages at startup and stop are monitored is unnecessary
> complicated. In virtio-scsi we have dataplane_started, dataplane_starting and
> dataplane_stopping in VirtIOSCSI.
> In virtio-blk we have dataplene_started in VirtIOBlock, and starting and stopping
> in VirtIOBlockDataPlane.
>
> Just replace all these flags with an atomic enum.
>
> Based-on: 20220803162824.948023-1-stefanha@redhat.com
As mentioned on IRC, I don't think it's useful to combine these fields
into a state machine because they serve different purposes
(starting/stopping prevents re-entrancy, started/stopped tracks whether
dataplane is enabled, and fenced tracks whether dataplane is broken).
Combining them all makes it harder to refactor those separate concerns.
In the future it would be nice to refactor away all this state and have
stateless IOThread support (I haven't figured out whether that's
possible yet).
I'm not against merging this, but I don't think using an enum is an
improvement - it's just different.
Regarding thread-safety, we need to guarantee that the state stored by a
QEMU thread is visible to the IOThread. This patch series doesn't really
do this: relaxed loads/stores aren't guaranteed to be visible to the
other thread. I comment on this in the patch: there needs to be at least
a comment or maybe something extra, like a memory barrier or stronger
atomic operation, to make the change to atomics worthwhile.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-08-08 15:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 9:41 [PATCH 0/2] virtio-blk and scsi: replace dataplane_{start/stopping/started} Emanuele Giuseppe Esposito
2022-08-08 9:41 ` [PATCH 1/2] virtio-scsi: replace VirtIOBlock dataplane_{start/starting/stopped} with enum Emanuele Giuseppe Esposito
2022-08-08 15:43 ` Stefan Hajnoczi
2022-08-08 9:41 ` [PATCH 2/2] virtio-blk: replace dataplane_start/stopping/started " Emanuele Giuseppe Esposito
2022-08-08 15:43 ` Stefan Hajnoczi
2022-08-08 15:52 ` Stefan Hajnoczi [this message]
2022-08-08 16:29 ` [PATCH 0/2] virtio-blk and scsi: replace dataplane_{start/stopping/started} Stefan Hajnoczi
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=YvExR5byISBIB/G5@fedora \
--to=stefanha@redhat.com \
--cc=eesposit@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@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).