Patchwork virtio-scsi spec: add per-LUN parameter query

login
register
mail settings
Submitter Cong Meng
Date Aug. 20, 2012, 9:03 a.m.
Message ID <1345453404-15244-1-git-send-email-mc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/178715/
State New
Headers show

Comments

Cong Meng - Aug. 20, 2012, 9:03 a.m.
Each virtio scsi HBA has global request queue limits. But the passthrough
LUNs (scsi-generic) come from different host HBAs may have different request
queue limits. If the guest sends commands that exceed the host limits, the
commands will be rejected by host HAB. 

To address this issue, this patch adds a per-LUN parameter query via the control
queue, and defines some parameter query types. The driver can query and set the
needed per-LUN parameters if the device enables this feature.

Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
--
 virtio-spec.lyx |  218 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 218 insertions(+), 0 deletions(-)
Paolo Bonzini - Aug. 20, 2012, 1:18 p.m.
Il 20/08/2012 11:03, Cong Meng ha scritto:
> Each virtio scsi HBA has global request queue limits. But the passthrough
> LUNs (scsi-generic) come from different host HBAs may have different request
> queue limits. If the guest sends commands that exceed the host limits, the
> commands will be rejected by host HAB. 
> 
> To address this issue, this patch adds a per-LUN parameter query via the control
> queue, and defines some parameter query types. The driver can query and set the
> needed per-LUN parameters if the device enables this feature.
> 
> Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
> --
>  virtio-spec.lyx |  218 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 218 insertions(+), 0 deletions(-)

Do you have kernel and QEMU patches for this?  That would help me
evaluate whether the interface is the correct one.

In any case, I'd rather have a single command returning all three values
(VIRTIO_SCSI_T_LUN_QUEUE_PARAMS), since it's unlikely that you need just
one.

Paolo
McPacino - Aug. 20, 2012, 2:44 p.m.
在 2012-8-20 下午9:18,"Paolo Bonzini" <pbonzini@redhat.com>写道:
>
> Il 20/08/2012 11:03, Cong Meng ha scritto:
> > Each virtio scsi HBA has global request queue limits. But the
passthrough
> > LUNs (scsi-generic) come from different host HBAs may have different
request
> > queue limits. If the guest sends commands that exceed the host limits,
the
> > commands will be rejected by host HAB.
> >
> > To address this issue, this patch adds a per-LUN parameter query via
the control
> > queue, and defines some parameter query types. The driver can query and
set the
> > needed per-LUN parameters if the device enables this feature.
> >
> > Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
> > --
> >  virtio-spec.lyx |  218
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 218 insertions(+), 0 deletions(-)
>
> Do you have kernel and QEMU patches for this?  That would help me
> evaluate whether the interface is the correct one.
>
yes,I have a demo. I will post it after I polish it tomorrow.

> In any case, I'd rather have a single command returning all three values
> (VIRTIO_SCSI_T_LUN_QUEUE_PARAMS), since it's unlikely that you need just
> one.

I intend to seperat them one by one. As there is opportunity that other new
parameters are needed for other features.

Thanks.
Cong.

>
> Paolo
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Paolo Bonzini - Aug. 20, 2012, 3:57 p.m.
Il 20/08/2012 16:44, McPacino ha scritto:
> 
> 在 2012-8-20 下午9:18,"Paolo Bonzini" <pbonzini@redhat.com
> <mailto:pbonzini@redhat.com>>写道:
>>
>> Il 20/08/2012 11:03, Cong Meng ha scritto:
>> > Each virtio scsi HBA has global request queue limits. But the
> passthrough
>> > LUNs (scsi-generic) come from different host HBAs may have different
> request
>> > queue limits. If the guest sends commands that exceed the host
> limits, the
>> > commands will be rejected by host HAB.
>> >
>> > To address this issue, this patch adds a per-LUN parameter query via
> the control
>> > queue, and defines some parameter query types. The driver can query
> and set the
>> > needed per-LUN parameters if the device enables this feature.
>> >
>> > Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com
> <mailto:mc@linux.vnet.ibm.com>>
>> > --
>> >  virtio-spec.lyx |  218
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >  1 files changed, 218 insertions(+), 0 deletions(-)
>>
>> Do you have kernel and QEMU patches for this?  That would help me
>> evaluate whether the interface is the correct one.
>>
> yes,I have a demo. I will post it after I polish it tomorrow.
> 
>> In any case, I'd rather have a single command returning all three values
>> (VIRTIO_SCSI_T_LUN_QUEUE_PARAMS), since it's unlikely that you need just
>> one.
> 
> I intend to seperat them one by one. As there is opportunity that other
> new parameters are needed for other features.

