On 01.02.24 16:25, Hanna Czenczek wrote:
On 01.02.24 15:28, Stefan Hajnoczi wrote:
[...]
Did you find a scenario where the virtio-scsi AioContext is different
from the scsi-hd BB's Aiocontext?
Technically, that’s the reason for this thread, specifically that
virtio_scsi_hotunplug() switches the BB back to the main context while
scsi_device_for_each_req_async_bh() is running. Yes, we can fix that
specific case via the in-flight counter, but I’m wondering whether
there’s really any merit in requiring the BB to always be in
virtio-scsi’s context, or whether it would make more sense to schedule
everything in virtio-scsi’s context. Now that BBs/BDSs can receive
requests from any context, that is.
Now that I know that wouldn’t be easy, let me turn this around: As far
as I understand, scsi_device_for_each_req_async_bh() should still run in
virtio-scsi’s context, but that’s hard, so we take the BB’s context,
which we therefore require to be the same one. Further, (again AFAIU,)
virtio-scsi’s context cannot change (only set in
virtio_scsi_dataplane_setup(), which is run in
virtio_scsi_device_realize()). Therefore, why does the
scsi_device_for_each_req_async() code accommodate for BB context changes?
Hanna