Guest User

Untitled

a guest
Jun 20th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.88 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "metadata": {},
  7. "outputs": [
  8. {
  9. "name": "stderr",
  10. "output_type": "stream",
  11. "text": [
  12. "2018-06-19 08:57:53,023 INFO : root : Using LISA logging configuration:\n",
  13. "2018-06-19 08:57:53,025 INFO : root : /home/juri/work/lisa/logging.conf\n"
  14. ]
  15. }
  16. ],
  17. "source": [
  18. "import logging\n",
  19. "from conf import LisaLogging\n",
  20. "LisaLogging.setup()\n",
  21. "\n",
  22. "# Uncomment the follwing line to enabled devlib debugging statements\n",
  23. "# logging.getLogger('ssh').setLevel(logging.DEBUG)"
  24. ]
  25. },
  26. {
  27. "cell_type": "code",
  28. "execution_count": 2,
  29. "metadata": {},
  30. "outputs": [
  31. {
  32. "name": "stdout",
  33. "output_type": "stream",
  34. "text": [
  35. "Populating the interactive namespace from numpy and matplotlib\n"
  36. ]
  37. }
  38. ],
  39. "source": [
  40. "# Generate plots inline\n",
  41. "%pylab inline\n",
  42. "\n",
  43. "import copy\n",
  44. "import json\n",
  45. "import os\n",
  46. "\n",
  47. "# Support to access the remote target\n",
  48. "import devlib\n",
  49. "from env import TestEnv\n",
  50. "\n",
  51. "# Support to configure and run RTApp based workloads\n",
  52. "from wlgen import RTA, Periodic, PerfMessaging\n",
  53. "\n",
  54. "# Support for performance analysis of RTApp workloads\n",
  55. "from perf_analysis import PerfAnalysis\n",
  56. "\n",
  57. "# Support for trace events analysis\n",
  58. "from trace import Trace\n",
  59. "\n",
  60. "# Suport for FTrace events parsing and visualization\n",
  61. "import trappy\n",
  62. "\n",
  63. "import pandas as pd\n",
  64. "import matplotlib.pyplot as plt"
  65. ]
  66. },
  67. {
  68. "cell_type": "markdown",
  69. "metadata": {},
  70. "source": [
  71. "# Test environment setup"
  72. ]
  73. },
  74. {
  75. "cell_type": "code",
  76. "execution_count": 3,
  77. "metadata": {},
  78. "outputs": [],
  79. "source": [
  80. "# Setup a target configuration\n",
  81. "my_conf = {\n",
  82. " \n",
  83. " # Define the kind of target platform to use for the experiments\n",
  84. " \"platform\" : 'linux', # Linux system, valid other options are:\n",
  85. " # android - access via ADB\n",
  86. " # linux - access via SSH\n",
  87. " # host - direct access\n",
  88. " \n",
  89. " # Preload settings for a specific target\n",
  90. " #\"board\" : 'xeon_E5-2609_v3',\n",
  91. " \n",
  92. " # Define devlib module to load\n",
  93. " \"modules\" : [\n",
  94. " #'bl', # enable big.LITTLE support\n",
  95. " #'cpufreq' # enable CPUFreq support\n",
  96. " 'hotplug'\n",
  97. " ],\n",
  98. " \n",
  99. " \"exclude_modules\" : [\n",
  100. " 'cpufreq'\n",
  101. " ],\n",
  102. "\n",
  103. " # Account to access the remote target\n",
  104. " \"host\" : '127.0.0.1',\n",
  105. " \"port\" : '10022',\n",
  106. " \"username\" : 'root',\n",
  107. " \"password\" : '',\n",
  108. "\n",
  109. " # Comment the following line to force rt-app calibration on your target\n",
  110. " \"rtapp-calib\" : {\n",
  111. " \"0\": 23, \"1\": 23, \"2\": 23, \"3\": 23\n",
  112. " },\n",
  113. " \n",
  114. " # Binary tools required to run this experiment\n",
  115. " # These tools must be present in the tools/ folder for the architecture\n",
  116. " \"tools\" : ['rt-app', 'taskset', 'trace-cmd', 'perf'],\n",
  117. " \n",
  118. " # FTrace events end buffer configuration\n",
  119. " \"ftrace\" : {\n",
  120. " \"events\" : [\n",
  121. " \"sched_switch\"\n",
  122. " ],\n",
  123. " \"buffsize\" : 20240\n",
  124. " },\n",
  125. " \n",
  126. " \"results_dir\" : \"cpuset-cgroup2-waiman-v10\"\n",
  127. "}"
  128. ]
  129. },
  130. {
  131. "cell_type": "code",
  132. "execution_count": 4,
  133. "metadata": {
  134. "scrolled": false
  135. },
  136. "outputs": [
  137. {
  138. "name": "stderr",
  139. "output_type": "stream",
  140. "text": [
  141. "2018-06-19 08:57:54,638 INFO : TestEnv : Using base path: /home/juri/work/lisa\n",
  142. "2018-06-19 08:57:54,642 INFO : TestEnv : Loading custom (inline) target configuration\n",
  143. "2018-06-19 08:57:54,645 INFO : TestEnv : Devlib modules to load: ['cpuidle', 'hotplug']\n",
  144. "2018-06-19 08:57:54,647 INFO : TestEnv : Connecting linux target:\n",
  145. "2018-06-19 08:57:54,651 INFO : TestEnv : username : root\n",
  146. "2018-06-19 08:57:54,655 INFO : TestEnv : host : 127.0.0.1\n",
  147. "2018-06-19 08:57:54,658 INFO : TestEnv : password : \n",
  148. "2018-06-19 08:57:54,659 INFO : TestEnv : port : 10022\n",
  149. "2018-06-19 08:57:54,661 INFO : TestEnv : Connection settings:\n",
  150. "2018-06-19 08:57:54,663 INFO : TestEnv : {'username': 'root', 'host': '127.0.0.1', 'password': '', 'port': '10022'}\n",
  151. "2018-06-19 08:57:58,214 INFO : TestEnv : Initializing target workdir:\n",
  152. "2018-06-19 08:57:58,219 INFO : TestEnv : /root/devlib-target\n",
  153. "2018-06-19 08:58:00,862 INFO : TestEnv : Attempting to read energy model from target\n",
  154. "2018-06-19 08:58:00,866 ERROR : TestEnv : Couldn't read target energy model: Requires cpufreq devlib module. Please ensure \"cpufreq\" is listed in your target/test modules\n",
  155. "2018-06-19 08:58:00,871 INFO : TestEnv : Topology:\n",
  156. "2018-06-19 08:58:00,873 INFO : TestEnv : [[0, 1, 2, 3]]\n",
  157. "2018-06-19 08:58:00,876 WARNING : TestEnv : Unable to identify cluster frequencies\n",
  158. "2018-06-19 08:58:06,666 INFO : TestEnv : Enabled tracepoints:\n",
  159. "2018-06-19 08:58:06,669 INFO : TestEnv : sched_switch\n",
  160. "2018-06-19 08:58:06,670 INFO : TestEnv : Using configuration provided RTApp calibration\n",
  161. "2018-06-19 08:58:06,672 INFO : TestEnv : Using RT-App calibration values:\n",
  162. "2018-06-19 08:58:06,674 INFO : TestEnv : {\"0\": 23, \"1\": 23, \"2\": 23, \"3\": 23}\n",
  163. "2018-06-19 08:58:06,675 INFO : TestEnv : Set results folder to:\n",
  164. "2018-06-19 08:58:06,676 INFO : TestEnv : /home/juri/work/lisa/results/cpuset-cgroup2-waiman-v10\n",
  165. "2018-06-19 08:58:06,678 INFO : TestEnv : Experiment results available also in:\n",
  166. "2018-06-19 08:58:06,679 INFO : TestEnv : /home/juri/work/lisa/results_latest\n"
  167. ]
  168. }
  169. ],
  170. "source": [
  171. "te = TestEnv(my_conf, force_new=True, wipe=False)\n",
  172. "target = te.target"
  173. ]
  174. },
  175. {
  176. "cell_type": "code",
  177. "execution_count": 5,
  178. "metadata": {},
  179. "outputs": [
  180. {
  181. "name": "stderr",
  182. "output_type": "stream",
  183. "text": [
  184. "2018-06-19 08:58:06,688 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"
  185. ]
  186. }
  187. ],
  188. "source": [
  189. "logging.info(\"Target ABI: %s, CPus: %s\",\n",
  190. " target.abi,\n",
  191. " target.cpuinfo.cpu_names)"
  192. ]
  193. },
  194. {
  195. "cell_type": "markdown",
  196. "metadata": {},
  197. "source": [
  198. "# Mount"
  199. ]
  200. },
  201. {
  202. "cell_type": "code",
  203. "execution_count": 6,
  204. "metadata": {},
  205. "outputs": [],
  206. "source": [
  207. "target.execute('mount -t cgroup none /sys/fs/cgroup');"
  208. ]
  209. },
  210. {
  211. "cell_type": "markdown",
  212. "metadata": {},
  213. "source": [
  214. "# Create and modify a single domain root"
  215. ]
  216. },
  217. {
  218. "cell_type": "code",
  219. "execution_count": 7,
  220. "metadata": {},
  221. "outputs": [
  222. {
  223. "data": {
  224. "text/plain": [
  225. "['def_root_domain: ', 'doms_cur[0]: 0-3 rd->span: 0-3 (n)', '']"
  226. ]
  227. },
  228. "execution_count": 7,
  229. "metadata": {},
  230. "output_type": "execute_result"
  231. }
  232. ],
  233. "source": [
  234. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  235. ]
  236. },
  237. {
  238. "cell_type": "code",
  239. "execution_count": 8,
  240. "metadata": {},
  241. "outputs": [],
  242. "source": [
  243. "target.execute('mkdir /sys/fs/cgroup/group1');"
  244. ]
  245. },
  246. {
  247. "cell_type": "code",
  248. "execution_count": 9,
  249. "metadata": {},
  250. "outputs": [],
  251. "source": [
  252. "target.execute('echo 0-1 > /sys/fs/cgroup/group1/cpuset.cpus');"
  253. ]
  254. },
  255. {
  256. "cell_type": "code",
  257. "execution_count": 10,
  258. "metadata": {},
  259. "outputs": [],
  260. "source": [
  261. "target.execute('echo 0 > /sys/fs/cgroup/group1/cpuset.mems');"
  262. ]
  263. },
  264. {
  265. "cell_type": "code",
  266. "execution_count": 26,
  267. "metadata": {},
  268. "outputs": [],
  269. "source": [
  270. "target.execute('echo 0 > /sys/fs/cgroup/cpuset.sched_load_balance');"
  271. ]
  272. },
  273. {
  274. "cell_type": "code",
  275. "execution_count": 27,
  276. "metadata": {},
  277. "outputs": [
  278. {
  279. "data": {
  280. "text/plain": [
  281. "['def_root_domain: 2-3', 'doms_cur[0]: 0-1 rd->span: 0-1 (n)', '']"
  282. ]
  283. },
  284. "execution_count": 27,
  285. "metadata": {},
  286. "output_type": "execute_result"
  287. }
  288. ],
  289. "source": [
  290. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  291. ]
  292. },
  293. {
  294. "cell_type": "markdown",
  295. "metadata": {},
  296. "source": [
  297. "### There are now 2 root domains (2-3 is the (default) root and 0-1 is group1)\n",
  298. "### Note that CPUs 2-3 are now part of def_root_domain, as load balance is disabled for root"
  299. ]
  300. },
  301. {
  302. "cell_type": "code",
  303. "execution_count": 28,
  304. "metadata": {},
  305. "outputs": [],
  306. "source": [
  307. "target.execute('echo 0 > /sys/fs/cgroup/group1/cpuset.cpus');"
  308. ]
  309. },
  310. {
  311. "cell_type": "code",
  312. "execution_count": 31,
  313. "metadata": {},
  314. "outputs": [
  315. {
  316. "data": {
  317. "text/plain": [
  318. "['def_root_domain: 1-3', 'doms_cur[0]: 0 rd->span: 0 (n)', '']"
  319. ]
  320. },
  321. "execution_count": 31,
  322. "metadata": {},
  323. "output_type": "execute_result"
  324. }
  325. ],
  326. "source": [
  327. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  328. ]
  329. },
  330. {
  331. "cell_type": "code",
  332. "execution_count": 32,
  333. "metadata": {},
  334. "outputs": [],
  335. "source": [
  336. "target.execute('echo '' > /sys/fs/cgroup/group1/cpuset.cpus');"
  337. ]
  338. },
  339. {
  340. "cell_type": "code",
  341. "execution_count": 34,
  342. "metadata": {},
  343. "outputs": [
  344. {
  345. "data": {
  346. "text/plain": [
  347. "['', '']"
  348. ]
  349. },
  350. "execution_count": 34,
  351. "metadata": {},
  352. "output_type": "execute_result"
  353. }
  354. ],
  355. "source": [
  356. "target.execute('cat /sys/fs/cgroup/group1/cpuset.cpus').split('\\r\\n')"
  357. ]
  358. },
  359. {
  360. "cell_type": "markdown",
  361. "metadata": {},
  362. "source": [
  363. "### Weird, I could successfully remove the last CPU from group1 cpus (domains stay the same though)"
  364. ]
  365. },
  366. {
  367. "cell_type": "code",
  368. "execution_count": 35,
  369. "metadata": {},
  370. "outputs": [],
  371. "source": [
  372. "target.execute('echo 0-3 > /sys/fs/cgroup/group1/cpuset.cpus');"
  373. ]
  374. },
  375. {
  376. "cell_type": "code",
  377. "execution_count": 36,
  378. "metadata": {},
  379. "outputs": [
  380. {
  381. "data": {
  382. "text/plain": [
  383. "['def_root_domain: ', 'doms_cur[0]: 0-3 rd->span: 0-3 (n)', '']"
  384. ]
  385. },
  386. "execution_count": 36,
  387. "metadata": {},
  388. "output_type": "execute_result"
  389. }
  390. ],
  391. "source": [
  392. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  393. ]
  394. },
  395. {
  396. "cell_type": "markdown",
  397. "metadata": {},
  398. "source": [
  399. "### With cgroup v1 root domain can become empty"
  400. ]
  401. },
  402. {
  403. "cell_type": "code",
  404. "execution_count": 37,
  405. "metadata": {},
  406. "outputs": [],
  407. "source": [
  408. "target.execute('rmdir /sys/fs/cgroup/group1');"
  409. ]
  410. },
  411. {
  412. "cell_type": "code",
  413. "execution_count": 38,
  414. "metadata": {},
  415. "outputs": [
  416. {
  417. "data": {
  418. "text/plain": [
  419. "['def_root_domain: 0-3', '']"
  420. ]
  421. },
  422. "execution_count": 38,
  423. "metadata": {},
  424. "output_type": "execute_result"
  425. }
  426. ],
  427. "source": [
  428. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  429. ]
  430. },
  431. {
  432. "cell_type": "code",
  433. "execution_count": 39,
  434. "metadata": {},
  435. "outputs": [],
  436. "source": [
  437. "target.execute('echo 1 > /sys/fs/cgroup/cpuset.sched_load_balance');"
  438. ]
  439. },
  440. {
  441. "cell_type": "code",
  442. "execution_count": 40,
  443. "metadata": {},
  444. "outputs": [
  445. {
  446. "data": {
  447. "text/plain": [
  448. "['def_root_domain: ', 'doms_cur[0]: 0-3 rd->span: 0-3 (n)', '']"
  449. ]
  450. },
  451. "execution_count": 40,
  452. "metadata": {},
  453. "output_type": "execute_result"
  454. }
  455. ],
  456. "source": [
  457. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  458. ]
  459. },
  460. {
  461. "cell_type": "markdown",
  462. "metadata": {},
  463. "source": [
  464. "# Create and modify two domain roots"
  465. ]
  466. },
  467. {
  468. "cell_type": "code",
  469. "execution_count": 41,
  470. "metadata": {},
  471. "outputs": [],
  472. "source": [
  473. "target.execute('mkdir /sys/fs/cgroup/group1');\n",
  474. "target.execute('mkdir /sys/fs/cgroup/group2');"
  475. ]
  476. },
  477. {
  478. "cell_type": "code",
  479. "execution_count": 42,
  480. "metadata": {},
  481. "outputs": [],
  482. "source": [
  483. "target.execute('echo 0-1 > /sys/fs/cgroup/group1/cpuset.cpus');\n",
  484. "target.execute('echo 2-3 > /sys/fs/cgroup/group2/cpuset.cpus');"
  485. ]
  486. },
  487. {
  488. "cell_type": "code",
  489. "execution_count": 43,
  490. "metadata": {},
  491. "outputs": [],
  492. "source": [
  493. "target.execute('echo 0 > /sys/fs/cgroup/cpuset.sched_load_balance');"
  494. ]
  495. },
  496. {
  497. "cell_type": "code",
  498. "execution_count": 44,
  499. "metadata": {},
  500. "outputs": [
  501. {
  502. "data": {
  503. "text/plain": [
  504. "['def_root_domain: ',\n",
  505. " 'doms_cur[0]: 0-1 rd->span: 0-1 (n)',\n",
  506. " 'doms_cur[1]: 2-3 rd->span: 2-3 (n)',\n",
  507. " '']"
  508. ]
  509. },
  510. "execution_count": 44,
  511. "metadata": {},
  512. "output_type": "execute_result"
  513. }
  514. ],
  515. "source": [
  516. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  517. ]
  518. },
  519. {
  520. "cell_type": "code",
  521. "execution_count": 45,
  522. "metadata": {},
  523. "outputs": [],
  524. "source": [
  525. "target.execute('echo 0 > /sys/fs/cgroup/group1/cpuset.cpus');\n",
  526. "target.execute('echo 1-2 > /sys/fs/cgroup/group2/cpuset.cpus');"
  527. ]
  528. },
  529. {
  530. "cell_type": "code",
  531. "execution_count": 46,
  532. "metadata": {},
  533. "outputs": [
  534. {
  535. "data": {
  536. "text/plain": [
  537. "['def_root_domain: 3',\n",
  538. " 'doms_cur[0]: 0 rd->span: 0 (n)',\n",
  539. " 'doms_cur[1]: 1-2 rd->span: 1-2 (n)',\n",
  540. " '']"
  541. ]
  542. },
  543. "execution_count": 46,
  544. "metadata": {},
  545. "output_type": "execute_result"
  546. }
  547. ],
  548. "source": [
  549. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  550. ]
  551. },
  552. {
  553. "cell_type": "markdown",
  554. "metadata": {},
  555. "source": [
  556. "# Hotplug"
  557. ]
  558. },
  559. {
  560. "cell_type": "code",
  561. "execution_count": 47,
  562. "metadata": {},
  563. "outputs": [],
  564. "source": [
  565. "target.hotplug.offline(2)"
  566. ]
  567. },
  568. {
  569. "cell_type": "code",
  570. "execution_count": 48,
  571. "metadata": {},
  572. "outputs": [
  573. {
  574. "data": {
  575. "text/plain": [
  576. "['def_root_domain: 3',\n",
  577. " 'doms_cur[0]: 0 rd->span: 0 (n)',\n",
  578. " 'doms_cur[1]: 1 rd->span: 1 (n)',\n",
  579. " '']"
  580. ]
  581. },
  582. "execution_count": 48,
  583. "metadata": {},
  584. "output_type": "execute_result"
  585. }
  586. ],
  587. "source": [
  588. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  589. ]
  590. },
  591. {
  592. "cell_type": "code",
  593. "execution_count": 49,
  594. "metadata": {},
  595. "outputs": [],
  596. "source": [
  597. "target.hotplug.online(2)"
  598. ]
  599. },
  600. {
  601. "cell_type": "code",
  602. "execution_count": 50,
  603. "metadata": {},
  604. "outputs": [
  605. {
  606. "data": {
  607. "text/plain": [
  608. "['def_root_domain: 2-3',\n",
  609. " 'doms_cur[0]: 0 rd->span: 0 (n)',\n",
  610. " 'doms_cur[1]: 1 rd->span: 1 (n)',\n",
  611. " '']"
  612. ]
  613. },
  614. "execution_count": 50,
  615. "metadata": {},
  616. "output_type": "execute_result"
  617. }
  618. ],
  619. "source": [
  620. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  621. ]
  622. },
  623. {
  624. "cell_type": "markdown",
  625. "metadata": {},
  626. "source": [
  627. "### CPU2 membership is lost after an hotplug event"
  628. ]
  629. },
  630. {
  631. "cell_type": "code",
  632. "execution_count": 51,
  633. "metadata": {},
  634. "outputs": [],
  635. "source": [
  636. "target.hotplug.offline(2)"
  637. ]
  638. },
  639. {
  640. "cell_type": "code",
  641. "execution_count": 52,
  642. "metadata": {},
  643. "outputs": [],
  644. "source": [
  645. "target.execute('rmdir /sys/fs/cgroup/group2');"
  646. ]
  647. },
  648. {
  649. "cell_type": "code",
  650. "execution_count": 53,
  651. "metadata": {},
  652. "outputs": [],
  653. "source": [
  654. "target.hotplug.online(2)"
  655. ]
  656. },
  657. {
  658. "cell_type": "code",
  659. "execution_count": 54,
  660. "metadata": {},
  661. "outputs": [
  662. {
  663. "data": {
  664. "text/plain": [
  665. "['def_root_domain: 1-3', 'doms_cur[0]: 0 rd->span: 0 (n)', '']"
  666. ]
  667. },
  668. "execution_count": 54,
  669. "metadata": {},
  670. "output_type": "execute_result"
  671. }
  672. ],
  673. "source": [
  674. "target.execute('cat /proc/doms_debug').split('\\r\\n')"
  675. ]
  676. }
  677. ],
  678. "metadata": {
  679. "kernelspec": {
  680. "display_name": "Python 2",
  681. "language": "python",
  682. "name": "python2"
  683. },
  684. "language_info": {
  685. "codemirror_mode": {
  686. "name": "ipython",
  687. "version": 2
  688. },
  689. "file_extension": ".py",
  690. "mimetype": "text/x-python",
  691. "name": "python",
  692. "nbconvert_exporter": "python",
  693. "pygments_lexer": "ipython2",
  694. "version": "2.7.14"
  695. }
  696. },
  697. "nbformat": 4,
  698. "nbformat_minor": 1
  699. }
Add Comment
Please, Sign In to add comment