From owner-freebsd-scsi@FreeBSD.ORG Mon Nov 8 16:30:04 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C158D10656A9 for ; Mon, 8 Nov 2010 16:30:04 +0000 (UTC) (envelope-from joerg.schilling9ab33xy531fokus.fraunhofer.de@bounce.antispameurope.com) Received: from relay01-haj2.antispameurope.com (relay01-haj2.antispameurope.com [83.246.65.51]) by mx1.freebsd.org (Postfix) with ESMTP id 3C1BC8FC21 for ; Mon, 8 Nov 2010 16:30:03 +0000 (UTC) Received: by relay01-haj2.antispameurope.com (ASE-Secure-MTA, from userid 1000) id 99EB016005D; Mon, 8 Nov 2010 17:19:11 +0100 (CET) Received: from pluto.fokus.fraunhofer.de (pluto.fokus.fraunhofer.de [195.37.77.164]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by relay01-haj2.antispameurope.com (ASE-Secure-MTA) with ESMTP id 8C831160053; Mon, 8 Nov 2010 17:19:09 +0100 (CET) Received: from EXCHSRV.fokus.fraunhofer.de (bohr.fokus.fraunhofer.de [10.147.9.231]) by pluto.fokus.fraunhofer.de (8.14.2/8.14.2) with SMTP id oA8GJ3Yp026804; Mon, 8 Nov 2010 17:19:08 +0100 (MET) Received: from rigel ([10.147.65.195]) by EXCHSRV.fokus.fraunhofer.de with Microsoft SMTPSVC(6.0.3790.3959); Mon, 8 Nov 2010 17:18:42 +0100 Date: Mon, 08 Nov 2010 17:18:39 +0100 From: Joerg.Schilling@fokus.fraunhofer.de (Joerg Schilling) To: mav@freebsd.org, marius@alchemy.franken.de Message-ID: <4cd822df.o/wBtwsNCXiy8xZn%Joerg.Schilling@fokus.fraunhofer.de> References: <4CD45209.5010607@FreeBSD.org> <20101105192028.GA68728@alchemy.franken.de> In-Reply-To: <20101105192028.GA68728@alchemy.franken.de> User-Agent: nail 11.22 3/20/05 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 08 Nov 2010 16:18:42.0976 (UTC) FILETIME=[9C854A00:01CB7F60] Cc: freebsd-scsi@freebsd.org, freebsd-current@freebsd.org, freebsd-stable@freebsd.org Subject: Re: Sense fetching [Was: cdrtools /devel ...] X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 16:30:04 -0000 Marius Strobl wrote: > On Fri, Nov 05, 2010 at 08:50:49PM +0200, Alexander Motin wrote: > > Hi. > > > > I've reviewed tests that scgcheck does to SCSI subsystem. It shown > > combination of several issues in both CAM, ahci(4) and cdrtools itself. > > Several small patches allow us to pass most of that tests: > > http://people.freebsd.org/~mav/sense/ > > > > ahci_resid.patch: Add support for reporting residual length on data > > underrun. SCSI commands often returns results shorter then expected. > > Returned value allows application to know/check how much data it really > > has. It is also important for sense fetching, as ATAPI and USB devices > > return sense as data in response to REQUEST_SENSE command. > > > > sense_resid.patch: When manually requesting sense data (ATAPI or USB), > > request only as much data as user requested (not the fixed structure > > size), and return respective sense residual length. Your patch to libscg looks definitely OK if we only look at the new corrected kernel driver behavior. There is a problem: In case that there is a sense data residual > 0, libscg will asume that there is less sense data that really present in case that a "new" libscg is runnung on an old kernel. Given the fact that many drives will probably only return 18 bytes of sense data, this will happen every time libscg is told to fetch more sense than the drive is willing to return. Is there a way to distinct an old kernel from a new one? > > pass_autosence.patch: Unless CAM_DIS_AUTOSENSE is set, always fetch > > sense if not done by SIM, independently of CAM_PASS_ERR_RECOVER. As soon > > as device freeze released before returning to user-level, user-level > > application by definition can't reliably fetch sense data if some other > > application (like hald) tries to access device same time. This is what we need! > > cdrtools.patch: Make libscg (part of cdrtools) on FreeBSD to submit > > wanted sense length to CAM and do not clear sense return buffer. It is > > mostly cosmetics, important probably only for scgcheck. I see no advantage in removing the call to fillbytes(). > Please don't commit this to the port directly but let it loop back > via upstream (CC'ed) instead, otherwise we would need to obey the > following, which is undesirable, especially if these really are > mostly cosmetic issues: > /* > * Warning: you may change this source, but if you do that > * you need to change the _scg_version and _scg_auth* string below. > * You may not return "schily" for an SCG_AUTHOR request anymore. > * Choose your name instead of "schily" and make clear that the version > * string is related to a modified source. > */ > > > > > Testers and reviewers welcome. I am especially interested in opinion > > about pass_autosence.patch -- may be we should lower sense fetching even > > deeper, to make it work for all cam_periph_runccb() consumers. Did you test a modified libscg on an unmodified kernel? Jörg -- EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin js@cs.tu-berlin.de (uni) joerg.schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily