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
c7438747
Commit
c7438747
authored
Jan 13, 2024
by
Hejing Li
Browse files
add homa image
parent
8b2fefc3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
235 additions
and
4 deletions
+235
-4
experiments/pyexps/homa_simple_ping.py
experiments/pyexps/homa_simple_ping.py
+81
-0
experiments/simbricks/orchestration/nodeconfig.py
experiments/simbricks/orchestration/nodeconfig.py
+36
-0
images/kernel/linux-5.17.7-timers-gem5.patch
images/kernel/linux-5.17.7-timers-gem5.patch
+70
-0
images/rules.mk
images/rules.mk
+22
-2
images/scripts/install-base.sh
images/scripts/install-base.sh
+2
-2
images/scripts/install-homa.sh
images/scripts/install-homa.sh
+24
-0
No files found.
experiments/pyexps/homa_simple_ping.py
0 → 100644
View file @
c7438747
# Copyright 2022 Max Planck Institute for Software Systems, and
# National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
Simple example experiment, which sets up a client and a server host connected
through a switch.
The client pings the server.
"""
from
simbricks.orchestration.experiments
import
Experiment
from
simbricks.orchestration.nodeconfig
import
(
HomaClientNode
,
HomaServerNode
,
I40eLinuxNode
,
IdleHost
,
PingClient
)
from
simbricks.orchestration.simulators
import
QemuHost
,
Gem5Host
,
I40eNIC
,
SwitchNet
e
=
Experiment
(
name
=
'simple_ping'
)
e
.
checkpoint
=
True
# use checkpoint and restore to speed up simulation
# create client
client_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
client_config
.
disk_image
=
'homa'
client_config
.
ip
=
'10.0.0.1'
client_config
.
app
=
HomaClientNode
()
client
=
QemuHost
(
client_config
)
client
.
sync
=
True
client
.
name
=
'client'
client
.
wait
=
True
# wait for client simulator to finish execution
e
.
add_host
(
client
)
# attach client's NIC
client_nic
=
I40eNIC
()
e
.
add_nic
(
client_nic
)
client
.
add_nic
(
client_nic
)
# create server
server_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
server_config
.
disk_image
=
'homa'
server_config
.
ip
=
'10.0.0.2'
server_config
.
app
=
HomaServerNode
()
server
=
QemuHost
(
server_config
)
server
.
sync
=
True
server
.
name
=
'server'
e
.
add_host
(
server
)
# attach server's NIC
server_nic
=
I40eNIC
()
e
.
add_nic
(
server_nic
)
server
.
add_nic
(
server_nic
)
# connect NICs over network
network
=
SwitchNet
()
e
.
add_network
(
network
)
client_nic
.
set_network
(
network
)
server_nic
.
set_network
(
network
)
# set more interesting link latencies than default
eth_latency
=
500
*
10
**
3
# 500 us
network
.
eth_latency
=
eth_latency
client_nic
.
eth_latency
=
eth_latency
server_nic
.
eth_latency
=
eth_latency
experiments
=
[
e
]
experiments/simbricks/orchestration/nodeconfig.py
View file @
c7438747
...
...
@@ -395,6 +395,42 @@ class LinuxFEMUNode(NodeConfig):
return
super
().
prepare_post_cp
()
+
l
class
HomaClientNode
(
AppConfig
):
def
prepare_post_cp
(
self
)
->
tp
.
List
[
str
]:
return
super
().
prepare_post_cp
()
+
[
'insmod homa.ko'
]
# pylint: disable=consider-using-with
def
config_files
(
self
)
->
tp
.
Dict
[
str
,
tp
.
IO
]:
m
=
{
'homa.ko'
:
open
(
'../images/homa/homa.ko'
,
'rb'
)}
return
{
**
m
,
**
super
().
config_files
()}
def
run_cmds
(
self
,
node
:
NodeConfig
)
->
tp
.
List
[
str
]:
return
[
'echo "10.0.0.2 node1" >> /etc/hosts'
,
#'cat /etc/hosts',
#'ping 10.0.0.2 -c 3',
#'ping node1',
'/root/homa/util/cp_node client'
]
class
HomaServerNode
(
AppConfig
):
def
prepare_post_cp
(
self
)
->
tp
.
List
[
str
]:
return
super
().
prepare_post_cp
()
+
[
'insmod homa.ko'
]
# pylint: disable=consider-using-with
def
config_files
(
self
)
->
tp
.
Dict
[
str
,
tp
.
IO
]:
m
=
{
'homa.ko'
:
open
(
'../images/homa/homa.ko'
,
'rb'
)}
return
{
**
m
,
**
super
().
config_files
()}
def
run_cmds
(
self
,
node
:
NodeConfig
)
->
tp
.
List
[
str
]:
return
[
'/root/homa/util/cp_node server'
]
class
IdleHost
(
AppConfig
):
def
run_cmds
(
self
,
node
:
NodeConfig
)
->
tp
.
List
[
str
]:
...
...
images/kernel/linux-5.17.7-timers-gem5.patch
0 → 100644
View file @
c7438747
diff -ur linux-5.15.69.old/arch/x86/kernel/apic/apic.c linux-5.15.69/arch/x86/kernel/apic/apic.c
--- linux-5.15.69.old/arch/x86/kernel/apic/apic.c 2022-09-20 12:39:46.000000000 +0200
+++ linux-5.15.69/arch/x86/kernel/apic/apic.c 2022-09-22 12:30:20.240719422 +0200
@@ -1001,6 +1001,8 @@
return -1;
}
+
+ printk(KERN_ERR " calibrated lapic_timer_period=%u\n", lapic_timer_period);
return 0;
}
@@ -2957,3 +2959,13 @@
return 0;
}
early_param("apic_extnmi", apic_set_extnmi);
+
+static int __init lapic_set_timer_period(char *arg)
+{
+ if (!arg || kstrtouint(arg, 10, &lapic_timer_period)) {
+ return -EINVAL;
+ }
+ return 0;
+}
+
+early_param("lapic_timer_period", lapic_set_timer_period);
diff -ur linux-5.15.69.old/arch/x86/kernel/tsc.c linux-5.15.69/arch/x86/kernel/tsc.c
--- linux-5.15.69.old/arch/x86/kernel/tsc.c 2022-09-20 12:39:46.000000000 +0200
+++ linux-5.15.69/arch/x86/kernel/tsc.c 2022-09-22 12:30:20.240719422 +0200
@@ -53,6 +53,8 @@
static u64 art_to_tsc_offset;
struct clocksource *art_related_clocksource;
+static unsigned long tsc_override_freq = 0;
+
struct cyc2ns {
struct cyc2ns_data data[2]; /* 0 + 2*16 = 32 */
seqcount_latch_t seq; /* 32 + 4 = 36 */
@@ -870,6 +872,8 @@
{
unsigned long flags, fast_calibrate = cpu_khz_from_cpuid();
+ if (tsc_override_freq)
+ return tsc_override_freq;
if (!fast_calibrate)
fast_calibrate = cpu_khz_from_msr();
if (!fast_calibrate) {
@@ -877,6 +881,7 @@
fast_calibrate = quick_pit_calibrate();
local_irq_restore(flags);
}
+ pr_warn("calibrated TSC: tsc_freq=%lu\n", fast_calibrate);
return fast_calibrate;
}
@@ -1575,3 +1580,14 @@
return 0;
}
#endif
+
+
+static int __init tsc_set_override_freq(char *arg)
+{
+ if (!arg || kstrtoul(arg, 10, &tsc_override_freq)) {
+ return -EINVAL;
+ }
+ return 0;
+}
+
+early_param("tsc_override_freq", tsc_set_override_freq);
images/rules.mk
View file @
c7438747
...
...
@@ -23,16 +23,17 @@
include
mk/subdir_pre.mk
PACKER_VERSION
:=
1.7.0
KERNEL_VERSION
:=
5.1
5.93
KERNEL_VERSION
:=
5.1
7.7
BASE_IMAGE
:=
$(d)
output-base/base
MEMCACHED_IMAGE
:=
$(d)
output-memcached/memcached
NOPAXOS_IMAGE
:=
$(d)
output-nopaxos/nopaxos
MTCP_IMAGE
:=
$(d)
output-mtcp/mtcp
TAS_IMAGE
:=
$(d)
output-tas/tas
HOMA_IMAGE
:=
$(d)
output-homa/homa
COMPRESSED_IMAGES
?=
false
IMAGES
:=
$(BASE_IMAGE)
$(NOPAXOS_IMAGE)
$(MEMCACHED_IMAGE)
IMAGES
:=
$(BASE_IMAGE)
$(NOPAXOS_IMAGE)
$(MEMCACHED_IMAGE)
$(HOMA_IMAGE)
RAW_IMAGES
:=
$(
addsuffix
.raw,
$(IMAGES)
)
IMAGES_MIN
:=
$(BASE_IMAGE)
...
...
@@ -54,6 +55,8 @@ farmem_dir := $(d)farmem
farmem_mod
:=
$(farmem_dir)
/farmem.ko
m5_bin
:=
$(d)
m5
guest_init
:=
$(d)
/scripts/guestinit.sh
homa_dir
:=
$(d)
homa
homa_mod
:=
$(homa_dir)
/homa.ko
build-images
:
$(IMAGES) $(RAW_IMAGES) $(vmlinux) $(bz_image) $(mqnic_mod)
\
$(farmem_mod)
...
...
@@ -121,6 +124,18 @@ $(TAS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \
$(COMPRESSED_IMAGES)
touch
$@
$(HOMA_IMAGE)
:
$(packer) $(QEMU) $(BASE_IMAGE)
\
$(addprefix $(d)
,
extended-image.pkr.hcl scripts/install-homa.sh
\
scripts/cleanup.sh)
rm
-rf
$(
dir
$@
)
mkdir
-p
$(img_dir)
/input-homa
cp
-r
$(homa_dir)
\
$(img_dir)
/input-homa
cd
$(img_dir)
&&
./packer-wrap.sh base homa extended-image.pkr.hcl
\
$(COMPRESSED_IMAGES)
rm
-rf
$(img_dir)
/input-homa
touch
$@
$(packer)
:
wget
-O
$(img_dir)
packer_
$(PACKER_VERSION)
_linux_amd64.zip
\
https://releases.hashicorp.com/packer/
$(PACKER_VERSION)
/packer_
$(PACKER_VERSION)
_linux_amd64.zip
...
...
@@ -183,6 +198,11 @@ $(mqnic_mod): $(vmlinux)
$(MAKE)
-C
$(kernel_dir)
M
=
$(
abspath
$(mqnic_dir)
)
modules
touch
$@
# HOMA kernel module
$(homa_mod)
:
$(vmlinux)
$(MAKE)
-C
$(kernel_dir)
M
=
$(
abspath
$(homa_dir)
)
modules
touch
$@
################################################
# farmem kernel module
...
...
images/scripts/install-base.sh
View file @
c7438747
...
...
@@ -18,8 +18,8 @@ apt-get -y install \
pushd
/tmp/input
mv
guestinit.sh /home/ubuntu/guestinit.sh
mv
bzImage /boot/vmlinuz-5.1
5.93
mv
config-5.1
5.93
/boot/
mv
bzImage /boot/vmlinuz-5.1
7.7
mv
config-5.1
7.7
/boot/
mv
m5 /sbin/m5
GRUB_CFG_FILE
=
/etc/default/grub.d/50-cloudimg-settings.cfg
...
...
images/scripts/install-homa.sh
0 → 100644
View file @
c7438747
#!/bin/bash -eux
apt-get update
apt-get
-y
install
\
autoconf
\
automake
\
build-essential
\
g++
\
git
\
libevent-dev
\
libssl-dev
\
libtool
\
libunwind-dev
\
make
\
vim
\
pkg-config
mkdir
-p
/root
#git clone https://github.com/PlatformLab/HomaModule.git /root/homa
cp
-r
/tmp/input/homa /root/homa
cd
/root/homa
#git checkout linux_5.17.7
cd
/root/homa/util
make
\ No newline at end of file
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