Il 20/08/2013 16:13, James Bottomley ha scritto:
> > 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? We really should send scsi
> > commands to the device to figure out and set/clear it.
>
> Right: this illustrates how the incremental addition can be done: do
> pass through on the mode sense SCSI uses to decide this and discovery
> can proceed normally. Older virtio says I don't know what you're
> talking about and SCSI assumes write through ... the same will work for
> all the other features.
No, please don't!!!
The host is _not_ supposed to have a SCSI target implementation for
VIRTIO_BLK_F_SCSI's sake, no matter how simple!
And the guest is not supposed to build CDBs if you are using virtio-blk
(if you are writing a Windows driver, you have to interpret CDBs, but
that's a different story).
If you want CDBs, that's perfect---but then your device model should
follow the virtio-scsi spec and reuse _all_ the SCSI code in the guest
(virtio-scsi.c and sd.c).
Do not try to resurrect the utterly broken VIRTIO_BLK_F_SCSI experiment
that unluckily made it to the spec. And keep virtio-blk damn simple.
If that means not adding a feature, do not add it.
>> > I also note that virtio-blk simply has custom sysfs attributes
>> > for WCE control and status. Is this normal?
>> > James, are there tools that send scsi commands to block devices
>> > to control WCE?
> Yes, it's actually very simple
>
> echo "cache type" > /sys/class/scsi_disk/<dev>/cache_type
Same for virtio-blk, though the change is always volatile.
Paolo