Skip to content

Instantly share code, notes, and snippets.

@jlelli
Created June 19, 2018 09:42
Show Gist options
  • Save jlelli/57ff1e9dc72c8fde693bb8ba49ba9673 to your computer and use it in GitHub Desktop.
Save jlelli/57ff1e9dc72c8fde693bb8ba49ba9673 to your computer and use it in GitHub Desktop.
Test Cpuset in default hierarchy (v10)
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.
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-19 09:08:40,783 INFO : root : Using LISA logging configuration:\n",
"2018-06-19 09:08:40,785 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\" : \"cpuset-cgroup2-waiman-v10\"\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2018-06-19 09:08:42,293 INFO : TestEnv : Using base path: /home/juri/work/lisa\n",
"2018-06-19 09:08:42,298 INFO : TestEnv : Loading custom (inline) target configuration\n",
"2018-06-19 09:08:42,301 INFO : TestEnv : Devlib modules to load: ['cpuidle', 'hotplug']\n",
"2018-06-19 09:08:42,303 INFO : TestEnv : Connecting linux target:\n",
"2018-06-19 09:08:42,307 INFO : TestEnv : username : root\n",
"2018-06-19 09:08:42,308 INFO : TestEnv : host : 127.0.0.1\n",
"2018-06-19 09:08:42,310 INFO : TestEnv : password : \n",
"2018-06-19 09:08:42,313 INFO : TestEnv : port : 10022\n",
"2018-06-19 09:08:42,314 INFO : TestEnv : Connection settings:\n",
"2018-06-19 09:08:42,316 INFO : TestEnv : {'username': 'root', 'host': '127.0.0.1', 'password': '', 'port': '10022'}\n",
"2018-06-19 09:08:45,770 INFO : TestEnv : Initializing target workdir:\n",
"2018-06-19 09:08:45,775 INFO : TestEnv : /root/devlib-target\n",
"2018-06-19 09:08:48,370 INFO : TestEnv : Attempting to read energy model from target\n",
"2018-06-19 09:08:48,375 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-19 09:08:48,382 INFO : TestEnv : Topology:\n",
"2018-06-19 09:08:48,384 INFO : TestEnv : [[0, 1, 2, 3]]\n",
"2018-06-19 09:08:48,387 WARNING : TestEnv : Unable to identify cluster frequencies\n",
"2018-06-19 09:08:49,295 INFO : TestEnv : Enabled tracepoints:\n",
"2018-06-19 09:08:49,297 INFO : TestEnv : sched_switch\n",
"2018-06-19 09:08:49,299 INFO : TestEnv : Using configuration provided RTApp calibration\n",
"2018-06-19 09:08:49,301 INFO : TestEnv : Using RT-App calibration values:\n",
"2018-06-19 09:08:49,303 INFO : TestEnv : {\"0\": 23, \"1\": 23, \"2\": 23, \"3\": 23}\n",
"2018-06-19 09:08:49,304 INFO : TestEnv : Set results folder to:\n",
"2018-06-19 09:08:49,306 INFO : TestEnv : /home/juri/work/lisa/results/cpuset-cgroup2-waiman-v10\n",
"2018-06-19 09:08:49,308 INFO : TestEnv : Experiment results available also in:\n",
"2018-06-19 09:08:49,309 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-19 09:08:49,320 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": [
"# Mount"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"target.execute('mount -t cgroup2 none /sys/fs/cgroup');"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo \"+cpuset\" > /sys/fs/cgroup/cgroup.subtree_control');"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Create and modify a single domain root"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ', 'doms_cur[0]: 0-3 rd->span: 0-3 (n)', '']"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"target.execute('mkdir /sys/fs/cgroup/group1');"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 0-1 > /sys/fs/cgroup/group1/cpuset.cpus');"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 1 > /sys/fs/cgroup/group1/cpuset.sched.domain_root');"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ',\n",
" 'doms_cur[0]: 2-3 rd->span: 2-3 (n)',\n",
" 'doms_cur[1]: 0-1 rd->span: 0-1 (n)',\n",
" '']"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### There are now 2 root domains (2-3 is the root one and 0-1 is group1)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 0 > /sys/fs/cgroup/group1/cpuset.cpus');"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ',\n",
" 'doms_cur[0]: 1-3 rd->span: 1-3 (n)',\n",
" 'doms_cur[1]: 0 rd->span: 0 (n)',\n",
" '']"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"ename": "TargetError",
"evalue": "Got exit code 1\nfrom: echo > /sys/fs/cgroup/group1/cpuset.cpus\nOUTPUT: -bash: echo: write error: Invalid argument\r\n",
"output_type": "error",
"traceback": [
"\u001b[0;31m\u001b[0m",
"\u001b[0;31mTargetError\u001b[0mTraceback (most recent call last)",
"\u001b[0;32m<ipython-input-15-ba2cafa827af>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtarget\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'echo '\u001b[0m\u001b[0;34m' > /sys/fs/cgroup/group1/cpuset.cpus'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/juri/work/lisa/libs/devlib/devlib/target.pyc\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, command, timeout, check_exit_code, as_root)\u001b[0m\n\u001b[1;32m 338\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 339\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcheck_exit_code\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mas_root\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 340\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcheck_exit_code\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mas_root\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 341\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 342\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mbackground\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstdout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPIPE\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstderr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPIPE\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mas_root\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/juri/work/lisa/libs/devlib/devlib/utils/ssh.pyc\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, command, timeout, check_exit_code, as_root, strip_colors)\u001b[0m\n\u001b[1;32m 207\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mexit_code\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 208\u001b[0m \u001b[0mmessage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'Got exit code {}\\nfrom: {}\\nOUTPUT: {}'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 209\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTargetError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexit_code\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 210\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mValueError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mIndexError\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 211\u001b[0m logger.warning(\n",
"\u001b[0;31mTargetError\u001b[0m: Got exit code 1\nfrom: echo > /sys/fs/cgroup/group1/cpuset.cpus\nOUTPUT: -bash: echo: write error: Invalid argument\r\n"
]
}
],
"source": [
"target.execute('echo '' > /sys/fs/cgroup/group1/cpuset.cpus');"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"ename": "TargetError",
"evalue": "Got exit code 1\nfrom: echo 0-3 > /sys/fs/cgroup/group1/cpuset.cpus\nOUTPUT: -bash: echo: write error: Device or resource busy\r\n",
"output_type": "error",
"traceback": [
"\u001b[0;31m\u001b[0m",
"\u001b[0;31mTargetError\u001b[0mTraceback (most recent call last)",
"\u001b[0;32m<ipython-input-16-ad6096be76e5>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtarget\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'echo 0-3 > /sys/fs/cgroup/group1/cpuset.cpus'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/juri/work/lisa/libs/devlib/devlib/target.pyc\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, command, timeout, check_exit_code, as_root)\u001b[0m\n\u001b[1;32m 338\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 339\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcheck_exit_code\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mas_root\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 340\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcheck_exit_code\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mas_root\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 341\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 342\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mbackground\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstdout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPIPE\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstderr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPIPE\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mas_root\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/juri/work/lisa/libs/devlib/devlib/utils/ssh.pyc\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, command, timeout, check_exit_code, as_root, strip_colors)\u001b[0m\n\u001b[1;32m 207\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mexit_code\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 208\u001b[0m \u001b[0mmessage\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'Got exit code {}\\nfrom: {}\\nOUTPUT: {}'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 209\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTargetError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexit_code\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommand\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 210\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mValueError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mIndexError\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 211\u001b[0m logger.warning(\n",
"\u001b[0;31mTargetError\u001b[0m: Got exit code 1\nfrom: echo 0-3 > /sys/fs/cgroup/group1/cpuset.cpus\nOUTPUT: -bash: echo: write error: Device or resource busy\r\n"
]
}
],
"source": [
"target.execute('echo 0-3 > /sys/fs/cgroup/group1/cpuset.cpus');"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Both trying to remove all cpus from group1 and root fails"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"target.execute('rmdir /sys/fs/cgroup/group1');"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ', 'doms_cur[0]: 0-3 rd->span: 0-3 (n)', '']"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Create and modify two domain roots"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"target.execute('mkdir /sys/fs/cgroup/group1');\n",
"target.execute('mkdir /sys/fs/cgroup/group2');"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 0-1 > /sys/fs/cgroup/group1/cpuset.cpus');\n",
"target.execute('echo 2 > /sys/fs/cgroup/group2/cpuset.cpus');"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 1 > /sys/fs/cgroup/group1/cpuset.sched.domain_root');"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 1 > /sys/fs/cgroup/group2/cpuset.sched.domain_root');"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ',\n",
" 'doms_cur[0]: 3 rd->span: 3 (n)',\n",
" 'doms_cur[1]: 0-1 rd->span: 0-1 (n)',\n",
" 'doms_cur[2]: 2 rd->span: 2 (n)',\n",
" '']"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2 domains roots as expected"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"target.execute('echo 0 > /sys/fs/cgroup/group1/cpuset.cpus');\n",
"target.execute('echo 1-2 > /sys/fs/cgroup/group2/cpuset.cpus');"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ',\n",
" 'doms_cur[0]: 3 rd->span: 3 (n)',\n",
" 'doms_cur[1]: 0 rd->span: 0 (n)',\n",
" 'doms_cur[2]: 1-2 rd->span: 1-2 (n)',\n",
" '']"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Which can be modified"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Hotplug"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"target.hotplug.offline(2)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ',\n",
" 'doms_cur[0]: 3 rd->span: 3 (n)',\n",
" 'doms_cur[1]: 0 rd->span: 0 (n)',\n",
" 'doms_cur[2]: 1 rd->span: 1 (n)',\n",
" '']"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### group2 \"lost\" CPU2"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"target.hotplug.online(2)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ',\n",
" 'doms_cur[0]: 3 rd->span: 3 (n)',\n",
" 'doms_cur[1]: 0 rd->span: 0 (n)',\n",
" 'doms_cur[2]: 1-2 rd->span: 1-2 (n)',\n",
" '']"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### But it now has it back, nice."
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"target.hotplug.offline(2)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"target.execute('rmdir /sys/fs/cgroup/group2');"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"target.hotplug.online(2)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['def_root_domain: ',\n",
" 'doms_cur[0]: 1-3 rd->span: 1-3 (n)',\n",
" 'doms_cur[1]: 0 rd->span: 0 (n)',\n",
" '']"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.execute('cat /proc/doms_debug').split('\\r\\n')"
]
}
],
"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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment