From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zqhye-0000iO-0u for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:38:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqhyZ-0005ow-S3 for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:38:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqhyZ-0005os-Mr for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:38:15 -0400 References: <55FC99F6.4050005@redhat.com> <20151022212210.GA1979@HEDWIG.INI.CMU.EDU> <20151026104808.GE20111@stefanha-x1.localdomain> <20151026124919.GE1979@HEDWIG.INI.CMU.EDU> From: Laszlo Ersek Message-ID: <562E2CC3.9060100@redhat.com> Date: Mon, 26 Oct 2015 14:38:11 +0100 MIME-Version: 1.0 In-Reply-To: <20151026124919.GE1979@HEDWIG.INI.CMU.EDU> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 4/5] Enable fw_cfg DMA interface for ARM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gabriel L. Somlo" , Stefan Hajnoczi Cc: peter.maydell@linaro.org, jordan.l.justen@intel.com, qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com, markmb@redhat.com 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 >