From: Laszlo Ersek <lersek@redhat.com>
To: "Gabriel L. Somlo" <somlo@cmu.edu>, Stefan Hajnoczi <stefanha@gmail.com>
Cc: peter.maydell@linaro.org, jordan.l.justen@intel.com,
qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com,
markmb@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 4/5] Enable fw_cfg DMA interface for ARM
Date: Mon, 26 Oct 2015 14:38:11 +0100 [thread overview]
Message-ID: <562E2CC3.9060100@redhat.com> (raw)
In-Reply-To: <20151026124919.GE1979@HEDWIG.INI.CMU.EDU>
On 10/26/15 13:49, Gabriel L. Somlo wrote:
> On Mon, Oct 26, 2015 at 10:48:08AM +0000, Stefan Hajnoczi wrote:
>> On Thu, Oct 22, 2015 at 05:22:16PM -0400, Gabriel L. Somlo wrote:
>>> I was re-reading the documentation for fw_cfg_add_file_callback(),
>>> and noticed that non-dma read operations check for the presence
>>> of a callback (and call it if present) for *every* *single* *byte*,
>>> even on 64-bit MMIO reads. That's also what the documentation says
>>> (in docs/specs/fw_cfg.txt, being moved into fw_cfg.h as per
>>> http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg05315.html).
>>>
>>> During DMA reads, however, the callback is only checked once before
>>> each chunk, effectively once per DMA read operation.
>>>
>>> Now, typical callbacks I found throughout the qemu source tend to return
>>> immediately except for the first time they're invoked, but I wonder if
>>> skipping over all those extra "do I have a callback, if so call it,
>>> mostly so it can return without doing anything" per-byte operations
>>> account in some significant part for the dramatically faster transfers?
>>>
>>> Not sure how I'd test for that -- besides my not having anything
>>> resembling a viable ARM setup, I'm not sure if limiting the callbacks
>>> to only be invoked if (s->cur_offset == 0) would make sense, just as a
>>> test ?
>>
>> I think Marc came to the conclusion that it's safe and therefore made
>> that optimization for DMA.
>>
>> The same can be done for PIO.
>
> OK, so at the risk of over-reaching here, would it make sense to
> rewrite the fw_cfg spec to say "If present, a callback will be
> executed *once* before each time a blob is read" ?
>
> My hypothesis (which I guess I'm volunteering to verify, unless we
> end up rejecting this immediately as a bad idea, for some reason that
> I have missed), is that current functionality wouldn't change, given
> the way existing callbacks work right now, and that we could run the
> callback each time a blob is *selected*, rather than hooking into the
> (dma/mmio/pio) read methods.
Callback executed on first read only sounds okay to me, callback
executed on selection... hm... don't like it. :)
Thanks
Laszlo
>
> Thanks,
> --Gabriel
>
next prev parent reply other threads:[~2015-10-26 13:38 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 8:58 [Qemu-devel] QEMU fw_cfg DMA interface Marc Marí
2015-09-18 8:58 ` [Qemu-devel] [PATCH v3 0/5] " Marc Marí
2015-09-18 8:58 ` [Qemu-devel] [PATCH v3 1/5] fw_cfg: document fw_cfg_modify_iXX() update functions Marc Marí
2015-09-18 8:58 ` [Qemu-devel] [PATCH v3 2/5] fw_cfg DMA interface documentation Marc Marí
2015-09-18 15:15 ` Peter Maydell
2015-09-18 8:58 ` [Qemu-devel] [PATCH v3 3/5] Implement fw_cfg DMA interface Marc Marí
2015-09-18 15:31 ` Peter Maydell
2015-09-18 18:29 ` Kevin O'Connor
2015-09-18 8:58 ` [Qemu-devel] [PATCH v3 4/5] Enable fw_cfg DMA interface for ARM Marc Marí
2015-09-18 15:15 ` Peter Maydell
2015-09-18 19:33 ` Laszlo Ersek
2015-09-18 20:16 ` Laszlo Ersek
2015-09-18 20:24 ` Marc Marí
2015-09-18 23:10 ` Laszlo Ersek
2015-09-19 13:09 ` Marc Marí
2015-10-22 21:22 ` Gabriel L. Somlo
2015-10-26 10:48 ` Stefan Hajnoczi
2015-10-26 12:49 ` Gabriel L. Somlo
2015-10-26 13:38 ` Laszlo Ersek [this message]
2015-10-26 14:21 ` Gabriel L. Somlo
2015-10-27 11:11 ` Gerd Hoffmann
2015-10-27 12:43 ` Laszlo Ersek
2015-10-28 1:12 ` Gabriel L. Somlo
2015-10-28 10:42 ` Laszlo Ersek
2015-09-18 8:58 ` [Qemu-devel] [PATCH v3 5/5] Enable fw_cfg DMA interface for x86 Marc Marí
2015-09-18 10:58 ` Gerd Hoffmann
2015-09-18 15:12 ` Peter Maydell
2015-09-18 18:25 ` [Qemu-devel] [PATCH v3 0/5] fw_cfg DMA interface Kevin O'Connor
2015-09-18 19:14 ` Marc Marí
2015-09-18 22:47 ` Peter Maydell
2015-09-18 23:43 ` Kevin O'Connor
2015-09-19 9:48 ` Peter Maydell
2015-09-19 15:15 ` Kevin O'Connor
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=562E2CC3.9060100@redhat.com \
--to=lersek@redhat.com \
--cc=jordan.l.justen@intel.com \
--cc=kraxel@redhat.com \
--cc=markmb@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=somlo@cmu.edu \
--cc=stefanha@gmail.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).