From: Maxim Levitsky <mlevitsk@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Fam Zheng" <fam@euphon.net>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v4 6/9] scsi/scsi-bus: scsi_device_find: don't return unrealized devices
Date: Wed, 09 Sep 2020 11:15:57 +0300 [thread overview]
Message-ID: <c32cf4169a941f0dee057eda59ce96e71b4fa541.camel@redhat.com> (raw)
In-Reply-To: <20200908150038.GE7154@stefanha-x1.localdomain>
On Tue, 2020-09-08 at 16:00 +0100, Stefan Hajnoczi wrote:
> On Mon, Aug 31, 2020 at 06:01:21PM +0300, Maxim Levitsky wrote:
> > The device core first places a device on the bus and then realizes it.
> > Make scsi_device_find avoid returing such devices to avoid
> > races in drivers that use an iothread (currently virtio-scsi)
> >
> > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1812399
> >
> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> > ---
> > hw/scsi/scsi-bus.c | 88 ++++++++++++++++++++++++++++------------------
> > 1 file changed, 53 insertions(+), 35 deletions(-)
> >
> > diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> > index 92d412b65c..7ceae2c92b 100644
> > --- a/hw/scsi/scsi-bus.c
> > +++ b/hw/scsi/scsi-bus.c
> > @@ -51,6 +51,56 @@ static const TypeInfo scsi_bus_info = {
> > };
> > static int next_scsi_bus;
> >
> > +static SCSIDevice *_scsi_device_find(SCSIBus *bus, int channel, int id, int lun,
> > + bool include_unrealized)
>
> Declaring an identifier with a leading underscore with file scope is
> undefined behavior according to the C99 standard (7.1.3 Reserved
> identifiers). QEMU code usually avoids doing this by calling the
> function do_scsi_device_find() or similar.
I'll fix that, thanks!
Best regards,
Maxim Levitsky
>
> I'm not aware of any practical problem though, so don't worry about
> changing it unless you respin the series:
>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
next prev parent reply other threads:[~2020-09-09 8:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 15:01 [PATCH v4 0/9] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 1/9] scsi/scsi_bus: switch search direction in scsi_device_find Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 2/9] rcu: Implement drain_call_rcu Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 3/9] device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 4/9] device-core: use RCU for list of childs of a bus Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 5/9] device-core: use atomic_set on .realized property Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 6/9] scsi/scsi-bus: scsi_device_find: don't return unrealized devices Maxim Levitsky
2020-09-08 15:00 ` Stefan Hajnoczi
2020-09-09 8:15 ` Maxim Levitsky [this message]
2020-08-31 15:01 ` [PATCH v4 7/9] scsi/scsi_bus: Add scsi_device_get Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 8/9] virtio-scsi: use scsi_device_get Maxim Levitsky
2020-08-31 15:01 ` [PATCH v4 9/9] scsi/scsi_bus: fix races in REPORT LUNS Maxim Levitsky
2020-09-01 9:15 ` Maxim Levitsky
2020-09-08 15:27 ` Stefan Hajnoczi
2020-09-09 8:20 ` Maxim Levitsky
2020-09-11 15:12 ` 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=c32cf4169a941f0dee057eda59ce96e71b4fa541.camel@redhat.com \
--to=mlevitsk@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 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).