Skip to contentSkip to conversation

virtio config access races

DISCUSSION Michael S. Tsirkin 2 participants 3 messages Jul 12, 2012 – Jul 13, 2012

Subsystems (2)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

It looks like there's a problem in the way virtio config currently
works: if driver reads config in probe routine, config subsequently can change before core sets DRIVER_OK. This will not cause an interrupt and so this event is lost. Maybe we should document that devices should delay such events until after DRIVER_OK?

Signature · 1 line
MST
#1 lore raw
Quoted 6 lines · Michael S. Tsirkin

It looks like there's a problem in the way virtio config currently
works: if driver reads config in probe routine, config subsequently can change before core sets DRIVER_OK. This will not cause an interrupt and so this event is lost. Maybe we should document that devices should delay such events until after DRIVER_OK?

The device is currently defined to be active from the time we acknowledge the features (which means we may get a spurious interrupt before we probe, I think). We abuse this for virtio_blk for example, where we add_disk() inside the probe function.

Hmm, the changed interrupt is live from find_vqs, right? Perhaps we should leave it to drivers to set that up in the right order.

Thoughts?
Rusty.

#2 lore raw
In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin

It looks like there's a problem in the way virtio config currently
works: if driver reads config in probe routine, config subsequently can change before core sets DRIVER_OK. This will not cause an interrupt and so this event is lost. Maybe we should document that devices should delay such events until after DRIVER_OK?

The device is currently defined to be active from the time we acknowledge the features (which means we may get a spurious interrupt before we probe, I think). We abuse this for virtio_blk for example, where we add_disk() inside the probe function.

Hmm, the changed interrupt is live from find_vqs, right? Perhaps we should leave it to drivers to set that up in the right order.

Thoughts?
Rusty.