RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-29 Thread KY Srinivasan


 -Original Message-
 From: James Bottomley [mailto:jbottom...@parallels.com]
 Sent: Monday, July 28, 2014 1:03 PM
 To: KY Srinivasan
 Cc: linux-ker...@vger.kernel.org; h...@infradead.org; sits...@gmail.com;
 de...@linuxdriverproject.org; a...@canonical.com;
 martin.peter...@oracle.com; linux-scsi@vger.kernel.org;
 oher...@suse.com; gre...@linuxfoundation.org; jasow...@redhat.com
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
 On Mon, 2014-07-28 at 19:05 +, KY Srinivasan wrote:
 
   -Original Message-
   From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
   Sent: Monday, July 28, 2014 12:03 PM
   To: KY Srinivasan
   Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
   gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
   de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
   jasow...@redhat.com; jbottom...@parallels.com; linux-
   s...@vger.kernel.org
   Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks
   tests
  
KY == KY Srinivasan k...@microsoft.com writes:
  
   KY,
  
   KY At the time thin-provisioning was defined, the discovery
   KY information was first proposed in READ CAPACITY 16 command. And
   then
   KY moved into the new dedicated VPD page - B2h. You can see the
   KY information reported in this VPD page is richer than READ
   KY CAPACITY
   KY 16 command. As this transition happened during we added the
   KY feature, Windows uses the newer method that based on VPD page
   KY B2h. It looks Linux tries to use both new and old method which is
 weird to me.
  
   The READ CAPACITY(16) response is not optional.
 
  Ok; that settles the issue then. I will attempt to get it fixed on Windows.
 
 Like Martin says, this isn't optional either/or; it's mandatory to support 
 the RC
 16 bits.  If you don't want to get into playing the messenger between us and
 the windows guys on SCSI standards, we'd be happy to communicate
 directly, either by email or a phone meeting.

We will fix this bug in the next release of Windows; we are also looking at 
backporting the fix to prior versions of Windows.

Thanks,

K. Y



Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-29 Thread Martin K. Petersen
 KY == KY Srinivasan k...@microsoft.com writes:

KY We will fix this bug in the next release of Windows; we are also
KY looking at backporting the fix to prior versions of Windows.

Excellent. Thanks for looking into this!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread KY Srinivasan


 -Original Message-
 From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
 Sent: Saturday, July 26, 2014 12:25 PM
 To: KY Srinivasan
 Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
 gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
 de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
 jasow...@redhat.com; jbottom...@parallels.com; linux-
 s...@vger.kernel.org
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
  KY == KY Srinivasan k...@microsoft.com writes:
 
  Great! I'd just like to have a reasonable level of confidence in
  what's happening down the stack before I entertain turning something
  on that's not being properly advertised.
 
 KY As I look at the output of inquiry between Linux on Hyper-V and
 KY native Linux, is not specifying conformance level the main issue?
 
 The main problem for this particular use case (aside from the issue we've
 already addressed) is that the passthrough device (SATA SSD) has
 LBPME=0 in the READ CAPACITY(16) response. The LBP VPD is correctly
 provided with LBPU flag set but because LBPME is reported as disabled we
 will not attempt to issue UNMAP commands to the device.

Had a chance to chat with the Windows sscsi folks. Here is their response:

At the time  thin-provisioning was defined, the discovery information was 
first proposed in READ CAPACITY 16 command. And then moved into the new 
dedicated VPD page - B2h. You can see the information reported in this VPD page 
is richer than READ CAPACITY 16 command. As this transition happened during we 
added the feature, Windows uses the newer method that based on VPD page B2h. It 
looks Linux tries to use both new and old method which is weird to me.

Would it make sense for us to work  around this issue for Linux on Hyper-V 
(just use the VPD page instead of looking at the output of READ CAPACITY)?

Regards,

K. Y
 
 --
 Martin K. PetersenOracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread Martin K. Petersen
 KY == KY Srinivasan k...@microsoft.com writes:

