mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 19:21:35 +01:00
This commit is contained in:
300
index.html
300
index.html
@@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="generator" content="Asciidoctor 2.0.10">
|
<meta name="generator" content="Asciidoctor 2.0.10">
|
||||||
<meta name="description" content="The perfect emulation setup to study and develop the <<linux-kernel>> v5.4.3, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>. "Tested" in an Ubuntu 20.04 host.">
|
<meta name="description" content="The perfect emulation setup to study and develop the <<linux-kernel>> v5.9.2, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>. "Tested" in an Ubuntu 20.04 host.">
|
||||||
<title>Linux Kernel Module Cheat</title>
|
<title>Linux Kernel Module Cheat</title>
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
|
||||||
<style>
|
<style>
|
||||||
@@ -456,7 +456,7 @@ pre{ white-space:pre }
|
|||||||
<p><a href="https://zenodo.org/badge/latestdoi/64534859"><span class="image"><img src="https://zenodo.org/badge/64534859.svg" alt="64534859"></span></a></p>
|
<p><a href="https://zenodo.org/badge/latestdoi/64534859"><span class="image"><img src="https://zenodo.org/badge/64534859.svg" alt="64534859"></span></a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>The perfect emulation setup to study and develop the <a href="#linux-kernel">Linux kernel</a> v5.4.3, kernel modules, <a href="#qemu-buildroot-setup">QEMU</a>, <a href="#gem5-buildroot-setup">gem5</a> and x86_64, ARMv7 and ARMv8 <a href="#userland-assembly">userland</a> and <a href="#baremetal-setup">baremetal</a> assembly, <a href="#c">ANSI C</a>, <a href="#cpp">C++</a> and <a href="#posix">POSIX</a>. <a href="#gdb">GDB step debug</a> and <a href="#kgdb">KGDB</a> just work. Powered by <a href="#about-the-qemu-buildroot-setup">Buildroot</a> and <a href="#about-the-baremetal-setup">crosstool-NG</a>. Highly automated. Thoroughly documented. Automated <a href="#test-this-repo">tests</a>. "Tested" in an Ubuntu 20.04 host.</p>
|
<p>The perfect emulation setup to study and develop the <a href="#linux-kernel">Linux kernel</a> v5.9.2, kernel modules, <a href="#qemu-buildroot-setup">QEMU</a>, <a href="#gem5-buildroot-setup">gem5</a> and x86_64, ARMv7 and ARMv8 <a href="#userland-assembly">userland</a> and <a href="#baremetal-setup">baremetal</a> assembly, <a href="#c">ANSI C</a>, <a href="#cpp">C++</a> and <a href="#posix">POSIX</a>. <a href="#gdb">GDB step debug</a> and <a href="#kgdb">KGDB</a> just work. Powered by <a href="#about-the-qemu-buildroot-setup">Buildroot</a> and <a href="#about-the-baremetal-setup">crosstool-NG</a>. Highly automated. Thoroughly documented. Automated <a href="#test-this-repo">tests</a>. "Tested" in an Ubuntu 20.04 host.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>TL;DR: <a href="#qemu-buildroot-setup-getting-started">Section 1.2.1, “QEMU Buildroot setup getting started”</a></p>
|
<p>TL;DR: <a href="#qemu-buildroot-setup-getting-started">Section 1.2.1, “QEMU Buildroot setup getting started”</a></p>
|
||||||
@@ -1598,16 +1598,7 @@ pre{ white-space:pre }
|
|||||||
</li>
|
</li>
|
||||||
<li><a href="#benchmarks">26.9. Benchmarks</a>
|
<li><a href="#benchmarks">26.9. Benchmarks</a>
|
||||||
<ul class="sectlevel3">
|
<ul class="sectlevel3">
|
||||||
<li><a href="#parsec-benchmark">26.9.1. PARSEC benchmark</a>
|
<li><a href="#microbenchmarks">26.9.1. Microbenchmarks</a></li>
|
||||||
<ul class="sectlevel4">
|
|
||||||
<li><a href="#parsec-benchmark-without-parsecmgmt">26.9.1.1. PARSEC benchmark without parsecmgmt</a></li>
|
|
||||||
<li><a href="#parsec-change-the-input-size">26.9.1.2. PARSEC change the input size</a></li>
|
|
||||||
<li><a href="#parsec-benchmark-with-parsecmgmt">26.9.1.3. PARSEC benchmark with parsecmgmt</a></li>
|
|
||||||
<li><a href="#parsec-uninstall">26.9.1.4. PARSEC uninstall</a></li>
|
|
||||||
<li><a href="#parsec-benchmark-hacking">26.9.1.5. PARSEC benchmark hacking</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a href="#microbenchmarks">26.9.2. Microbenchmarks</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#userland-libs-directory">26.10. userland/libs directory</a>
|
<li><a href="#userland-libs-directory">26.10. userland/libs directory</a>
|
||||||
@@ -3045,6 +3036,19 @@ j = 0</pre>
|
|||||||
<div class="sect3">
|
<div class="sect3">
|
||||||
<h4 id="about-the-qemu-buildroot-setup"><a class="anchor" href="#about-the-qemu-buildroot-setup"></a><a class="link" href="#about-the-qemu-buildroot-setup">1.2.3. About the QEMU Buildroot setup</a></h4>
|
<h4 id="about-the-qemu-buildroot-setup"><a class="anchor" href="#about-the-qemu-buildroot-setup"></a><a class="link" href="#about-the-qemu-buildroot-setup">1.2.3. About the QEMU Buildroot setup</a></h4>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
|
<p>What QEMU and Buildroot are:</p>
|
||||||
|
</div>
|
||||||
|
<div class="ulist">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<p><a href="#introduction-to-buildroot">Introduction to Buildroot</a></p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><a href="#introduction-to-qemu">Introduction to QEMU</a></p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="paragraph">
|
||||||
<p>This is our reference setup, and the best supported one, use it unless you have good reason not to.</p>
|
<p>This is our reference setup, and the best supported one, use it unless you have good reason not to.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
@@ -4100,7 +4104,17 @@ cd userland
|
|||||||
<p>This setup allows you to make a tiny OS and that runs just a few instructions, use it to fully control the CPU to better understand the simulators for example, or develop your own OS if you are into that.</p>
|
<p>This setup allows you to make a tiny OS and that runs just a few instructions, use it to fully control the CPU to better understand the simulators for example, or develop your own OS if you are into that.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>You can also use C and a subset of the C standard library because we enable <a href="https://en.wikipedia.org/wiki/Newlib">Newlib</a> by default. See also: <a href="https://electronics.stackexchange.com/questions/223929/c-standard-libraries-on-bare-metal/400077#400077" class="bare">https://electronics.stackexchange.com/questions/223929/c-standard-libraries-on-bare-metal/400077#400077</a></p>
|
<p>You can also use C and a subset of the C standard library because we enable <a href="https://en.wikipedia.org/wiki/Newlib">Newlib</a> by default. See also:</p>
|
||||||
|
</div>
|
||||||
|
<div class="ulist">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<p><a href="https://electronics.stackexchange.com/questions/223929/c-standard-libraries-on-bare-metal/400077#400077" class="bare">https://electronics.stackexchange.com/questions/223929/c-standard-libraries-on-bare-metal/400077#400077</a></p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><a href="https://stackoverflow.com/questions/13063055/does-a-libc-os-exist/59771531#59771531" class="bare">https://stackoverflow.com/questions/13063055/does-a-libc-os-exist/59771531#59771531</a></p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>Our C bare-metal compiler is built with <a href="https://github.com/crosstool-ng/crosstool-ng">crosstool-NG</a>. If you have already built <a href="#qemu-buildroot-setup">Buildroot</a> previously, you will end up with two GCCs installed. Unfortunately I don’t see a solution for this, since we need separate toolchains for Newlib on baremetal and glibc on Linux: <a href="https://stackoverflow.com/questions/38956680/difference-between-arm-none-eabi-and-arm-linux-gnueabi/38989869#38989869" class="bare">https://stackoverflow.com/questions/38956680/difference-between-arm-none-eabi-and-arm-linux-gnueabi/38989869#38989869</a></p>
|
<p>Our C bare-metal compiler is built with <a href="https://github.com/crosstool-ng/crosstool-ng">crosstool-NG</a>. If you have already built <a href="#qemu-buildroot-setup">Buildroot</a> previously, you will end up with two GCCs installed. Unfortunately I don’t see a solution for this, since we need separate toolchains for Newlib on baremetal and glibc on Linux: <a href="https://stackoverflow.com/questions/38956680/difference-between-arm-none-eabi-and-arm-linux-gnueabi/38989869#38989869" class="bare">https://stackoverflow.com/questions/38956680/difference-between-arm-none-eabi-and-arm-linux-gnueabi/38989869#38989869</a></p>
|
||||||
@@ -29988,7 +30002,7 @@ gensim/models/armv8/isa.ac
|
|||||||
<div class="ulist">
|
<div class="ulist">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p>the first build takes a while, but it is well worth it</p>
|
<p>the first build takes a while compared to downloading prebuilts, but it is well worth it</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>the selection of software packages is relatively limited if compared to Debian.</p>
|
<p>the selection of software packages is relatively limited if compared to Debian.</p>
|
||||||
@@ -30008,6 +30022,9 @@ gensim/models/armv8/isa.ac
|
|||||||
<p>This repo basically wraps around that, and tries to make everything even more awesome for kernel developers by adding the capability of seamlessly running the stuff you’ve built on emulators usually via <code>./run</code>.</p>
|
<p>This repo basically wraps around that, and tries to make everything even more awesome for kernel developers by adding the capability of seamlessly running the stuff you’ve built on emulators usually via <code>./run</code>.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
|
<p>This runnable part of selecting the command line options for different emulators and setups is to a large extent what <a href="https://en.wikipedia.org/wiki/Libvirt">Libvirt</a> does. But we feel that having both build and run on the same repository is the key.</p>
|
||||||
|
</div>
|
||||||
|
<div class="paragraph">
|
||||||
<p>As this repo develops however, we’ve started taking some of the build out of Buildroot, e.g. notably the <a href="#buildroot-vanilla-kernel">Linux kernel</a> to have more build flexibility and faster build startup times.</p>
|
<p>As this repo develops however, we’ve started taking some of the build out of Buildroot, e.g. notably the <a href="#buildroot-vanilla-kernel">Linux kernel</a> to have more build flexibility and faster build startup times.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
@@ -30317,9 +30334,6 @@ make menuconfig</pre>
|
|||||||
<div class="paragraph">
|
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<div class="paragraph">
|
|
||||||
<p>See this for a sample manual workaround: <a href="#parsec-uninstall">Section 26.9.1.4, “PARSEC uninstall”</a>.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sect2">
|
<div class="sect2">
|
||||||
<h3 id="br2-target-rootfs-ext2-size"><a class="anchor" href="#br2-target-rootfs-ext2-size"></a><a class="link" href="#br2-target-rootfs-ext2-size">25.7. BR2_TARGET_ROOTFS_EXT2_SIZE</a></h3>
|
<h3 id="br2-target-rootfs-ext2-size"><a class="anchor" href="#br2-target-rootfs-ext2-size"></a><a class="link" href="#br2-target-rootfs-ext2-size">25.7. BR2_TARGET_ROOTFS_EXT2_SIZE</a></h3>
|
||||||
@@ -33119,257 +33133,7 @@ cblas_dgemm( CblasColMajor, CblasNoTrans, CblasTrans,3,3,2 ,1, A,3, B,
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="sect3">
|
<div class="sect3">
|
||||||
<h4 id="parsec-benchmark"><a class="anchor" href="#parsec-benchmark"></a><a class="link" href="#parsec-benchmark">26.9.1. PARSEC benchmark</a></h4>
|
<h4 id="microbenchmarks"><a class="anchor" href="#microbenchmarks"></a><a class="link" href="#microbenchmarks">26.9.1. Microbenchmarks</a></h4>
|
||||||
<div class="paragraph">
|
|
||||||
<p>We have ported parts of the <a href="http://parsec.cs.princeton.edu">PARSEC benchmark</a> for cross compilation at: <a href="https://github.com/cirosantilli/parsec-benchmark" class="bare">https://github.com/cirosantilli/parsec-benchmark</a> See the documentation on that repo to find out which benchmarks have been ported. Some of the benchmarks were are segfaulting, they are documented in that repo.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>There are two ways to run PARSEC with this repo:</p>
|
|
||||||
</div>
|
|
||||||
<div class="ulist">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p><a href="#parsec-benchmark-without-parsecmgmt">without <code>pasecmgmt</code></a>, most likely what you want</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p><a href="#parsec-benchmark-with-parsecmgmt">with <code>pasecmgmt</code></a></p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="sect4">
|
|
||||||
<h5 id="parsec-benchmark-without-parsecmgmt"><a class="anchor" href="#parsec-benchmark-without-parsecmgmt"></a><a class="link" href="#parsec-benchmark-without-parsecmgmt">26.9.1.1. PARSEC benchmark without parsecmgmt</a></h5>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>./build --arch arm --download-dependencies gem5-buildroot parsec-benchmark
|
|
||||||
./build-buildroot --arch arm --config 'BR2_PACKAGE_PARSEC_BENCHMARK=y'
|
|
||||||
./run --arch arm --emulator gem5</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Once inside the guest, launch one of the <code>test</code> input sized benchmarks manually as in:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>cd /parsec/ext/splash2x/apps/fmm/run
|
|
||||||
../inst/arm-linux.gcc/bin/fmm 1 < input_1</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>To find run out how to run many of the benchmarks, have a look at the <code>test.sh</code> script of the <code>parse-benchmark</code> repo.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>From the guest, you can also run it as:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>cd /parsec
|
|
||||||
./test.sh</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>but this might be a bit time consuming in gem5.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sect4">
|
|
||||||
<h5 id="parsec-change-the-input-size"><a class="anchor" href="#parsec-change-the-input-size"></a><a class="link" href="#parsec-change-the-input-size">26.9.1.2. PARSEC change the input size</a></h5>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Running a benchmark of a size different than <code>test</code>, e.g. <code>simsmall</code>, requires a rebuild with:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>./build-buildroot \
|
|
||||||
--arch arm \
|
|
||||||
--config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \
|
|
||||||
--config 'BR2_PACKAGE_PARSEC_BENCHMARK_INPUT_SIZE="simsmall"' \
|
|
||||||
-- parsec_benchmark-reconfigure \
|
|
||||||
;</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Large input may also require tweaking:</p>
|
|
||||||
</div>
|
|
||||||
<div class="ulist">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p><a href="#br2-target-rootfs-ext2-size">BR2_TARGET_ROOTFS_EXT2_SIZE</a> if the unpacked inputs are large</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p><a href="#memory-size">Memory size</a>, unless you want to meet the OOM killer, which is admittedly kind of fun</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p><code>test.sh</code> only contains the run commands for the <code>test</code> size, and cannot be used for <code>simsmall</code>.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>The easiest thing to do, is to <a href="https://superuser.com/questions/231002/how-can-i-search-within-the-output-buffer-of-a-tmux-shell/1253137#1253137">scroll up on the host shell</a> after the build, and look for a line of type:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>Running /root/linux-kernel-module-cheat/out/aarch64/buildroot/build/parsec-benchmark-custom/ext/splash2x/apps/ocean_ncp/inst/aarch64-linux.gcc/bin/ocean_ncp -n2050 -p1 -e1e-07 -r20000 -t28800</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>and then tweak the command found in <code>test.sh</code> accordingly.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Yes, we do run the benchmarks on host just to unpack / generate inputs. They are expected fail to run since they were build for the guest instead of host, including for x86_64 guest which has a different interpreter than the host’s (see <code>file myexecutable</code>).</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>The rebuild is required because we unpack input files on the host.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Separating input sizes also allows to create smaller images when only running the smaller benchmarks.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>This limitation exists because <code>parsecmgmt</code> generates the input files just before running via the Bash scripts, but we can’t run <code>parsecmgmt</code> on gem5 as it is too slow!</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>One option would be to do that inside the guest with QEMU.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Also, we can’t generate all input sizes at once, because many of them have the same name and would overwrite one another…​</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>PARSEC simply wasn’t designed with non native machines in mind…​</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sect4">
|
|
||||||
<h5 id="parsec-benchmark-with-parsecmgmt"><a class="anchor" href="#parsec-benchmark-with-parsecmgmt"></a><a class="link" href="#parsec-benchmark-with-parsecmgmt">26.9.1.3. PARSEC benchmark with parsecmgmt</a></h5>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Most users won’t want to use this method because:</p>
|
|
||||||
</div>
|
|
||||||
<div class="ulist">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>running the <code>parsecmgmt</code> Bash scripts takes forever before it ever starts running the actual benchmarks on gem5</p>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Running on QEMU is feasible, but not the main use case, since QEMU cannot be used for performance measurements</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>it requires putting the full <code>.tar</code> inputs on the guest, which makes the image twice as large (1x for the <code>.tar</code>, 1x for the unpacked input files)</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>It would be awesome if it were possible to use this method, since this is what Parsec supports officially, and so:</p>
|
|
||||||
</div>
|
|
||||||
<div class="ulist">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>you don’t have to dig into what raw command to run</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>there is an easy way to run all the benchmarks in one go to test them out</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>you can just run any of the benchmarks that you want</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>but it simply is not feasible in gem5 because it takes too long.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>If you still want to run this, try it out with:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>./build-buildroot \
|
|
||||||
--arch aarch64 \
|
|
||||||
--config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \
|
|
||||||
--config 'BR2_PACKAGE_PARSEC_BENCHMARK_PARSECMGMT=y' \
|
|
||||||
--config 'BR2_TARGET_ROOTFS_EXT2_SIZE="3G"' \
|
|
||||||
-- parsec_benchmark-reconfigure \
|
|
||||||
;</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>And then you can run it just as you would on the host:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>cd /parsec/
|
|
||||||
bash
|
|
||||||
. env.sh
|
|
||||||
parsecmgmt -a run -p splash2x.fmm -i test</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sect4">
|
|
||||||
<h5 id="parsec-uninstall"><a class="anchor" href="#parsec-uninstall"></a><a class="link" href="#parsec-uninstall">26.9.1.4. PARSEC uninstall</a></h5>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>If you want to remove PARSEC later, Buildroot doesn’t provide an automated package removal mechanism as mentioned at: <a href="#remove-buildroot-packages">Section 25.6, “Remove Buildroot packages”</a>, but the following procedure should be satisfactory:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>rm -rf \
|
|
||||||
"$(./getvar buildroot_download_dir)"/parsec-* \
|
|
||||||
"$(./getvar buildroot_build_dir)"/build/parsec-* \
|
|
||||||
"$(./getvar buildroot_build_dir)"/build/packages-file-list.txt \
|
|
||||||
"$(./getvar buildroot_build_dir)"/images/rootfs.* \
|
|
||||||
"$(./getvar buildroot_build_dir)"/target/parsec-* \
|
|
||||||
;
|
|
||||||
./build-buildroot --arch arm</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sect4">
|
|
||||||
<h5 id="parsec-benchmark-hacking"><a class="anchor" href="#parsec-benchmark-hacking"></a><a class="link" href="#parsec-benchmark-hacking">26.9.1.5. PARSEC benchmark hacking</a></h5>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>If you end up going inside <a href="https://github.com/cirosantilli/linux-kernel-module-cheat/blob/master/submodules/parsec-benchmark">submodules/parsec-benchmark</a> to hack up the benchmark (you will!), these tips will be helpful.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Buildroot was not designed to deal with large images, and currently cross rebuilds are a bit slow, due to some image generation and validation steps.</p>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>A few workarounds are:</p>
|
|
||||||
</div>
|
|
||||||
<div class="ulist">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>develop in host first as much as you can. Our PARSEC fork supports it.</p>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>If you do this, don’t forget to do a:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>cd "$(./getvar parsec_source_dir)"
|
|
||||||
git clean -xdf .</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>before going for the cross compile build.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>patch Buildroot to work well, and keep cross compiling all the way. This should be totally viable, and we should do it.</p>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>Don’t forget to explicitly rebuild PARSEC with:</p>
|
|
||||||
</div>
|
|
||||||
<div class="literalblock">
|
|
||||||
<div class="content">
|
|
||||||
<pre>./build-buildroot \
|
|
||||||
--arch arm \
|
|
||||||
--config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \
|
|
||||||
-- parsec_benchmark-reconfigure \
|
|
||||||
;</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="paragraph">
|
|
||||||
<p>You may also want to test if your patches are still functionally correct inside of QEMU first, which is a faster emulator.</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p>sell your soul, and compile natively inside the guest. We won’t do this, not only because it is evil, but also because Buildroot explicitly does not support it: <a href="https://buildroot.org/downloads/manual/manual.html#faq-no-compiler-on-target" class="bare">https://buildroot.org/downloads/manual/manual.html#faq-no-compiler-on-target</a> ARM employees have been known to do this: <a href="https://github.com/arm-university/arm-gem5-rsk/blob/aa3b51b175a0f3b6e75c9c856092ae0c8f2a7cdc/parsec_patches/qemu-patch.diff" class="bare">https://github.com/arm-university/arm-gem5-rsk/blob/aa3b51b175a0f3b6e75c9c856092ae0c8f2a7cdc/parsec_patches/qemu-patch.diff</a></p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sect3">
|
|
||||||
<h4 id="microbenchmarks"><a class="anchor" href="#microbenchmarks"></a><a class="link" href="#microbenchmarks">26.9.2. Microbenchmarks</a></h4>
|
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<p>It eventually has to come to that, hasn’t it?</p>
|
<p>It eventually has to come to that, hasn’t it?</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user