From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by mx.groups.io with SMTP id smtpd.web12.456.1630345845893852960 for ; Mon, 30 Aug 2021 10:50:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@newmexicoconsortium-org.20150623.gappssmtp.com header.s=20150623 header.b=Ew4O4YO7; spf=none, err=SPF record not found (domain: newmexicoconsortium.org, ip: 209.85.215.174, mailfrom: dbautista@newmexicoconsortium.org) Received: by mail-pg1-f174.google.com with SMTP id q68so14131765pga.9 for ; Mon, 30 Aug 2021 10:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newmexicoconsortium-org.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=8+0IklwOzZG/+VJvQq26SaTaqfcVCHwLlxbt/N9wUTw=; b=Ew4O4YO779jzGe6Dzjcg51gNM3yBySSt/Fw8jGbrTvGEwJt88nOo98tvPiZM4+5aAi poapzptbP0+nEZ3uPrwFdEi+IHrzAR77jhcGVnchCsozvw3zor0HtIFS78ReXXxNpFFi zOO0C0/n4Z6ATKZHfzMpgOSvCFJbVxAdEd7BDrZ+q5wYu94yz/Sixl7FilJ8tG6ptamv rFn3jkpySORkkQyxi9kVmBPdeUbMUEh10KNBTj50Q57jw4qran29PvEhVeHAgzg7e+MT FPGWxzNuHUQtnAb9v464NVeuJqXujC2DD2JkoDmYjrXFcScQd781OShWKa9rS0JhCt9Q FpOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=8+0IklwOzZG/+VJvQq26SaTaqfcVCHwLlxbt/N9wUTw=; b=iD4UFNDUc8WqBH82JB2tnbPMerMnRAwWGRdqi/EtdUbv9mr7VLipw7Hk/mrPZk8iay kgEkkVu0WHYJRTlwp5HmHeHxPU5//4qQV0GQRolDBijCQFR9E4DEZtEd4sXmEWR/Zcb0 OH6ADwI0QSWc/KgisMEe55z2X9E2FcKK+iclzCWqs+5yD+0ZJ3L+RsalmiY2EbMA5dn/ r4k8NIgCbZFhnx8bsfdGARImz6rrqX9tjRh63KrKi0/x78ghFSq6xeUKoWhUWamBZXl9 keornwmyN6I/2zmCZsP/904p6jtURnrRHjEAm2TECAH05iLtbtrgXnqQQi7Mi049daF2 9QWg== X-Gm-Message-State: AOAM5338Ej/ARoDagyawDFvpIHFHw1wYgQ+KCU9Qk2PVNdDL/dCaDWS9 2lRTOCkYnZDsaqRb7HHsH4RAfw== X-Google-Smtp-Source: ABdhPJy0STGWr1foezsAAz66rYss0fUErLXzHRfJ23dA4TG7Zhlo/MzkovN/XLkfiOzBL5fWzixU/g== X-Received: by 2002:a05:6a00:16c6:b029:32d:e190:9dd0 with SMTP id l6-20020a056a0016c6b029032de1909dd0mr24303067pfc.70.1630345844284; Mon, 30 Aug 2021 10:50:44 -0700 (PDT) Return-Path: Received: from [192.168.3.111] (c-73-48-255-158.hsd1.ca.comcast.net. [73.48.255.158]) by smtp.gmail.com with ESMTPSA id gn12sm121104pjb.26.2021.08.30.10.50.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Aug 2021 10:50:43 -0700 (PDT) Subject: Re: [edk2-devel] OVMF: NV Variable Store Layout of Larger Build Targets To: Gerd Hoffmann , devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, jiewen.yao@intel.com, jordan.l.justen@intel.com References: <3e91ce2b-15c4-d0d7-4ae8-277d61d0c3c6@newmexicoconsortium.org> <20210830064507.ll6jckr4in6lz3f7@sirius.home.kraxel.org> From: "Devon Bautista" Message-ID: Date: Mon, 30 Aug 2021 10:52:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210830064507.ll6jckr4in6lz3f7@sirius.home.kraxel.org> Content-Type: multipart/alternative; boundary="------------A53CF988D48B2CFF0B12C605" Content-Language: en-US --------------A53CF988D48B2CFF0B12C605 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi Gerd, >> The current maximum image size of an OVMF image is 4MB, which is >> insufficient for storing even a minimal and compressed kernel and initramfs. >> To get around this, we've been maintaining our own fork of EDK2 that adds >> 8MiB and 16MiB OVMF build targets that have enough room in the DXE volume to >> store a reasonably-sized kernel and initramfs. However, it would be >> convenient if upstream EDK2 supported these larger OVMF targets. > I'm wondering whenever it makes sense to have the 8M option. I think > I'd tend to go straight to 16M (which is the max size we can do on x86). On the Linuxboot side, we really only need 16MiB. However, I think Laszlo justified an 8MiB target because the QEMU commit he pointed to (referenced in my initial post) increased the absolute firmware size limit to be 16MiB when setting the maximum (`pcms->max_fw_size`) in `pc_machine_set_max_fw_size()`, but the default maximum if not set is 8MiB. So I understand why an 8MiB target is justified, but, like you, I am not sure if it's really needed. >> However, as Laszlo mentioned, introducing a larger volume size is >> compatibility breaking, and so seizing the opportunity to come up >> with a larger non-volatile variable store layout is necessary. >> >> That said, I would like to use this thread to discuss among hardware >> vendors an optimal variable store layout for these larger image sizes. > The 2M -> 4M switch happened because the varstore was too small. It was > Confirm64KilobytesOfUnauthenticatedVariableStorage test of the the > Microsoft Hardware Certification failing. I guess Microsoft has good > reasons to test for 64k varstore, probably they expect this is big > enough in practice. > > The varstore size of the 4M layout is *way* above that (see 2M -> 4M > commit message): > > Variable store 56 -> 256 ( +200) > Spare area 64 -> 264 ( +200) > > Assuming 256k varstore is more than enough: Sticking to the 4M variable > store layout for the 16M (and maybe 8M) builds looks like the best > option to me. I think the varstore would be identical for 4M and 16M > builds then, so it should be possible to switch guests from 4M to 16M > while keeping the varstore. Keeping the 4MiB varstore layout would be the most compatible and straightforward option and is what I would want to go with. But I also think that it might make sense when introducing a considerably larger build target to account for any possible increases in variable store size that vendors may expect in the future. I for one dismay any further size increase, but I suppose the more relevant question is, is 256KiB of varstore enough for vendors? -- Best, Devon --------------A53CF988D48B2CFF0B12C605 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hi Gerd,