KY,

KY At the time thin-provisioning was defined, the discovery
KY information was first proposed in READ CAPACITY 16 command. And then
KY moved into the new dedicated VPD page - B2h. You can see the
KY information reported in this VPD page is richer than READ CAPACITY
KY 16 command. As this transition happened during we added the feature,
KY Windows uses the newer method that based on VPD page B2h. It looks
KY Linux tries to use both new and old method which is weird to me.

The READ CAPACITY(16) response is not optional.

SBC3r36 section 4.7.3.3 Thin provisioned logical unit:

The device server in a thin provisioned logical unit shall set:

a) the LBPME bit to one in the READ CAPACITY (16) parameter data (see
   5.16.2); and

b) the PROVISIONING TYPE field to 010b (i.e., thin provisioned) in the
   Logical Block Provisioning VPD page (see 6.6.4).

That's a shall. The LBP VPD elaborates on the provisioning type,
commands preference, etc. But it's all gated by LBPME=1 in the READ
CAPACITY(16) response.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread KY Srinivasan


 -Original Message-
 From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
 Sent: Monday, July 28, 2014 12:03 PM
 To: KY Srinivasan
 Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
 gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
 de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
 jasow...@redhat.com; jbottom...@parallels.com; linux-
 s...@vger.kernel.org
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
  KY == KY Srinivasan k...@microsoft.com writes:
 
 KY,
 
 KY At the time thin-provisioning was defined, the discovery
 KY information was first proposed in READ CAPACITY 16 command. And
 then
 KY moved into the new dedicated VPD page - B2h. You can see the
 KY information reported in this VPD page is richer than READ CAPACITY
 KY 16 command. As this transition happened during we added the feature,
 KY Windows uses the newer method that based on VPD page B2h. It looks
 KY Linux tries to use both new and old method which is weird to me.
 
 The READ CAPACITY(16) response is not optional.

Ok; that settles the issue then. I will attempt to get it fixed on Windows.

K. Y

 
 --
 Martin K. PetersenOracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread James Bottomley
On Mon, 2014-07-28 at 19:05 +, KY Srinivasan wrote:
 
  -Original Message-
  From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
  Sent: Monday, July 28, 2014 12:03 PM
  To: KY Srinivasan
  Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
  gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
  de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
  jasow...@redhat.com; jbottom...@parallels.com; linux-
  s...@vger.kernel.org
  Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
  
   KY == KY Srinivasan k...@microsoft.com writes:
  
  KY,
  
  KY At the time thin-provisioning was defined, the discovery
  KY information was first proposed in READ CAPACITY 16 command. And
  then
  KY moved into the new dedicated VPD page - B2h. You can see the
  KY information reported in this VPD page is richer than READ CAPACITY
  KY 16 command. As this transition happened during we added the feature,
  KY Windows uses the newer method that based on VPD page B2h. It looks
  KY Linux tries to use both new and old method which is weird to me.
  
  The READ CAPACITY(16) response is not optional.
 
 Ok; that settles the issue then. I will attempt to get it fixed on Windows.

Like Martin says, this isn't optional either/or; it's mandatory to
support the RC 16 bits.  If you don't want to get into playing the
messenger between us and the windows guys on SCSI standards, we'd be
happy to communicate directly, either by email or a phone meeting.

James



RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread KY Srinivasan


 -Original Message-
 From: James Bottomley [mailto:jbottom...@parallels.com]
 Sent: Monday, July 28, 2014 1:03 PM
 To: KY Srinivasan
 Cc: linux-ker...@vger.kernel.org; h...@infradead.org; sits...@gmail.com;
 de...@linuxdriverproject.org; a...@canonical.com;
 martin.peter...@oracle.com; linux-scsi@vger.kernel.org;
 oher...@suse.com; gre...@linuxfoundation.org; jasow...@redhat.com
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
 On Mon, 2014-07-28 at 19:05 +, KY Srinivasan wrote:
 
   -Original Message-
   From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
   Sent: Monday, July 28, 2014 12:03 PM
   To: KY Srinivasan
   Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
   gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
   de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
   jasow...@redhat.com; jbottom...@parallels.com; linux-
   s...@vger.kernel.org
   Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks
   tests
  
