From: "Monty Montgomery" <monty@xiph.org>
To: Tejun Heo <htejun@gmail.com>
Cc: Brice Goglin <Brice.Goglin@ens-lyon.org>,
Jens Axboe <jens.axboe@oracle.com>,
Gregor Jasny <gjasny@googlemail.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Jeff Garzik <jgarzik@pobox.com>,
linux-ide@vger.kernel.org, Douglas Gilbert <dougg@torque.net>
Subject: Re: 2.6.19-rc3 system freezes when ripping with cdparanoia at ioctl(SG_IO)
Date: Thu, 9 Nov 2006 15:09:22 -0500 [thread overview]
Message-ID: <806dafc20611091209s5864c9eam77a9290194de343d@mail.gmail.com> (raw)
In-Reply-To: <45533468.1060400@gmail.com>
On 11/9/06, Tejun Heo <htejun@gmail.com> wrote:
> drivers/scsi/sg.c interprets SG_DXFER_TO_FROM_DEV as read while
> block/scsi_ioctl.c interprets it as write. I guess this is historic
> thing (scsi/sg.c updated but block/scsi_ioctl.c is forgotten).
Not historic; Jens accidentally implemented it backwards. No one
noticed for a long time. I submitted a patch for this a few months
ago.
> This works for most PATA ATAPI devices. Most devices detect reversed
> transfer and terminate the command promptly.
No. The rejection is *not* in hardware; it is in software.
block/scsi_ioctl.c, at least up to 2.6.16, rejected the TO_FROM_DEVICE
request when verifying the command for sanity after setting the
transfer direction incorrectly. As far as the *device* can see,
TO_FROM_DEVICE and FROM_DEVICE are identical. The difference only
applies inside the kernel mid-level driver where TO_FROM_DEVICE
prefills the transfer buffer as a way of working around having no
other detection path for short DMA transfers.
> But this doesn't seem to
> be true for SATA device.
Then the driver is broken and needs to be fixed. And I'll need to
find a workaround for broken kernels that doesn't cause a boom.
> Jens, I think we need to match block sg's behavior to SCSI's. Monty,
> the timeout and hard lock up are due to hardware restrictions.
No., the kernel setting the transfer direction incorrectly. I don't
set the transfer direction, the kernel does.
In your case, I pass in "SGIO_TO_FROM_DEVICE" and the kernel says
"that's a write". The kernel is wrong. It is a read. The original
description of what TO_FROM_DEVICE is for is explicit on this point.
> Kernel
> and libata can't do much about it. So, please find other way to detect
> interface.
Just to be clear-- it is the kernel at fault here, and the kernel can
do something about it-- but only if the kernel gets fixed. Also to be
clear, given this brokenness, yes I need to find another way.
Dammit, dammit, dammit, one step forward, two steps back :-(
Monty
next prev parent reply other threads:[~2006-11-09 20:09 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-29 19:20 2.6.19-rc3 system freezes when ripping with cdparanoia at ioctl(SG_IO) Gregor Jasny
2006-10-29 21:31 ` Ken Moffat
2006-10-29 22:05 ` Brice Goglin
2006-10-30 11:45 ` Jens Axboe
2006-10-30 13:14 ` Gregor Jasny
2006-10-30 13:17 ` Gregor Jasny
2006-10-30 13:27 ` Jens Axboe
2006-11-09 9:46 ` Brice Goglin
2006-11-09 14:00 ` Tejun Heo
2006-11-09 14:14 ` Jeff Garzik
2006-11-09 20:13 ` Monty Montgomery
2006-11-09 15:50 ` Douglas Gilbert
2006-11-10 10:36 ` Luben Tuikov
2006-11-10 12:58 ` Douglas Gilbert
2006-11-10 20:08 ` Luben Tuikov
2006-11-11 10:46 ` Christoph Hellwig
2006-11-11 16:39 ` Douglas Gilbert
2006-11-11 19:09 ` Luben Tuikov
2006-11-14 22:52 ` Monty Montgomery
2006-11-09 20:09 ` Monty Montgomery [this message]
2006-11-09 22:47 ` Tejun Heo
2006-11-10 16:15 ` Jens Axboe
2006-11-10 16:19 ` Brice Goglin
2006-11-10 16:23 ` Jens Axboe
2006-11-14 12:24 ` Brice Goglin
2006-11-14 12:29 ` Jens Axboe
2006-11-14 12:40 ` Brice Goglin
2006-11-14 12:50 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=806dafc20611091209s5864c9eam77a9290194de343d@mail.gmail.com \
--to=monty@xiph.org \
--cc=Brice.Goglin@ens-lyon.org \
--cc=dougg@torque.net \
--cc=gjasny@googlemail.com \
--cc=htejun@gmail.com \
--cc=jens.axboe@oracle.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.