All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	linux-ide@vger.kernel.org, Jeff Garzik <jgarzik@redhat.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: todays git: WARNING: at drivers/ata/libata-sff.c:1017 ata_sff_hsm_move+0x45e/0x750()
Date: Sat, 10 Jan 2009 09:22:51 -0600	[thread overview]
Message-ID: <1231600972.3642.22.camel@localhost.localdomain> (raw)
In-Reply-To: <20090110151248.063199d2@lxorguk.ukuu.org.uk>

On Sat, 2009-01-10 at 15:12 +0000, Alan Cox wrote:
> O> Your problem is that the *device* is wanting to transfer a set of bytes
> > not divisible by four.  If you want to use word based PIO, you'll have
> > to fall back to collecting bytes for the last two.  Alternatively, you
> 
> Nope.. you can't do that with ATA block transfers - it isn't the same as
> SCSI

Well, in that case you'll have to do byte PIO for all ATAPI devices,
because this is an expected device to host transfer length.

> > could just do byte PIO for all reply lengths like this ... they occur
> > all over the SCSI standard, but not usually in critical paths.
> 
> The problem we have is that the sg list the drivers were given had a
> segment which was not divisible in length by four and was *NOT* the last
> segment in the sg list

Yes it was, look at the debugging info:

Christian Borntraeger wrote:

> [    1.499843] scsi 1:0:0:0: CD-ROM            HL-DT-ST DVDRAM
> GSA-U10N  1.05 PQ: 0 ANSI: 5
> [    1.508389] count: 18 sg->length: 96 qc->cursg_ofs: 0 bytes: 18
> [    1.509369] qc->cdb[]:03000000600000000000000000000000
> That one is broken.

That's a single element sg list with a 96 byte buffer.  That's precisely
what SCSI sets up to receive incoming sense data.  There's basically no
setup commands which are multiple element because the sg list is set up
on a kmalloc'd buffer.

The problem is that bytes is 18 and that comes from this:

	ap->ops->sff_tf_read(ap, &qc->result_tf);
	ireason = qc->result_tf.nsect;
	bc_lo = qc->result_tf.lbam;
	bc_hi = qc->result_tf.lbah;
	bytes = (bc_hi << 8) | bc_lo;

So we're asking the device how much data it wants to transfer. It said
18 bytes.  There's nothing padding or aligning in block can do about
this.

> The logic in the ATA PIO code is basically
> 
> 
> 	for each sg entry
> 
> 		compute the number of bytes to transfer staying within
> the page
> 		transfer that many bytes (but may be more)
> 
> 		if and only if the transfer is NOT the last segment but is
> 			more than the bytes requested - WARN
> 
> 
> The block alignment is set to 4 bytes so the block code should be handing
> down stuff which is safe. Some of the sense and other stuff is "adjusted"
> by the libata-scsi conversion code which at this point I suspect is the
> offender.

It is.  The receive buffer is 96 bytes.  It will be page aligned and 96
is divisible by 4.

> This is why libata uses the pad buffers we don't get to be quite so exact
> about transfer sizes as SCSI is.

The block layer does do pad buffers, but in this case there was no need
of one.

James



  reply	other threads:[~2009-01-10 15:22 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 12:34 todays git: WARNING: at drivers/ata/libata-sff.c:1017 ata_sff_hsm_move+0x45e/0x750() Christian Borntraeger
2009-01-09 12:44 ` Alan Cox
2009-01-09 13:09   ` Christian Borntraeger
2009-01-10  9:09   ` Christian Borntraeger
2009-01-10 10:41     ` Alan Cox
2009-01-10 11:42       ` Christian Borntraeger
2009-01-10 11:49         ` Sergei Shtylyov
2009-01-10 12:21           ` Alan Cox
2009-01-10 13:01             ` Sergei Shtylyov
2009-01-10 13:55               ` Alan Cox
2009-01-10 13:04             ` Christian Borntraeger
2009-01-10 13:14               ` Jeff Garzik
2009-01-10 13:27                 ` Christian Borntraeger
2009-01-10 13:51                 ` Alan Cox
2009-01-10 21:21                   ` Arjan van de Ven
2009-01-10 13:07             ` Ingo Molnar
2009-01-10 13:12               ` Jeff Garzik
2009-01-10 13:24                 ` Ingo Molnar
2009-01-10 13:36                   ` [bisected] " Ingo Molnar
2009-01-10 13:57                     ` Alan Cox
2009-01-10 15:10                       ` Sergei Shtylyov
2009-01-10 15:28                         ` Alan Cox
2009-01-10 15:59                           ` Sergei Shtylyov
2009-01-10 20:06                             ` Sergei Shtylyov
2009-01-10 20:31                               ` Jeff Garzik
2009-01-10 20:50                                 ` Sergei Shtylyov
2009-01-11  0:10                               ` Alan Cox
2009-01-11  9:18                                 ` Sergei Shtylyov
2009-01-11 11:24                                   ` Alan Cox
2009-01-13  9:38                           ` [PATCH] ata: fix wrong WARN_ON_ONCE Christian Borntraeger
2009-01-10 13:57                     ` [bisected] Re: todays git: WARNING: at drivers/ata/libata-sff.c:1017 ata_sff_hsm_move+0x45e/0x750() Christian Borntraeger
2009-01-10 13:53               ` Alan Cox
2009-01-10 14:36             ` James Bottomley
2009-01-10 15:03               ` Jeff Garzik
2009-01-10 15:12               ` Alan Cox
2009-01-10 15:22                 ` James Bottomley [this message]
2009-01-10 15:29                   ` Alan Cox
2009-01-10 15:34                   ` Sergei Shtylyov
2009-01-10 15:29                 ` Sergei Shtylyov
2009-01-10 15:32                   ` Alan Cox

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=1231600972.3642.22.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=borntraeger@de.ibm.com \
    --cc=jgarzik@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sshtylyov@ru.mvista.com \
    /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.