From owner-freebsd-stable@freebsd.org Wed Aug 22 17:48:33 2018 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 179DF109051A for ; Wed, 22 Aug 2018 17:48:33 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost2.sentex.ca (smarthost2.sentex.ca [IPv6:2607:f3e0:80:80::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smarthost2.sentex.ca", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4E8580FA8 for ; Wed, 22 Aug 2018 17:48:32 +0000 (UTC) (envelope-from mike@sentex.net) Received: from lava.sentex.ca (lava.sentex.ca [IPv6:2607:f3e0:0:5:0:0:0:11]) by smarthost2.sentex.ca (8.15.2/8.15.2) with ESMTPS id w7MHmVJk087256 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Aug 2018 13:48:32 -0400 (EDT) (envelope-from mike@sentex.net) Received: from [192.168.43.26] (saphire3.sentex.net [192.168.43.26]) by lava.sentex.ca (8.15.2/8.15.2) with ESMTP id w7MHmTKT096175; Wed, 22 Aug 2018 13:48:30 -0400 (EDT) (envelope-from mike@sentex.net) Subject: Re: mSATA strangeness (was Re: gpart strangeness) From: Mike Tancsa To: Eugene Grosbein , FreeBSD-STABLE Mailing List , Eric van Gyzen References: <4e5b6d81-7fc5-c538-2bd2-8cd5dd040a1d@sentex.net> <6be4ee74-c09d-b88f-e4ed-cadb1537e478@grosbein.net> <7886da80-d2e3-1562-07df-cb955d888e1b@sentex.net> <62183e11-77ad-9b6d-ed57-357764e988d8@sentex.net> <3c606f0b-41a2-b654-9413-8b0f1be2f651@sentex.net> Openpgp: preference=signencrypt Autocrypt: addr=mike@sentex.net; prefer-encrypt=mutual; keydata=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22X8SqfVAiO TFKedCf/6jbSOedPN931FJQYopj9P6b3m0nI3ZiCDVSqeyOAIBLzm+RBUIU3brzoxDhYR8pz CJc2sK8l6YjqivPakrD86bFDff8AEQEAAcLAXwQYAQIACQUCTNwDbgIbDAAKCRCVx8DNpHPK 1+iQB/99aqNtez9ZTBWELj269La8ntuRx6gCpzfPXfn6SDIfTItDxTh1hrdRVP5QNGGF5wus N4EMwXouskva1hbFX3Pv72csYSxxEJXjW16oV8WK4KjKXoskLg2RyRP4uXqL7Mp2ezNtVY5F 9nu3fj4ydpHCSaqKy5xd70A8D50PfZsFgkrsa5gdQhPiGGEdxhq/XSeAAnZ4uVLJKarH+mj5 MEhgZPEBWkGrbDZpezl9qbFcUem/uT9x8FYT/JIztMVh9qDcdP5tzANW5J7nvgXjska+VFGY ryZK4SPDczh74mn6GI/+RBi7OUzXXPgpPBrhS5FByjwCqjjsSpTjTds+NGIY Organization: Sentex Communications Message-ID: <76177786-2e0e-2a21-fcaa-e07695b7d49a@sentex.net> Date: Wed, 22 Aug 2018 13:48:29 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <3c606f0b-41a2-b654-9413-8b0f1be2f651@sentex.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.83 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2018 17:48:33 -0000 Never mind, I found the issue hw.ata.ata_dma=0 hw.ata.atapi_dma=0 in /boot/loader.conf, hanging around from the days of wood burning power supplies was causing this strange behaviour! Sorry for the noise folks! ---Mike On 8/22/2018 12:17 PM, Mike Tancsa wrote: > OK, > Some more odd things going on. If I write to a file from dd some random > junk, not all of the file is saved when I do an unmount. This seems to > be specific either to the ata controller of the APU or to the msata disk > as I tested on a regular server with plain old disks and no issue > > Eric, any chance you can try this on your APU as well ? > > > 0# umount /mnt > 0# mount /dev/ada0p1 /mnt > 0# dd if=/dev/urandom of=/mnt/junk2 bs=512k count=4 > 4+0 records in > 4+0 records out > 2097152 bytes transferred in 0.101394 secs (20683253 bytes/sec) > 0# md5 /mnt/junk2 > MD5 (/mnt/junk2) = acca1d8997c3b9d906b40d99cba734b6 > 0# hd /mnt/junk2 > /tmp/hd-junk2 > 0# ls -l /mnt/junk2 > -rw------- 1 root wheel - 2097152 Aug 22 11:53 /mnt/junk2 > 0# umount /mnt > 0# mount /dev/ada0p1 /mnt > 0# md5 /mnt/junk2 > MD5 (/mnt/junk2) = 2ef0cadf32db4e07a8edf4fc66f8a4eb > 0# ls -l /mnt/junk2 > -rw------- 1 root wheel - 2097152 Aug 22 11:53 /mnt/junk2 > 0# hd /mnt/junk2 > /tmp/hd-junk2-post-mount > 0# ls -l /tmp/hd-junk2* > -rw------- 1 root wheel - 10354697 Aug 22 11:54 /tmp/hd-junk2 > -rw------- 1 root wheel - 1941594 Aug 22 11:54 /tmp/hd-junk2-post-mount > 0# > > If I do the same test on a USB stick it works as expected > > 0# umount /mnt > 0# mount /dev/da0p1 /mnt > 0# dd if=/dev/urandom of=/mnt/junk2 bs=512k count=4 > 4+0 records in > 4+0 records out > 2097152 bytes transferred in 0.102256 secs (20508777 bytes/sec) > 0# md5 /mnt/junk2 > MD5 (/mnt/junk2) = 51190332cdd4ef898bdc9c2520a9f749 > 0# umount /mnt > 0# mount /dev/da0p1 /mnt > 0# md5 /mnt/junk2 > MD5 (/mnt/junk2) = 51190332cdd4ef898bdc9c2520a9f749 > 0# > Same with an SD card. All is OK > > 0# umount /mnt > 0# mount /dev/mmcsd0s2a /mnt > 0# dd if=/dev/urandom of=/mnt/junk2 bs=512k count=4 > 4+0 records in > 4+0 records out > 2097152 bytes transferred in 0.107400 secs (19526588 bytes/sec) > 0# md5 /mnt/junk2 > MD5 (/mnt/junk2) = 0811af4e57ab5a3bc224e5b8f8b3bc29 > 0# umount /mnt > 0# mount /dev/mmcsd0s2a /mnt > 0# md5 /mnt/junk2 > MD5 (/mnt/junk2) = 0811af4e57ab5a3bc224e5b8f8b3bc29 > 0# > > Looking at hd before and after, its missing the end of the file > > --- hd-junk2 2018-08-22 11:54:09.891572000 -0400 > +++ hd-junk2-post-mount 2018-08-22 11:54:41.996983000 -0400 > @@ -24574,106500 +24574,6 @@ > 0005ffd0 8b 71 87 b8 78 03 72 ca 0e 06 3b d4 31 fd 18 f8 > |.q..x.r...;.1...| > 0005ffe0 de 39 72 fb c8 39 fd 1f 93 75 10 de 05 56 43 fb > |.9r..9...u...VC.| > 0005fff0 40 ce 54 e2 a4 17 3e 1e ec 01 b7 fd 1b 69 b7 6f > |@.T...>......i.o| > -00060000 91 f3 02 ea 95 f4 12 1c bf 00 68 1b 3d 8c 01 43 > |..........h.=..C| > -00060010 f6 5b 4e ec 7f 37 19 15 5b c4 e6 fb 88 27 1c 54 > |.[N..7..[....'.T| > -00060020 15 6c 02 7d fb 00 06 c1 4a 4a bf ce 9a 1b fe d4 > |.l.}....JJ......| > -00060030 1c 3c b5 05 b6 4f 4e 62 b5 03 e3 e7 5e 27 d6 71 > |.<...ONb....^'.q| > -00060040 ea 22 00 99 9d 13 e8 a9 64 0e fd 13 cc 23 73 67 > |."......d....#sg| > -00060050 8e 78 0a ad ae 70 ab e4 22 b4 b7 b9 3b 75 9f 85 > |.x...p.."...;u..| > -00060060 53 39 0c af 15 39 5f 04 ac 3c 65 e9 ea 29 1d b7 > |S9...9_.. -00060070 ea f0 2f 19 3c 6d 1c 21 f1 58 4a 4b a8 26 8e f6 > |../. -00060080 05 99 8a 9d 54 75 e4 77 78 78 6c 75 21 31 d4 0c > |....Tu.wxxlu!1..| > -00060090 52 88 c6 65 c0 09 04 ce 7f 5f 29 0c 46 9a 68 13 > |R..e....._).F.h.| > -000600a0 73 30 97 78 d7 b7 d2 ba 8f 73 27 58 3d eb 0c d6 > |s0.x.....s'X=...| > > > 1# camcontrol identify ada0 > pass0: ACS-3 ATA SATA 3.x device > pass0: 600.000MB/s transfers (SATA 3.x, PIO4, PIO 8192bytes) > > protocol ATA/ATAPI-10 SATA 3.x > device model SATA SSD > firmware revision S9FM02.0 > serial number 81B5074C1B6500076878 > cylinders 16383 > heads 16 > sectors/track 63 > sector size logical 512, physical 512, offset 0 > LBA supported 31277232 sectors > LBA48 supported 31277232 sectors > PIO supported PIO4 > DMA supported WDMA2 UDMA6 > media RPM non-rotating > Zoned-Device Commands no > > Feature Support Enabled Value Vendor > read ahead yes yes > write cache yes yes > flush cache yes yes > overlap no > Tagged Command Queuing (TCQ) no no > Native Command Queuing (NCQ) yes 32 tags > NCQ Queue Management no > NCQ Streaming no > Receive & Send FPDMA Queued no > SMART yes yes > microcode download yes yes > security yes no > power management yes yes > advanced power management yes no 0/0x00 > automatic acoustic management no no > media status notification no no > power-up in Standby no no > write-read-verify no no > unload yes yes > general purpose logging yes yes > free-fall no no > Data Set Management (DSM/TRIM) yes > DSM - max 512byte blocks yes 8 > DSM - deterministic read no > Host Protected Area (HPA) yes no 31277232/31277232 > HPA - Security no > 0# > > > > On 8/21/2018 2:30 PM, Mike Tancsa wrote: >> On 8/21/2018 9:51 AM, Eugene Grosbein wrote: >>> >>> It seems like faulty media to me: it silently returns bad data. >>> >>> There is an easy way to verify this just with naked eye: >>> >>> yes | dd bs=128k of=/dev/ada0 >>> hd /dev/ada0 >>> >>> That is, hd(1) should write back only 3 lines of output: >>> >>> 00000000 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a |y.y.y.y.y.y.y.y.| >>> * >>> 01000000 >>> >>> If not, the media if faulty. >>> >> >> There are 3 of these disks I found. Unfortunately, they all seem a >> little different from the revision stamps on the board. They are all >> from PCEngines who generally seem to source quality products. This is in >> an APU3 >> >> A "bad" disk >> >> 0# camcontrol identify ada0 >> pass0: ACS-3 ATA SATA 3.x device >> pass0: 600.000MB/s transfers (SATA 3.x, PIO4, PIO 8192bytes) >> >> protocol ATA/ATAPI-10 SATA 3.x >> device model SATA SSD >> firmware revision S9FM02.0 >> serial number DED9075313EC01677930 >> cylinders 16383 >> heads 16 >> sectors/track 63 >> sector size logical 512, physical 512, offset 0 >> LBA supported 31277232 sectors >> LBA48 supported 31277232 sectors >> PIO supported PIO4 >> DMA supported WDMA2 UDMA6 >> media RPM non-rotating >> Zoned-Device Commands no >> >> Feature Support Enabled Value Vendor >> read ahead yes yes >> write cache yes yes >> flush cache yes yes >> overlap no >> Tagged Command Queuing (TCQ) no no >> Native Command Queuing (NCQ) yes 32 tags >> NCQ Queue Management no >> NCQ Streaming no >> Receive & Send FPDMA Queued no >> SMART yes yes >> microcode download yes yes >> security yes no >> power management yes yes >> advanced power management yes no 0/0x00 >> automatic acoustic management no no >> media status notification no no >> power-up in Standby no no >> write-read-verify no no >> unload yes yes >> general purpose logging yes yes >> free-fall no no >> Data Set Management (DSM/TRIM) yes >> DSM - max 512byte blocks yes 8 >> DSM - deterministic read no >> Host Protected Area (HPA) yes no 31277232/31277232 >> HPA - Security no >> 0# >> >> vs >> a 'good' disk >> >> # camcontrol identify ada0 >> pass0: ACS-4 ATA SATA 3.x device >> pass0: 600.000MB/s transfers (SATA 3.x, PIO4, PIO 8192bytes) >> >> protocol ATA/ATAPI-11 SATA 3.x >> device model SATA SSD >> firmware revision SBFM01.0 >> serial number A44907781CE300040613 >> WWN 5000000000000000 >> cylinders 16383 >> heads 16 >> sectors/track 63 >> sector size logical 512, physical 512, offset 0 >> LBA supported 31277232 sectors >> LBA48 supported 31277232 sectors >> PIO supported PIO4 >> DMA supported WDMA2 UDMA6 >> media RPM non-rotating >> Zoned-Device Commands no >> >> Feature Support Enabled Value Vendor >> read ahead yes yes >> write cache yes yes >> flush cache yes yes >> overlap no >> Tagged Command Queuing (TCQ) no no >> Native Command Queuing (NCQ) yes 32 tags >> NCQ Queue Management no >> NCQ Streaming no >> Receive & Send FPDMA Queued no >> SMART yes yes >> microcode download yes yes >> security yes no >> power management yes yes >> advanced power management no no >> automatic acoustic management no no >> media status notification no no >> power-up in Standby no no >> write-read-verify no no >> unload no no >> general purpose logging yes yes >> free-fall no no >> Data Set Management (DSM/TRIM) yes >> DSM - max 512byte blocks yes 8 >> DSM - deterministic read no >> Host Protected Area (HPA) yes no 31277232/31277232 >> HPA - Security no >> >> >> >> % diff good bad >> 1c1 >> < pass0: ACS-4 ATA SATA 3.x device >> --- >>> pass0: ACS-3 ATA SATA 3.x device >> 4c4 >> < protocol ATA/ATAPI-11 SATA 3.x >> --- >>> protocol ATA/ATAPI-10 SATA 3.x >> 6,8c6,7 >> < firmware revision SBFM01.0 >> < serial number A44907781CE300040613 >> < WWN 5000000000000000 >> --- >>> firmware revision S9FM02.0 >>> serial number DED9075313EC01677930 >> 34c33 >> < advanced power management no no >> --- >>> advanced power management yes no 0/0x00 >> 39c38 >> < unload no no >> --- >>> unload yes yes >> 46a46 >>> >> >> 1# yes | dd bs=128k of=/dev/ada0 >> dd: /dev/ada0: short write on character device >> dd: /dev/ada0: end of device >> 0+1066621 records in >> 122176+1 records out >> 16013942784 bytes transferred in 566.461990 secs (28270110 bytes/sec) >> 1# hd /dev/ada0 >> 00000000 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a 79 0a >> |y.y.y.y.y.y.y.y.| >> * >> 3ba816000 >> 0# >> > > -- ------------------- Mike Tancsa, tel +1 519 651 3400 x203 Sentex Communications, mike@sentex.net Providing Internet services since 1994 www.sentex.net Cambridge, Ontario Canada