The current maximum image size of an OVMF image is 4MB, which is
insufficient for storing even a minimal and compressed kernel and initramfs.
To get around this, we've been maintaining our own fork of EDK2 that adds
8MiB and 16MiB OVMF build targets that have enough room in the DXE volume to
store a reasonably-sized kernel and initramfs. However, it would be
convenient if upstream EDK2 supported these larger OVMF targets.
I'm wondering whenever it makes sense to have the 8M option.  I think
I'd tend to go straight to 16M (which is the max size we can do on x86).

On the Linuxboot side, we really only need 16MiB. However, I think Laszlo justified an 8MiB target because the QEMU commit he pointed to (referenced in my initial post) increased the absolute firmware size limit to be 16MiB when setting the maximum (`pcms->max_fw_size`) in `pc_machine_set_max_fw_size()`, but the default maximum if not set is 8MiB.

So I understand why an 8MiB target is justified, but, like you, I am not sure if it's really needed.

However, as Laszlo mentioned, introducing a larger volume size is
compatibility breaking, and so seizing the opportunity to come up
with a larger non-volatile variable store layout is necessary.

That said, I would like to use this thread to discuss among hardware
vendors an optimal variable store layout for these larger image sizes.
The 2M -> 4M switch happened because the varstore was too small.  It was
Confirm64KilobytesOfUnauthenticatedVariableStorage test of the the
Microsoft Hardware Certification failing.  I guess Microsoft has good
reasons to test for 64k varstore, probably they expect this is big
enough in practice.

The varstore size of the 4M layout is *way* above that (see 2M -> 4M
commit message):

  Variable store      56 ->   256 ( +200)
  Spare area          64 ->   264 ( +200)

Assuming 256k varstore is more than enough:  Sticking to the 4M variable
store layout for the 16M (and maybe 8M) builds looks like the best
option to me.  I think the varstore would be identical for 4M and 16M
builds then, so it should be possible to switch guests from 4M to 16M
while keeping the varstore.

Keeping the 4MiB varstore layout would be the most compatible and straightforward option and is what I would want to go with.

But I also think that it might make sense when introducing a considerably larger build target to account for any possible increases in variable store size that vendors may expect in the future. I for one dismay any further size increase, but I suppose the more relevant question is, is 256KiB of varstore enough for vendors?

--
Best,
Devon
--------------A53CF988D48B2CFF0B12C605--