qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: pbonzini@redhat.com, qemu-block@nongnu.org, hare@suse.de,
	stefanha@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] atapi: abort transfers with 0 byte limits
Date: Tue, 1 Sep 2015 14:06:58 +0200	[thread overview]
Message-ID: <20150901120658.GD4304@noname.redhat.com> (raw)
In-Reply-To: <55DBB5E6.3090503@redhat.com>

Am 25.08.2015 um 02:25 hat John Snow geschrieben:
> 
> 
> On 07/13/2015 06:18 AM, Kevin Wolf wrote:
> > Am 11.07.2015 um 03:05 hat John Snow geschrieben:
> >> We're supposed to abort on transfers like this, unless we fill
> >> Word 125 of our IDENTIFY data with a default transfer size, which
> >> we don't currently do.
> >>
> >> This is an ATA error, not a SCSI/ATAPI one.
> >> See ATA8-ACS3 sections 7.17.6.49 or 7.21.5.
> >>
> >> If we don't do this, QEMU will loop forever trying to transfer
> >> zero bytes, which isn't particularly useful.
> >>
> >> Signed-off-by: John Snow <jsnow@redhat.com>
> > 
> > Of course, one could argue that for a clean separation between the ATA
> > core and SCSI/ATAPI, this check should really be done in cmd_packet and
> > ide_abort_command() could stay static. And in fact, I do think it's
> > worthwhile to try getting a better separation in the mid term.
> > 
> > However, for a 2.4 fix, this patch might be the right thing to do.
> > 
> > The interesting part is that the SCSI command is already partially
> > handled before the error is returned. The required assumption here is
> > that the guest doesn't actually see any intermediate state between
> > issuing the command and getting the abort, so it doesn't notice that we
> > already started the command successfully. I _think_ that assumption
> > holds true.
> > 
> > Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> > 
> 
> Ping --
> 
> Do you still feel it's necessary we perform the abort in the IDE layer?

I can hardly say that it's necessary, but it might be desirable.

> This requires us to peek into the CDB and determine if the CDB will (or
> will not) transfer any data.
> 
> Is that sane? Is that worse than exporting ide_abort_command into the
> ATAPI layer?

No, core.c looking at the CDB is definitely not sane.

> Pretty much either way, the ATA bits need to know about the SCSI packet,
> or the ATAPI bits need to invoke core ATA functionality.
> 
> It's sort of gross, since the spec unfortunately allows for this field
> to be zero if the command does not transfer data. :(

The only reasonable way to do this that I can think of offhand would be
to return this information from ide_atapi_cmd().

Of course, the current structure of the code doesn't make this easy. But
in theory it can be done if (and only if) no asynchronous operation is
involved and the command is completed while ide_atapi_cmd() is running.
As I said in my review above, we already make that assumption; if it
weren't true, our current behaviour would be wrong.

In order to actually implement things this way, we would need to first
restructure the commands to move completion to ide_atapi_cmd() instead
of duplicating it in each command; I already mentioned this as a
possible improvement of the code in our private email thread.

Kevin

  reply	other threads:[~2015-09-01 12:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-11  1:05 [Qemu-devel] [PATCH 0/2] ahci: fix atapi PIO (for 2.4?) John Snow
2015-07-11  1:05 ` [Qemu-devel] [PATCH 1/2] atapi: abort transfers with 0 byte limits John Snow
2015-07-13 10:18   ` Kevin Wolf
2015-07-13 15:09     ` John Snow
2015-08-25  0:25     ` John Snow
2015-09-01 12:06       ` Kevin Wolf [this message]
2015-07-11  1:05 ` [Qemu-devel] [PATCH 2/2] ide: unify io_buffer_offset increments John Snow

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=20150901120658.GD4304@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=hare@suse.de \
    --cc=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).