Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
98ae1d1c
"...git@developer.sourcefind.cn:OpenDAS/mmdetection3d.git" did not exist on "c8c5e1a9d7ce5d3c8495bec850852230f49d7588"
Commit
98ae1d1c
authored
Jun 19, 2020
by
Antoine Kaufmann
Browse files
experiments: add some gem5 examples
parent
e7c6e658
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
112 additions
and
4 deletions
+112
-4
experiments/Makefile
experiments/Makefile
+5
-0
experiments/common-functions.sh
experiments/common-functions.sh
+41
-4
experiments/experiments/gem5-kvm-corundum-bm-pair.sh
experiments/experiments/gem5-kvm-corundum-bm-pair.sh
+14
-0
experiments/experiments/gem5-timing-corundum-verilator-pair.sh
...iments/experiments/gem5-timing-corundum-verilator-pair.sh
+30
-0
experiments/guests/gem5-pair-client-cp/run.sh
experiments/guests/gem5-pair-client-cp/run.sh
+8
-0
experiments/guests/gem5-pair-client/run.sh
experiments/guests/gem5-pair-client/run.sh
+7
-0
experiments/guests/gem5-pair-server-cp/run.sh
experiments/guests/gem5-pair-server-cp/run.sh
+7
-0
No files found.
experiments/Makefile
View file @
98ae1d1c
...
@@ -3,10 +3,15 @@ MQNICMOD := $(abspath ../images/mqnic/mqnic.ko)
...
@@ -3,10 +3,15 @@ MQNICMOD := $(abspath ../images/mqnic/mqnic.ko)
GUESTS
:=
\
GUESTS
:=
\
qemu-pair-client
\
qemu-pair-client
\
qemu-pair-server
\
qemu-pair-server
\
gem5-pair-client
\
gem5-pair-server-cp
\
gem5-pair-client-cp
\
EXPERIMENTS
:=
\
EXPERIMENTS
:=
\
qemu-corundum-bm-pair
\
qemu-corundum-bm-pair
\
qemu-corundum-verilator-pair
\
qemu-corundum-verilator-pair
\
gem5-kvm-corundum-bm-pair
\
gem5-timing-corundum-verilator-pair
\
BUILDDIR
:=
build
BUILDDIR
:=
build
OUTDIR
:=
out
OUTDIR
:=
out
...
...
experiments/common-functions.sh
View file @
98ae1d1c
...
@@ -7,19 +7,26 @@ fi
...
@@ -7,19 +7,26 @@ fi
source
local-config.sh
source
local-config.sh
if
[
-z
"
$EHSIM_BASE
"
]
;
then
if
[
!
-d
"
$EHSIM_BASE
"
]
;
then
echo
"
\$
EHSIM_BASE should be set to the absolute path of the root"
\
echo
"
\$
EHSIM_BASE should be set to the absolute path of the root"
\
"of this repo (local-config.sh)"
"of this repo (local-config.sh)"
exit
1
exit
1
fi
fi
if
[
-z
"
$QEMU_CMD
"
]
;
then
if
[
!
-f
"
$QEMU_CMD
"
]
;
then
echo
"
\$
QEMU_CMD should be set to the absolute path to a QEMU instance"
\
echo
"
\$
QEMU_CMD should be set to the absolute path to a QEMU instance"
\
"with cosim support (local-config.sh)"
"with cosim support (local-config.sh)"
exit
1
exit
1
fi
fi
if
[
!
-d
"
$GEM5_BASE
"
]
;
then
echo
"
\$
GEM5_BASE should be set to the absolute path to a built gem5 repo"
\
"(local-config.sh)"
exit
1
fi
QEMU_
BASE_
IMAGE
=
$EHSIM_BASE
/images/output-ubuntu1804/ubuntu1804
QEMU_IMAGE
=
$EHSIM_BASE
/images/output-ubuntu1804/ubuntu1804
QEMU_KERNEL
=
$EHSIM_BASE
/images/bzImage
QEMU_KERNEL
=
$EHSIM_BASE
/images/bzImage
GEM5_IMAGE
=
$EHSIM_BASE
/images/output-ubuntu1804/ubuntu1804.raw
GEM5_KERNEL
=
$EHSIM_BASE
/images/vmlinux
# Args:
# Args:
# - experiment name
# - experiment name
...
@@ -39,7 +46,7 @@ run_qemu() {
...
@@ -39,7 +46,7 @@ run_qemu() {
pcisock
=
"
$OUTDIR
/pci.
$2
"
pcisock
=
"
$OUTDIR
/pci.
$2
"
rm
-f
$img_a
$img_b
rm
-f
$img_a
$img_b
echo
Creating disk
for
qemu
$1
echo
Creating disk
for
qemu
$1
qemu-img create
-f
qcow2
-o
backing_file
=
$QEMU_
BASE_
IMAGE
$img_a
qemu-img create
-f
qcow2
-o
backing_file
=
$QEMU_IMAGE
$img_a
cp
$3
$img_b
cp
$3
$img_b
echo
Starting qemu
$1
echo
Starting qemu
$1
$QEMU_CMD
-machine
q35
-cpu
host
\
$QEMU_CMD
-machine
q35
-cpu
host
\
...
@@ -56,6 +63,31 @@ run_qemu() {
...
@@ -56,6 +63,31 @@ run_qemu() {
return
$pid
return
$pid
}
}
# Args:
# - Instance name
# - Cosim instance
# - secondary hard drive
# - cpu type
# - checkpoint dir
# - extra flags
run_gem5
()
{
echo
Starting gem5
$1
pcisock
=
"
$OUTDIR
/pci.
$2
"
shm
=
"
$OUTDIR
/shm.
$2
"
cpdir
=
"
$OUTDIR
/checkpoints.
$5
"
mkdir
-p
$cpdir
$GEM5_BASE
/build/X86/gem5.opt
\
--outdir
=
$OUTDIR
/gem5.out.
$1
\
$GEM5_BASE
/configs/cosim/cosim.py
\
--kernel
=
$GEM5_KERNEL
--disk-image
=
$GEM5_IMAGE
--disk-image
=
$3
\
--cpu-type
=
$4
--mem-size
=
4GB
--cosim-pci
=
$pcisock
--cosim-shm
=
$shm
\
--checkpoint-dir
=
"
$cpdir
"
$6
\
&>
$OUTDIR
/gem5.
$1
.log &
pid
=
$!
ALL_PIDS
=
"
$ALL_PIDS
$pid
"
return
$pid
}
# Args:
# Args:
# - Instance name
# - Instance name
run_corundum_verilator
()
{
run_corundum_verilator
()
{
...
@@ -95,8 +127,13 @@ run_wire() {
...
@@ -95,8 +127,13 @@ run_wire() {
cleanup
()
{
cleanup
()
{
echo
Cleaning up
echo
Cleaning up
for
p
in
$ALL_PIDS
;
do
kill
$p
&>/dev/null
done
sleep
1
for
p
in
$ALL_PIDS
;
do
for
p
in
$ALL_PIDS
;
do
kill
-KILL
$p
&>/dev/null
kill
-KILL
$p
&>/dev/null
done
done
rm
-f
$OUTDIR
/
{
qemu.hd.
*
,shm.
*
,pci.
*
,eth.
*
}
rm
-f
$OUTDIR
/
{
qemu.hd.
*
,shm.
*
,pci.
*
,eth.
*
}
}
}
experiments/experiments/gem5-kvm-corundum-bm-pair.sh
0 → 100644
View file @
98ae1d1c
#!/bin/bash
source
common-functions.sh
init_out gem5-kvm-corundum-bm-pair
run_corundum_bm a
run_corundum_bm b
sleep
0.5
run_wire ab a b
run_gem5 a a build/qemu-pair-server.tar X86KvmCPU a
run_gem5 b b build/gem5-pair-client.tar X86KvmCPU b
client_pid
=
$!
wait
$client_pid
cleanup
experiments/experiments/gem5-timing-corundum-verilator-pair.sh
0 → 100644
View file @
98ae1d1c
#!/bin/bash
source
common-functions.sh
init_out gem5-timing-corundum-verilator-pair
# first run to checkpoint with fast CPU
run_corundum_verilator a
run_corundum_verilator b
sleep
0.5
run_wire ab a b
run_gem5 a a build/gem5-pair-server-cp.tar X86KvmCPU server
run_gem5 b b build/gem5-pair-client-cp.tar X86KvmCPU client
client_pid
=
$!
wait
$client_pid
cleanup
echo
"Took checkpoint successfully"
# then run with timing CPU
run_corundum_verilator a_cp
run_corundum_verilator b_cp
sleep
0.5
run_wire ab_cp a_cp b_cp
run_gem5 a_cp a_cp build/gem5-pair-server-cp.tar TimingSimpleCPU server
"-r 0 --cosim-sync"
run_gem5 b_cp b_cp build/gem5-pair-client-cp.tar TimingSimpleCPU client
"-r 0 --cosim-sync"
client_pid
=
$!
wait
$client_pid
cleanup
experiments/guests/gem5-pair-client-cp/run.sh
0 → 100755
View file @
98ae1d1c
#!/bin/bash
m5 checkpoint
insmod mqnic.ko
ip
link set
dev eth0 up
ip addr add 192.168.64.2/24 dev eth0
sleep
2
iperf
-c
192.168.64.1
m5
exit
experiments/guests/gem5-pair-client/run.sh
0 → 100755
View file @
98ae1d1c
#!/bin/bash
insmod mqnic.ko
ip
link set
dev eth0 up
ip addr add 192.168.64.2/24 dev eth0
sleep
2
iperf
-c
192.168.64.1
m5
exit
experiments/guests/gem5-pair-server-cp/run.sh
0 → 100755
View file @
98ae1d1c
#!/bin/bash
m5 checkpoint
insmod mqnic.ko
ip
link set
dev eth0 up
ip addr add 192.168.64.1/24 dev eth0
iperf
-s
m5
exit
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment