Il 19/08/2013 21:10, Michael S. Tsirkin ha scritto:
> virtio-blk is widely used. I wouldn't write it off just yet.
> So I think these comments are valuable.
>
> For example, this made me realize that even when scsi command
> pass-through is enabled, we either take the clue on WCE support from
> host feature bit. This is wrong, isn't it?
No, it isn't. Very much the contrary, actually.
> We really should send scsi
> commands to the device to figure out and set/clear it.
Absolutely not, because this would bypass the host kernel. Flush
requests would not work properly.
There is _no_ reason why a guest kernel should _ever_ use
VIRTIO_BLK_F_SCSI, except if userspace tells it to (with the assumption
that userspace knows what it's doing).
In fact, deprecating VIRTIO_BLK_F_SCSI would be a very good idea. It is
half-assed, as Rusty put it, confusing, and mostly useless. It's also
one of the few cases where we rely on buffers to determine field sizes.
> I also note that virtio-blk simply has custom sysfs attributes
> for WCE control and status. Is this normal?
Yes, the sysfs attribute is modeled after the one for SCSI disks.
> James, are there tools that send scsi commands to block devices
> to control WCE?
You can use sg_raw, but it is not safe. Not coincidentially, the
sg3_utils suite has a tool to send MODE SENSE (i.e. grab the raw state
from the block device), but no tool to send MODE SELECT.
Paolo