Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
manibuilder/anita: Always provide reasonable --memory-size

It turned out that the `--memory-size` given at install time is
not persistent. All later anita runs use an arch-dependent default
(32M for i386, so this might explain why it was never stable).

Assuming most machines have >1GiB RAM per processor core available,
we can also increase the runtime size further (better to waste some
RAM than to wait very long because it starts swapping things out).
We choose 512MiB for 64-bit targets and 256MiB for 32-bit ones.

However, we don't need that much for the initial installation step
and it also decides the size of the swap partition. So we use a
smaller size initially that's just enough to get us through the
installation quickly enough (192MiB & 128MiB).

Change-Id: I255c41aeb92cda29ed23a236017472982e839530
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52484
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
---
M util/manibuilder/Dockerfile.anita
M util/manibuilder/Makefile.anita
M util/manibuilder/anita-wrapper.sh
3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/util/manibuilder/Dockerfile.anita b/util/manibuilder/Dockerfile.anita
index dd6f4dd..f4b1309 100644
--- a/util/manibuilder/Dockerfile.anita
+++ b/util/manibuilder/Dockerfile.anita
@@ -3,7 +3,7 @@
ARG PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.1/All
ARG INST_IMG=http://ftp.de.netbsd.org/pub/NetBSD/NetBSD-7.1/amd64/
ARG DISK_SIZE=1G
-ARG MEM_SIZE=128M
+ARG INSTALL_MEM=128M
ARG EXTRA_PKG=""

RUN \
@@ -20,11 +20,12 @@
USER mani
RUN cd && mkdir .ccache && chown mani:mani .ccache && \
anita --sets kern-GENERIC,modules,base,etc,comp \
- --disk-size ${DISK_SIZE} --memory-size=${MEM_SIZE} \
+ --disk-size ${DISK_SIZE} --memory-size=${INSTALL_MEM} \
install ${INST_IMG} && \
rm -rf work-*/download

-RUN cd && anita --persist --run \
+ARG RUNTIME_MEM=128M
+RUN cd && anita --persist --memory-size=${RUNTIME_MEM} --run \
"echo 'dhcpcd' >init && \
echo 'export PKG_PATH=${PKG_PATH}' >>init && \
. ./init && \
@@ -35,7 +36,8 @@
boot ${INST_IMG}

RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \
- anita --vmm-args '-hdb cache.img' --persist --run \
+ anita --vmm-args '-hdb cache.img' --persist \
+ --memory-size=${RUNTIME_MEM} --run \
"if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \
bdev=wd1d; \
else \
@@ -59,4 +61,5 @@

COPY anita-wrapper.sh /home/mani/mani-wrapper.sh
ENV INST_IMG ${INST_IMG}
+ENV MEM_SIZE ${RUNTIME_MEM}
ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"]
diff --git a/util/manibuilder/Makefile.anita b/util/manibuilder/Makefile.anita
index e795194..21cad8c 100644
--- a/util/manibuilder/Makefile.anita
+++ b/util/manibuilder/Makefile.anita
@@ -4,21 +4,25 @@
anita\:8.2-amd64-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/amd64/8.2/All
anita\:8.2-amd64-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-8.2/amd64/
anita\:8.2-amd64-build: QEMU_DISK_SIZE=2G
-anita\:8.2-amd64-build: QEMU_MEM_SIZE=256M
+anita\:8.2-amd64-build: QEMU_INSTALL_MEM=192M
+anita\:8.2-amd64-build: QEMU_RUNTIME_MEM=512M

anita\:7.1-amd64-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/amd64/7.1/All
anita\:7.1-amd64-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/amd64/
anita\:7.1-amd64-build: QEMU_DISK_SIZE=1G
-anita\:7.1-amd64-build: QEMU_MEM_SIZE=128M
+anita\:7.1-amd64-build: QEMU_INSTALL_MEM=192M
+anita\:7.1-amd64-build: QEMU_RUNTIME_MEM=512M

anita\:7.1-i386-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/i386/7.1/All
anita\:7.1-i386-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/i386/
anita\:7.1-i386-build: QEMU_DISK_SIZE=1G
-anita\:7.1-i386-build: QEMU_MEM_SIZE=128M
+anita\:7.1-i386-build: QEMU_INSTALL_MEM=128M
+anita\:7.1-i386-build: QEMU_RUNTIME_MEM=256M

$(addsuffix -build,$(ANITA_TAGS)): %-build: Dockerfile.anita anita-wrapper.sh
$(QUIET_SETUP)docker build . -f $< -t mani/$* \
--build-arg PKG_PATH=$(PKGSRC_MIRROR)$(PKGSRC_PATH) \
--build-arg INST_IMG=$(NETBSD_MIRROR)$(NETBSD_IMAGE) \
--build-arg DISK_SIZE=$(QEMU_DISK_SIZE) \
- --build-arg MEM_SIZE=$(QEMU_MEM_SIZE)
+ --build-arg INSTALL_MEM=$(QEMU_INSTALL_MEM) \
+ --build-arg RUNTIME_MEM=$(QEMU_RUNTIME_MEM)
diff --git a/util/manibuilder/anita-wrapper.sh b/util/manibuilder/anita-wrapper.sh
index 617e17f..3ff9ee1 100644
--- a/util/manibuilder/anita-wrapper.sh
+++ b/util/manibuilder/anita-wrapper.sh
@@ -9,9 +9,10 @@
[ -f ${CCACHE} ] || zcat cache.img.gz >${CCACHE}

if [ $# -eq 0 ]; then
- exec anita --vmm-args "-hdb ${CCACHE}" interact ${INST_IMG}
+ exec anita --vmm-args "-hdb ${CCACHE}" --memory-size=${MEM_SIZE} \
+ interact ${INST_IMG}
else
- exec anita --vmm-args "-hdb ${CCACHE}" --persist \
- --run ". ./init && manitest \"$*\"" \
+ exec anita --vmm-args "-hdb ${CCACHE}" --memory-size=${MEM_SIZE} \
+ --persist --run ". ./init && manitest \"$*\"" \
boot ${INST_IMG}
fi

To view, visit change 52484. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I255c41aeb92cda29ed23a236017472982e839530
Gerrit-Change-Number: 52484
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged