From: John Snow <jsnow@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Peter Lieven <pl@kamp.de>,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [RFC PATCH 0/5] atapi: change unlimited recursion to while loop
Date: Fri, 23 Mar 2018 16:28:00 -0400 [thread overview]
Message-ID: <2964a562-a689-4281-ecde-c9f695efc378@redhat.com> (raw)
In-Reply-To: <933679da-c0b1-f1e3-5681-9709bd383143@redhat.com>
On 03/23/2018 04:17 PM, Paolo Bonzini wrote:
> On 23/03/2018 21:08, John Snow wrote:
>>
>>
>> On 02/23/2018 10:26 AM, Paolo Bonzini wrote:
>>> Real hardware doesn't have an unlimited stack, so the unlimited
>>> recursion in the ATAPI code smells a bit. In fact, the call to
>>> ide_transfer_start easily becomes a tail call with a small change
>>> to the code (patch 4). The remaining four patches move code around
>>> so as to the turn the call back to ide_atapi_cmd_reply_end into
>>> another tail call, and then convert the (double) tail recursion into
>>> a while loop.
>>>
>>> I'm not sure how this can be tested, apart from adding a READ CD
>>> test to ahci-test (which I don't really have time for now, hence
>>> the RFC tag). The existing AHCI tests still pass, so patches 1-3
>>> aren't complete crap.
>>>
>>> Paolo
>>>
>>> Paolo Bonzini (5):
>>> ide: push call to end_transfer_func out of start_transfer callback
>>> ide: push end_transfer callback to ide_transfer_halt
>>> ide: make ide_transfer_stop idempotent
>>> atapi: call ide_set_irq before ide_transfer_start
>>> ide: introduce ide_transfer_start_norecurse
>>>
>>> hw/ide/ahci.c | 12 +++++++-----
>>> hw/ide/atapi.c | 37 ++++++++++++++++++++-----------------
>>> hw/ide/core.c | 37 +++++++++++++++++++++++--------------
>>> include/hw/ide/internal.h | 3 +++
>>> 4 files changed, 53 insertions(+), 36 deletions(-)
>>>
>>
>> LGTM; only comments wound up being naming.
>
> The "PIO setup" FIS though should be sent at the *beginning* of data
> transfer according to the spec. And if that is fixed a bunch of things
> are simpler (no end_transfer callback!). I'll test and send next week.
>
> Paolo
>
My naive understanding is that it gets sent at the beginning to inform
the transfer -- but I'm not sure what the values of the frame should
actually be since it specifies it should also set what the value of the
registers ought to be after the transfer -- and I don't know how to
interpret that.
Is that an "expected value" or does that mean that the device (like the
SATA device) is expected to buffer up the transfer first, then send the
PIO Setup FIS frame and thus it already knows if it succeeded or failed
in buffering the data?
It's not tremendously clear to me -- but as long as at the end of the
transfer AHCI's mirror for the ATA registers match our core register
values, then it's probably fine...?
prev parent reply other threads:[~2018-03-23 20:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 15:26 [Qemu-devel] [RFC PATCH 0/5] atapi: change unlimited recursion to while loop Paolo Bonzini
2018-02-23 15:26 ` [Qemu-devel] [PATCH 1/5] ide: push call to end_transfer_func out of start_transfer callback Paolo Bonzini
2018-03-20 21:46 ` John Snow
2018-03-21 5:37 ` Paolo Bonzini
2018-02-23 15:26 ` [Qemu-devel] [PATCH 2/5] ide: push end_transfer callback to ide_transfer_halt Paolo Bonzini
2018-03-20 22:11 ` John Snow
2018-03-21 5:39 ` Paolo Bonzini
2018-03-21 18:05 ` John Snow
2018-02-23 15:26 ` [Qemu-devel] [PATCH 3/5] ide: do not set s->end_transfer_func to ide_transfer_cancel Paolo Bonzini
2018-03-20 22:19 ` John Snow
2018-02-23 15:26 ` [Qemu-devel] [PATCH 4/5] atapi: call ide_set_irq before ide_transfer_start Paolo Bonzini
2018-03-21 0:35 ` John Snow
2018-03-21 5:44 ` Paolo Bonzini
2018-02-23 15:26 ` [Qemu-devel] [PATCH 5/5] ide: introduce ide_transfer_start_norecurse Paolo Bonzini
2018-02-28 4:21 ` [Qemu-devel] [RFC PATCH 0/5] atapi: change unlimited recursion to while loop John Snow
2018-03-23 20:08 ` John Snow
2018-03-23 20:17 ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
2018-03-23 20:28 ` John Snow [this message]
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=2964a562-a689-4281-ecde-c9f695efc378@redhat.com \
--to=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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 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).