KY == KY Srinivasan k...@microsoft.com writes:
  
   KY,
  
   KY At the time thin-provisioning was defined, the discovery
   KY information was first proposed in READ CAPACITY 16 command. And
   then
   KY moved into the new dedicated VPD page - B2h. You can see the
   KY information reported in this VPD page is richer than READ
   KY CAPACITY
   KY 16 command. As this transition happened during we added the
   KY feature, Windows uses the newer method that based on VPD page
   KY B2h. It looks Linux tries to use both new and old method which is
 weird to me.
  
   The READ CAPACITY(16) response is not optional.
 
  Ok; that settles the issue then. I will attempt to get it fixed on Windows.
 
 Like Martin says, this isn't optional either/or; it's mandatory to support 
 the RC
 16 bits.  If you don't want to get into playing the messenger between us and
 the windows guys on SCSI standards, we'd be happy to communicate
 directly, either by email or a phone meeting.

Thanks James. I will take up your offer if needed.

Regards,

K. Y
N�r��yb�X��ǧv�^�)޺{.n�+{{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj��!�i

RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-26 Thread KY Srinivasan


 -Original Message-
 From: James Bottomley [mailto:jbottom...@parallels.com]
 Sent: Friday, July 25, 2014 10:10 AM
 To: KY Srinivasan
 Cc: linux-ker...@vger.kernel.org; h...@infradead.org; sits...@gmail.com;
 de...@linuxdriverproject.org; a...@canonical.com;
 martin.peter...@oracle.com; linux-scsi@vger.kernel.org;
 oher...@suse.com; gre...@linuxfoundation.org; jasow...@redhat.com
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
 On Fri, 2014-07-25 at 16:47 +, KY Srinivasan wrote:
 
   -Original Message-
   From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
   Sent: Thursday, July 24, 2014 8:54 AM
   To: Sitsofe Wheeler
   Cc: Martin K. Petersen; Christoph Hellwig; KY Srinivasan;
   gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
   de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
   jasow...@redhat.com; jbottom...@parallels.com; linux-
   s...@vger.kernel.org
   Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks
   tests
  
Sitsofe == Sitsofe Wheeler sits...@gmail.com writes:
  
   Sitsofe So we can see it is really a SATA device that announces
   Sitsofe discard correctly and supports discard through WRITE_SAME(16).
  
   No, that's the SATA device that announces support for DSM TRIM, and
   as a result the Linux SATL reports support for WRITE SAME(16) w. the
   UNMAP bit set and LBPME.
  
   Sitsofe It is the act of passing it through Hyper-V that turned it
   Sitsofe into a SCSI device that supports UNMAP (but not
   Sitsofe WRITE_SAME(16)), doesn't announce its SCSI conformance
   Sitsofe number and doesn't correctly announce which features it
   Sitsofe supports. Surely in this case it's reasonable to quirk our way
 around the problem?
  
   No. That's an issue in Hyper-V that'll you'll have to take up with
   Microsoft. I don't know what their passthrough limitations are for SCSI-
 ATA translation.
   Maybe K. Y. has some insight into this?
 
  For the pass through case, the host validates the request and passes
  the request to the device.
  However, not all scsi commands are passed through even though the
  device it is being passed through may support the command. WRITE_SAME
  is one such command. Consequently, in the EVPD page, we will set state
  indicating that WRITE_SAME is not supported (even if the device
  supports it).
 
 I think you haven't appreciated the problem: He's passing a SATA SSD via the
 SCSI hyper-v interface.  That means that the windows host is doing SCSI-
 ATA translation.  The problem is that the Windows translation layer (SATL)
 looks to be incomplete and it's not correctly translating the IDENTIFY bit 
 that
 corresponds to TRIM to the correct VPD pages so consequently, Linux  won't
 send UNMAP commands to the device (to be translated back to TRIM).
 
 We already know this is a bug in the Windows SATL which needs fixing (if you
 could report it and get a fix, that would be great) and that we're not going 
 to
 be able to work around this automatically in Linux because the proposed
 patch would have us unconditionally try UNMAP for all Hyper-V devices.  The
 current proposed fix is to enable UNMAP manually via sysfs in the guest boot
 scripts, but obviously that means that Hyper-V guests with direct pass
 through of SSDs need operator intervention to turn on TRIM.

James,

Thanks for the clarification. I am talking to the folks in MSFT that develop 
the native scsi
stack on Windows. Hyper-V's back-end driver is not involved in SATL. I will 
keep you guys
posted.

Regards,

K. Y
 
 James



RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-26 Thread KY Srinivasan


 -Original Message-
 From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
 Sent: Friday, July 25, 2014 9:57 AM
 To: KY Srinivasan
 Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
 gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
 de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
 jasow...@redhat.com; jbottom...@parallels.com; linux-
 s...@vger.kernel.org
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
  KY == KY Srinivasan k...@microsoft.com writes:
 
 KY For the pass through case, the host validates the request and passes
 KY the request to the device.  However, not all scsi commands are
 KY passed through even though the device it is being passed through may
 KY support the command. WRITE_SAME is one such command.
 Consequently,
 KY in the EVPD page, we will set state indicating that WRITE_SAME is
 KY not supported (even if the device supports it).
 
 The LBP VPD page flags UNMAP as being supported. Do you actually support
 UNMAP to DSM TRIM SCSI-ATA translation?

Martin,

I have been told by the Windows folks that this is done. I am trying to get
additional details.

K. Y
 
 One challenge in that department is that a single UNMAP command may turn
 into many, many, many DSM TRIM commands on the underlying SATA
 device.
 That's why we went with WRITE SAME for the internal Linux SATL, capping
 the maximum number of blocks to what we can fit in a single DSM TRIM
 command.
 
 --
 Martin K. PetersenOracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-26 Thread Martin K. Petersen
 KY == KY Srinivasan k...@microsoft.com writes:

 The LBP VPD page flags UNMAP as being supported. Do you actually
 support UNMAP to DSM TRIM SCSI-ATA translation?

KY I have been told by the Windows folks that this is done. I am trying
KY to get additional details.

Great! I'd just like to have a reasonable level of confidence in what's
happening down the stack before I entertain turning something on that's
not being properly advertised.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-26 Thread KY Srinivasan


 -Original Message-
 From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
 Sent: Saturday, July 26, 2014 9:55 AM
 To: KY Srinivasan
 Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
 gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
 de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
 jasow...@redhat.com; jbottom...@parallels.com; linux-
 s...@vger.kernel.org
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
  KY == KY Srinivasan k...@microsoft.com writes:
 
  The LBP VPD page flags UNMAP as being supported. Do you actually
  support UNMAP to DSM TRIM SCSI-ATA translation?
 
 KY I have been told by the Windows folks that this is done. I am trying
 KY to get additional details.
 
 Great! I'd just like to have a reasonable level of confidence in what's
 happening down the stack before I entertain turning something on that's not
 being properly advertised.

As I look at the output of inquiry between Linux on Hyper-V and native Linux, 
is not specifying
conformance level the main issue?

K. Y
 
 --
 Martin K. PetersenOracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-26 Thread KY Srinivasan


 -Original Message-
 From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
 Sent: Saturday, July 26, 2014 12:25 PM
 To: KY Srinivasan
 Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
 gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
 de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
 jasow...@redhat.com; jbottom...@parallels.com; linux-
 s...@vger.kernel.org
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
  KY == KY Srinivasan k...@microsoft.com writes:
 
  Great! I'd just like to have a reasonable level of confidence in
  what's happening down the stack before I entertain turning something
  on that's not being properly advertised.
 
 KY As I look at the output of inquiry between Linux on Hyper-V and
 KY native Linux, is not specifying conformance level the main issue?
 
 The main problem for this particular use case (aside from the issue we've
 already addressed) is that the passthrough device (SATA SSD) has
 LBPME=0 in the READ CAPACITY(16) response. The LBP VPD is correctly
 provided with LBPU flag set but because LBPME is reported as disabled we
 will not attempt to issue UNMAP commands to the device.

Oh; ok. I missed the read_capacity response.

Thanks,

K. Y
 
 --
 Martin K. PetersenOracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-25 Thread KY Srinivasan


 -Original Message-
 From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
 Sent: Thursday, July 24, 2014 8:54 AM
 To: Sitsofe Wheeler
 Cc: Martin K. Petersen; Christoph Hellwig; KY Srinivasan;
 gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
 de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
 jasow...@redhat.com; jbottom...@parallels.com; linux-
 s...@vger.kernel.org
 Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
 
  Sitsofe == Sitsofe Wheeler sits...@gmail.com writes:
 
 Sitsofe So we can see it is really a SATA device that announces discard
 Sitsofe correctly and supports discard through WRITE_SAME(16).
 
 No, that's the SATA device that announces support for DSM TRIM, and as a
 result the Linux SATL reports support for WRITE SAME(16) w. the UNMAP bit
 set and LBPME.
 
 Sitsofe It is the act of passing it through Hyper-V that turned it into
 Sitsofe a SCSI device that supports UNMAP (but not WRITE_SAME(16)),
 Sitsofe doesn't announce its SCSI conformance number and doesn't
 Sitsofe correctly announce which features it supports. Surely in this
 Sitsofe case it's reasonable to quirk our way around the problem?
 
 No. That's an issue in Hyper-V that'll you'll have to take up with Microsoft. 
 I
 don't know what their passthrough limitations are for SCSI-ATA translation.
 Maybe K. Y. has some insight into this?

For the pass through case, the host validates the request and passes the 
request to the device.
However, not all scsi commands are passed through even though the device it is 
being passed through
may support the command. WRITE_SAME is one such command. Consequently, in the 
EVPD page,
we will set state indicating that WRITE_SAME is not supported (even if the 
device supports it).

Hope this helps.

K. Y 
 
 There must be a reason why the VPD page was added and yet the device not
 flagged as LBPME=1.
 
 Many vendors do not support UNMAP/WRITE SAME to DSM TRIM
 translation.
 Additionally, many vendors explicitly only whitelist drives that are known to
 be working correctly. Your drive is an ADATA and therefore very likely to be
 blacklisted by default by a vendor SATL.
 
 --
 Martin K. PetersenOracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-25 Thread Martin K. Petersen
 KY == KY Srinivasan k...@microsoft.com writes:

KY For the pass through case, the host validates the request and passes
KY the request to the device.  However, not all scsi commands are
KY passed through even though the device it is being passed through may
KY support the command. WRITE_SAME is one such command. Consequently,
KY in the EVPD page, we will set state indicating that WRITE_SAME is
KY not supported (even if the device supports it).

The LBP VPD page flags UNMAP as being supported. Do you actually support
UNMAP to DSM TRIM SCSI-ATA translation?

One challenge in that department is that a single UNMAP command may turn
into many, many, many DSM TRIM commands on the underlying SATA device.
That's why we went with WRITE SAME for the internal Linux SATL, capping
the maximum number of blocks to what we can fit in a single DSM TRIM
command.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-25 Thread James Bottomley
On Fri, 2014-07-25 at 16:47 +, KY Srinivasan wrote:
 
  -Original Message-
  From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
  Sent: Thursday, July 24, 2014 8:54 AM
  To: Sitsofe Wheeler
  Cc: Martin K. Petersen; Christoph Hellwig; KY Srinivasan;
  gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
  de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
  jasow...@redhat.com; jbottom...@parallels.com; linux-
  s...@vger.kernel.org
  Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
  
   Sitsofe == Sitsofe Wheeler sits...@gmail.com writes:
  
  Sitsofe So we can see it is really a SATA device that announces discard
  Sitsofe correctly and supports discard through WRITE_SAME(16).
  
  No, that's the SATA device that announces support for DSM TRIM, and as a
  result the Linux SATL reports support for WRITE SAME(16) w. the UNMAP bit
  set and LBPME.
  
  Sitsofe It is the act of passing it through Hyper-V that turned it into
  Sitsofe a SCSI device that supports UNMAP (but not WRITE_SAME(16)),
  Sitsofe doesn't announce its SCSI conformance number and doesn't
  Sitsofe correctly announce which features it supports. Surely in this
  Sitsofe case it's reasonable to quirk our way around the problem?
  
  No. That's an issue in Hyper-V that'll you'll have to take up with 
  Microsoft. I
  don't know what their passthrough limitations are for SCSI-ATA translation.
  Maybe K. Y. has some insight into this?
 
 For the pass through case, the host validates the request and passes
 the request to the device.
 However, not all scsi commands are passed through even though the
 device it is being passed through
 may support the command. WRITE_SAME is one such command. Consequently,
 in the EVPD page,
 we will set state indicating that WRITE_SAME is not supported (even if
 the device supports it).

I think you haven't appreciated the problem: He's passing a SATA SSD via
the SCSI hyper-v interface.  That means that the windows host is doing
SCSI-ATA translation.  The problem is that the Windows translation
layer (SATL) looks to be incomplete and it's not correctly translating
the IDENTIFY bit that corresponds to TRIM to the correct VPD pages so
consequently, Linux  won't send UNMAP commands to the device (to be
translated back to TRIM).

We already know this is a bug in the Windows SATL which needs fixing (if
you could report it and get a fix, that would be great) and that we're
not going to be able to work around this automatically in Linux because
the proposed patch would have us unconditionally try UNMAP for all
Hyper-V devices.  The current proposed fix is to enable UNMAP manually
via sysfs in the guest boot scripts, but obviously that means that
Hyper-V guests with direct pass through of SSDs need operator
intervention to turn on TRIM.

James



Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-24 Thread Martin K. Petersen
 Sitsofe == Sitsofe Wheeler sits...@gmail.com writes:

Sitsofe Fix incorrectly named variable.  Some block devices (such as
Sitsofe Hyper-V passthrough SSDs) support logical block provisioning
Sitsofe (e.g. via UNMAP) but don't set lbpme thus disabling discard. 

The fix for an SSD that is known to support LBP but which does not claim
support for it is to use:

echo unmap  /sys/class/scsi_disk/foo/provisioning_mode

I'm very much against short-circuiting the LBP logic in a passthrough
driver because then we might end up in the exact situation we were
trying to avoid with this patch series. Namely sending down commands
unsupported by the target device.

This kind of thing really needs to be a sysadmin decision and can be
handled with a udev rule.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-24 Thread Christoph Hellwig
On Thu, Jul 24, 2014 at 09:54:24AM -0400, Martin K. Petersen wrote:
 I'm very much against short-circuiting the LBP logic in a passthrough
 driver because then we might end up in the exact situation we were
 trying to avoid with this patch series. Namely sending down commands
 unsupported by the target device.
 
 This kind of thing really needs to be a sysadmin decision and can be
 handled with a udev rule.

I agree - I'd like to pull in KY's simple fix as soon as I get a second
review for it.

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-24 Thread Christoph Hellwig
On Thu, Jul 24, 2014 at 08:34:19AM -0700, Christoph Hellwig wrote:
 I agree - I'd like to pull in KY's simple fix as soon as I get a second
 review for it.

Ok, looks like I just got that from Hannes.  Let's see if there's more
to be done for the pass through case, but I'd rather wait for the next
window for that.

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-24 Thread Sitsofe Wheeler
On Thu, Jul 24, 2014 at 09:54:24AM -0400, Martin K. Petersen wrote:
  Sitsofe == Sitsofe Wheeler sits...@gmail.com writes:
 
 Sitsofe Fix incorrectly named variable.  Some block devices (such as
 Sitsofe Hyper-V passthrough SSDs) support logical block provisioning
 Sitsofe (e.g. via UNMAP) but don't set lbpme thus disabling discard. 
 
 The fix for an SSD that is known to support LBP but which does not claim
 support for it is to use:
 
 echo unmap  /sys/class/scsi_disk/foo/provisioning_mode
 
 I'm very much against short-circuiting the LBP logic in a passthrough
 driver because then we might end up in the exact situation we were
 trying to avoid with this patch series. Namely sending down commands
 unsupported by the target device.
 
 This kind of thing really needs to be a sysadmin decision and can be
 handled with a udev rule.

The problem is that the SSD _does_ claim to support it. Here are the
results of booting Linux directly on the host hardware and looking at
the device directly with a 3.10.35 kernel:

root@sysresccd /root % uname -a
Linux sysresccd 3.10.35-std420-amd64 #2 SMP Wed Apr 2 18:31:51 UTC 2014 x86_64 
Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz GenuineIntel GNU/Linux
root@sysresccd /root % sg_vpd -p lbpv /dev/sdb
root@sysresccd /root % sg_inq /dev/sdb   
standard INQUIRY:
  PQual=0  Device_type=0  RMB=0  version=0x05  [SPC-3]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=0  Resp_data_format=2
  SCCS=0  ACC=0  TPGS=0  3PC=0  Protect=0  [BQue=0]
  EncServ=0  MultiP=0  [MChngr=0]  [ACKREQQ=0]  Addr16=0
  [RelAdr=0]  WBus16=0  Sync=0  Linked=0  [TranDis=0]  CmdQue=0
  [SPI: Clocking=0x0  QAS=0  IUS=0]
length=96 (0x60)   Peripheral device type: disk
 Vendor identification: ATA 
 Product identification: ADATA SSD S510 1
 Product revision level: 5.2.
 Unit serial number: 0320511550032076
root@sysresccd /root % sg_readcap -l /dev/sdb
Read Capacity results:
   Protection: prot_en=0, p_type=0, p_i_exponent=0
   Logical block provisioning: lbpme=1, lbprz=0
   Last logical block address=234441647 (0xdf94baf), Number of logical 
blocks=234441648
   Logical block length=512 bytes
   Logical blocks per physical block exponent=0
   Lowest aligned logical block address=0
Hence:
   Device size: 120034123776 bytes, 114473.5 MiB, 120.03 GB
Logical block provisioning VPD page (SBC):
  Unmap command supported (LBPU): 0
  Write same (16) with unmap bit supported (LBWS): 1
  Write same (10) with unmap bit supported (LBWS10): 0
  Logical block provisioning read zeros (LBPRZ): 0
  Anchored LBAs supported (ANC_SUP): 0
  Threshold exponent: 0
  Descriptor present (DP): 0
  Provisioning type: 0
root@sysresccd /root % sg_vpd -p bl /dev/sdb
Block limits VPD page (SBC):
  Write same no zero (WSNZ): 0
  Maximum compare and write length: 0 blocks
  Optimal transfer length granularity: 1 blocks
  Maximum transfer length: 0 blocks
  Optimal transfer length: 0 blocks
  Maximum prefetch length: 0 blocks
  Maximum unmap LBA count: 0
  Maximum unmap block descriptor count: 0
  Optimal unmap granularity: 1
  Unmap granularity alignment valid: 0
  Unmap granularity alignment: 0
  Maximum write same length: 0x3fffc0 blocks
root@sysresccd /root % grep . /sys/block/sdb/device/scsi_disk/1:0:0:0/* 
   
/sys/block/sdb/device/scsi_disk/1:0:0:0/allow_restart:1
/sys/block/sdb/device/scsi_disk/1:0:0:0/app_tag_own:0
/sys/block/sdb/device/scsi_disk/1:0:0:0/cache_type:write back
grep: /sys/block/sdb/device/scsi_disk/1:0:0:0/device: Is a directory
/sys/block/sdb/device/scsi_disk/1:0:0:0/FUA:0
/sys/block/sdb/device/scsi_disk/1:0:0:0/manage_start_stop:1
/sys/block/sdb/device/scsi_disk/1:0:0:0/max_medium_access_timeouts:2
/sys/block/sdb/device/scsi_disk/1:0:0:0/max_write_same_blocks:0
grep: /sys/block/sdb/device/scsi_disk/1:0:0:0/power: Is a directory
/sys/block/sdb/device/scsi_disk/1:0:0:0/protection_mode:none
/sys/block/sdb/device/scsi_disk/1:0:0:0/protection_type:0
/sys/block/sdb/device/scsi_disk/1:0:0:0/provisioning_mode:writesame_16
grep: /sys/block/sdb/device/scsi_disk/1:0:0:0/subsystem: Is a directory
/sys/block/sdb/device/scsi_disk/1:0:0:0/thin_provisioning:1

So we can see it is really a SATA device that announces discard
correctly and supports discard through WRITE_SAME(16). It is the act of
passing it through Hyper-V that turned it into a SCSI device that supports
UNMAP (but not WRITE_SAME(16)), doesn't announce its SCSI conformance number
and doesn't correctly announce which features it supports. Surely in
this case it's reasonable to quirk our way around the problem?

-- 
Sitsofe | http://sucs.org/~sits/
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-24 Thread Martin K. Petersen
 Sitsofe == Sitsofe Wheeler sits...@gmail.com writes:

Sitsofe So we can see it is really a SATA device that announces discard
Sitsofe correctly and supports discard through WRITE_SAME(16).

No, that's the SATA device that announces support for DSM TRIM, and as a
result the Linux SATL reports support for WRITE SAME(16) w. the UNMAP
bit set and LBPME.

Sitsofe It is the act of passing it through Hyper-V that turned it into
Sitsofe a SCSI device that supports UNMAP (but not WRITE_SAME(16)),
Sitsofe doesn't announce its SCSI conformance number and doesn't
Sitsofe correctly announce which features it supports. Surely in this
Sitsofe case it's reasonable to quirk our way around the problem?

No. That's an issue in Hyper-V that'll you'll have to take up with
Microsoft. I don't know what their passthrough limitations are for
SCSI-ATA translation. Maybe K. Y. has some insight into this?

There must be a reason why the VPD page was added and yet the device not
flagged as LBPME=1.

Many vendors do not support UNMAP/WRITE SAME to DSM TRIM translation.
Additionally, many vendors explicitly only whitelist drives that are
known to be working correctly. Your drive is an ADATA and therefore very
likely to be blacklisted by default by a vendor SATL.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-24 Thread Sitsofe Wheeler
On Thu, Jul 24, 2014 at 08:35:13AM -0700, Christoph Hellwig wrote:
 On Thu, Jul 24, 2014 at 08:34:19AM -0700, Christoph Hellwig wrote:
  I agree - I'd like to pull in KY's simple fix as soon as I get a second
  review for it.
 
 Ok, looks like I just got that from Hannes.  Let's see if there's more
 to be done for the pass through case, but I'd rather wait for the next
 window for that.

There's nothing Linux can do for today's Hyper-V passthrough wrt to
automatically turning on discard on my SATA SSD.

Martin explained that vendors often disable UNMAP/WRITE SAME to DSM TRIM
translation on purpose and/or have explicit device whitelists/blacklists
for those devices they want to support. It could be that Microsoft are
doing something similar (although it might be interesting to know how a
Windows 2012 guest on Hyper-V handles things).

-- 
Sitsofe | http://sucs.org/~sits/
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html