"git@developer.sourcefind.cn:cnjsdfcy/simbricks.git" did not exist on "6650df5b9eb5e7e50f6b8da4df272a3fb7e2b438"
Commit c7438747 authored by Hejing Li's avatar Hejing Li
Browse files

add homa image

parent 8b2fefc3
# 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]
...@@ -395,6 +395,42 @@ class LinuxFEMUNode(NodeConfig): ...@@ -395,6 +395,42 @@ class LinuxFEMUNode(NodeConfig):
return super().prepare_post_cp() + l 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): class IdleHost(AppConfig):
def run_cmds(self, node: NodeConfig) -> tp.List[str]: def run_cmds(self, node: NodeConfig) -> tp.List[str]:
......
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);
...@@ -23,16 +23,17 @@ ...@@ -23,16 +23,17 @@
include mk/subdir_pre.mk include mk/subdir_pre.mk
PACKER_VERSION := 1.7.0 PACKER_VERSION := 1.7.0
KERNEL_VERSION := 5.15.93 KERNEL_VERSION := 5.17.7
BASE_IMAGE := $(d)output-base/base BASE_IMAGE := $(d)output-base/base
MEMCACHED_IMAGE := $(d)output-memcached/memcached MEMCACHED_IMAGE := $(d)output-memcached/memcached
NOPAXOS_IMAGE := $(d)output-nopaxos/nopaxos NOPAXOS_IMAGE := $(d)output-nopaxos/nopaxos
MTCP_IMAGE := $(d)output-mtcp/mtcp MTCP_IMAGE := $(d)output-mtcp/mtcp
TAS_IMAGE := $(d)output-tas/tas TAS_IMAGE := $(d)output-tas/tas
HOMA_IMAGE := $(d)output-homa/homa
COMPRESSED_IMAGES ?= false COMPRESSED_IMAGES ?= false
IMAGES := $(BASE_IMAGE) $(NOPAXOS_IMAGE) $(MEMCACHED_IMAGE) IMAGES := $(BASE_IMAGE) $(NOPAXOS_IMAGE) $(MEMCACHED_IMAGE) $(HOMA_IMAGE)
RAW_IMAGES := $(addsuffix .raw,$(IMAGES)) RAW_IMAGES := $(addsuffix .raw,$(IMAGES))
IMAGES_MIN := $(BASE_IMAGE) IMAGES_MIN := $(BASE_IMAGE)
...@@ -54,6 +55,8 @@ farmem_dir := $(d)farmem ...@@ -54,6 +55,8 @@ farmem_dir := $(d)farmem
farmem_mod := $(farmem_dir)/farmem.ko farmem_mod := $(farmem_dir)/farmem.ko
m5_bin := $(d)m5 m5_bin := $(d)m5
guest_init := $(d)/scripts/guestinit.sh 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) \ build-images: $(IMAGES) $(RAW_IMAGES) $(vmlinux) $(bz_image) $(mqnic_mod) \
$(farmem_mod) $(farmem_mod)
...@@ -121,6 +124,18 @@ $(TAS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \ ...@@ -121,6 +124,18 @@ $(TAS_IMAGE): $(packer) $(QEMU) $(BASE_IMAGE) \
$(COMPRESSED_IMAGES) $(COMPRESSED_IMAGES)
touch $@ 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): $(packer):
wget -O $(img_dir)packer_$(PACKER_VERSION)_linux_amd64.zip \ wget -O $(img_dir)packer_$(PACKER_VERSION)_linux_amd64.zip \
https://releases.hashicorp.com/packer/$(PACKER_VERSION)/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) ...@@ -183,6 +198,11 @@ $(mqnic_mod): $(vmlinux)
$(MAKE) -C $(kernel_dir) M=$(abspath $(mqnic_dir)) modules $(MAKE) -C $(kernel_dir) M=$(abspath $(mqnic_dir)) modules
touch $@ touch $@
# HOMA kernel module
$(homa_mod): $(vmlinux)
$(MAKE) -C $(kernel_dir) M=$(abspath $(homa_dir)) modules
touch $@
################################################ ################################################
# farmem kernel module # farmem kernel module
......
...@@ -18,8 +18,8 @@ apt-get -y install \ ...@@ -18,8 +18,8 @@ apt-get -y install \
pushd /tmp/input pushd /tmp/input
mv guestinit.sh /home/ubuntu/guestinit.sh mv guestinit.sh /home/ubuntu/guestinit.sh
mv bzImage /boot/vmlinuz-5.15.93 mv bzImage /boot/vmlinuz-5.17.7
mv config-5.15.93 /boot/ mv config-5.17.7 /boot/
mv m5 /sbin/m5 mv m5 /sbin/m5
GRUB_CFG_FILE=/etc/default/grub.d/50-cloudimg-settings.cfg GRUB_CFG_FILE=/etc/default/grub.d/50-cloudimg-settings.cfg
......
#!/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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment