qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
	"Ard Biesheuvel" <Ard.Biesheuvel@arm.com>,
	"Leif Lindholm" <leif@nuviainc.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Xu Yandong" <xuyandong2@huawei.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"David Edmondson" <david.edmondson@oracle.com>,
	"Shannon Zhao" <shannon.zhaosl@gmail.com>,
	"Zheng Xiang" <zhengxiang9@huawei.com>,
	qemu-arm@nongnu.org, "haibinzhang(张海斌)" <haibinzhang@tencent.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"John Snow" <jsnow@redhat.com>
Subject: Re: [RFC PATCH 0/5] ARM: reduce the memory consumed when mapping UEFI flash images
Date: Thu, 19 Nov 2020 12:57:21 +0100	[thread overview]
Message-ID: <7a87651c-47be-1d61-b88a-d0ee151d67fa@redhat.com> (raw)
In-Reply-To: <87ft55vad4.fsf@linaro.org>

+Ard & Leif for EDK2.

On 11/19/20 12:45 PM, Alex Bennée wrote:
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
>> On 11/16/20 2:48 PM, Markus Armbruster wrote:
>>> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
>>>
>>>> Hi David,
>>>>
>>>> On 11/16/20 11:42 AM, David Edmondson wrote:
>>>>> Currently ARM UEFI images are typically built as 2MB/768kB flash
>>>>> images for code and variables respectively. These images are both then
>>>>> padded out to 64MB before being loaded by QEMU.
>>>>>
>>>>> Because the images are 64MB each, QEMU allocates 128MB of memory to
>>>>> read them, and then proceeds to read all 128MB from disk (dirtying the
>>>>> memory). Of this 128MB less than 3MB is useful - the rest is zero
>>>>> padding.
>>>>
>>>> 2 years ago I commented the same problem, and suggested to access the
>>>> underlying storage by "block", as this is a "block storage".
>>>>
>>>> Back then the response was "do not try to fix something that works".
>>>> This is why we choose the big hammer "do not accept image size not
>>>> matching device size" way.
>>>>
>>>> While your series seems to help, it only postpone the same
>>>> implementation problem. If what you want is use the least memory
>>>> required, I still believe accessing the device by block is the
>>>> best approach.
>>>
>>> "Do not try to fix something that works" is hard to disagree with.
>>> However, at least some users seem to disagree with "this works".  Enough
>>> to overcome the resistance to change?
>>
>> Yeah, at least 3 big users so far:
>>
>> - Huawei
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg607292.html
>> - Tencent
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg742066.html
>> - Oracle
>> (this series).
>>
>> Then Huawei tried the MicroVM approach:
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg680103.html
>>
>> I simply wanted to save David time by remembering this other approach,
>> since Peter already commented on David's one (see Huawei link).
> 
> IIRC the two questions that came up were:
> 
>   - what would reading memory not covered by a file look like (0's or
>     something more like real HW, 7f?).

For NOR flashes erased bit is high, programmed bit is low, so: 0xff.

> 
>   - what happens when the guest writes beyond the bounds of a backing
>     file?

Report an hardware error, so guest firmware have a chance to do
do something (not sure what, beside rebooting...).

> 
> I'm guessing for these cloudy type applications no one cares about
> persistence of EFI variables? Maybe we just need a formulation for the
> second pflash which is explicit about writes being ephemeral while also
> being accepted?

Someone suggested adding a new machine type to QEMU to be able to use
smaller flash for cloud usage (but I don't remember who). Then EDK2
could be built with for this new flash size.

Regards,

Phil.



  reply	other threads:[~2020-11-19 11:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 10:42 [RFC PATCH 0/5] ARM: reduce the memory consumed when mapping UEFI flash images David Edmondson
2020-11-16 10:42 ` [RFC PATCH 1/5] hw/block: blk_check_size_and_read_all should report backend name David Edmondson
2020-11-16 11:23   ` Philippe Mathieu-Daudé
2020-11-16 13:29     ` David Edmondson
2020-11-19 11:56   ` Alex Bennée
2020-11-16 10:42 ` [RFC PATCH 2/5] hw/block: Flash images can be smaller than the device David Edmondson
2020-11-16 10:42 ` [RFC PATCH 3/5] hw/arm: Convert assertions about flash image size to error_report David Edmondson
2020-11-19 11:39   ` Alex Bennée
2020-11-16 10:42 ` [RFC PATCH 4/5] hw/arm: Flash image mapping follows image size David Edmondson
2020-11-16 10:42 ` [RFC PATCH 5/5] hw/arm: Only minimise flash size on older machines David Edmondson
2020-11-16 11:39 ` [RFC PATCH 0/5] ARM: reduce the memory consumed when mapping UEFI flash images Philippe Mathieu-Daudé
2020-11-16 13:43   ` David Edmondson
2020-11-16 13:48   ` Markus Armbruster
2020-11-19  6:09     ` Philippe Mathieu-Daudé
2020-11-19 11:45       ` Alex Bennée
2020-11-19 11:57         ` Philippe Mathieu-Daudé [this message]
2020-12-07 12:07         ` David Edmondson

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=7a87651c-47be-1d61-b88a-d0ee151d67fa@redhat.com \
    --to=philmd@redhat.com \
    --cc=Ard.Biesheuvel@arm.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=david.edmondson@oracle.com \
    --cc=haibinzhang@tencent.com \
    --cc=imammedo@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leif@nuviainc.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=xuyandong2@huawei.com \
    --cc=zhengxiang9@huawei.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).