qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about scsi device hotplug (e.g scsi-hd)


From: Maxim Levitsky
Subject: Re: Question about scsi device hotplug (e.g scsi-hd)
Date: Thu, 02 Apr 2020 11:46:57 +0300

On Wed, 2020-04-01 at 18:36 +0200, Paolo Bonzini wrote:
> On 01/04/20 17:09, Stefan Hajnoczi wrote:
> > > What do you think about it?
> > 
> > Maybe aio_disable_external() is needed to postpone device emulation
> > until after realize has finished?

Isn't that virtio specific? In theory this issue can touch any driver that
behaves similar to scsi.

Also due to racing, the request might already be in virtqueue and the 
virtio-scsi iothread might have already
fetched it when we place the device on the bus.

In fact I don't see any locking in bus_add_child / scsi_device_find so in fact 
if the timing is right
and iothread calls the scsi_device_find while main thread adds the device on 
the bus that will cause
the whole thing go south.

IMHO the right solution for this is first to realize the device and then place 
it
on the bus, and even that I am not sure that will fix the race completely.

IMHO the correct solution here is to stop querying the bus children on the 
guest controlled IO path 
(scsi_device_find) but rather use the hotplug handlers to
store the active luns of the scsi device in parallel (and with proper locking).


Best regards,
        Maxim Levitsky


> > 
> > Virtqueue kick ioeventfds are marked "external" and won't be processed
> > while external events are disabled.  See also
> > virtio_queue_aio_set_host_notifier_handler() ->
> > aio_set_event_notifier().
> 
> Yes, I think Stefan is right.
> 
> Paolo
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]