a126f4279b73893cd2e961b2d4777550825e61eb

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-07-14 00:00:00 +00:00
parent 0ee4ad79ab
commit 8913c7f72c
4 changed files with 149 additions and 61 deletions

BIN
bst-vs-heap.tmp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -1585,7 +1585,12 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</li>
<li><a href="#benchmark-this-repo">27. Benchmark this repo</a>
<ul class="sectlevel2">
<li><a href="#travis">27.1. Travis</a></li>
<li><a href="#continuous-integraion">27.1. Continuous integraion</a>
<ul class="sectlevel3">
<li><a href="#travis">27.1.1. Travis</a></li>
<li><a href="#circleci">27.1.2. CircleCI</a></li>
</ul>
</li>
<li><a href="#benchmark-this-repo-benchmarks">27.2. Benchmark this repo benchmarks</a>
<ul class="sectlevel3">
<li><a href="#benchmark-linux-kernel-boot">27.2.1. Benchmark Linux kernel boot</a>
@@ -2153,7 +2158,7 @@ hello /root/.profile
<p>which implies that people can&#8217;t develop open source <a href="https://en.wikipedia.org/wiki/Electronic_design_automation">EDA tools</a></p>
</li>
<li>
<p>which implies that you can&#8217;t get decent <a href="https://community.cadence.com/cadence_blogs_8/b/di/posts/hls-ppa-is-it-all-you-need-to-know">power</a> estimates</p>
<p>which implies that you can&#8217;t get decent <a href="https://community.cadence.com/cadence_blogs_8/b/di/posts/hls-ppa-is-it-all-you-need-to-know">power, performance and area</a> estimates</p>
</li>
</ul>
</div>
@@ -2800,7 +2805,17 @@ j = 0</pre>
<p>you won&#8217;t get the latest version of this repository. Our <a href="#travis">Travis</a> attempt to automate builds failed, and storing a release for every commit would likely make GitHub mad at us anyways.</p>
</li>
<li>
<p><a href="#gem5">gem5</a> is not currently supported. The major blocking point is how to avoid distributing the kernel images twice: once for gem5 which uses <code>vmlinux</code>, and once for QEMU which uses <code>arch/*</code> images, see also: <a href="#vmlinux-vs-bzimage-vs-zimage-vs-image">vmlinux vs bzImage vs zImage vs Image</a>.</p>
<p><a href="#gem5">gem5</a> is not currently supported. The major blocking point is how to avoid distributing the kernel images twice: once for gem5 which uses <code>vmlinux</code>, and once for QEMU which uses <code>arch/*</code> images, see also:</p>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/issues/79" class="bare">https://github.com/cirosantilli/linux-kernel-module-cheat/issues/79</a></p>
</li>
<li>
<p><a href="#vmlinux-vs-bzimage-vs-zimage-vs-image">vmlinux vs bzImage vs zImage vs Image</a>.</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
@@ -6017,7 +6032,7 @@ vim rootfs_overlay/etc/init.d/S99.gitignore
<div class="sect2">
<h3 id="init-environment"><a class="anchor" href="#init-environment"></a><a class="link" href="#init-environment">6.4. Init environment</a></h3>
<div class="paragraph">
<p>Documented at <a href="https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html"><a href="https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html" class="bare">https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html</a></a>:</p>
<p>Documented at <a href="https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html" class="bare">https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html</a>:</p>
</div>
<div class="quoteblock">
<blockquote>
@@ -8344,7 +8359,7 @@ xeyes</pre>
</div>
<div id="image-x11" class="imageblock">
<div class="content">
<img src="x11.png" alt="image">
<a class="image" href="x11.png"><img src="x11.png" alt="x11"></a>
</div>
<div class="title">Figure 1. X11 Buildroot graphical user interface screenshot</div>
</div>
@@ -9052,7 +9067,7 @@ CONFIG_IKCONFIG_PROC=y</pre>
</div>
</div>
<div class="paragraph">
<p>Just for fun <a href="https://stackoverflow.com/questions/14958192/how-to-get-the-config-from-a-linux-kernel-image/14958263#14958263"><a href="https://stackoverflow.com/questions/14958192/how-to-get-the-config-from-a-linux-kernel-image/14958263#14958263" class="bare">https://stackoverflow.com/questions/14958192/how-to-get-the-config-from-a-linux-kernel-image/14958263#14958263</a></a>:</p>
<p>Just for fun <a href="https://stackoverflow.com/questions/14958192/how-to-get-the-config-from-a-linux-kernel-image/14958263#14958263" class="bare">https://stackoverflow.com/questions/14958192/how-to-get-the-config-from-a-linux-kernel-image/14958263#14958263</a>:</p>
</div>
<div class="literalblock">
<div class="content">
@@ -9267,7 +9282,7 @@ CONFIG_IKCONFIG_PROC=y</pre>
<p><code>arm</code> and <code>aarch64</code> configs present in the official ARM gem5 Linux kernel fork: <a href="#gem5-arm-linux-kernel-patches">gem5 arm Linux kernel patches</a>. Some of the configs present there are added by the patches.</p>
</li>
<li>
<p>Jason&#8217;s magic <code>x86_64</code> config: <a href="http://web.archive.org/web/20171229121642/http://www.lowepower.com/jason/files/config" class="bare">http://web.archive.org/web/20171229121642/http://www.lowepower.com/jason/files/config</a> which is referenced at: <a href="http://web.archive.org/web/20171229121525/http://www.lowepower.com/jason/setting-up-gem5-full-system.html"><a href="http://web.archive.org/web/20171229121525/http://www.lowepower.com/jason/setting-up-gem5-full-system.html" class="bare">http://web.archive.org/web/20171229121525/http://www.lowepower.com/jason/setting-up-gem5-full-system.html</a></a>. QEMU boots with that by removing <code># CONFIG_VIRTIO_PCI is not set</code>.</p>
<p>Jason&#8217;s magic <code>x86_64</code> config: <a href="http://web.archive.org/web/20171229121642/http://www.lowepower.com/jason/files/config" class="bare">http://web.archive.org/web/20171229121642/http://www.lowepower.com/jason/files/config</a> which is referenced at: <a href="http://web.archive.org/web/20171229121525/http://www.lowepower.com/jason/setting-up-gem5-full-system.html" class="bare">http://web.archive.org/web/20171229121525/http://www.lowepower.com/jason/setting-up-gem5-full-system.html</a>. QEMU boots with that by removing <code># CONFIG_VIRTIO_PCI is not set</code>.</p>
</li>
</ul>
</div>
@@ -14105,7 +14120,7 @@ tty63::respawn:-/bin/sh
</div>
</li>
<li>
<p><code>/dev/ttyN</code> for the other graphic TTYs. Note that there are only 63 available ones, from <code>/dev/tty1</code> to <code>/dev/tty63</code> (<code>/dev/tty0</code> is the current one): <a href="https://superuser.com/questions/449781/why-is-there-so-many-linux-dev-tty"><a href="https://superuser.com/questions/449781/why-is-there-so-many-linux-dev-tty" class="bare">https://superuser.com/questions/449781/why-is-there-so-many-linux-dev-tty</a></a>. I think this is determined by:</p>
<p><code>/dev/ttyN</code> for the other graphic TTYs. Note that there are only 63 available ones, from <code>/dev/tty1</code> to <code>/dev/tty63</code> (<code>/dev/tty0</code> is the current one): <a href="https://superuser.com/questions/449781/why-is-there-so-many-linux-dev-tty" class="bare">https://superuser.com/questions/449781/why-is-there-so-many-linux-dev-tty</a>. I think this is determined by:</p>
<div class="literalblock">
<div class="content">
<pre>#define MAX_NR_CONSOLES 63</pre>
@@ -14630,28 +14645,10 @@ ps</pre>
<p>We are trying to maintain a description of each at: <a href="https://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vml/482978#482978" class="bare">https://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vml/482978#482978</a></p>
</div>
<div class="paragraph">
<p>QEMU does not seem able to boot ELF files like <code>vmlinux</code>, only <code>objdump</code> code: <a href="https://superuser.com/questions/1376944/can-qemu-boot-linux-from-vmlinux-instead-of-bzimage" class="bare">https://superuser.com/questions/1376944/can-qemu-boot-linux-from-vmlinux-instead-of-bzimage</a></p>
<p>QEMU does not seem able to boot ELF files like <code>vmlinux</code>: <a href="https://superuser.com/questions/1376944/can-qemu-boot-linux-from-vmlinux-instead-of-bzimage" class="bare">https://superuser.com/questions/1376944/can-qemu-boot-linux-from-vmlinux-instead-of-bzimage</a></p>
</div>
<div class="paragraph">
<p>Converting <code>arch/*</code> images to <code>vmlinux</code> is possible in x86 with <a href="https://github.com/torvalds/linux/blob/master/scripts/extract-vmlinux"><code>extract-vmlinux</code></a>. But for arm it fails with:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>run-detectors: unable to find an interpreter for</pre>
</div>
</div>
<div class="paragraph">
<p>as mentioned at:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://unix.stackexchange.com/questions/352215/how-do-i-extract-vmlinux-from-an-arm-image" class="bare">https://unix.stackexchange.com/questions/352215/how-do-i-extract-vmlinux-from-an-arm-image</a></p>
</li>
<li>
<p><a href="https://raspberrypi.stackexchange.com/questions/88621/why-doesnt-extract-vmlinux-work-with-raspbians-boot-kernel-img" class="bare">https://raspberrypi.stackexchange.com/questions/88621/why-doesnt-extract-vmlinux-work-with-raspbians-boot-kernel-img</a></p>
</li>
</ul>
<p>Converting <code>arch/*</code> images to <code>vmlinux</code> is possible in theory x86 with <a href="https://github.com/torvalds/linux/blob/v5.1/scripts/extract-vmlinux"><code>extract-vmlinux</code></a> but we didn&#8217;t get any gem5 boots working from images generated like that for some reason, see: <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/issues/79" class="bare">https://github.com/cirosantilli/linux-kernel-module-cheat/issues/79</a></p>
</div>
</div>
</div>
@@ -16290,7 +16287,7 @@ less "$(./getvar --arch x86_64 run_dir)/trace-lines.txt"</pre>
<p>TODO get working.</p>
</div>
<div class="paragraph">
<p>QEMU replays support checkpointing, and this allows for a simplistic "reverse debugging" implementation proposed at <a href="https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg00478.html" class="bare">https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg00478.html</a> on the unmerged <a href="https://github.com/ispras/qemu/tree/rr-180725"><a href="https://github.com/ispras/qemu/tree/rr-180725" class="bare">https://github.com/ispras/qemu/tree/rr-180725</a></a>:</p>
<p>QEMU replays support checkpointing, and this allows for a simplistic "reverse debugging" implementation proposed at <a href="https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg00478.html" class="bare">https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg00478.html</a> on the unmerged <a href="https://github.com/ispras/qemu/tree/rr-180725" class="bare">https://github.com/ispras/qemu/tree/rr-180725</a>:</p>
</div>
<div class="literalblock">
<div class="content">
@@ -16341,7 +16338,7 @@ reverse-continue</pre>
<div class="sect3">
<h4 id="gem5-tracing"><a class="anchor" href="#gem5-tracing"></a><a class="link" href="#gem5-tracing">17.8.6. gem5 tracing</a></h4>
<div class="paragraph">
<p>gem5 provides also provides a tracing mechanism documented at: <a href="http://www.gem5.org/Trace_Based_Debugging"><a href="http://www.gem5.org/Trace_Based_Debugging" class="bare">http://www.gem5.org/Trace_Based_Debugging</a></a>:</p>
<p>gem5 provides also provides a tracing mechanism documented at: <a href="http://www.gem5.org/Trace_Based_Debugging" class="bare">http://www.gem5.org/Trace_Based_Debugging</a>:</p>
</div>
<div class="literalblock">
<div class="content">
@@ -16432,7 +16429,7 @@ less "$(./getvar gem5_source_dir)/src/cpu/exetrace.cc"</pre>
<p>full instructions, as the first line. Only shown if the <code>ExecMacro</code> flag is given.</p>
</li>
<li>
<p>micro ops that constitute the instruction, the lines that follow. Yes, <code>aarch64</code> also has microops: <a href="https://superuser.com/questions/934752/do-arm-processors-like-cortex-a9-use-microcode/934755#934755"><a href="https://superuser.com/questions/934752/do-arm-processors-like-cortex-a9-use-microcode/934755#934755" class="bare">https://superuser.com/questions/934752/do-arm-processors-like-cortex-a9-use-microcode/934755#934755</a></a>. Only shown if the <code>ExecMicro</code> flag is given.</p>
<p>micro ops that constitute the instruction, the lines that follow. Yes, <code>aarch64</code> also has microops: <a href="https://superuser.com/questions/934752/do-arm-processors-like-cortex-a9-use-microcode/934755#934755" class="bare">https://superuser.com/questions/934752/do-arm-processors-like-cortex-a9-use-microcode/934755#934755</a>. Only shown if the <code>ExecMicro</code> flag is given.</p>
</li>
</ul>
</div>
@@ -16577,7 +16574,7 @@ root</pre>
<div class="ulist">
<ul>
<li>
<p>would require exposing proprietary information of the CPU designs: <a href="https://stackoverflow.com/questions/17454955/can-you-check-performance-of-a-program-running-with-qemu-simulator/33580850#33580850"><a href="https://stackoverflow.com/questions/17454955/can-you-check-performance-of-a-program-running-with-qemu-simulator/33580850#33580850" class="bare">https://stackoverflow.com/questions/17454955/can-you-check-performance-of-a-program-running-with-qemu-simulator/33580850#33580850</a></a></p>
<p>would require exposing proprietary information of the CPU designs: <a href="https://stackoverflow.com/questions/17454955/can-you-check-performance-of-a-program-running-with-qemu-simulator/33580850#33580850" class="bare">https://stackoverflow.com/questions/17454955/can-you-check-performance-of-a-program-running-with-qemu-simulator/33580850#33580850</a></p>
</li>
<li>
<p>would make the simulation even slower TODO confirm, by how much</p>
@@ -16649,15 +16646,69 @@ root</pre>
<p>Let&#8217;s see how many cycles <a href="https://en.wikipedia.org/wiki/Dhrystone">Dhrystone</a>, which Buildroot provides, takes for a few different input parameters.</p>
</div>
<div class="paragraph">
<p>First build Dhrystone into the root filesystem:</p>
<p>We will do that for various input parameters on full system by taking a checkpoint after the boot finishes a fast atomic CPU boot, and then we will restore in a more detailed mode and run the benchmark:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>./build-buildroot --config 'BR2_PACKAGE_DHRYSTONE=y'</pre>
<pre>./build-buildroot --config 'BR2_PACKAGE_DHRYSTONE=y'
# Boot fast, take checkpoint, and exit.
./run --arch aarch64 --emulator gem5 --eval-after './gem5.sh'
# Restore the checkpoint after boot, and benchmark with input 1000.
./run \
--arch aarch64 \
--emulator gem5 \
--eval-after './gem5.sh' \
--gem5-readfile 'm5 resetstats;dhrystone 1000;m5 dumpstats' \
--gem5-restore 1 \
-- \
--cpu-type=HPI \
--restore-with-cpu=HPI \
--caches \
--l2cache \
--l1d_size=64kB \
--l1i_size=64kB \
--l2_size=256kB \
;
# Get the value for number of cycles.
# head because there are two lines: our dumpstats and the
# automatic dumpstats at the end which we don't care about.
./gem5-stat --arch aarch64 | head -n 1
# Now for input 10000.
./run \
--arch aarch64 \
--emulator gem5 \
--eval-after './gem5.sh' \
--gem5-readfile 'm5 resetstats;dhrystone 10000;m5 dumpstats' \
--gem5-restore 1 \
-- \
--cpu-type=HPI \
--restore-with-cpu=HPI \
--caches \
--l2cache \
--l1d_size=64kB \
--l1i_size=64kB \
--l2_size=256kB \
;
./gem5-stat --arch aarch64 | head -n 1</pre>
</div>
</div>
<div class="paragraph">
<p>Then, a flexible setup is demonstrated at:</p>
<p>If you ever need a shell to quickly inspect the system state after boot, you can just use:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>./run \
--arch aarch64 \
--emulator gem5 \
--eval-after './gem5.sh' \
--gem5-readfile 'sh' \
--gem5-restore 1 \</pre>
</div>
</div>
<div class="paragraph">
<p>This procedure is further automated and DRYed up at:</p>
</div>
<div class="literalblock">
<div class="content">
@@ -16669,14 +16720,14 @@ cat out/gem5-bench-dhrystone.txt</pre>
<p>Source: <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/gem5-bench-dhrystone">gem5-bench-dhrystone</a></p>
</div>
<div class="paragraph">
<p>Sample output:</p>
<p>Output at 2438410c25e200d9766c8c65773ee7469b599e4a + 1:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>n cycles
1000 12898577
10000 23441629
100000 128428617</pre>
1000 13665219
10000 20559002
100000 85977065</pre>
</div>
</div>
<div class="paragraph">
@@ -16686,9 +16737,6 @@ cat out/gem5-bench-dhrystone.txt</pre>
<p>The <code>gem5-stats</code> commands output the approximate number of CPU cycles it took Dhrystone to run.</p>
</div>
<div class="paragraph">
<p>Another interesting example can be found at: <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/gem5-bench-cache">gem5-bench-cache</a>.</p>
</div>
<div class="paragraph">
<p>A more naive and simpler to understand approach would be a direct:</p>
</div>
<div class="literalblock">
@@ -16697,7 +16745,7 @@ cat out/gem5-bench-dhrystone.txt</pre>
</div>
</div>
<div class="paragraph">
<p>but the problem is that this method does not allow to easily run a different script without running the boot again, see: <a href="#gem5-restore-new-script">gem5 checkpoint restore and run a different script</a>.</p>
<p>but the problem is that this method does not allow to easily run a different script without running the boot again. The <code>./gem5.sh</code> script works around that by using <a href="#m5-readfile">m5 readfile</a> as explained further at: <a href="#gem5-restore-new-script">gem5 checkpoint restore and run a different script</a>.</p>
</div>
<div class="paragraph">
<p>Now you can play a fun little game with your friends:</p>
@@ -16868,7 +16916,7 @@ getconf _NPROCESSORS_CONF</pre>
</ul>
</div>
<div class="paragraph">
<p>Cache sizes can in theory be checked with the methods described at: <a href="https://superuser.com/questions/55776/finding-l2-cache-size-in-linux"><a href="https://superuser.com/questions/55776/finding-l2-cache-size-in-linux" class="bare">https://superuser.com/questions/55776/finding-l2-cache-size-in-linux</a></a>:</p>
<p>Cache sizes can in theory be checked with the methods described at: <a href="https://superuser.com/questions/55776/finding-l2-cache-size-in-linux" class="bare">https://superuser.com/questions/55776/finding-l2-cache-size-in-linux</a>:</p>
</div>
<div class="literalblock">
<div class="content">
@@ -17788,24 +17836,24 @@ m5 checkpoint</pre>
<div class="literalblock">
<div class="content">
<pre># Boot, checkpoint and exit.
printf 'echo "setup run";m5 exit' &gt; "$(./getvar gem5_readfile)"
printf 'echo "setup run";m5 exit' &gt; "$(./getvar gem5_readfile_file)"
./run --emulator gem5 --eval 'm5 checkpoint;m5 readfile &gt; a.sh;sh a.sh'
# Restore and run the first benchmark.
printf 'echo "first benchmark";m5 exit' &gt; "$(./getvar gem5_readfile)"
printf 'echo "first benchmark";m5 exit' &gt; "$(./getvar gem5_readfile_file)"
./run --emulator gem5 --gem5-restore 1
# Restore and run the second benchmark.
printf 'echo "second benchmark";m5 exit' &gt; "$(./getvar gem5_readfile)"
printf 'echo "second benchmark";m5 exit' &gt; "$(./getvar gem5_readfile_file)"
./run --emulator gem5 --gem5-restore 1
# If something weird happened, create an interactive shell to examine the system.
printf 'sh' &gt; "$(./getvar gem5_readfile)"
printf 'sh' &gt; "$(./getvar gem5_readfile_file)"
./run --emulator gem5 --gem5-restore 1</pre>
</div>
</div>
<div class="paragraph">
<p>Since this is such a common setup, we provide some helpers for it as described at <a href="#gem5-run-benchmark">gem5 run benchmark</a>:</p>
<p>Since this is such a common setup, we provide the following helpers for this operation:</p>
</div>
<div class="ulist">
<ul>
@@ -17818,6 +17866,9 @@ printf 'sh' &gt; "$(./getvar gem5_readfile)"
</ul>
</div>
<div class="paragraph">
<p>Their usage us exemplified at <a href="#gem5-run-benchmark">gem5 run benchmark</a>.</p>
</div>
<div class="paragraph">
<p>Other loophole possibilities include:</p>
</div>
<div class="ulist">
@@ -18094,7 +18145,7 @@ m5 writefile myfileguest myfilehost</pre>
</div>
<div class="literalblock">
<div class="content">
<pre>date &gt; "$(./getvar gem5_readfile)"</pre>
<pre>date &gt; "$(./getvar gem5_readfile_file)"</pre>
</div>
</div>
<div class="paragraph">
@@ -18147,7 +18198,7 @@ m5 writefile myfileguest myfilehost</pre>
<div class="content">
<pre>printf '#!/bin/sh
echo asdf
' &gt; "$(./getvar gem5_readfile)"</pre>
' &gt; "$(./getvar gem5_readfile_file)"</pre>
</div>
</div>
<div class="paragraph">
@@ -18386,7 +18437,7 @@ m5_fail(ints[1], ints[0]);</pre>
<p>The patches also <a href="#notable-alternate-gem5-kernel-configs">add defconfigs</a> that are known to work well with gem5.</p>
</div>
<div class="paragraph">
<p>E.g. for arm v4.9 there is: <a href="https://gem5.googlesource.com/arm/linux/+/917e007a4150d26a0aa95e4f5353ba72753669c7/arch/arm/configs/gem5_defconfig"><a href="https://gem5.googlesource.com/arm/linux/+/917e007a4150d26a0aa95e4f5353ba72753669c7/arch/arm/configs/gem5_defconfig" class="bare">https://gem5.googlesource.com/arm/linux/+/917e007a4150d26a0aa95e4f5353ba72753669c7/arch/arm/configs/gem5_defconfig</a></a>.</p>
<p>E.g. for arm v4.9 there is: <a href="https://gem5.googlesource.com/arm/linux/+/917e007a4150d26a0aa95e4f5353ba72753669c7/arch/arm/configs/gem5_defconfig" class="bare">https://gem5.googlesource.com/arm/linux/+/917e007a4150d26a0aa95e4f5353ba72753669c7/arch/arm/configs/gem5_defconfig</a>.</p>
</div>
<div class="paragraph">
<p>In order to use those patches and their associated configs, and, we recommend using <a href="#linux-kernel-build-variants">Linux kernel build variants</a> as:</p>
@@ -19121,7 +19172,7 @@ make menuconfig</pre>
<p>Once you&#8217;ve built a package in to the image, there is no easy way to remove it.</p>
</div>
<div class="paragraph">
<p>Documented at: <a href="https://github.com/buildroot/buildroot/blob/2017.08/docs/manual/rebuilding-packages.txt#L90"><a href="https://github.com/buildroot/buildroot/blob/2017.08/docs/manual/rebuilding-packages.txt#L90" class="bare">https://github.com/buildroot/buildroot/blob/2017.08/docs/manual/rebuilding-packages.txt#L90</a></a></p>
<p>Documented at: <a href="https://github.com/buildroot/buildroot/blob/2017.08/docs/manual/rebuilding-packages.txt#L90" class="bare">https://github.com/buildroot/buildroot/blob/2017.08/docs/manual/rebuilding-packages.txt#L90</a></p>
</div>
<div class="paragraph">
<p>Also mentioned at: <a href="https://stackoverflow.com/questions/47320800/how-to-clean-only-target-in-buildroot" class="bare">https://stackoverflow.com/questions/47320800/how-to-clean-only-target-in-buildroot</a></p>
@@ -19172,7 +19223,7 @@ make menuconfig</pre>
TODO benchmark: would gem5 suffer a considerable disk read performance hit due to decompressing SquashFS?</p>
</li>
<li>
<p>libguestfs: <a href="https://serverfault.com/questions/246835/convert-directory-to-qemu-kvm-virtual-disk-image/916697#916697"><a href="https://serverfault.com/questions/246835/convert-directory-to-qemu-kvm-virtual-disk-image/916697#916697" class="bare">https://serverfault.com/questions/246835/convert-directory-to-qemu-kvm-virtual-disk-image/916697#916697</a></a>, in particular <a href="http://libguestfs.org/guestfish.1.html#vfs-minimum-size"><code>vfs-minimum-size</code></a></p>
<p>libguestfs: <a href="https://serverfault.com/questions/246835/convert-directory-to-qemu-kvm-virtual-disk-image/916697#916697" class="bare">https://serverfault.com/questions/246835/convert-directory-to-qemu-kvm-virtual-disk-image/916697#916697</a>, in particular <a href="http://libguestfs.org/guestfish.1.html#vfs-minimum-size"><code>vfs-minimum-size</code></a></p>
</li>
<li>
<p>use methods described at: <a href="#gem5-restore-new-script">gem5 checkpoint restore and run a different script</a> instead of putting builds on the root filesystem</p>
@@ -24108,7 +24159,7 @@ AArch64, see Procedure Call Standard for the ARM 64-bit Architecture.</p>
<div class="sect3">
<h4 id="arm-official-bibliography"><a class="anchor" href="#arm-official-bibliography"></a><a class="link" href="#arm-official-bibliography">23.8.2. ARM official bibliography</a></h4>
<div class="paragraph">
<p>The official manuals were stored in <a href="http://infocenter.arm.com" class="bare">http://infocenter.arm.com</a> but as of 2017 they started to slowly move to <a href="https://developer.arm.com"><a href="https://developer.arm.com" class="bare">https://developer.arm.com</a></a>.</p>
<p>The official manuals were stored in <a href="http://infocenter.arm.com" class="bare">http://infocenter.arm.com</a> but as of 2017 they started to slowly move to <a href="https://developer.arm.com" class="bare">https://developer.arm.com</a>.</p>
</div>
<div class="paragraph">
<p>Each revision of a document has a "ARM DDI" unique document identifier.</p>
@@ -25266,10 +25317,10 @@ IN:
</div>
</div>
<div class="paragraph">
<p>To wake up CPU 1 on QEMU, we must use the Power State Coordination Interface (PSCI) which is documented at: <a href="https://developer.arm.com/docs/den0022/latest/arm-power-state-coordination-interface-platform-design-document"><a href="https://developer.arm.com/docs/den0022/latest/arm-power-state-coordination-interface-platform-design-document" class="bare">https://developer.arm.com/docs/den0022/latest/arm-power-state-coordination-interface-platform-design-document</a></a>.</p>
<p>To wake up CPU 1 on QEMU, we must use the Power State Coordination Interface (PSCI) which is documented at: <a href="https://developer.arm.com/docs/den0022/latest/arm-power-state-coordination-interface-platform-design-document" class="bare">https://developer.arm.com/docs/den0022/latest/arm-power-state-coordination-interface-platform-design-document</a>.</p>
</div>
<div class="paragraph">
<p>This interface uses HVC calls, and the calling convention is documented at "SMC CALLING CONVENTION" <a href="https://developer.arm.com/docs/den0028/latest"><a href="https://developer.arm.com/docs/den0028/latest" class="bare">https://developer.arm.com/docs/den0028/latest</a></a>.</p>
<p>This interface uses HVC calls, and the calling convention is documented at "SMC CALLING CONVENTION" <a href="https://developer.arm.com/docs/den0028/latest" class="bare">https://developer.arm.com/docs/den0028/latest</a>.</p>
</div>
<div class="paragraph">
<p>If we boot the Linux kernel on QEMU and <a href="#get-device-tree-from-a-running-kernel">dump the auto-generated device tree</a>, we observe that it contains the address of the PSCI CPU_ON call:</p>
@@ -26038,11 +26089,48 @@ cd -
</div>
</div>
<div class="sect2">
<h3 id="travis"><a class="anchor" href="#travis"></a><a class="link" href="#travis">27.1. Travis</a></h3>
<h3 id="continuous-integraion"><a class="anchor" href="#continuous-integraion"></a><a class="link" href="#continuous-integraion">27.1. Continuous integraion</a></h3>
<div class="paragraph">
<p>We have exploreed a few Continuous integration solutions.</p>
</div>
<div class="paragraph">
<p>We haven&#8217;t setup any of them yet.</p>
</div>
<div class="sect3">
<h4 id="travis"><a class="anchor" href="#travis"></a><a class="link" href="#travis">27.1.1. Travis</a></h4>
<div class="paragraph">
<p>We tried to automate it on Travis with <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/.travis.yml">.travis.yml</a> but it hits the current 50 minute job timeout: <a href="https://travis-ci.org/cirosantilli/linux-kernel-module-cheat/builds/296454523" class="bare">https://travis-ci.org/cirosantilli/linux-kernel-module-cheat/builds/296454523</a> And I bet it would likely hit a disk maxout either way if it went on.</p>
</div>
</div>
<div class="sect3">
<h4 id="circleci"><a class="anchor" href="#circleci"></a><a class="link" href="#circleci">27.1.2. CircleCI</a></h4>
<div class="paragraph">
<p>This setup sucessfully built gem5 on every commit: <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/.circleci/config.yml">.circleci/config.yml</a></p>
</div>
<div class="paragraph">
<p>Enabling it is however blocked on: <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/issues/79" class="bare">https://github.com/cirosantilli/linux-kernel-module-cheat/issues/79</a> so we disabled the builds on the web UI.</p>
</div>
<div class="paragraph">
<p>If that ever gets done, we will also need to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>convert this to a nightly with a workflow, to save server resources: <a href="https://circleci.com/docs/2.0/configuration-reference/#triggers" class="bare">https://circleci.com/docs/2.0/configuration-reference/#triggers</a></p>
</li>
<li>
<p>download the prebuilt disk images and enable caches to save the images across runs</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>A build took about 1 hour of a core, and the free tier allows for 1000 minutes per month: <a href="https://circleci.com/pricing/" class="bare">https://circleci.com/pricing/</a> so about 17 hours. The cheapest non-free setup seems to be 50 dollars per month gets us infinite build minutes per month and 2 containers, so we could scale things to run in under 24 hours.</p>
</div>
<div class="paragraph">
<p>There is no result reporting web UI however&#8230;&#8203; but neither does GitLab CI: <a href="https://gitlab.com/gitlab-org/gitlab-ce/issues/17081" class="bare">https://gitlab.com/gitlab-org/gitlab-ce/issues/17081</a></p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="benchmark-this-repo-benchmarks"><a class="anchor" href="#benchmark-this-repo-benchmarks"></a><a class="link" href="#benchmark-this-repo-benchmarks">27.2. Benchmark this repo benchmarks</a></h3>
<div class="sect3">
@@ -26437,7 +26525,7 @@ tail -n+1 ../linux-kernel-module-cheat-regression/*/gem5-bench-build-*.txt</pre>
<div class="ulist">
<ul>
<li>
<p><a href="https://www.mail-archive.com/gem5-users@gem5.org/msg15262.html"><a href="https://www.mail-archive.com/gem5-users@gem5.org/msg15262.html" class="bare">https://www.mail-archive.com/gem5-users@gem5.org/msg15262.html</a></a> which parts of the gem5 code make it slow</p>
<p><a href="https://www.mail-archive.com/gem5-users@gem5.org/msg15262.html" class="bare">https://www.mail-archive.com/gem5-users@gem5.org/msg15262.html</a> which parts of the gem5 code make it slow</p>
</li>
<li>
<p>what are the minimum system requirements:</p>
@@ -26946,7 +27034,7 @@ export CCACHE_MAXSIZE="20G"</pre>
<p>When doing long simulations sweeping across multiple system parameters, it becomes fundamental to do multiple simulations in parallel.</p>
</div>
<div class="paragraph">
<p>This is specially true for gem5, which runs much slower than QEMU, and cannot use multiple host cores to speed up the simulation: <a href="https://github.com/cirosantilli-work/gem5-issues/issues/15"><a href="https://github.com/cirosantilli-work/gem5-issues/issues/15" class="bare">https://github.com/cirosantilli-work/gem5-issues/issues/15</a></a>, so the only way to parallelize is to run multiple instances in parallel.</p>
<p>This is specially true for gem5, which runs much slower than QEMU, and cannot use multiple host cores to speed up the simulation: <a href="https://github.com/cirosantilli-work/gem5-issues/issues/15" class="bare">https://github.com/cirosantilli-work/gem5-issues/issues/15</a>, so the only way to parallelize is to run multiple instances in parallel.</p>
</div>
<div class="paragraph">
<p>This also has a good synergy with <a href="#build-variants">Build variants</a>.</p>
@@ -27917,7 +28005,7 @@ echo $?</pre>
<li>
<p>the <code>exit()</code> baremetal function when <code>status != 1</code>.</p>
<div class="paragraph">
<p>Unfortunately the only way we found to set this up was with <code>on_exit</code>: <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/issues/59"><a href="https://github.com/cirosantilli/linux-kernel-module-cheat/issues/59" class="bare">https://github.com/cirosantilli/linux-kernel-module-cheat/issues/59</a></a>.</p>
<p>Unfortunately the only way we found to set this up was with <code>on_exit</code>: <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/issues/59" class="bare">https://github.com/cirosantilli/linux-kernel-module-cheat/issues/59</a>.</p>
</div>
<div class="paragraph">
<p>Trying to patch <code>_exit</code> directly fails since at that point some de-initialization has already happened which prevents the print.</p>