public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Paolo Bonzini <pbonzini@redhat.com>,
	virtualization <virtualization@lists.linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	linux-scsi <linux-scsi@redhat.com>
Subject: Re: [PATCH] Add virtio-scsi to the virtio spec
Date: Thu, 01 Dec 2011 13:44:37 +1030	[thread overview]
Message-ID: <87sjl5rnj6.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1322661042-28191-1-git-send-email-pbonzini@redhat.com>

On Wed, 30 Nov 2011 14:50:41 +0100, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Hi all,
> 
> here is the specification for a virtio-based SCSI host (controller, HBA,
> you name it).  The virtio SCSI host is the basis of an alternative
> storage stack for KVM. This stack would overcome several limitations of
> the current solution, virtio-blk:

OK, I like the idea, but I'd prefer to see the spec only cover things
which are implemented and tested, otherwise the risk of a flaw in the
spec is really high in my experience.

Comments below:

>   num_queues is the total number of virtqueues exposed by the
>     device. The driver is free to use only one request queue, or
>     it can use more to achieve better performance.

s/total number of virtqueues/total number of request virtqueues/ ?

>   max_channel, max_target and max_lun can be used by the driver
>     as hints for scanning the logical units on the host. In the
>     current version of the spec, they will always be respectively
>     0, 255 and 16383.

s/hints for scanning/hints to constrain scanning/ ? (I assume).  But why
mention the current values?  That doesn't help someone implementing a
driver or a device.  If you want to, you could mention that as an
implementation detail of your current implmentation, but it seems out of
place in the spec.

> If the driver uses the eventq, it should then place at least a
> buffer in the eventq.

s/at least a/at least one/

> The driver queues requests to an arbitrary request queue, and they are
> used by the device on that same queue. In this version of the spec,
> if a driver uses more than one queue it is the responsibility of the
> driver to ensure strict request ordering; commands placed on different
> queue will be consumed with no order constraints.

Suggest simplification of second sentence:

It is the responsibility of the driver to ensure strict request
ordering; commands placed on different queues will be consumed with no
order constraints.

> The lun field addresses a target and logical unit in the
> virtio-scsi device's SCSI domain. In this version of the spec,
> the only supported format for the LUN field is: first byte set to
> 1, second byte set to target, third and fourth byte representing
> a single level LUN structure, followed by four zero bytes. With
> this representation, a virtio-scsi device can serve up to 256
> targets and 16384 LUNs per target.

You keep saying "In this version of the spec".  I would delete that
phrase everywhere.

> Task_attr, prio and crn should be left to zero: command priority
> is explicitly not supported by this version of the device;
> task_attr defines the task attribute as in the table above, but
> all task attributes may be mapped to SIMPLE by the device; crn
> may also be provided by clients, but is generally expected to be
> 0. The maximum CRN value defined by the protocol is 255, since
> CRN is stored in an 8-bit integer.

Be braver in your language please.  It helps poor implementers who are
already confused by learning SCSI and virtio:

 Task_attr, and prio must be zero.[1] task_attr defines the task
 attribute as in the table above, but all task attributes may be mapped
 to SIMPLE by the device; crn may also be provided by clients, but is
 generally expected to be 0.

 [1] Future extensions may use these fields.

Is it useful for a driver to specify ordered (or other) modes, knowing
it could be reduced to SIMPLE without it being aware?  Or should we use
feature bits to indicate what the device supports?

>   Note that since ACA is not supported by this version of the
>   spec, VIRTIO_SCSI_T_TMF_CLEAR_ACA is always a no-operation.

I think if you don't support ACA in the spec, don't define this.  How
will a driver author use this information?

>     struct virtio_scsi_ctrl_an {
>	 u32 type;
>	 u8  lun[8];
>	 u32 event_requested;
>	 u32 event_actual;
>	 u8  response;
>     }

With all these structures, you might want a comment indicating the
read-only and write-only (from the device POV) parts of the struct, eg:

     struct virtio_scsi_ctrl_an {
         // Read-only part
	 u32 type;
	 u8  lun[8];
	 u32 event_requested;
         // Write-only part
	 u32 event_actual;
	 u8  response;
     }

But basically, though I know nothing about SCSI, I like both the content
and style of this addition!

Thanks,
Rusty.

  parent reply	other threads:[~2011-12-01  3:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 13:50 [PATCH] Add virtio-scsi to the virtio spec Paolo Bonzini
2011-11-30 13:50 ` virtio-scsi spec (was Re: [PATCH] Add virtio-scsi to the virtio spec) Paolo Bonzini
2011-11-30 14:17   ` Hannes Reinecke
2011-11-30 16:36     ` Paolo Bonzini
2011-12-01  9:52       ` Hannes Reinecke
2011-12-01  8:49         ` Paolo Bonzini
2011-12-01  3:14 ` Rusty Russell [this message]
2011-12-01  8:55   ` [PATCH] Add virtio-scsi to the virtio spec Paolo Bonzini
2011-12-02  0:51     ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sjl5rnj6.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox