* Re: discard synchronous on most SSDs?
2014-03-14 5:17 ` Marc MERLIN
@ 2014-03-14 7:33 ` Chris Samuel
2014-03-14 19:26 ` Marc MERLIN
2014-03-15 4:06 ` Chris Samuel
2014-03-14 12:07 ` Duncan
2014-03-14 21:44 ` Chris Murphy
2 siblings, 2 replies; 32+ messages in thread
From: Chris Samuel @ 2014-03-14 7:33 UTC (permalink / raw)
To: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
Hi Marc,
On Thu, 13 Mar 2014 10:17:50 PM Marc MERLIN wrote:
> I'm not sure I'm seeing this, which field is that?
I *think* you want smartctl -i instead, and look for the field that says
something like:
ATA Version is: ATA8-ACS, ACS-2 T13/2015-D revision 3
So if my understanding is correct that says it's just rev. 3.0 so TRIM for
this is synchronous.
Good luck!
Chris
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 482 bytes --]
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-14 7:33 ` Chris Samuel
@ 2014-03-14 19:26 ` Marc MERLIN
2014-03-14 19:57 ` Martin K. Petersen
2014-03-15 4:06 ` Chris Samuel
1 sibling, 1 reply; 32+ messages in thread
From: Marc MERLIN @ 2014-03-14 19:26 UTC (permalink / raw)
To: Chris Samuel, Duncan, Christopher Corsi; +Cc: linux-btrfs
On Fri, Mar 14, 2014 at 12:07:54PM +0000, Duncan wrote:
> Marc MERLIN posted on Thu, 13 Mar 2014 22:17:50 -0700 as excerpted:
>
> > On Thu, Mar 13, 2014 at 09:39:02PM -0600, Chris Murphy wrote:
> >>
> >> On Mar 13, 2014, at 8:11 PM, Marc MERLIN <marc@merlins.org> wrote:
> >>
> >> > On Sun, Mar 09, 2014 at 11:33:50AM +0000, Hugo Mills wrote:
> >> >> discard is, except on the very latest hardware, a synchronous
> >> >> command (it's a limitation of the SATA standard), and therefore
> >> >> results in very very poor performance.
> >> >
> >> > Interesting. How do I know if a given SSD will hang on discard?
> >> > Is a Samsung EVO 840 1TB SSD latest hardware enough, or not? :)
> >>
> >> smartctl -a or -x will tell you what SATA revision is in place. The
> >> queued trim support is in SATA Rev 3.1. I'm not certain if this
> >> requires only the drive to support that revision level, or both
> >> controller and drive.
> >
> > I'm not sure I'm seeing this, which field is that?
>
> > ATA Version is: 8
> > ATA Standard is: ATA-8-ACS revision 4c
>
> Your drive didn't report it, but here, I have SATA fields as well, in
> addition to the ATA fields:
>
> Here's the fields from my Corsair Neutron SSDs:
>
> ATA Version is: ATA8-ACS (minor revision not indicated)
> SATA Version is: SATA 2.5, 6.0 Gb/s
>
> Here's the fields from my Seagate 500-gig 2.5-inch spinning rust:
>
> ATA Version is: ATA8-ACS T13/1699-D revision 4
> SATA Version is: SATA 2.6, 3.0 Gb/s
Ok, my smartmontools was too old. I got a newer one and now have proper
output:
Device Model: Samsung SSD 840 EVO 1TB
Serial Number: S1D9NEAD934600N
LU WWN Device Id: 5 002538 85009a8ff
Firmware Version: EXT0BB0Q
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2, ATA8-ACS T13/1699-D revision 4c
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Fri Mar 14 10:49:39 2014 PDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
So I have Sata 3.1, that's great news, it means I can keep using discard
without worrying about performance and hangs
Thanks,
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: discard synchronous on most SSDs?
2014-03-14 19:26 ` Marc MERLIN
@ 2014-03-14 19:57 ` Martin K. Petersen
2014-03-14 20:46 ` Holger Hoffstätte
2014-03-15 5:25 ` Chris Samuel
0 siblings, 2 replies; 32+ messages in thread
From: Martin K. Petersen @ 2014-03-14 19:57 UTC (permalink / raw)
To: Marc MERLIN; +Cc: Chris Samuel, Duncan, Christopher Corsi, linux-btrfs
>>>>> "Marc" == Marc MERLIN <marc@merlins.org> writes:
Marc,
Marc> So I have Sata 3.1, that's great news, it means I can keep using
Marc> discard without worrying about performance and hangs
The fact that the drive reports compliance with a certain version of
SATA does not in any way imply that it implements all commands defined
in that specification.
The location where queued TRIM support is reported is somewhat unusual.
And last I looked hdparm -I had no infrastructure in place to report
stuff contained in log pages.
The kernel does look the right place to determine whether to issue the
queued or unqueued variant or not. But the information isn't exported to
userland.
So right now I'm afraid we don't have a good way for a user to determine
whether a device supports queued trims or not.
I guess we could consider either adding an ATA-specific "I don't suck"
flag in sysfs, add the missing code to hdparm, or both...
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-14 19:57 ` Martin K. Petersen
@ 2014-03-14 20:46 ` Holger Hoffstätte
2014-03-15 4:21 ` Marc MERLIN
2014-03-15 5:25 ` Chris Samuel
1 sibling, 1 reply; 32+ messages in thread
From: Holger Hoffstätte @ 2014-03-14 20:46 UTC (permalink / raw)
To: linux-btrfs
On Fri, 14 Mar 2014 15:57:41 -0400, Martin K. Petersen wrote:
> So right now I'm afraid we don't have a good way for a user to determine
> whether a device supports queued trims or not.
Mount with discard, unpack kernel tree, sync, rm -rf tree.
If it takes several seconds, you have sync discard, no?
This changed somewhere around kernel 3.8.x; before that it used to be
acceptably fast. Since then I only do batch trims, daily (server) or
weekly (laptop).
-h
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-14 20:46 ` Holger Hoffstätte
@ 2014-03-15 4:21 ` Marc MERLIN
2014-03-15 9:38 ` Holger Hoffstätte
0 siblings, 1 reply; 32+ messages in thread
From: Marc MERLIN @ 2014-03-15 4:21 UTC (permalink / raw)
To: Holger Hoffstätte; +Cc: linux-btrfs
On Fri, Mar 14, 2014 at 08:46:09PM +0000, Holger Hoffstätte wrote:
> On Fri, 14 Mar 2014 15:57:41 -0400, Martin K. Petersen wrote:
>
> > So right now I'm afraid we don't have a good way for a user to determine
> > whether a device supports queued trims or not.
>
> Mount with discard, unpack kernel tree, sync, rm -rf tree.
> If it takes several seconds, you have sync discard, no?
Mmmh, interesting point.
legolas:/usr/src# time rm -rf linux-3.14-rc5
real 0m1.584s
user 0m0.008s
sys 0m1.524s
I remounted my FS with remount,nodiscard, and the time was the same.
> This changed somewhere around kernel 3.8.x; before that it used to be
> acceptably fast. Since then I only do batch trims, daily (server) or
> weekly (laptop).
I'm never really timed this before. Is it supposed to be faster than 1.5s on
a fast SSD?
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: discard synchronous on most SSDs?
2014-03-15 4:21 ` Marc MERLIN
@ 2014-03-15 9:38 ` Holger Hoffstätte
0 siblings, 0 replies; 32+ messages in thread
From: Holger Hoffstätte @ 2014-03-15 9:38 UTC (permalink / raw)
To: linux-btrfs
On Fri, 14 Mar 2014 21:21:16 -0700, Marc MERLIN wrote:
> On Fri, Mar 14, 2014 at 08:46:09PM +0000, Holger Hoffstätte wrote:
>> On Fri, 14 Mar 2014 15:57:41 -0400, Martin K. Petersen wrote:
>>
>> > So right now I'm afraid we don't have a good way for a user to
>> > determine whether a device supports queued trims or not.
>>
>> Mount with discard, unpack kernel tree, sync, rm -rf tree.
>> If it takes several seconds, you have sync discard, no?
>
> Mmmh, interesting point.
>
> legolas:/usr/src# time rm -rf linux-3.14-rc5 real 0m1.584s user
0m0.008s
> sys 0m1.524s
>
> I remounted my FS with remount,nodiscard, and the time was the same.
>
>> This changed somewhere around kernel 3.8.x; before that it used to be
>> acceptably fast. Since then I only do batch trims, daily (server) or
>> weekly (laptop).
>
> I'm never really timed this before. Is it supposed to be faster than
> 1.5s on a fast SSD?
No, ~1s + noise is OK and seems normal, depending on filesystem and
phase of the moon. To contrast here is the output from my laptop,
which has an old but still-going-strong Intel G2 with ext4:
$smartctl -i /dev/sda | grep ATA
ATA Version is: ATA/ATAPI-7 T13/1532D revision 1
SATA Version is: SATA 2.6, 3.0 Gb/s
without dicard:
rm -rf linux-3.12.14 0.05s user 1.28s system 98% cpu 1.364 total
remounted with discard & after an initial manual fstrim:
rm -rf linux-3.12.14 1.90s user 0.02s system 2% cpu 1:07.45 total
I think these numbers speak for themselves. :)
It's really good to know that SATA 3.1 apparently fixed this.
cheers
Holger
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-14 19:57 ` Martin K. Petersen
2014-03-14 20:46 ` Holger Hoffstätte
@ 2014-03-15 5:25 ` Chris Samuel
2014-03-15 6:48 ` Chris Samuel
2014-03-16 16:22 ` Martin K. Petersen
1 sibling, 2 replies; 32+ messages in thread
From: Chris Samuel @ 2014-03-15 5:25 UTC (permalink / raw)
To: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 962 bytes --]
On Fri, 14 Mar 2014 03:57:41 PM Martin K. Petersen wrote:
> The fact that the drive reports compliance with a certain version of
> SATA does not in any way imply that it implements all commands defined
> in that specification.
It looks like drives that do support it can be detected with the kernel helper
function ata_fpdma_dsm_supported() defined in include/linux/libata.h.
I wonder if it would be possible to use that knowledge to extend the
smartctl's --identify functionality to report this?
Not even all drives that implement it do so correctly, the kernel has a
blacklist of drives that don't and currently lists just two:
/* devices that don't properly handle queued TRIM commands */
{ "Micron_M500*",· · NULL,· ATA_HORKAGE_NO_NCQ_TRIM, },
{ "Crucial_CT???M500SSD*",· NULL,· ATA_HORKAGE_NO_NCQ_TRIM, },
cheers,
Chris
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 482 bytes --]
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: discard synchronous on most SSDs?
2014-03-15 5:25 ` Chris Samuel
@ 2014-03-15 6:48 ` Chris Samuel
2014-03-15 11:26 ` Duncan
2014-03-16 16:22 ` Martin K. Petersen
1 sibling, 1 reply; 32+ messages in thread
From: Chris Samuel @ 2014-03-15 6:48 UTC (permalink / raw)
To: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
On Sat, 15 Mar 2014 04:25:05 PM Chris Samuel wrote:
> I wonder if it would be possible to use that knowledge to extend the
> smartctl's --identify functionality to report this?
After reading the SATA 3.1 spec I believe that smartctl *can* indicate if a
drive claims to support SATA 3.1 NCQ TRIM, thus:
$ sudo smartctl --identify /dev/sdb | fgrep 'Trim bit in DATA SET MANAGEMENT'
169 0 1 Trim bit in DATA SET MANAGEMENT command supported
$
If that command returns nothing then it's not reported as supported (and I've
tested that). You can get the same info with hdparm -I.
Of course, as Martin said, that doesn't necessarily mean the kernel is using
that reported ability.
My puzzle now is that I have two SSD drives that report supporting NCQ TRIM
(one confirmed via product info) but report only supporting SATA 3.0 not 3.1.
cheers,
Chris
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 482 bytes --]
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-15 6:48 ` Chris Samuel
@ 2014-03-15 11:26 ` Duncan
2014-03-15 22:48 ` Chris Samuel
2014-03-16 6:06 ` Marc MERLIN
0 siblings, 2 replies; 32+ messages in thread
From: Duncan @ 2014-03-15 11:26 UTC (permalink / raw)
To: linux-btrfs
Chris Samuel posted on Sat, 15 Mar 2014 17:48:56 +1100 as excerpted:
> $ sudo smartctl --identify /dev/sdb | fgrep 'Trim bit in DATA SET
> MANAGEMENT'
> 169 0 1 Trim bit in DATA SET MANAGEMENT command
> supported
> $
>
> If that command returns nothing then it's not reported as supported (and
> I've tested that). You can get the same info with hdparm -I.
> My puzzle now is that I have two SSD drives that report supporting NCQ
> TRIM (one confirmed via product info) but report only supporting SATA
> 3.0 not 3.1.
My SATA 2.5 SSDs reported earlier, report support for it too, so it's
apparently not SATA 3.1 limited. (Note that I'm simply grepping word
169, in the command below. Since word 169 is trim support...)
sudo smartctl --identify /dev/sda | grep '^ 169'
169 - 0x0001 Data Set Management support
169 0 1 Trim bit in DATA SET MANAGEMENT command supported
Either that or that feature bit simply indicates trim support, not NCQ
trim support.
But it can be noted that if SATA 3.1 requires trim to be NCQ if its
supported at all (spinning rust would thus get a pass), then claiming 3.1
support as well as trim support should be the equivalent of claiming NCQ
trim support, likely with no indicator of whether that trim support is NCQ
or not, pre-3.1.
... Which would mean that my SATA 2.5 and your SATA 3.0 drives are simply
indicating trim support, not specifically NCQ trim support.
I guess you'd have to check the SATA 2.5 and 3.0 specs to find that out.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-15 11:26 ` Duncan
@ 2014-03-15 22:48 ` Chris Samuel
2014-03-16 6:06 ` Marc MERLIN
1 sibling, 0 replies; 32+ messages in thread
From: Chris Samuel @ 2014-03-15 22:48 UTC (permalink / raw)
To: linux-btrfs
On 15/03/14 22:26, Duncan wrote:
> Either that or that feature bit simply indicates trim support, not NCQ
> trim support.
You're quite right, I outsmarted myself by noticing at the fact that the
kernel tests for ATA_LOG_NCQ_SEND_RECV_DSM_TRIM and unsets that for
drives that don't support NCQ DSM TRIM and then seeing DSM TRIM in the
SATA 3.1 spec and inferred they were the same thing.
Looking closer at the kernel code that tests for what trim to use with
ATA_LOG_NCQ_SEND_RECV_DSM_TRIM it falls back to ATA_DSM_TRIM if it can't
do the NCQ version.
Mea culpa!
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-15 11:26 ` Duncan
2014-03-15 22:48 ` Chris Samuel
@ 2014-03-16 6:06 ` Marc MERLIN
2014-03-16 17:09 ` Chris Murphy
1 sibling, 1 reply; 32+ messages in thread
From: Marc MERLIN @ 2014-03-16 6:06 UTC (permalink / raw)
To: Duncan; +Cc: linux-btrfs
On Sat, Mar 15, 2014 at 11:26:27AM +0000, Duncan wrote:
> Chris Samuel posted on Sat, 15 Mar 2014 17:48:56 +1100 as excerpted:
>
> > $ sudo smartctl --identify /dev/sdb | fgrep 'Trim bit in DATA SET
> > MANAGEMENT'
> > 169 0 1 Trim bit in DATA SET MANAGEMENT command
> > supported
> > $
> >
> > If that command returns nothing then it's not reported as supported (and
> > I've tested that). You can get the same info with hdparm -I.
>
> > My puzzle now is that I have two SSD drives that report supporting NCQ
> > TRIM (one confirmed via product info) but report only supporting SATA
> > 3.0 not 3.1.
>
> My SATA 2.5 SSDs reported earlier, report support for it too, so it's
> apparently not SATA 3.1 limited. (Note that I'm simply grepping word
> 169, in the command below. Since word 169 is trim support...)
>
> sudo smartctl --identify /dev/sda | grep '^ 169'
> 169 - 0x0001 Data Set Management support
> 169 0 1 Trim bit in DATA SET MANAGEMENT command supported
>
> Either that or that feature bit simply indicates trim support, not NCQ
> trim support.
Mmmh, so now I'm confused.
See this:
=== START OF INFORMATION SECTION ===
Device Model: INTEL SSDSC2BW180A3L
Serial Number: CVCV215200XU180EGN
LU WWN Device Id: 5 001517 bb28c5317
Firmware Version: LE1i
User Capacity: 180,045,766,656 bytes [180 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2 (minor revision not indicated)
SATA Version is: SATA 3.0, 3.0 Gb/s (current: 3.0 Gb/s)
Local Time is: Sat Mar 15 15:49:06 2014 PDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
polgara:/usr/src# smartctl --identify /dev/sda | grep '^ 169'
169 - 0x0001 Data Set Management support
169 0 1 Trim bit in DATA SET MANAGEMENT command supported
This is a super old SSD from 3 years ago. Clearly it can't support
synchronous dicard, right?
Yet, deleting a kernel tree also takes 1.5 seconds:
polgara:/usr/src# time rm -rf linux-3.14-rc5/
real 0m1.441s
user 0m0.048s
sys 0m1.352s
So maybe it's not the data level, but just the value of 169?
Either way, this SSD is more than 2 years old, maybe 3 actually.
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | PGP 1024R/763BE901
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: discard synchronous on most SSDs?
2014-03-16 6:06 ` Marc MERLIN
@ 2014-03-16 17:09 ` Chris Murphy
0 siblings, 0 replies; 32+ messages in thread
From: Chris Murphy @ 2014-03-16 17:09 UTC (permalink / raw)
To: Btrfs
On Mar 16, 2014, at 12:06 AM, Marc MERLIN <marc@merlins.org> wrote:
>
> Mmmh, so now I'm confused.
>
> See this:
>
> === START OF INFORMATION SECTION ===
> Device Model: INTEL SSDSC2BW180A3L
> Serial Number: CVCV215200XU180EGN
> LU WWN Device Id: 5 001517 bb28c5317
> Firmware Version: LE1i
> User Capacity: 180,045,766,656 bytes [180 GB]
> Sector Size: 512 bytes logical/physical
> Rotation Rate: Solid State Device
> Device is: Not in smartctl database [for details use: -P showall]
> ATA Version is: ACS-2 (minor revision not indicated)
> SATA Version is: SATA 3.0, 3.0 Gb/s (current: 3.0 Gb/s)
> Local Time is: Sat Mar 15 15:49:06 2014 PDT
> SMART support is: Available - device has SMART capability.
> SMART support is: Enabled
>
> polgara:/usr/src# smartctl --identify /dev/sda | grep '^ 169'
> 169 - 0x0001 Data Set Management support
> 169 0 1 Trim bit in DATA SET MANAGEMENT command supported
>
> This is a super old SSD from 3 years ago. Clearly it can't support
> synchronous dicard, right?
No. The first signs I saw they were appearing in the wild was 3rd quarter 2013. I'm pretty sure SAS SSDs always have had a queued trim command. So in the workloads that demanded it and with a budget, this wouldn't have ever been a problem.
> Yet, deleting a kernel tree also takes 1.5 seconds:
> polgara:/usr/src# time rm -rf linux-3.14-rc5/
> real 0m1.441s
> user 0m0.048s
> sys 0m1.352s
I don't know that this is a good test for two reasons. Does rm always call trim before the rm command completes? If trim is batched or delayed it could happen well after. Second, and more of a factor, the queue needs to have pending commands in them that an async trim command will have to wait for. The problem with non-queued trim is that it requires the queue to be empty. So you'd need a test or workload that causes that behavior to be a problem.
And yet another factor with trim is that some SSDs immediately, aggressively start garbage collection and become slow to respond to anything. While others are smarter about doing this when the drive isn't as busy.
Chris Murphy
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-15 5:25 ` Chris Samuel
2014-03-15 6:48 ` Chris Samuel
@ 2014-03-16 16:22 ` Martin K. Petersen
2014-03-16 17:50 ` Marc MERLIN
1 sibling, 1 reply; 32+ messages in thread
From: Martin K. Petersen @ 2014-03-16 16:22 UTC (permalink / raw)
To: Chris Samuel; +Cc: linux-btrfs
>>>>> "Chris" == Chris Samuel <chris@csamuel.org> writes:
Chris> It looks like drives that do support it can be detected with the
Chris> kernel helper function ata_fpdma_dsm_supported() defined in
Chris> include/linux/libata.h.
Chris> I wonder if it would be possible to use that knowledge to extend
Chris> the smartctl's --identify functionality to report this?
Queued trim support is indicated in a log page and not the identify
information. However, we can get to the information we want using
smartctl's ability to look at log pages.
I don't have a single drive from any vendor in the lab that supports
queued trim, not even a prototype. I went out and bought a 840 EVO this
morning because the general lazyweb opinion seemed to indicate that this
drive supports queued trim. Well, it doesn't. At least not in the 120GB
version:
# smartctl -l gplog,0x13 /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.14.0-rc6+] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
General Purpose Log 0x13 does not exist (override with '-T permissive' option)
If there's a drive with a working queued trim implementation out there,
I'd like to know about it...
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-16 16:22 ` Martin K. Petersen
@ 2014-03-16 17:50 ` Marc MERLIN
0 siblings, 0 replies; 32+ messages in thread
From: Marc MERLIN @ 2014-03-16 17:50 UTC (permalink / raw)
To: Martin K. Petersen; +Cc: Chris Samuel, linux-btrfs
On Sun, Mar 16, 2014 at 12:22:05PM -0400, Martin K. Petersen wrote:
> queued trim, not even a prototype. I went out and bought a 840 EVO this
> morning because the general lazyweb opinion seemed to indicate that this
> drive supports queued trim. Well, it doesn't. At least not in the 120GB
> version:
>
> # smartctl -l gplog,0x13 /dev/sda
> smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.14.0-rc6+] (local build)
> Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
>
> General Purpose Log 0x13 does not exist (override with '-T permissive' option)
>
> If there's a drive with a working queued trim implementation out there,
> I'd like to know about it...
I tried that for you on my 840 EVO 1TB and go the same as you:
legolas:/usr/src# smartctl -l gplog,0x13 /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.14.0-rc5-amd64-i915-preempt-20140216c] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
General Purpose Log 0x13 does not exist (override with '-T permissive' option)
Now, back to the fact that it takes 1.5sec to delete a kernel tree with
discard on, and it doesn't seem faster with discard off on either that
drive or my very old intel SSD, I'm starting to think that this is kind
of a non problem and/or that something else makes rm of a kernel tree
take around 1.5sec
Is is it much faster on an ssd for someone else?
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | PGP 1024R/763BE901
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-14 7:33 ` Chris Samuel
2014-03-14 19:26 ` Marc MERLIN
@ 2014-03-15 4:06 ` Chris Samuel
2014-03-16 16:07 ` Martin K. Petersen
1 sibling, 1 reply; 32+ messages in thread
From: Chris Samuel @ 2014-03-15 4:06 UTC (permalink / raw)
To: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
On Fri, 14 Mar 2014 06:33:24 PM Chris Samuel wrote:
> I *think* you want smartctl -i instead, and look for the field that says
> something like:
>
> ATA Version is: ATA8-ACS, ACS-2 T13/2015-D revision 3
Late night, cut and pasted the wrong line of output, mine says:
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Of course that's what the drive is reporting it supports, I'm not sure whether
that's the result of what has been negotiated between the controller and drive
or purely what the drive supports.
To get more information from smartctl you can use the --identify=wb option
instead of -i and that should give you a lot more detail about what then
drives claims to (and not to) support. On the version in Kubuntu 13.10
(6.1+svn3812-1) it only reports 3 things regarding TRIM for my drives.
chris@quad:/tmp$ sudo smartctl --identify=wb -d sat /dev/sdb | egrep -i 'trim|
discard'
69 14 1 Deterministic data after trim supported
69 5 0 Trimmed LBA range(s) returning zeroed data supported
169 0 1 Trim bit in DATA SET MANAGEMENT command supported
I'm currently doing a git clone of their SVN repo to see if there's any new
functionality that will gather any more information.
cheers,
Chris
--
Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 482 bytes --]
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-15 4:06 ` Chris Samuel
@ 2014-03-16 16:07 ` Martin K. Petersen
0 siblings, 0 replies; 32+ messages in thread
From: Martin K. Petersen @ 2014-03-16 16:07 UTC (permalink / raw)
To: Chris Samuel; +Cc: linux-btrfs
>>>>> "Chris" == Chris Samuel <chris@csamuel.org> writes:
Chris> SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Chris> Of course that's what the drive is reporting it supports, I'm not
Chris> sure whether that's the result of what has been negotiated
Chris> between the controller and drive or purely what the drive
Chris> supports.
It just what the drive reports. Often drives will implement features
before they are ratified in the spec and thus before they can claim
compliance with a specific version.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-14 5:17 ` Marc MERLIN
2014-03-14 7:33 ` Chris Samuel
@ 2014-03-14 12:07 ` Duncan
2014-03-14 21:44 ` Chris Murphy
2 siblings, 0 replies; 32+ messages in thread
From: Duncan @ 2014-03-14 12:07 UTC (permalink / raw)
To: linux-btrfs
Marc MERLIN posted on Thu, 13 Mar 2014 22:17:50 -0700 as excerpted:
> On Thu, Mar 13, 2014 at 09:39:02PM -0600, Chris Murphy wrote:
>>
>> On Mar 13, 2014, at 8:11 PM, Marc MERLIN <marc@merlins.org> wrote:
>>
>> > On Sun, Mar 09, 2014 at 11:33:50AM +0000, Hugo Mills wrote:
>> >> discard is, except on the very latest hardware, a synchronous
>> >> command (it's a limitation of the SATA standard), and therefore
>> >> results in very very poor performance.
>> >
>> > Interesting. How do I know if a given SSD will hang on discard?
>> > Is a Samsung EVO 840 1TB SSD latest hardware enough, or not? :)
>>
>> smartctl -a or -x will tell you what SATA revision is in place. The
>> queued trim support is in SATA Rev 3.1. I'm not certain if this
>> requires only the drive to support that revision level, or both
>> controller and drive.
>
> I'm not sure I'm seeing this, which field is that?
> ATA Version is: 8
> ATA Standard is: ATA-8-ACS revision 4c
Your drive didn't report it, but here, I have SATA fields as well, in
addition to the ATA fields:
Here's the fields from my Corsair Neutron SSDs:
ATA Version is: ATA8-ACS (minor revision not indicated)
SATA Version is: SATA 2.5, 6.0 Gb/s
Here's the fields from my Seagate 500-gig 2.5-inch spinning rust:
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 2.6, 3.0 Gb/s
(More about that below.)
Smartctl version here is 6.2 2013-07-26 r3841, according to the output.
(I'm running gentoo/~amd64 FWIW so it's a local-build). You snipped that
bit of your output so I can't compare.
But it may also depend on whether smartctl auto-detected and used the ATA
or the SCSI (or something else) command set and how your devices are
actually connected, plus BIOS settings, etc. See the manpage
documentation for the -d TYPE (--device=TYPE) option and the ATA/SCSI/SAT
discussion rather further down the manpage for more.
Here I have direct SATA connections with the BIOS set to AHCI mode and am
thus using the kernel's AHCI drivers, since that's the most common SATA
chipset standard these days, thus increasing portability given my
monolithic kernel build.
smartctl's -d test reports an original guess of scsi, changed to sat
after detection.
Of course connection via USB bridge or the like complicates things
considerably.
Meanwhile, SATA 2.5, 6 Gb/s on the SSDs, SATA 2.6, 3 Gb/s on the spinning
rust? WTF? The SSDs have SATA 2.5 but 6 Gb/s while the spinning rust
has a later 2.6 but only 3 Gb/s (tho of course on a mechanical drive the
bus speed won't be the bottleneck)? Now I'm confused.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: discard synchronous on most SSDs?
2014-03-14 5:17 ` Marc MERLIN
2014-03-14 7:33 ` Chris Samuel
2014-03-14 12:07 ` Duncan
@ 2014-03-14 21:44 ` Chris Murphy
2 siblings, 0 replies; 32+ messages in thread
From: Chris Murphy @ 2014-03-14 21:44 UTC (permalink / raw)
To: Marc MERLIN; +Cc: Btrfs BTRFS
On Mar 13, 2014, at 11:17 PM, Marc MERLIN <marc@merlins.org> wrote:
> On Thu, Mar 13, 2014 at 09:39:02PM -0600, Chris Murphy wrote:
>>
>> On Mar 13, 2014, at 8:11 PM, Marc MERLIN <marc@merlins.org> wrote:
>>
>>> On Sun, Mar 09, 2014 at 11:33:50AM +0000, Hugo Mills wrote:
>>>> discard is, except on the very latest hardware, a synchronous command
>>>> (it's a limitation of the SATA standard), and therefore results in
>>>> very very poor performance.
>>>
>>> Interesting. How do I know if a given SSD will hang on discard?
>>> Is a Samsung EVO 840 1TB SSD latest hardware enough, or not? :)
>>
>> smartctl -a or -x will tell you what SATA revision is in place. The queued trim support is in SATA Rev 3.1. I'm not certain if this requires only the drive to support that revision level, or both controller and drive.
>
> I'm not sure I'm seeing this, which field is that?
>
> === START OF INFORMATION SECTION ===
> Device Model: Samsung SSD 840 EVO 1TB
> Serial Number: S1D9NEAD934600N
> LU WWN Device Id: 5 002538 85009a8ff
> Firmware Version: EXT0BB0Q
> User Capacity: 1,000,204,886,016 bytes [1.00 TB]
> Sector Size: 512 bytes logical/physical
> Device is: Not in smartctl database [for details use: -P showall]
> ATA Version is: 8
> ATA Standard is: ATA-8-ACS revision 4c
> Local Time is: Thu Mar 13 22:15:14 2014 PDT
> SMART support is: Available - device has SMART capability.
> SMART support is: Enabled
After ATA Version for me.
$ smartctl -a /dev/disk0
smartctl 6.1 2013-03-16 r3800 [x86_64-apple-darwin12.3.0] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Samsung based SSDs
Device Model: SAMSUNG SSD 830 Series
Serial Number: S0Z4NEAC933856
LU WWN Device Id: 5 002538 043584d30
Firmware Version: CXM03B1Q
User Capacity: 256,060,514,304 bytes [256 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-2 T13/2015-D revision 2
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Fri Mar 14 15:37:07 2014 MDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
The Samsung hardware by and large is fairly well behaved with discard in my experience. But it does really depend a lot on the workload. I'd notice occasional random freezes for a couple of seconds when I had it enabled in OS X (totally different animal from the kernel up), nothing severe. But it was annoying enough I disabled it, and the problem went away. Apple doesn't enable trim by default on non-Apple SSD's still, so the idea that "everyone else" is doing this isn't true. The Windows implementation is rather complex, and also isn't always used contrary to what's been reported (on the everybody panic or get mad NOW type web sites).
If you want to be conservative about it, I'd say just manually run fstrim when the system is idle. Do that once a week or two. Chron job it if you want.
Chris Murphy
^ permalink raw reply [flat|nested] 32+ messages in thread