Re: broken TRIM support for JMS578 in uas mode

2018-09-18 Thread Panagiotis Malakoudis
I have the same issue that was posted in
https://marc.info/?l=linux-usb=153295104606185=2

Output of 0xb2 and 0xb0 pages is:
sg_vpd --page=0xb2 /dev/sda
Logical block provisioning VPD page (SBC):
  Unmap command supported (LBPU): 1
  Write same (16) with unmap bit supported (LBWS): 0
  Write same (10) with unmap bit supported (LBWS10): 0
  Logical block provisioning read zeros (LBPRZ): 0
  Anchored LBAs supported (ANC_SUP): 0
  Threshold exponent: 1
  Descriptor present (DP): 0
  Minimum percentage: 0
  Provisioning type: 0
  Threshold percentage: 0

sg_vpd --page=0xb0 /dev/sda
Block limits VPD page (SBC):
  Write same non-zero (WSNZ): 0
  Maximum compare and write length: 0 blocks
  Optimal transfer length granularity: 8 blocks
  Maximum transfer length: 65535 blocks
  Optimal transfer length: 65535 blocks
  Maximum prefetch length: 65535 blocks
  Maximum unmap LBA count: 65535
  Maximum unmap block descriptor count: 16
  Optimal unmap granularity: 0
  Unmap granularity alignment valid: 0
  Unmap granularity alignment: 0
  Maximum write same length: 0x0 blocks
  Maximum atomic transfer length: 0
  Atomic alignment: 0
  Atomic transfer length granularity: 0
  Maximum atomic transfer length with atomic boundary: 0
  Maximum atomic boundary size: 0

According to the link reported by Oliver Neukum, unmap should have
been enabled, but it is not.
Setting manually the provisioning_mode to unmap enables discard, and
after doing some testing, it really works.
cat /sys/class/scsi_disk/9\:0\:0\:0/provisioning_mode
full
echo unmap > /sys/class/scsi_disk/9\:0\:0\:0/provisioning_mode
lsblk -D
NAME   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda   04K   4G 0
├─sda104K   4G 0
├─sda204K   4G 0

So, why it fails to set provisioning_mode to unmap automatically?


Re: broken TRIM support for JMS578 in uas mode

2018-08-09 Thread Oliver Neukum
On Mo, 2018-07-30 at 14:43 +0300, Mailing Lists wrote:
> I cannot issue TRIM commands to SSD behind a JMS578-based sata to
> usb-c adapter. Tried with Fedora 28 kernel and with latest
> 4.18.0-0.rc6.git0.1.vanilla.knurd.1.fc28.x86_64
> lsblk -D shows that discard is not enabled, but the SSD has this
> capability (see below)
> 
> However Windows 10 successfully TRIMs the device. Also the
> trimcheck.exe tool validates the TRIM operation. This makes me think
> the linux uas driver needs additional reverse engineering or support
> from Jmicron about this chipset.

Hi,

The VPD page for TRIM support should be 0xb0. Could you provide that?

If all else fails:
for each SCSI device (UAS devices internally are SCSI) there is a
"provisioning_mode" attribute in sysfs. You can try to force TRIM
to be used.

https://gist.github.com/cathay4t/e80e02a737242a5f3824606543631bfe

Strictly speaking this is a SCSI issue, not a UAS problem.

HTH
Oliver

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


Re: broken TRIM support for JMS578 in uas mode

2018-08-02 Thread Johannes Thumshirn
On Thu, Aug 02, 2018 at 02:24:16PM +0200, Oliver Neukum wrote:
> On Mo, 2018-07-30 at 14:43 +0300, Mailing Lists wrote:
> > I cannot issue TRIM commands to SSD behind a JMS578-based sata to
> > usb-c adapter. Tried with Fedora 28 kernel and with latest
> > 4.18.0-0.rc6.git0.1.vanilla.knurd.1.fc28.x86_64
> > lsblk -D shows that discard is not enabled, but the SSD has this
> > capability (see below)
> 
> Hi Johannes,
> 
> is there a way to signal the SCSI layer that a trim for a device should
> be attempted, even if it claims not to support it?

Generally speaking no. If the USB Adapter doesn't translate the
Command it doesn't translate it.

Byte,
Johannes
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: broken TRIM support for JMS578 in uas mode

2018-08-02 Thread Oliver Neukum
On Mo, 2018-07-30 at 14:43 +0300, Mailing Lists wrote:
> I cannot issue TRIM commands to SSD behind a JMS578-based sata to
> usb-c adapter. Tried with Fedora 28 kernel and with latest
> 4.18.0-0.rc6.git0.1.vanilla.knurd.1.fc28.x86_64
> lsblk -D shows that discard is not enabled, but the SSD has this
> capability (see below)

Hi Johannes,

is there a way to signal the SCSI layer that a trim for a device should
be attempted, even if it claims not to support it?

Regards
Oliver

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