All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Peter Crosthwaite <crosthwaitepeter@gmail.com>,
	Alistair Francis <alistair.francis@xilinx.com>,
	Christopher Covington <cov@codeaurora.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v11 0/8] Add a generic loader
Date: Fri, 23 Sep 2016 10:10:02 +0200	[thread overview]
Message-ID: <87ponvxcit.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA_1iw4z3U6kwMBvsN7HHbtj=T-mJ4=aQ7yquYQ5pvzpOQ@mail.gmail.com> (Peter Maydell's message of "Thu, 22 Sep 2016 15:01:29 +0100")

Peter Maydell <peter.maydell@linaro.org> writes:

> On 22 September 2016 at 12:50, Markus Armbruster <armbru@redhat.com> wrote:
>> However, in the case we're discussing, we're not doing that!  There is
>> no RAM device with a trivial backend folded in.  There's only a weird
>> pseudo-device that copies the contents of a file into memory, then sits
>> around doing absolutely nothing.
>
> It doesn't sit around doing entirely nothing, it sits around
> so that when the machine is reset it can do the copying again...

True :)

> In any case, I'm going to drop patches 7 and 8 from target-arm.next
> for the moment so we can come to a consensus about whether this
> should be -device or -object (and possibly respin the patch to
> use -object if we decide that; hopefully it should be simple...)
> I'll keep patches 1..6 in.

Okay, that gives us a bit of time to try to settle the "is this a
device?" question.  How can we best make progress there?

Progress from where?  Starting from a gut feeling that -device is wrong,
I've come to the conclusion that conceptually, this really isn't a
frontend (-device), but a backend of a split device.  Hard to see
because we traditionally don't model memory devices as device objects of
their own.  Except for more interesting ones: persisent memory such as
flash since forever (because we need a backend to persist it), using
block backends created with -drive, and hot-pluggable memory more
recently (because we need a frontend to plug and unplug), using memory
backends created with -object.

For me, the similarity (at the conceptual level) to the persistent
memory case is striking: in both cases, we need a backend to manage
memory contents.  The difference is that for persistent memory, changes
persist, while for the loader, they get reverted at reset.

At the implementation level, though, the two are sadly different: for
persistent memory, the backend manages just contents, and is oblivious
of where it is mapped.  The mapping is done by binding the backend to a
frontend.  The "generic loader" doesn't just manage contents, it also
monkey-patches arbitrary(?) memory.  Feels like a hack to me.  A useful
hack, given the ways we model memory.

The hack part is perhaps kind of, sort of, almost device-like.  An
argument for using -device could go as follows: this is a device to
monkey patch memory.  It needs a backend to manage the bits, just like
other memory-related devices do.  Since its backend is trivial, we
folded it in rather than make it a separate backend.

If we decide to use this argument for the present interface design, I
want it recorded in the code and commit messages.

If, on the other hand, you come around to prefer a -object interface, it
would be fair to tell me "you want -object, you code it up".

Hmm, we already have a backend managing bits from a file:
memory-backend-file.  Naive question: could a read-only
memory-backend-file serve as backend for the "loader" hack device?
Mind, I'm not suggesting this is what we should do, I'm only trying to
understand how the new folded-in backend is related to existing
backends.

  reply	other threads:[~2016-09-23  8:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 14:54 [Qemu-devel] [PATCH v11 0/8] Add a generic loader Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 1/8] loader: Allow ELF loader to auto-detect the ELF arch Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 2/8] loader: Use the specified MemoryRegion Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 3/8] loader: Allow a custom AddressSpace when loading ROMs Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 4/8] loader: Add AddressSpace loading support to ELFs Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 5/8] loader: Add AddressSpace loading support to uImages Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 6/8] loader: Add AddressSpace loading support to targphys Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 7/8] generic-loader: Add a generic loader Alistair Francis
2016-09-20 14:54 ` [Qemu-devel] [PATCH v11 8/8] docs: Add a generic loader explanation document Alistair Francis
2016-09-20 17:41 ` [Qemu-devel] [PATCH v11 0/8] Add a generic loader Peter Maydell
2016-09-20 18:22   ` Alistair Francis
2016-09-21  6:05 ` Markus Armbruster
2016-09-21 15:46   ` Alistair Francis
2016-09-21 15:53     ` Paolo Bonzini
2016-09-22  9:19       ` Markus Armbruster
2016-09-22  9:22         ` Paolo Bonzini
2016-09-22 11:50           ` Markus Armbruster
2016-09-22 14:01             ` Peter Maydell
2016-09-23  8:10               ` Markus Armbruster [this message]
2016-09-23  8:18                 ` Paolo Bonzini
2016-09-27 13:28                   ` Markus Armbruster
2016-09-27 14:14                     ` Paolo Bonzini
2016-09-27 15:40                       ` Markus Armbruster
2016-09-27 16:24                         ` Alistair Francis
2016-09-28  2:04                           ` Markus Armbruster
2016-09-28 22:48                             ` Alistair Francis
2016-09-27 15:17                     ` Peter Maydell
2016-09-21 15:54   ` Daniel P. Berrange

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=87ponvxcit.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alistair.francis@xilinx.com \
    --cc=cov@codeaurora.org \
    --cc=crosthwaitepeter@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.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 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.