From owner-freebsd-current@FreeBSD.ORG Tue Apr 7 17:21:23 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB798B58 for ; Tue, 7 Apr 2015 17:21:23 +0000 (UTC) Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.31.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5BF1C6CC for ; Tue, 7 Apr 2015 17:21:23 +0000 (UTC) Received: from [78.35.186.174] (helo=fabiankeil.de) by smtprelay02.ispgateway.de with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1YfX86-0004PN-8E for freebsd-current@freebsd.org; Tue, 07 Apr 2015 19:17:38 +0200 Date: Tue, 7 Apr 2015 19:17:13 +0200 From: Fabian Keil To: freebsd-current@freebsd.org Subject: Re: async pass(4) patches available Message-ID: <4c23ab84.39d1cfcf@fabiankeil.de> In-Reply-To: <20150407163113.GA7762@mithlond.kdm.org> References: <20150330222358.GA46342@mithlond.kdm.org> <2147223b.4518a234@fabiankeil.de> <20150406220744.GA92212@mithlond.kdm.org> <00653530.74872429@fabiankeil.de> <20150407163113.GA7762@mithlond.kdm.org> Reply-To: freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/KBhCX2hwG4QRS.qEFAlUvvr"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2015 17:21:23 -0000 --Sig_/KBhCX2hwG4QRS.qEFAlUvvr Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable "Kenneth D. Merry" wrote: > On Tue, Apr 07, 2015 at 13:16:04 +0200, Fabian Keil wrote: > > "Kenneth D. Merry" wrote: > >=20 > > > On Mon, Apr 06, 2015 at 15:39:56 +0200, Fabian Keil wrote: > > > > "Kenneth D. Merry" wrote: > > > >=20 > > > > > I have put patches to add an asynchronous interface to the > > > > > pass(4) driver and add a new camdd(8) utility here: > > > > >=20 > > > > > FreeBSD/head as of SVN revision 280857: > > > > >=20 > > > > > http://people.freebsd.org/~ken/async_pass.head.20150330.1.txt > > > > [...] > > > > > Comments and testing are welcome! As I said, camdd(8) in > > > > > particular is a work in progress. It could use some cleanup and > > > > > there are some more useful features that could be added there. > > > >=20 > > > > I've been using the patch for a couple of days on an amd64 system > > > > based on 11.0-CURRENT r280952 and didn't notice any obvious > > > > regressions using the system as usual. > > [...]=20 > > > > I also tried to test camdd, but didn't get it to work. > > > > Some failed attempts: > > > >=20 > > > > [fk@kendra ~]$ sudo camdd -i pass=3Dda0,bs=3D65536 -o file=3Dblafse= l.img > > > > (pass2:umass-sim0:0:0:0): READ(6). CDB: 08 00 00 00 80 00=20 > > > > (pass2:umass-sim0:0:0:0): CAM status: CCB request completed with an > > > > error 13 bytes read from pass2 > > > > 13 bytes written to blafsel.img > > > > 20.3203 seconds elapsed > > > > 0.00 MB/sec > > > > [fk@kendra ~]$ sudo hd blafsel.img=20 > > > > 00000000 55 53 42 53 d9 02 00 00 00 00 01 00 01 > > > > |USBS.........| 0000000d > > > > [fk@kendra ~]$ sudo dd if=3D/dev/da0 bs=3D1k count=3D1 | hd | head= -n 1 > > > > 1+0 records in > > > > 1+0 records out > > > > 1024 bytes transferred in 0.000603 secs (1697756 bytes/sec) > > > > 00000000 fc 31 c0 8e c0 8e d8 8e d0 bc 00 0e be 1a 7c bf > > > > |.1............|.| > > >=20 > > > One possibility is that the device doesn't support 6-byte read/write > > > requests. The da(4) driver has quirk entries and code to figure > > > that out and default to 10-byte read/write requests, but camdd(8) > > > doesn't have anything like that yet. > > >=20 > > > I've attached patches to camdd that allow you to specify a minimum > > > command size. So, apply the patches, rebuild camdd, and try this: > > >=20 > > > # sudo camdd -i pass=3Dda0,bs=3D65536,mcs=3D10 -o file=3Dblafsel.img > > >=20 > > > We'll see if that helps. I'm not sure why you were even able to get > > > 13 bytes back. That is very strange. > >=20 > > With the patch, reading from da0 seems to work until the end, > > but again only 13 bytes are written out when writing to a file: > >=20 > > [fk@kendra ~]$ sudo camdd -i pass=3Dda0,bs=3D65536,mcs=3D10 -o > > file=3Dblafsel.img (pass2:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 78 > > a8 00 00 00 00 00 (pass2:umass-sim0:0:0:0): CAM status: CCB request > > completed with an error 4048551936 bytes read from pass2 > > 13 bytes written to blafsel.img > > 127.6488 seconds elapsed > > 0.00 MB/sec >=20 > Did the file exist before running that command? If so, camdd will look > at the file size and not write any more than the current file size. That was probably it, at least I couldn't reproduce the problem with a new file a few minutes ago: [fk@kendra ~]$ sudo camdd -i pass=3Dda0,bs=3D65536,mcs=3D10 -o file=3D/dpoo= l/scratch/new-file.img =20 (pass2:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 78 a8 00 00 00 00 00=20 (pass2:umass-sim0:0:0:0): CAM status: CCB request completed with an error 4048551936 bytes read from pass2 4048551936 bytes written to /dpool/scratch/new-file.img 127.3009 seconds elapsed 30.33 MB/sec and with an existing file camdd indeed behaved like you described: [fk@kendra ~]$ truncate -s 100 /dpool/scratch/small-file [fk@kendra ~]$ sudo camdd -i pass=3Dda0,bs=3D65536,mcs=3D10 -o file=3D/dpoo= l/scratch/small-file =20 (pass2:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 78 a8 00 00 00 00 00=20 (pass2:umass-sim0:0:0:0): CAM status: CCB request completed with an error 4048551936 bytes read from pass2 100 bytes written to /dpool/scratch/small-file 128.4956 seconds elapsed 0.00 MB/sec > Thank you for testing it! No problem. Fabian --Sig_/KBhCX2hwG4QRS.qEFAlUvvr Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlUkERYACgkQBYqIVf93VJ23XgCfSK/F3XlMJ3Bqgf/bHIExeims ODAAn0ifZpudIpbXn9wDRmO1Wkvekr3+ =JQRp -----END PGP SIGNATURE----- --Sig_/KBhCX2hwG4QRS.qEFAlUvvr--