From owner-freebsd-fs@freebsd.org Sat Sep 8 09:32:46 2018 Return-Path: Delivered-To: freebsd-fs@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 72614FEE4F4 for ; Sat, 8 Sep 2018 09:32:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-20.consmr.mail.gq1.yahoo.com (sonic309-20.consmr.mail.gq1.yahoo.com [98.137.65.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8F388D96F for ; Sat, 8 Sep 2018 09:32:45 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: vdV_uYsVM1no.QFATa2_NoSRJq2y3iEu3Gg.Bjce94SOfG7bDSfuaMirnegNEw0 nWa5rdR3oK21GxqKEJ7dpLWIUq2dq3FQRMs0XPEpXq5vShETl2Lmv_PewNo7gp0OdcDXvJ3E1suC ebqkiZMbmio5HYIk6c0j6250ubB42iECx3476fJkAra.aIbI.vr9fKh727FABqfsuqpMSBhmWqW_ tUjtdbi2Xerd7QIU5r3Ma5XNeFD.TKhKDmrsO9T6Q_MjnzD.d6YgMwEonSpILhhnN1kjaKXKe3AR A98khwSIB2ry0l2_AP_aBNoaw.iQwoe7sjS9ig42n6Pl9hu88ffXeGYb.rPRKLU7uyU.hh4jVkqi NHUqtjbKLh72EesCeUbx4ZnADgInAbme_5ts0BdchktDU41pVhfR1WWnQu2wgYGcHuvU6_O8wto9 SyD.0aHzCpmJyJv8_WQQG6wLHEozpYVUG2pjz6haHD6InpadP7Ot1VgWTlJfD.9mF.CySVPCV7c. Vfta5VYNSNcKYDCtCHSsXx5hNZmPzr8nIQTZK.AoeYgWKag8gVU6cnb4kco6aR1.7eRTkc.1.yQb gFzIoVfwnF3esRlMrl2rYP9STNmKtPZ6UdWlz7JtBnzIxBgSf63RknuPHV0OCTbjHrA7.dKgA.rj IXaLXjmpmZAKIKW9NZ03C9O.em_SJM.QkrFlnPt26_lOXmzHtdw1eYpBQv6pvxoitFCgTbjxtASi .Ilwg89eq6xEC.V5Q5EfAQGhDUFGtxJ.T7Ynzb8qy3qy1R4nzI2Vg6NUpQGk_QVEEH3Mri_NuxC0 3H9tf97rRbCbtQMjG70n1oGAQXXNiBCyP56ZlNi3lorckdmQNGqgWnS9Qx2q2KMFZSIOummfGFrc pPWqORpxNcSAG79xv2N09hJbhrkkYGq1JmyfgeiB1JR7VEGZtMxlsdgxEmNJNj.6r3LfYS2TvjLX uIK4a7aQ75l70KllAw2hf5V3MPsGbE1ZchjPcpUYUvnWGIVk0jUvIZAXUpWkyjE2r.y0wqqsmE1j zu4V717aS Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Sat, 8 Sep 2018 09:32:39 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp401.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID f010c9f6994ccd3735c83186d7b3f674; Sat, 08 Sep 2018 09:32:36 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: CFT: TRIM Consolodation on UFS/FFS filesystems From: Mark Millard In-Reply-To: Date: Sat, 8 Sep 2018 02:32:35 -0700 Cc: bob prohaska , FreeBSD Filesystems Content-Transfer-Encoding: 7bit Message-Id: References: <201809062330.w86NUphJ027262@chez.mckusick.com> To: Kirk McKusick X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Sep 2018 09:32:46 -0000 On 2018-Sep-8, at 1:36 AM, Mark Millard wrote: > Just an FYI. > > I figured out a hack that allows the e.MMC on a microsd card > adapter to be used to boot and operate the Pine64+ 2GB, in > DDR52 mode at that. (And so shows what was missing in the > FreeBSD operation even if the code change is not the > proper form of an official fix.) > > But in the process I discovered that FreeBSD is using > (for e.MMC in this tested context): > > mmc0: REQUEST: CMD38 arg 0x1 flags 0x1d > > That "0x1" means: TRIM that forces reads of zeros: the true > Data Removal command for mmc protocol, a form of erase. 0x3 > would be DISCARD, the "performance command" that does not > guarantee what would be read afterwards: no erase required. > > TRIM is older (added in e/MCC 4.4). DISCARD is newer (added > in e.MMC 4.5). Each is mandatory when the version has the > function at all. > > Does FreeBSD have a policy of preferring erasure when > there is also the option to not require it? I looked up published SD card material and that command set encodes differently for the argument: 0x1 is DISCARD (also not requiring an erase) 0x2 is FULE when start LBA=LBA0 and end LBA=MaxLBA. Otherwise it is ERASE. (FreeBSD's mmcsd_delete uses 0x0 for ERASE selection.) (I ignore handling violations of start LBA <= end LBA <= Max LBA or out of order command sequences. FULE: Full User Area Logical Erase.) It looks like FreeBSD uses mmcsd_delete for both SD and e.MMC and it is coded for SD to be more optimal (DISCARD), not differentiating e.MMC from SD for argument values to use. In e.MMC 4.5+ 0x2 is a "discard enable" bit in the argument, and never a FULE or other such. In e.MMC the 0x0 case for CMD38's argument is for performing an erase on erase group(s) instead of sector(s). (I'm not describing Secure Request or Force Garbage Collect being 0x1 for e.MMC: apparently unused by mmcsd_delete .) === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)