You can use more feature bits to dictate which bits are present.

Paolo

Patch

diff --git a/virtio-spec.lyx b/virtio-spec.lyx
index 7a073f4..6d23ab9 100644
--- a/virtio-spec.lyx
+++ b/virtio-spec.lyx
@@ -58,6 +58,7 @@ 
 \html_be_strict false
 \author -608949062 "Rusty Russell,,," 
 \author 1531152142 "Paolo Bonzini,,," 
+\author 2090695081 "Cong Meng,,," 
 \end_header
 
 \begin_body
@@ -7028,6 +7029,19 @@  VIRTIO_SCSI_F_CHANGE
 
 (2) The host will report changes to LUN parameters via a VIRTIO_SCSI_T_PARAM_CHA
 NGE event.
+\change_inserted 2090695081 1345439613
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 2090695081 1345442620
+VIRTIO_SCSI_F_PER_LUN_QUERY
+\begin_inset space ~
+\end_inset
+
+(3) The host will support the per-LUN parameter query.
+ 
 \change_unchanged
 
 \end_layout
@@ -8178,6 +8192,210 @@  response
 
 \begin_layout Standard
 No command-specific values are defined for the response byte.
+\change_inserted 2090695081 1345439679
+
+\end_layout
+
+\end_deeper
+\begin_layout Description
+
+\change_inserted 2090695081 1345441715
+Per
+\begin_inset space \space{}
+\end_inset
+
+LUN
+\begin_inset space \space{}
+\end_inset
+
+query
+\begin_inset space ~
+\end_inset
+
+
+\end_layout
+
+\begin_deeper
+\begin_layout Standard
+
+\change_inserted 2090695081 1345440230
+\begin_inset listings
+inline false
+status open
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441722
+
+#define VIRTIO_SCSI_T_PER_LUN_QUERY             3
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345440248
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441801
+
+/* query type */
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441725
+
+#define VIRTIO_SCSI_T_PLQ_MAX_SECTORS           0 
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441726
+
+#define VIRTIO_SCSI_T_PLQ_MAX_SEGMENTS          1 
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441727
+
+#define VIRTIO_SCSI_T_PLQ_MAX_SEGMENT_SIZE      2 
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345440248
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441729
+
+struct virtio_scsi_ctrl_plq {
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345440248
+
+    // Read-only part
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345440248
+
+    u32 type;
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441767
+
+    u8  lun[8];
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345441807
+
+    u32 query_type;
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345440248
+
+    // Write-only part
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345440248
+
+    u8  response;
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345445844
+
+    u32 parameter;
+\end_layout
+
+\begin_layout Plain Layout
+
+\change_inserted 2090695081 1345440248
+
+}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 2090695081 1345443439
+The type field should be VIRTIO_SCSI_T_PER_LUN_QUERY.
+ 
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 2090695081 1345445951
+The query_type field is defined as below:
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted 2090695081 1345445082
+VIRTIO_SCSI_T_PLQ_MAX_SECTORS: Maximum request size of the LUN's request
+ queue.
+ The unit is KB (1024 bytes).
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted 2090695081 1345446052
+VIRTIO_SCSI_T_PLQ_MAX_SEGMENTS: Maximum sg list segments of the LUN's request
+ queue.
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted 2090695081 1345445058
+VIRTIO_SCSI_T_PLQ_MAX_SEGMENT_SIZE: Maximum segment size of the LUN's request
+ queue.
+ The unit is byte.
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 2090695081 1345445877
+By sending this command, the driver asks the specified LUN to report the
+ parameter specified by the query_type field.
+ The device responds by writing the parameter that it supports into the
+ parameter field, and VIRTIO_SCSI_S_OK into the response field.
+ Otherwise the device should write the corresponding failure response value
+ into the response field.
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 2090695081 1345443070
+All fields of the read-only part are written by the driver.
+ All fields of the write-only part are written by the device.
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted 2090695081 1345440259
+No command-specific values are defined for the response byte.
 \end_layout
 
 \end_deeper