Skip to content

Instantly share code, notes, and snippets.

@jlelli
Created June 13, 2018 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlelli/9c44669aca300805a44261990114887d to your computer and use it in GitHub Desktop.
Save jlelli/9c44669aca300805a44261990114887d to your computer and use it in GitHub Desktop.
Fix SCHED_DEADLINE root domain bandwidth accounting
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2018-06-13 11:04:41,860 INFO : root : Using LISA logging configuration:\n",
"2018-06-13 11:04:41,862 INFO : root : /home/juri/work/lisa/logging.conf\n"
]
}
],
"source": [
"import logging\n",
"from conf import LisaLogging\n",
"LisaLogging.setup()\n",
"\n",
"# Uncomment the follwing line to enabled devlib debugging statements\n",
"# logging.getLogger('ssh').setLevel(logging.DEBUG)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"source": [
"# Generate plots inline\n",
"%pylab inline\n",
"\n",
"import copy\n",
"import json\n",
"import os\n",
"\n",
"# Support to access the remote target\n",
"import devlib\n",
"from env import TestEnv\n",
"\n",
"# Support to configure and run RTApp based workloads\n",
"from wlgen import RTA, Periodic, PerfMessaging\n",
"\n",
"# Support for performance analysis of RTApp workloads\n",
"from perf_analysis import PerfAnalysis\n",
"\n",
"# Support for trace events analysis\n",
"from trace import Trace\n",
"\n",
"# Suport for FTrace events parsing and visualization\n",
"import trappy\n",
"\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test environment setup"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Setup a target configuration\n",
"my_conf = {\n",
" \n",
" # Define the kind of target platform to use for the experiments\n",
" \"platform\" : 'linux', # Linux system, valid other options are:\n",
" # android - access via ADB\n",
" # linux - access via SSH\n",
" # host - direct access\n",
" \n",
" # Preload settings for a specific target\n",
" #\"board\" : 'xeon_E5-2609_v3',\n",
" \n",
" # Define devlib module to load\n",
" \"modules\" : [\n",
" #'bl', # enable big.LITTLE support\n",
" #'cpufreq' # enable CPUFreq support\n",
" 'hotplug'\n",
" ],\n",
" \n",
" \"exclude_modules\" : [\n",
" 'cpufreq'\n",
" ],\n",
"\n",
" # Account to access the remote target\n",
" \"host\" : '127.0.0.1',\n",
" \"port\" : '10022',\n",
" \"username\" : 'root',\n",
" \"password\" : '',\n",
"\n",
" # Comment the following line to force rt-app calibration on your target\n",
" \"rtapp-calib\" : {\n",
" \"0\": 23, \"1\": 23, \"2\": 23, \"3\": 23\n",
" },\n",
" \n",
" # Binary tools required to run this experiment\n",
" # These tools must be present in the tools/ folder for the architecture\n",
" \"tools\" : ['rt-app', 'taskset', 'trace-cmd', 'perf'],\n",
" \n",
" # FTrace events end buffer configuration\n",
" \"ftrace\" : {\n",
" \"events\" : [\n",
" \"sched_switch\"\n",
" ],\n",
" \"buffsize\" : 20240\n",
" },\n",
" \n",
" \"results_dir\" : \"kvm-root-domain\"\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2018-06-13 11:04:44,828 INFO : TestEnv : Using base path: /home/juri/work/lisa\n",
"2018-06-13 11:04:44,830 INFO : TestEnv : Loading custom (inline) target configuration\n",
"2018-06-13 11:04:44,831 INFO : TestEnv : Devlib modules to load: ['cpuidle', 'hotplug']\n",
"2018-06-13 11:04:44,833 INFO : TestEnv : Connecting linux target:\n",
"2018-06-13 11:04:44,834 INFO : TestEnv : username : root\n",
"2018-06-13 11:04:44,836 INFO : TestEnv : host : 127.0.0.1\n",
"2018-06-13 11:04:44,837 INFO : TestEnv : password : \n",
"2018-06-13 11:04:44,839 INFO : TestEnv : port : 10022\n",
"2018-06-13 11:04:44,840 INFO : TestEnv : Connection settings:\n",
"2018-06-13 11:04:44,841 INFO : TestEnv : {'username': 'root', 'host': '127.0.0.1', 'password': '', 'port': '10022'}\n",
"2018-06-13 11:04:48,406 INFO : TestEnv : Initializing target workdir:\n",
"2018-06-13 11:04:48,411 INFO : TestEnv : /root/devlib-target\n",
"2018-06-13 11:04:51,107 INFO : TestEnv : Attempting to read energy model from target\n",
"2018-06-13 11:04:51,112 ERROR : TestEnv : Couldn't read target energy model: Requires cpufreq devlib module. Please ensure \"cpufreq\" is listed in your target/test modules\n",
"2018-06-13 11:04:51,116 INFO : TestEnv : Topology:\n",
"2018-06-13 11:04:51,120 INFO : TestEnv : [[0, 1, 2, 3]]\n",
"2018-06-13 11:04:51,123 WARNING : TestEnv : Unable to identify cluster frequencies\n",
"2018-06-13 11:04:51,962 INFO : TestEnv : Enabled tracepoints:\n",
"2018-06-13 11:04:51,964 INFO : TestEnv : sched_switch\n",
"2018-06-13 11:04:51,966 INFO : TestEnv : Using configuration provided RTApp calibration\n",
"2018-06-13 11:04:51,968 INFO : TestEnv : Using RT-App calibration values:\n",
"2018-06-13 11:04:51,969 INFO : TestEnv : {\"0\": 23, \"1\": 23, \"2\": 23, \"3\": 23}\n",
"2018-06-13 11:04:51,971 INFO : TestEnv : Set results folder to:\n",
"2018-06-13 11:04:51,973 INFO : TestEnv : /home/juri/work/lisa/results/kvm-root-domain\n",
"2018-06-13 11:04:51,974 INFO : TestEnv : Experiment results available also in:\n",
"2018-06-13 11:04:51,975 INFO : TestEnv : /home/juri/work/lisa/results_latest\n"
]
}
],
"source": [
"te = TestEnv(my_conf, force_new=True, wipe=False)\n",
"target = te.target"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2018-06-13 11:04:51,987 INFO : root : Target ABI: x86_64, CPus: ['QEMU Virtual version 2.5+', 'QEMU Virtual version 2.5+', 'QEMU Virtual version 2.5+', 'QEMU Virtual version 2.5+']\n"
]
}
],
"source": [
"logging.info(\"Target ABI: %s, CPus: %s\",\n",
" target.abi,\n",
" target.cpuinfo.cpu_names)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test Root Domain accounting"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## sched_load_balance"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" '']"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"target.execute('schedtool -E -t 10000000:100000000 -e ~/sched-deadline-tests/basic/cpuhog &');"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" '']"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 0 > /sys/fs/cgroup/cpuset.sched_load_balance');"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" '']"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"target.execute('killall cpuhog');"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" '']"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 1 > /sys/fs/cgroup/cpuset.sched_load_balance');"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" '']"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## hotplug"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" '']"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[0, 1, 2, 3]"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.list_online_cpus()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"target.execute('schedtool -E -t 10000000:100000000 -e ~/sched-deadline-tests/basic/cpuhog &');"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 1',\n",
" ' .dl_nr_migratory : 1',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" '']"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"target.hotplug.offline(1)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[0, 2, 3]"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.list_online_cpus()"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 104857',\n",
" '']"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"target.execute('killall cpuhog');"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" '']"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"target.hotplug.online(1)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dl_rq[0]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[1]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[2]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" 'dl_rq[3]:',\n",
" ' .dl_nr_running : 0',\n",
" ' .dl_nr_migratory : 0',\n",
" ' .dl_bw->bw : 996147',\n",
" ' .dl_bw->total_bw : 0',\n",
" '']"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('grep dl_ /proc/sched_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.14"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment