qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Andrew Jones" <ajones@ventanamicro.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Sunil V L" <sunilvl@ventanamicro.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH V2] hw/riscv: virt: Remove size restriction for pflash
Date: Wed, 09 Nov 2022 16:26:53 +0100	[thread overview]
Message-ID: <87y1skkv2a.fsf@pond.sub.org> (raw)
In-Reply-To: <Y2lBnPuUA4bgKCLL@redhat.com> ("Daniel P. Berrangé"'s message of "Mon, 7 Nov 2022 17:34:20 +0000")

Daniel P. Berrangé <berrange@redhat.com> writes:

> On Mon, Nov 07, 2022 at 06:32:01PM +0100, Andrew Jones wrote:

[...]

>> Padding is a good idea, but too much causes other problems. When building
>> lightweight VMs which may pull the firmware image from a network,
>> AArch64 VMs require 64MB of mostly zeros to be transferred first, which
>> can become a substantial amount of the overall boot time[*]. Being able to
>> create images smaller than the total flash device size, but still add some
>> pad for later growth, seems like the happy-medium to shoot for.
>
> QEMU configures the firmware using -blockdev,

Yes, even though the devices in question are not block devices.

>                                               so can use any file
> format that QEMU supports at the block layer.  IOW, you can store
> the firmware in a qcow2 file and thus you will never fetch any
> of the padding zeros to be transferred.  That said I'm not sure
> that libvirt supports anything other than a raw file today. 

Here's another idea.  The "raw" format supports exposing a slice of the
underlying block node (options @offset and @size).  It could support
padding.  Writing to the padding should then grow the underlying node.

Taking a step back to look at the bigger picture...  there are three
issues, I think:

(A) Storing padding on disk is wasteful.

    Use a file system that supports sparse files, or an image format
    that can represent the padding efficiently.

(B) Reading padding into memory is wasteful.

    Matters mostly when a network is involved.  Use an image format that
    can represent the padding efficiently.

(C) Dirtying memory for padding is wasteful.

    I figure KSM could turn zero-padding into holes.

    We could play with mmap() & friends.

    Other ideas?

Any solution needs to work both for read-only and read/write padding.
Throwing away data written to the padding on cold restart is not what
I'd regard as "works".



  parent reply	other threads:[~2022-11-09 15:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 13:02 [PATCH V2] hw/riscv: virt: Remove size restriction for pflash Sunil V L
2022-11-07 13:06 ` Peter Maydell
2022-11-07 14:08   ` Philippe Mathieu-Daudé
2022-11-07 16:07     ` Markus Armbruster
2022-11-07 14:08   ` Sunil V L
2022-11-07 15:50     ` Alex Bennée
2022-11-07 16:19       ` Daniel P. Berrangé
2022-11-07 17:32         ` Andrew Jones
2022-11-07 17:34           ` Daniel P. Berrangé
2022-11-08 14:12             ` Philippe Mathieu-Daudé
2022-11-08 14:49               ` Andrew Jones
2022-11-08 15:03               ` Daniel P. Berrangé
2022-11-09 15:26             ` Markus Armbruster [this message]
2022-11-09 15:30               ` Daniel P. Berrangé
2022-11-09 15:45                 ` Markus Armbruster
2022-11-09 15:51                   ` Daniel P. Berrangé
2022-11-07 16:08     ` Peter Maydell
2022-11-08 16:01       ` Markus Armbruster
2022-11-09 10:07         ` Sunil V L

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=87y1skkv2a.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=ajones@ventanamicro.com \
    --cc=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=berrange@redhat.com \
    --cc=bin.meng@windriver.com \
    --cc=kraxel@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=sunilvl@ventanamicro.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).