diff --git a/.gitignore b/.gitignore index 52b9c1f..7227cca 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/tuna-0.11.1.tar.bz2 +SOURCES/tuna-0.13.tar.xz diff --git a/.tuna.metadata b/.tuna.metadata index 752f807..fa26b78 100644 --- a/.tuna.metadata +++ b/.tuna.metadata @@ -1 +1 @@ -8a4da0364fd1bb3a2b710747a4154a0ea12c4891 SOURCES/tuna-0.11.1.tar.bz2 +b8a6048d3e3dfaca2d23a3075b843fb8a183aca2 SOURCES/tuna-0.13.tar.xz diff --git a/SOURCES/Add-a-tuna.desktop-file.patch b/SOURCES/Add-a-tuna.desktop-file.patch deleted file mode 100644 index 42024b7..0000000 --- a/SOURCES/Add-a-tuna.desktop-file.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 14024e0845ffdfec688f8d0cde0ee2876c1a81cd Mon Sep 17 00:00:00 2001 -From: Guy Streeter -Date: Wed, 5 Feb 2014 15:40:36 -0600 -Subject: [PATCH 07/16] Add a tuna.desktop file - -change the desktop icon - -Signed-off-by: Guy Streeter -Tested-by: Jiri Kastner -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - rpm/SPECS/tuna.spec | 2 ++ - tuna.desktop | 9 +++++++++ - 1 file changed, 9 insertions(+) - create mode 100644 tuna.desktop - -diff --git a/tuna.desktop b/tuna.desktop -new file mode 100644 -index 000000000000..603011f79467 ---- /dev/null -+++ b/tuna.desktop -@@ -0,0 +1,9 @@ -+[Desktop Entry] -+Name=tuna -+GenericName=Application Tuner -+Exec=tuna --gui -+Type=Application -+Terminal=false -+Comment=Thread and IRQ attribute management -+Icon=gtk-preferences -+Categories=System;Settings; --- -1.8.3.1 - diff --git a/SOURCES/CLI-Do-not-show-column-headers-when-not-outputting-t.patch b/SOURCES/CLI-Do-not-show-column-headers-when-not-outputting-t.patch deleted file mode 100644 index 25fb04f..0000000 --- a/SOURCES/CLI-Do-not-show-column-headers-when-not-outputting-t.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 47ea4e06b7f042fa7d8512fa8e95d513bf82c741 Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Tue, 9 Jun 2015 16:27:30 -0300 -Subject: [PATCH 13/15] CLI: Do not show column headers when not outputting to - a tty: - -[root@felicio ~]# tuna -q en* -Q - # users affinity - 54 enp1s0f0-TxRx-0 0,1,2 ixgbe - 55 enp1s0f0-TxRx-1 0,1,2 ixgbe - 56 enp1s0f0-TxRx-2 0,1,2 ixgbe - 57 enp1s0f0-TxRx-3 0,1,2 ixgbe - 58 enp1s0f0 0,1,2 ixgbe - 59 enp1s0f1-TxRx-0 0,1,2 ixgbe - 60 enp1s0f1-TxRx-1 0,1,2 ixgbe - 61 enp1s0f1-TxRx-2 0,1,2 ixgbe - 62 enp1s0f1-TxRx-3 0,1,2 ixgbe - 63 enp1s0f1 0,1,2 ixgbe - 66 enp7s0 0,1,2 atl1c -[root@felicio ~]# tuna -q en* -Q | head -4 - 54 enp1s0f0-TxRx-0 0,1,2 ixgbe - 55 enp1s0f0-TxRx-1 0,1,2 ixgbe - 56 enp1s0f0-TxRx-2 0,1,2 ixgbe - 57 enp1s0f0-TxRx-3 0,1,2 ixgbe -[root@felicio ~]# - -[root@felicio ~]# tuna -t xfs-d* -P - thread ctxt_switches - pid SCHED_ rtpri affinity voluntary nonvoluntary cmd - 459 OTHER 0 0,1,2,3 2 1 xfs-data/dm-1 - 654 OTHER 0 0,1,2,3 2 0 xfs-data/sda1 - 669 OTHER 0 0,1,2,3 2 0 xfs-data/dm-2 -[root@felicio ~]# tuna -t xfs-d* -P | head - 459 OTHER 0 0,1,2,3 2 1 xfs-data/dm-1 - 654 OTHER 0 0,1,2,3 2 0 xfs-data/sda1 - 669 OTHER 0 0,1,2,3 2 0 xfs-data/dm-2 -[root@felicio ~]# - -Useful, for instance, when using wc to count how many IRQs or threadas match -some filters. - -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: John Kacur ---- - tuna-cmd.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/tuna-cmd.py b/tuna-cmd.py -index 9edf7de6c286..ba40ec8246ba 100755 ---- a/tuna-cmd.py -+++ b/tuna-cmd.py -@@ -305,7 +305,8 @@ def do_ps(thread_list, cpu_list, irq_list, show_uthreads, - - has_ctxt_switch_info = ps[1]["status"].has_key("voluntary_ctxt_switches") - try: -- ps_show_header(has_ctxt_switch_info, cgroups) -+ if sys.stdout.isatty(): -+ ps_show_header(has_ctxt_switch_info, cgroups) - ps_show(ps, affect_children, thread_list, - cpu_list, irq_list, show_uthreads, show_kthreads, - has_ctxt_switch_info, sock_inodes, sock_inode_re, cgroups) -@@ -334,7 +335,8 @@ def show_irqs(irq_list, cpu_list): - if not irqs: - irqs = procfs.interrupts() - -- print "%4s %-16s %8s" % ("#", _("users"), _("affinity"),) -+ if sys.stdout.isatty(): -+ print "%4s %-16s %8s" % ("#", _("users"), _("affinity"),) - sorted_irqs = [] - for k in irqs.keys(): - try: --- -1.8.3.1 - diff --git a/SOURCES/CLI-Introduce-nohz_full-N-entity.patch b/SOURCES/CLI-Introduce-nohz_full-N-entity.patch deleted file mode 100644 index 17f181f..0000000 --- a/SOURCES/CLI-Introduce-nohz_full-N-entity.patch +++ /dev/null @@ -1,69 +0,0 @@ -From ab9221d8a494194886cdf2ebabeeb8c74d888f2e Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Tue, 21 Oct 2014 22:47:42 -0300 -Subject: [PATCH 08/15] CLI: Introduce --nohz_full/-N entity - -This will set as the cpu list what was configured on the nohz_full= -kernel command line argument, allowing isolating these CPUs and then -moving to it some important app, i.e. all the other operations one -can do in tuna can apply to that cpu list. - -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: John Kacur ---- - tuna-cmd.py | 11 +++++++++-- - tuna/tuna.py | 4 ++++ - 2 files changed, 13 insertions(+), 2 deletions(-) - -diff --git a/tuna-cmd.py b/tuna-cmd.py -index 5dcc18167d17..9edf7de6c286 100755 ---- a/tuna-cmd.py -+++ b/tuna-cmd.py -@@ -58,6 +58,7 @@ def usage(): - print fmt % ('-K, --no_kthreads', _('Operations will not affect kernel threads')) - print fmt % ('-m, --move', _('Move selected entities to %(cpulist)s') % \ - {"cpulist": _('CPU-LIST')}) -+ print fmt % ('-N, --nohz_full', _('CPUs in nohz_full= kernel command line will be affected by operations')) - if have_inet_diag: - print fmt % ('-n, --show_sockets', _('Show network sockets in use by threads')) - print fmt % ('-p, --priority=[' + -@@ -449,9 +450,9 @@ def main(): - - i18n_init() - try: -- short = "a:c:CfgGhiIKlmp:PQq:s:S:t:UvWx" -+ short = "a:c:CfgGhiIKlmNp:PQq:s:S:t:UvWx" - long = ["cpus=", "affect_children", "filter", "gui", "help", -- "isolate", "include", "no_kthreads", "move", -+ "isolate", "include", "no_kthreads", "move", "nohz_full", - "show_sockets", "priority=", "show_threads", - "show_irqs", "irqs=", - "save=", "sockets=", "threads=", "no_uthreads", -@@ -490,6 +491,12 @@ def main(): - (op, a) = pick_op(a) - op_list = tuna.cpustring_to_list(a) - cpu_list = do_list_op(op, cpu_list, op_list) -+ elif o in ("-N", "--nohz_full"): -+ try: -+ cpu_list = tuna.nohz_full_list() -+ except: -+ print "tuna: --nohz_full " + _(" needs nohz_full=cpulist on the kernel command line") -+ sys.exit(2) - elif o in ("-C", "--affect_children"): - affect_children = True - elif o in ("-G", "--cgroup"): -diff --git a/tuna/tuna.py b/tuna/tuna.py -index 49c9eabdf499..7b839f1e2d96 100755 ---- a/tuna/tuna.py -+++ b/tuna/tuna.py -@@ -622,3 +622,7 @@ def generate_rtgroups(filename, kthreads, nr_cpus): - schedutils.schedstr(kt.policy)[6].lower(), - kt.rtprio, mask, regex)) - f.close() -+ -+ -+def nohz_full_list(): -+ return [ int(cpu) for cpu in procfs.cmdline().options["nohz_full"].split(",") ] --- -1.8.3.1 - diff --git a/SOURCES/CLI-fix-ps_show_thread-call-with-bad-args-count.patch b/SOURCES/CLI-fix-ps_show_thread-call-with-bad-args-count.patch deleted file mode 100644 index bf52e4f..0000000 --- a/SOURCES/CLI-fix-ps_show_thread-call-with-bad-args-count.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 3a54bb485a3a73023314e21b417fbaeb13aa4bd5 Mon Sep 17 00:00:00 2001 -From: Petr Oros -Date: Thu, 15 Aug 2013 11:15:45 +0200 -Subject: [PATCH 02/15] CLI: fix ps_show_thread call with bad args count - -Tested-By: Jiri Kastner -Signed-off-by: Petr Oros -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - tuna-cmd.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tuna-cmd.py b/tuna-cmd.py -index 64e3ad109d54..5dcc18167d17 100755 ---- a/tuna-cmd.py -+++ b/tuna-cmd.py -@@ -227,7 +227,7 @@ def ps_show_thread(pid, affect_children, ps, - for tid in ps[pid]["threads"].keys(): - ps_show_thread(tid, False, ps[pid]["threads"], - has_ctxt_switch_info, -- sock_inodes, sock_inode_re) -+ sock_inodes, sock_inode_re, cgroups) - - - def ps_show(ps, affect_children, thread_list, cpu_list, --- -1.8.3.1 - diff --git a/SOURCES/CLI-fix-traceback-due-unavailable-display.patch b/SOURCES/CLI-fix-traceback-due-unavailable-display.patch deleted file mode 100644 index 5407318..0000000 --- a/SOURCES/CLI-fix-traceback-due-unavailable-display.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 2db07dded58386fed39a094d60966d741430ab3d Mon Sep 17 00:00:00 2001 -From: Petr Oros -Date: Wed, 4 Dec 2013 07:29:35 +0000 -Subject: [PATCH 04/15] CLI: fix traceback due unavailable display - -Tuna showing traceback when user haven't set DISPLAY variable and using CLI with param -l. -This is caused by gtk library which try create "window", but in CLI mode is not neccesary. -Patch remove unnecesary library which cause this problem - -Tested-by: Jiri Kastner -Signed-off-by: Petr Oros -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - tuna/config.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tuna/config.py b/tuna/config.py -index e4464478fc2e..77cc4d800c03 100644 ---- a/tuna/config.py -+++ b/tuna/config.py -@@ -1,5 +1,5 @@ - import io, os, re, fnmatch --import sys, gtk, pygtk -+import sys, pygtk - import codecs, ConfigParser - from time import localtime, strftime - from subprocess import Popen, PIPE, STDOUT, call --- -1.8.3.1 - diff --git a/SOURCES/CLI-fix-traceback-when-p-is-used-with-unsupported-va.patch b/SOURCES/CLI-fix-traceback-when-p-is-used-with-unsupported-va.patch deleted file mode 100644 index 809843e..0000000 --- a/SOURCES/CLI-fix-traceback-when-p-is-used-with-unsupported-va.patch +++ /dev/null @@ -1,45 +0,0 @@ -From c10e375b7832d2179ef9e43f3f4fadf468ffe503 Mon Sep 17 00:00:00 2001 -From: Petr Oros -Date: Tue, 4 Feb 2014 07:09:28 +0100 -Subject: [PATCH 06/15] CLI: fix traceback when -p is used with unsupported - value - -CLI: fix traceback when -p is used with unsupported value -$ tuna -t 4364 -p fif -Traceback (most recent call last): - File "/usr/bin/tuna", line 647, in - main() - File "/usr/bin/tuna", line 531, in main - tuna.threads_set_priority(thread_list, a, affect_children) - File "/usr/lib/python2.7/site-packages/tuna/tuna.py", line 502, in threads_set_priority - rtprio = int(parms[0]) -ValueError: invalid literal for int() with base 10: 'fif' - -Signed-off-by: Petr Oros -Tested-by: Jiri Kastner -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - tuna/tuna.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/tuna/tuna.py b/tuna/tuna.py -index 0feb521fc5eb..49c9eabdf499 100755 ---- a/tuna/tuna.py -+++ b/tuna/tuna.py -@@ -498,8 +498,11 @@ def threads_set_priority(tids, parm, affect_children = False): - rtprio = int(parms[1]) - elif parms[0].upper() in ["FIFO", "RR"]: - rtprio = 1 -- else: -+ elif parms[0].isdigit(): - rtprio = int(parms[0]) -+ else: -+ print "tuna: " + _("\"%s\" is unsupported priority value!") % parms[0] -+ return - - for tid in tids: - try: --- -1.8.3.1 - diff --git a/SOURCES/CLI-fix-traceback-where-enter-p-policy-without-prio.patch b/SOURCES/CLI-fix-traceback-where-enter-p-policy-without-prio.patch deleted file mode 100644 index 0a5e100..0000000 --- a/SOURCES/CLI-fix-traceback-where-enter-p-policy-without-prio.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 4a71b9fe168279bb66e8497e3c32021fc8a8c419 Mon Sep 17 00:00:00 2001 -From: Petr Oros -Date: Wed, 4 Dec 2013 08:27:15 +0000 -Subject: [PATCH 03/15] CLI: fix traceback where enter -p policy without prio - -Tuna throwing value error when not specified priority. -Example: tuna -t PID_OF_SOME_PROCESS -p OTHER -Here "other" not priority, but scheduler policy. -For RR and FIFO default 1. For OTHER and BATCH default 0. -After patch apply, tuna use first part of string as policy and remaining part as priority. -All unacceptable values cause exception in schedutils library and tuna show error - -Tested-by: Jiri Kastner -Signed-off-by: Petr Oros -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - tuna/tuna.py | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/tuna/tuna.py b/tuna/tuna.py -index 6dfe7408ae8a..0feb521fc5eb 100755 ---- a/tuna/tuna.py -+++ b/tuna/tuna.py -@@ -490,10 +490,14 @@ def thread_set_priority(tid, policy, rtprio): - - def threads_set_priority(tids, parm, affect_children = False): - parms = parm.split(":") -+ rtprio = 0 - policy = None -- if len(parms) != 1: -+ if parms[0].upper() in ["OTHER", "BATCH", "IDLE", "FIFO", "RR"]: - policy = schedutils.schedfromstr("SCHED_%s" % parms[0].upper()) -- rtprio = int(parms[1]) -+ if len(parms) > 1: -+ rtprio = int(parms[1]) -+ elif parms[0].upper() in ["FIFO", "RR"]: -+ rtprio = 1 - else: - rtprio = int(parms[0]) - --- -1.8.3.1 - diff --git a/SOURCES/CLI-start-a-process-from-tuna.patch b/SOURCES/CLI-start-a-process-from-tuna.patch new file mode 100644 index 0000000..8b5c27a --- /dev/null +++ b/SOURCES/CLI-start-a-process-from-tuna.patch @@ -0,0 +1,313 @@ +From d7a7671477710eca0673a54475b47a58dbf44842 Mon Sep 17 00:00:00 2001 +From: Daniel Bristot de Oliveira +Date: Thu, 25 Jun 2015 16:50:18 -0300 +Subject: [PATCH 1/2] CLI: start a process from tuna +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Currently it is possible to set the CPU affinity and sched tunables for +threads running on a system. However, tuna does not permit to start a +new application with these parameters set. + +This patch adds the ability to start a new process with its affinity +and sched tunable set before it starts to run. + +To do so, one parameter was added to tuna's command line. This +parameter is the Action -r, --run=: + + -r, --run="COMMAND" + Run the COMMAND. If arguments are passed, the entire com‐ + mand line must be provided inside "quotes". Modifiers -c + and -p can be used to set the affinity and scheduler tun‐ + ables of the given COMMAND. The arg[0] (i.e. the command) + will be set in THREAD-LIST. Likewise the -t, the COMMAND + accepts the prefix + and - as wildcards in order to be + appended or removed from THREAD-LIST, respectively. + +The option -r will fork a new process, set the sched tunables and +affinity, and execute the new application's binary. + +Tuna will wait for the new process to return, and then continue +its execution. That means that it is possible to execute many Actions +after the creation of a new process, including the start of many process +in a single command line. + +Example of use: + +[root@kiron tuna]# tuna -p fifo:1 -t bash -c 1,2 -r +httpd -P + thread ctxt_switches + pid SCHED_ rtpri affinity voluntary nonvoluntary cmd + 10550 OTHER 0 0,1,2,3 300 81 bash + 12898 OTHER 0 0,1,2,3 30 6 bash + 12930 OTHER 0 0,1,2,3 246 27 bash + 13022 FIFO 1 1,2 1 0 httpd + +In this example, the schedule policy:prio fifo:1 is saved for future +Actions, "bash" is set in Thread list, cpus 1,2 are set in the cpulist, +the command "httpd" is appended to the Thread list and is started. +Finally, the threads in Thread list are printed. + +Signed-off-by: Daniel Bristot de Oliveira +Signed-off-by: John Kacur +--- + tuna-cmd.py | 98 ++++++++++++++++++++++++++++++++++++++++++++---------------- + tuna/tuna.py | 59 ++++++++++++++++++++++++++++-------- + 2 files changed, 119 insertions(+), 38 deletions(-) + +diff --git a/tuna-cmd.py b/tuna-cmd.py +index 3c9bfaa50bb4..164fbfcfe5e0 100755 +--- a/tuna-cmd.py ++++ b/tuna-cmd.py +@@ -69,6 +69,8 @@ def usage(): + print fmt % ('-Q, --show_irqs', _('Show IRQ list')) + print fmt % ('-q, --irqs=' + _('IRQ-LIST'), _('%(irqlist)s affected by commands') % + {"irqlist": _('IRQ-LIST')}) ++ print fmt % ('-r, --run=' + _('COMMAND'), _('fork a new process and run the %(command)s') % \ ++ {"command": _('COMMAND')}) + print fmt % ('-s, --save=' + _('FILENAME'), _('Save kthreads sched tunables to %(filename)s') % \ + {"filename": _('FILENAME')}) + print fmt % ('-S, --sockets=' + +@@ -377,8 +379,8 @@ def thread_mapper(s): + return [ int(s), ] + except: + pass +- if not ps: +- ps = procfs.pidstats() ++ ++ ps = procfs.pidstats() + + try: + return ps.find_by_regex(re.compile(fnmatch.translate(s))) +@@ -454,13 +456,14 @@ def main(): + + i18n_init() + try: +- short = "a:c:CfgGhiIKlmNp:PQq:s:S:t:UvWx" ++ short = "a:c:CfgGhiIKlmNp:PQq:r:s:S:t:UvWx" + long = ["cpus=", "affect_children", "filter", "gui", "help", + "isolate", "include", "no_kthreads", "move", "nohz_full", + "show_sockets", "priority=", "show_threads", + "show_irqs", "irqs=", + "save=", "sockets=", "threads=", "no_uthreads", +- "version", "what_is", "spread","cgroup","config_file_apply=","config_file_list="] ++ "version", "what_is", "spread","cgroup","config_file_apply=","config_file_list=", ++ "run=" ] + if have_inet_diag: + short += "n" + long.append("show_sockets") +@@ -477,11 +480,14 @@ def main(): + cpu_list = None + irq_list = None + irq_list_str = None ++ rtprio = None ++ policy = None + thread_list = [] + thread_list_str = None + filter = False + affect_children = False + show_sockets = False ++ p_waiting_action = False + + for o, a in opts: + if o in ("-h", "--help"): +@@ -510,20 +516,25 @@ def main(): + elif o in ("-G", "--cgroup"): + cgroups = True + elif o in ("-t", "--threads"): +- (op, a) = pick_op(a) +- op_list = reduce(lambda i, j: i + j, +- map(thread_mapper, a.split(","))) +- op_list = list(set(op_list)) +- thread_list = do_list_op(op, thread_list, op_list) +- # Check if a process name was especified and no +- # threads was found, which would result in an empty +- # thread list, i.e. we would print all the threads +- # in the system when we should print nothing. +- if not op_list and type(a) == type(''): +- thread_list_str = do_list_op(op, thread_list_str, +- a.split(",")) +- if not op: +- irq_list = None ++ # The -t - will reset thread list ++ if a == '-': ++ thread_list = [] ++ thread_list_str = '' ++ else: ++ (op, a) = pick_op(a) ++ op_list = reduce(lambda i, j: i + j, ++ map(thread_mapper, a.split(","))) ++ op_list = list(set(op_list)) ++ thread_list = do_list_op(op, thread_list, op_list) ++ # Check if a process name was especified and no ++ # threads was found, which would result in an empty ++ # thread list, i.e. we would print all the threads ++ # in the system when we should print nothing. ++ if not op_list and type(a) == type(''): ++ thread_list_str = do_list_op(op, thread_list_str, ++ a.split(",")) ++ if not op: ++ irq_list = None + elif o in ("-f", "--filter"): + filter = True + elif o in ("-g", "--gui"): +@@ -539,14 +550,17 @@ def main(): + sys.exit(2) + tuna.include_cpus(cpu_list, get_nr_cpus()) + elif o in ("-p", "--priority"): ++ # Save policy and rtprio for future Actions (e.g. --run). ++ (policy, rtprio) = tuna.get_policy_and_rtprio(a) + if not thread_list: +- print ("tuna: %s " % o) + _("requires a thread list!") +- sys.exit(2) +- try: +- tuna.threads_set_priority(thread_list, a, affect_children) +- except (SystemError, OSError) as err: # (3, 'No such process') old python-schedutils incorrectly raised SystemError +- print "tuna: %s" % err +- sys.exit(2) ++ # For backward compatibility ++ p_waiting_action = True ++ else: ++ try: ++ tuna.threads_set_priority(thread_list, a, affect_children) ++ except (SystemError, OSError) as err: # (3, 'No such process') old python-schedutils incorrectly raised SystemError ++ print "tuna: %s" % err ++ sys.exit(2) + elif o in ("-P", "--show_threads"): + # If the user specified process names that weren't + # resolved to pids, don't show all threads. +@@ -637,6 +651,40 @@ def main(): + sys.exit(2) + for tid in thread_list: + thread_help(tid) ++ elif o in ("-r", "--run"): ++ # If -p is set, it will be consumed. So, no backward compatible ++ # error handling action must be taken. ++ p_waiting_action = False ++ ++ # pick_op() before run the command: to remove the prefix ++ # + or - from command line. ++ (op, a) = pick_op(a) ++ ++ # In order to include the new process, it must run ++ # the command first, and then get the list of pids, ++ tuna.run_command(a, policy, rtprio, cpu_list) ++ ++ op_list = reduce(lambda i, j: i + j, ++ map(thread_mapper, a.split(","))) ++ op_list = list(set(op_list)) ++ thread_list = do_list_op(op, thread_list, op_list) ++ ++ # Check if a process name was especified and no ++ # threads was found, which would result in an empty ++ # thread list, i.e. we would print all the threads ++ # in the system when we should print nothing. ++ if not op_list and type(a) == type(''): ++ thread_list_str = do_list_op(op, thread_list_str, ++ a.split(",")) ++ if not op: ++ irq_list = None ++ ++ # For backward compatibility: when -p used to be only an Action, it ++ # used to exit(2) if no action was taken (i.e. if no threads_list ++ # was set). ++ if p_waiting_action: ++ print ("tuna: -p ") + _("requires a thread list!") ++ sys.exit(2) + + if run_gui: + try: +diff --git a/tuna/tuna.py b/tuna/tuna.py +index 646b8dfa700f..9aab16a409d2 100755 +--- a/tuna/tuna.py ++++ b/tuna/tuna.py +@@ -1,7 +1,7 @@ + # -*- python -*- + # -*- coding: utf-8 -*- + +-import copy, ethtool, os, procfs, re, schedutils ++import copy, ethtool, os, procfs, re, schedutils, sys, shlex + import help, fnmatch + from procfs import utilist + +@@ -498,6 +498,22 @@ def get_irq_affinity_text(irqs, irq): + # needs root prio to read /proc/irq//smp_affinity + return "" + ++def get_policy_and_rtprio(parm): ++ parms = parm.split(":") ++ rtprio = 0 ++ policy = None ++ if parms[0].upper() in ["OTHER", "BATCH", "IDLE", "FIFO", "RR"]: ++ policy = schedutils.schedfromstr("SCHED_%s" % parms[0].upper()) ++ if len(parms) > 1: ++ rtprio = int(parms[1]) ++ elif parms[0].upper() in ["FIFO", "RR"]: ++ rtprio = 1 ++ elif parms[0].isdigit(): ++ rtprio = int(parms[0]) ++ else: ++ raise ValueError ++ return (policy, rtprio) ++ + def thread_filtered(tid, cpus_filtered, show_kthreads, show_uthreads): + if cpus_filtered: + try: +@@ -532,18 +548,9 @@ def thread_set_priority(tid, policy, rtprio): + schedutils.set_scheduler(tid, policy, rtprio) + + def threads_set_priority(tids, parm, affect_children = False): +- parms = parm.split(":") +- rtprio = 0 +- policy = None +- if parms[0].upper() in ["OTHER", "BATCH", "IDLE", "FIFO", "RR"]: +- policy = schedutils.schedfromstr("SCHED_%s" % parms[0].upper()) +- if len(parms) > 1: +- rtprio = int(parms[1]) +- elif parms[0].upper() in ["FIFO", "RR"]: +- rtprio = 1 +- elif parms[0].isdigit(): +- rtprio = int(parms[0]) +- else: ++ try: ++ (policy, rtprio) = get_policy_and_rtprio(parm) ++ except ValueError: + print "tuna: " + _("\"%s\" is unsupported priority value!") % parms[0] + return + +@@ -602,6 +609,32 @@ def get_kthread_sched_tunings(proc = None): + + return kthreads + ++def run_command(cmd, policy, rtprio, cpu_list): ++ newpid = os.fork() ++ if newpid == 0: ++ cmd_list = shlex.split(cmd) ++ pid = os.getpid() ++ if rtprio: ++ try: ++ thread_set_priority(pid, policy, rtprio) ++ except (SystemError, OSError) as err: ++ print "tuna: %s" % err ++ sys.exit(2) ++ if cpu_list: ++ try: ++ schedutils.set_affinity(pid, cpu_list) ++ except (SystemError, OSError) as err: ++ print "tuna: %s" % err ++ sys.exit(2) ++ ++ try: ++ os.execvp(cmd_list[0], cmd_list) ++ except (SystemError, OSError) as err: ++ print "tuna: %s" % err ++ sys.exit(2) ++ else: ++ os.waitpid(newpid, 0); ++ + def generate_rtgroups(filename, kthreads, nr_cpus): + f = file(filename, "w") + f.write('''# Generated by tuna +-- +2.4.11 + diff --git a/SOURCES/Correct-a-typo-in-the-net.ipv4.ipfrag_time-help-stri.patch b/SOURCES/Correct-a-typo-in-the-net.ipv4.ipfrag_time-help-stri.patch deleted file mode 100644 index ec4c729..0000000 --- a/SOURCES/Correct-a-typo-in-the-net.ipv4.ipfrag_time-help-stri.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e8999259d8935220e9343f95aab5a1d77b2db0f3 Mon Sep 17 00:00:00 2001 -From: Guy Streeter -Date: Thu, 28 Aug 2014 14:03:32 -0500 -Subject: [PATCH 15/15] Correct a typo in the net.ipv4.ipfrag_time help string - -What should be "\n" is just "\" - -Signed-off-by: Guy Streeter -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - tuna/help.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tuna/help.py b/tuna/help.py -index 44d4fe38cd70..fa47ae835962 100644 ---- a/tuna/help.py -+++ b/tuna/help.py -@@ -75,7 +75,7 @@ PROC_SYS_HELP = { - 'net.ipv4.ipfrag_low_thresh':N_('Minimum memory used to reassemble IP fragments. When ipfrag_high_thresh bytes of memory is allocated for this purpose, the fragment handler will toss packets until ipfrag_low_thresh is reached.'), - 'net.ipv4.ipfrag_max_dist':N_('Ipfrag_max_dist is a non-negative integer value which defines the maximum "disorder" which is allowed among fragments which share a common IP source address. Note that reordering of packets is not unusual, but if a large number of fragments arrive from a source IP address while a particular fragment queue remains incomplete, it probably indicates that one or more fragments belonging to that queue have been lost. When ipfrag_max_dist is positive, an additional check is done on fragments before they are added to a reassembly queue - if ipfrag_max_dist (or more) fragments have arrived from a particular IP address between additions to any IP fragment queue using that source address, it\'s presumed that one or more fragments in the queue are lost. The existing fragment queue will be dropped, and a new one started. An ipfrag_max_dist value of zero disables this check.\n\nUsing a very small value, e.g. 1 or 2, for ipfrag_max_dist can result in unnecessarily dropping fragment queues when normal reordering of packets occurs, which could lead to poor application performance. Using a very large value, e.g. 50000, increases the likelihood of incorrectly reassembling IP fragments that originate from different IP datagrams, which could result in data corruption.\nDefault: 64'), - 'net.ipv4.ipfrag_secret_interval':N_('Regeneration interval of the hash secret (or lifetime for the hash secret) for IP fragments.\nDefault: 600\nUnit: second'), -- 'net.ipv4.ipfrag_time':N_('Time to keep an IP fragment in memory.\Unit: second'), -+ 'net.ipv4.ipfrag_time':N_('Time to keep an IP fragment in memory.\nUnit: second'), - 'net.ipv4.ip_local_port_range':N_('Defines the local port range that is used by TCP and UDP to choose the local port. The first number is the first, the second the last local port number.\nDefault value depends on amount of memory available on the system:\n - > 128Mb 32768-61000\n - < 128Mb 1024-4999 or even less.\nThis number defines number of active connections, which this system can issue simultaneously to systems not supporting TCP extensions (timestamps). With tcp_tw_recycle enabled (i.e. by default) range 1024-4999 is enough to issue up to 2000 connections per second to systems supporting timestamps.'), - 'net.ipv4.ip_local_reserved_ports':N_('Specify the ports which are reserved for known third-party applications. These ports will not be used by automatic port assignments (e.g. when calling connect() or bind() with port number 0). Explicit port allocation behavior is unchanged.\nThe format used for both input and output is a comma separated list of ranges (e.g. "1,2-4,10-10" for ports 1, 2, 3, 4 and 10). Writing to the file will clear all previously reserved ports and update the current list with the one given in the input.\nDefault: Empty'), - 'net.ipv4.ip_nonlocal_bind':N_('If set, allows processes to bind() to non-local IP addresses, which can be quite useful - but may break some applications.\nDefault: 0'), --- -1.8.3.1 - diff --git a/SOURCES/Fix-behavior-for-dot-inside-proc-sys-path.patch b/SOURCES/Fix-behavior-for-dot-inside-proc-sys-path.patch deleted file mode 100644 index b83959b..0000000 --- a/SOURCES/Fix-behavior-for-dot-inside-proc-sys-path.patch +++ /dev/null @@ -1,121 +0,0 @@ -From dca3278e7875dd2df07f409abaedcb9cd1d77047 Mon Sep 17 00:00:00 2001 -From: Petr Oros -Date: Mon, 18 May 2015 12:30:50 +0200 -Subject: [PATCH 14/15] Fix behavior for dot inside /proc/sys/ path - - When /proc/sys/ path contain dot (for example netif name) and config - file using * for filename tuna fail with traceback: - - Invalid item! file: /proc/sys/net/ipv6/conf/tuna/1/forwarding - Traceback (most recent call last): - File "/usr/bin/tuna", line 647, in - main() - File "/usr/bin/tuna", line 641, in main - app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered) - File "/usr/lib/python2.7/site-packages/tuna/tuna_gui.py", line 64, in __init__ - self.profileview.init_default_file() - File "/usr/lib/python2.7/site-packages/tuna/gui/profileview.py", line 146, in init_default_file - self.commonview.updateCommonView() - File "/usr/lib/python2.7/site-packages/tuna/gui/commonview.py", line 13, in updateCommonView - self.setup() - File "/usr/lib/python2.7/site-packages/tuna/gui/commonview.py", line 80, in setup - frameContent[catCntr]['texts'][contentCntr].set_value(int(self.config.ctlParams[catCntr][val])) - ValueError: invalid literal for int() with base 10: '' - - This patch add support for escaping "." character. - -Signed-off-by: Petr Oros -Reported-by: Arnaldo Carvalho de Melo -Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1178917 -Signed-off-by: John Kacur ---- - tuna/config.py | 26 ++++++++++++++++---------- - 1 file changed, 16 insertions(+), 10 deletions(-) - -diff --git a/tuna/config.py b/tuna/config.py -index 7e19a28f967f..e82a4200c6ff 100644 ---- a/tuna/config.py -+++ b/tuna/config.py -@@ -30,6 +30,12 @@ class Config: - self.config[option] = value - self.cacheFileName = '' - -+ def FileNameToConfigPath(self, filename): -+ return filename.replace(".", "\\.").replace("/", ".") -+ -+ def ConfigPathToFileName(self, configpath): -+ return configpath.replace(".", "/").replace("\\/", ".") -+ - def updateDefault(self, filename): - if filename.replace("", "temp-direct-load.conf") != filename: - self.temp = ConfigParser.RawConfigParser() -@@ -154,9 +160,9 @@ class Config: - tempCfg = [] - for index in range(len(oldTempCfg)): - if self.isFnString(oldTempCfg[index][0]): -- expanded = self.getFilesByFN("/proc/sys", oldTempCfg[index][0].replace(".", "/")) -+ expanded = self.getFilesByFN("/proc/sys", self.ConfigPathToFileName(oldTempCfg[index][0])) - for index2 in range(len(expanded)): -- expandedData = (expanded[index2].replace("/", "."), oldTempCfg[index][1]) -+ expandedData = (self.FileNameToConfigPath(expanded[index2]), oldTempCfg[index][1]) - tempCfg.append(expandedData) - else: - tempCfg.append(oldTempCfg[index]) -@@ -241,9 +247,9 @@ class Config: - def getSystemValue(self, filename): - filename = self.aliasToOriginal(filename) - try: -- buffer = open("/proc/sys/" + filename.replace(".", "/"), 'r').read() -+ buffer = open("/proc/sys/" + self.ConfigPathToFileName(filename), 'r').read() - except IOError: -- print _("Invalid item! file: /proc/sys/%s" %(filename.replace(".", "/"))) -+ print _("Invalid item! file: /proc/sys/%s" %(self.ConfigPathToFileName(filename))) - return "" - return buffer.strip() - -@@ -253,10 +259,10 @@ class Config: - if value == "" or old == value: - return 0 - try: -- fp = open("/proc/sys/" + filename.replace(".", "/"), 'w') -+ fp = open("/proc/sys/" + self.ConfigPathToFileName(filename), 'w') - fp.write(value) - except IOError: -- print "%s%s %s %s" % (_("Cant write to file! path: /proc/sys/"), filename.replace(".","/"), _("value:"), value) -+ print "%s%s %s %s" % (_("Cant write to file! path: /proc/sys/"), self.ConfigPathToFileName(filename), _("value:"), value) - return -1 - return 0 - -@@ -302,9 +308,9 @@ class Config: - snapcont = [] - for index in range(len(snapcontPacked)): - if self.isFnString(snapcontPacked[index][0]): -- expanded = self.getFilesByFN("/proc/sys",snapcontPacked[index][0].replace(".","/")) -+ expanded = self.getFilesByFN("/proc/sys",self.ConfigPathToFileName(snapcontPacked[index][0])) - for index2 in range(len(expanded)): -- expandedData = (expanded[index2].replace("/","."),snapcontPacked[index][1]) -+ expandedData = (self.FileNameToConfigPath(expanded[index2]),snapcontPacked[index][1]) - snapcont.append(expandedData) - else: - snapcont.append(snapcontPacked[index]) -@@ -348,7 +354,7 @@ class Config: - return msgStack - current = self.checkParser.items(option) - for opt,val in current: -- if not os.path.exists("/proc/sys/" + opt.replace(".","/")) and len(self.getFilesByFN("/proc/sys/",opt.replace(".","/"))) == 0: -+ if not os.path.exists("/proc/sys/" + self.ConfigPathToFileName(opt)) and len(self.getFilesByFN("/proc/sys/", self.ConfigPathToFileName(opt))) == 0: - msgStack = "%s%s%s\n" % (msgStack, _("Warning: File not found: /proc/sys/"), opt) - self.empty = False - if self.empty: -@@ -367,7 +373,7 @@ class Config: - self.checkParser.set('categories', '#' + option, value) - current = self.checkParser.items(option) - for opt,val in current: -- if not os.path.exists("/proc/sys/" + opt.replace(".", "/")) and len(self.getFilesByFN("/proc/sys/", opt.replace(".", "/"))) == 0: -+ if not os.path.exists("/proc/sys/" + self.ConfigPathToFileName(opt)) and len(self.getFilesByFN("/proc/sys/", self.ConfigPathToFileName(opt))) == 0: - self.checkParser.remove_option(option, opt) - self.checkParser.set(option, '#' + opt, val) - except (ConfigParser.Error, IOError) as e: --- -1.8.3.1 - diff --git a/SOURCES/display-usage-instead-of-traceback-when-c-missing-args.patch b/SOURCES/display-usage-instead-of-traceback-when-c-missing-args.patch new file mode 100644 index 0000000..164da06 --- /dev/null +++ b/SOURCES/display-usage-instead-of-traceback-when-c-missing-args.patch @@ -0,0 +1,86 @@ +From e9a4bc14e15115e3493781fe8487fb4bd575ae9e Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 30 May 2016 20:31:37 +0200 +Subject: [PATCH] tuna: tuna-cmd: Display usage instead of traceback -c missing + args + +Display a usage messaage instead of a python traceback when a required +argument to the -c or --cpus is missing, or when the argument doesn't +make sense. (Such as passing a nonsense string, instead of a comma separated list of numbers) + +- In function pick_op, handle the unusual but possible case where an + empty string is passed as an argument. +- Display a usage message upon ValueError when caling cpustring_to_list + when processing the -c option + +This fixes various erroneous or missing input to -c, such as the +following + +./tuna-cmd.py -c -P +Traceback (most recent call last): + File "./tuna-cmd.py", line 656, in + main() + File "./tuna-cmd.py", line 494, in main + op_list = tuna.cpustring_to_list(a) + File "/home/jkacur/source/tuna/tuna/tuna.py", line 124, in +cpustring_to_list + ends = [ int(a, 0) for a in field.split("-") ] +ValueError: invalid literal for int() with base 0: 'P' + +./tuna-cmd.py -c "" -P +Traceback (most recent call last): + File "./tuna-cmd.py", line 656, in + main() + File "./tuna-cmd.py", line 493, in main + (op, a) = pick_op(a) + File "./tuna-cmd.py", line 408, in pick_op + if argument[0] in ('+', '-'): +IndexError: string index out of range + +./tuna-cmd.py -c "nonesense" -P +Traceback (most recent call last): + File "./tuna-cmd.py", line 656, in + main() + File "./tuna-cmd.py", line 494, in main + op_list = tuna.cpustring_to_list(a) + File "/home/jkacur/source/tuna/tuna/tuna.py", line 124, in +cpustring_to_list + ends = [ int(a, 0) for a in field.split("-") ] +ValueError: invalid literal for int() with base 0: 'nonesense' + +This fixes bugzilla 1268287 + +Signed-off-by: John Kacur +--- + tuna-cmd.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tuna-cmd.py b/tuna-cmd.py +index ae4f78ab7d56..3c9bfaa50bb4 100755 +--- a/tuna-cmd.py ++++ b/tuna-cmd.py +@@ -405,6 +405,8 @@ def irq_mapper(s): + return irq_list + + def pick_op(argument): ++ if argument == "": ++ return (None, argument) + if argument[0] in ('+', '-'): + return (argument[0], argument[1:]) + return (None, argument) +@@ -491,7 +493,11 @@ def main(): + list_config() + elif o in ("-c", "--cpus"): + (op, a) = pick_op(a) +- op_list = tuna.cpustring_to_list(a) ++ try: ++ op_list = tuna.cpustring_to_list(a) ++ except ValueError: ++ usage() ++ return + cpu_list = do_list_op(op, cpu_list, op_list) + elif o in ("-N", "--nohz_full"): + try: +-- +2.4.11 + diff --git a/SOURCES/docs-Remove-stray-a.patch b/SOURCES/docs-Remove-stray-a.patch deleted file mode 100644 index 33470a1..0000000 --- a/SOURCES/docs-Remove-stray-a.patch +++ /dev/null @@ -1,32 +0,0 @@ -From da8e1f93194ca8c8e781131c008e7e1a216514b6 Mon Sep 17 00:00:00 2001 -From: John Kacur -Date: Mon, 25 Nov 2013 15:54:27 +0100 -Subject: [PATCH 01/15] docs: Remove stray - -Remove a stray without a paired . This was probably left over from -an early edit. It doesn't cause any harm for html parsers that ignore it, -but can cause complaints by tools that look for problems in xml. - -Signed-off-by: John Kacur -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - docs/oscilloscope+tuna.html | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/docs/oscilloscope+tuna.html b/docs/oscilloscope+tuna.html -index 9bba9ae43898..de3b4d7f7ae6 100644 ---- a/docs/oscilloscope+tuna.html -+++ b/docs/oscilloscope+tuna.html -@@ -103,7 +103,7 @@ OSADL - The Open Source Automation Development Lab - -

By: Carsten Emde (Used by permission)

-

New versatile tools are helping us to manage real-time challenges under Linux (but you still can't tuna fish).

--

The "CyclictestoSCOPE" in action

-+

The "CyclictestoSCOPE" in action

-

Do you wish you had a built-in oscilloscope that continuously displays the latency of your system? Here is one - thanks to Arnaldo Carvalho de Melo who not only wrote the oscilloscope but also the graphical process inspection and modification tool tuna that is part of the same tool package. In addition, these tools are not only very versatile tools that help us to manage real-time challenges - they also are excellent examples of the power and the beauty of the Python script language and its libraries.

-

However, before we can install and run these tools, we must learn a little bit about cyclictest and its command line arguments, since this is where oscilloscope gets its data from.

-
Cyclictest
--- -1.8.3.1 - diff --git a/SOURCES/docs-upgrade-tuna.8-man-page-with-option-r.patch b/SOURCES/docs-upgrade-tuna.8-man-page-with-option-r.patch new file mode 100644 index 0000000..86616d7 --- /dev/null +++ b/SOURCES/docs-upgrade-tuna.8-man-page-with-option-r.patch @@ -0,0 +1,76 @@ +From 3a07bae7e8539955bc3a0f4bafe82a8ff0e25fa9 Mon Sep 17 00:00:00 2001 +From: Daniel Bristot de Oliveira +Date: Thu, 25 Jun 2015 16:51:59 -0300 +Subject: [PATCH 2/2] docs: upgrade tuna.8 man page with option -r +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Update tuna.8 man page with the descriptions of the new command line +options: + -r, --run="COMMAND" + Run the COMMAND. If arguments are passed, the entire com‐ + mand line must be provided inside "quotes". Modifiers -c + and -p can be used to set the affinity and scheduler tun‐ + ables of the given COMMAND. The arg[0] (i.e. the command) + will be set in THREAD-LIST. Likewise the -t, the COMMAND + accepts the prefix + and - as wildcards in order to be + appended or removed from THREAD-LIST, respectively. + +And the modifications of -p behavior: + -p, --priority=[POLICY:]RTPRIO + Set thread scheduler tunables: POLICY and RTPRIO. POLICY + is one of OTHER, FIFO, RR, or BATCH. If -t is not set, -p + will act as a Modifier, saving the sched tunables for + future Actions, for example -r. + +And -t behavior: + -t, --threads=THREAD-LIST + THREAD-LIST affected by commands. Requires a thread num‐ + ber or thread name, or a comma-separated list of thread + numbers and/or names. Thread names may contain wildcards. + Be sure to quote or escape any wildcard specifications. + If only - is passed as argument, the THREAD-LIST will be + cleared. + +Signed-off-by: Daniel Bristot de Oliveira +Signed-off-by: John Kacur +--- + docs/tuna.8 | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/docs/tuna.8 b/docs/tuna.8 +index a0a504cb13b9..81a42dd114a5 100644 +--- a/docs/tuna.8 ++++ b/docs/tuna.8 +@@ -35,7 +35,7 @@ Allow all threads to run on CPU\-LIST. Requires \fB\-c\fR or \fB-S\fR. + Move selected entities to CPU\-LIST. Requires \fB\-c\fR and either \fB-t\fR or \fB-q\fR. + .TP + \fB\-p\fR, \fB\-\-priority\fR=\fI[POLICY:]\fRRTPRIO +-Set thread scheduler tunables: POLICY and RTPRIO. POLICY is one of OTHER, FIFO, RR, or BATCH. Requires \fB\-t\fR. ++Set thread scheduler tunables: POLICY and RTPRIO. POLICY is one of OTHER, FIFO, RR, or BATCH. If \fB\-t\fR is not set, \fB\-p\fR will act as a Modifier saving the sched tunables for future Actions, for example \fB\-r\fR. + .TP + \fB\-P\fR, \fB\-\-show_threads\fR + Show thread list. +@@ -43,6 +43,9 @@ Show thread list. + \fB\-s\fR, \fB\-\-save\fR=\fIFILENAME\fR + Save kthreads sched tunables to FILENAME. + .TP ++\fB\-r\fR, \fB\-\-run\fR=\fI"COMMAND"\fR ++Run the COMMAND. If arguments are passed, the entire command line must be provided inside "quotes". Modifiers \fB-c\fR and \fB-p\fR can be used to set the affinity and scheduler tunables of the given COMMAND. The arg[0] (i.e. the command) will be set in THREAD\-LIST. Likewise the \fB-t\fR, the COMMAND accepts the prefix \fB+\fR and \fB-\fR as wildcards in order to be appended or removed from THREAD\-LIST, respectively. ++.TP + \fB\-v\fR, \fB\-\-version\fR + Show version + .TP +@@ -75,7 +78,7 @@ IRQ\-LIST affected by commands. Requires an IRQ number or a comma-separated list + CPU\-SOCKET\-LIST affected by commands. Requires a socket number or a comma-separated list of socket numbers. + .TP + \fB\-t\fR, \fB\-\-threads\fR=\fITHREAD\-LIST\fR +-THREAD\-LIST affected by commands. Requires a thread number or thread name, or a comma-separated list of thread numbers and/or names. Thread names may contain wildcards. Be sure to quote or escape any wildcard specifications. ++THREAD\-LIST affected by commands. Requires a thread number or thread name, or a comma-separated list of thread numbers and/or names. Thread names may contain wildcards. Be sure to quote or escape any wildcard specifications. If only \fB-\fR is passed as argument, the THREAD\-LIST will be cleared. + .TP + \fB\-U\fR, \fB\-\-no_uthreads\fR + Operations will not affect user threads. +-- +2.4.11 + diff --git a/SOURCES/spec-Mark-configuration-files-with-config.patch b/SOURCES/spec-Mark-configuration-files-with-config.patch deleted file mode 100644 index 60d703e..0000000 --- a/SOURCES/spec-Mark-configuration-files-with-config.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 8ead51bb37c1d95bdba7f224288255de95a05034 Mon Sep 17 00:00:00 2001 -From: John Kacur -Date: Mon, 19 Aug 2013 22:28:01 +0200 -Subject: [PATCH 1/4] spec: Mark configuration files with %config - -Explicitly declaring configuration files as such, prevents rpmlint -from falsely complaining that non-configuration files are being installed -in /etc - -Signed-off-by: John Kacur ---- - rpm/SPECS/tuna.spec | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/rpm/SPECS/tuna.spec b/rpm/SPECS/tuna.spec -index 9393df6..4dd26f8 100644 ---- a/rpm/SPECS/tuna.spec -+++ b/rpm/SPECS/tuna.spec -@@ -86,8 +86,8 @@ rm -rf %{buildroot} - %{_datadir}/tuna/ - %{python_sitelib}/tuna/ - %{_mandir}/man8/tuna.8* --%{_sysconfdir}/tuna.conf --%{_sysconfdir}/tuna/* -+%config(noreplace) %{_sysconfdir}/tuna.conf -+%config %{_sysconfdir}/tuna/example.conf - %{_datadir}/polkit-1/actions/org.tuna.policy - - %files -n oscilloscope --- -1.8.1.4 - diff --git a/SOURCES/spec-Show-where-the-original-source-comes-from-in-co.patch b/SOURCES/spec-Show-where-the-original-source-comes-from-in-co.patch deleted file mode 100644 index 8e69c66..0000000 --- a/SOURCES/spec-Show-where-the-original-source-comes-from-in-co.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e9b3dec6a7396f6da2b21ded1bb97b00b6505077 Mon Sep 17 00:00:00 2001 -From: John Kacur -Date: Thu, 22 Aug 2013 15:51:50 +0200 -Subject: [PATCH 4/4] spec: Show where the original source comes from in - comments Signed-off-by: John Kacur - ---- - rpm/SPECS/tuna.spec | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/rpm/SPECS/tuna.spec b/rpm/SPECS/tuna.spec -index 4dd26f8..09d571d 100644 ---- a/rpm/SPECS/tuna.spec -+++ b/rpm/SPECS/tuna.spec -@@ -9,6 +9,7 @@ Summary: Application tuning GUI & command line utility - Group: Applications/System - Source: http://userweb.kernel.org/~acme/tuna/%{name}-%{version}.tar.bz2 - URL: http://userweb.kernel.org/~acme/tuna/ -+# Real source is now at git://git.kernel.org/pub/scm/utils/tuna/tuna - BuildArch: noarch - BuildRequires: python-devel, gettext - Requires: python-ethtool --- -1.8.1.4 - diff --git a/SOURCES/tuna-Decide-whether-to-isolate-a-thread-based-on-PF_.patch b/SOURCES/tuna-Decide-whether-to-isolate-a-thread-based-on-PF_.patch deleted file mode 100644 index 10e7c37..0000000 --- a/SOURCES/tuna-Decide-whether-to-isolate-a-thread-based-on-PF_.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 6f0a2ef512aeb2e4a16a561673c95568a8780713 Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Tue, 9 Jun 2015 16:08:44 -0300 -Subject: [PATCH 11/15] tuna: Decide whether to isolate a thread based on - PF_NO_SETAFFINITY - -We were avoiding moving kernel threads, for isolation purposes it is better -to check /perf/PID/stat's 'flag' big mask for PF_NO_SETAFFINITY instead. - -Requested-by: Luiz Capitulino -Cc: Clark Williams -Cc: Guy Streeter -Cc: Jeremy Eder -Cc: Jiri Kastner -Cc: John Kacur -Cc: Marcelo Tosatti -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: John Kacur ---- - tuna/tuna.py | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/tuna/tuna.py b/tuna/tuna.py -index 0efa84fdf314..6cd6bddd2137 100755 ---- a/tuna/tuna.py -+++ b/tuna/tuna.py -@@ -171,6 +171,15 @@ def is_hardirq_handler(self, pid): - return int(self.processes[pid]["stat"]["flags"]) & \ - PF_HARDIRQ and True or False - -+# FIXME: move to python-linux-procfs -+def cannot_set_affinity(self, pid): -+ PF_NO_SETAFFINITY = 0x04000000 -+ try: -+ return int(self.processes[pid]["stat"]["flags"]) & \ -+ PF_NO_SETAFFINITY and True or False -+ except: -+ return True -+ - def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None, - spread = False): - changed = False -@@ -325,7 +334,7 @@ def isolate_cpus(cpus, nr_cpus): - ps.reload_threads() - previous_pid_affinities = {} - for pid in ps.keys(): -- if iskthread(pid): -+ if cannot_set_affinity(ps, pid): - continue - try: - affinity = schedutils.get_affinity(pid) -@@ -347,7 +356,7 @@ def isolate_cpus(cpus, nr_cpus): - continue - threads = ps[pid]["threads"] - for tid in threads.keys(): -- if iskthread(tid): -+ if cannot_set_affinity(ps, tid): - continue - try: - affinity = schedutils.get_affinity(tid) -@@ -393,7 +402,7 @@ def include_cpus(cpus, nr_cpus): - ps.reload_threads() - previous_pid_affinities = {} - for pid in ps.keys(): -- if iskthread(pid): -+ if cannot_set_affinity(ps, pid): - continue - try: - affinity = schedutils.get_affinity(pid) -@@ -415,7 +424,7 @@ def include_cpus(cpus, nr_cpus): - continue - threads = ps[pid]["threads"] - for tid in threads.keys(): -- if iskthread(tid): -+ if cannot_set_affinity(ps, tid): - continue - try: - affinity = schedutils.get_affinity(tid) --- -1.8.3.1 - diff --git a/SOURCES/tuna-Fix-race-in-is_hardirq_handler.patch b/SOURCES/tuna-Fix-race-in-is_hardirq_handler.patch deleted file mode 100644 index 1d10399..0000000 --- a/SOURCES/tuna-Fix-race-in-is_hardirq_handler.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a4fdd27814ed7b4f2f6f609a72364b581ec19bc0 Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Tue, 9 Jun 2015 16:15:42 -0300 -Subject: [PATCH 12/15] tuna: Fix race in is_hardirq_handler - -It is better to try accessing the fields catching exceptions, as just -checking if we have that key is not enough for, right after, that thread -having gone away and the populating of that dict entry not finding the -file on /proc/PID/. - -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: John Kacur ---- - tuna/tuna.py | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/tuna/tuna.py b/tuna/tuna.py -index 6cd6bddd2137..3c30f03ea134 100755 ---- a/tuna/tuna.py -+++ b/tuna/tuna.py -@@ -166,10 +166,11 @@ def list_to_cpustring(l): - # FIXME: move to python-linux-procfs - def is_hardirq_handler(self, pid): - PF_HARDIRQ = 0x08000000 -- if not self.processes.has_key(pid): -+ try: -+ return int(self.processes[pid]["stat"]["flags"]) & \ -+ PF_HARDIRQ and True or False -+ except: - return False -- return int(self.processes[pid]["stat"]["flags"]) & \ -- PF_HARDIRQ and True or False - - # FIXME: move to python-linux-procfs - def cannot_set_affinity(self, pid): --- -1.8.3.1 - diff --git a/SOURCES/tuna-Make-isolate-include-operations-affect-proc-irq.patch b/SOURCES/tuna-Make-isolate-include-operations-affect-proc-irq.patch deleted file mode 100644 index ffb6165..0000000 --- a/SOURCES/tuna-Make-isolate-include-operations-affect-proc-irq.patch +++ /dev/null @@ -1,143 +0,0 @@ -From af7e63a63258c5151c0be3596ff184c35cd9fff9 Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Tue, 9 Jun 2015 13:23:27 -0300 -Subject: [PATCH 10/15] tuna: Make --isolate/--include operations affect - /proc/irq/default_smp_affinity - -When isolating CPUs we affect the IRQ smp_affinity masks, but that will not -affect new devices, to make the isolation operation to stick for that case too we -need to remove the isolated CPUs from the /proc/irq/default_smp_affinity file, -that is what is used to set the initial affinity mask for new device IRQs. - -E.g.: - -[root@emilia git]# tuna -q enp21s0f0-* -Q - # users affinity - 66 enp21s0f0-TxRx-0 0xff ixgbe - 67 enp21s0f0-TxRx-1 0xff ixgbe - 68 enp21s0f0-TxRx-2 0xff ixgbe - 69 enp21s0f0-TxRx-3 0xff ixgbe -[root@emilia git]# cat /proc/irq/default_smp_affinity -ff -[root@emilia git]# tuna -S1 --isolate -[root@emilia git]# tuna -q enp21s0f0-* -Q - # users affinity - 66 enp21s0f0-TxRx-0 0,2,4,6 ixgbe - 67 enp21s0f0-TxRx-1 0,2,4,6 ixgbe - 68 enp21s0f0-TxRx-2 0,2,4,6 ixgbe - 69 enp21s0f0-TxRx-3 0,2,4,6 ixgbe -[root@emilia git]# cat /proc/irq/default_smp_affinity -55 ->>> hex((1 << 0) | (1 << 2) | (1 << 4) | (1 << 6)) -'0x55' -[root@emilia git]# tuna --cpu 6 --isolate -[root@emilia git]# tuna -q enp21s0f0-* -Q - # users affinity - 66 enp21s0f0-TxRx-0 0,2,4 ixgbe - 67 enp21s0f0-TxRx-1 0,2,4 ixgbe - 68 enp21s0f0-TxRx-2 0,2,4 ixgbe - 69 enp21s0f0-TxRx-3 0,2,4 ixgbe -[root@emilia git]# cat /proc/irq/default_smp_affinity -15 ->>> hex((1 << 0) | (1 << 2) | (1 << 4)) -'0x15' -[root@emilia git]# tuna --cpu 1 --include -[root@emilia git]# tuna -q enp21s0f0-* -Q - # users affinity - 66 enp21s0f0-TxRx-0 0,1,2,4 ixgbe - 67 enp21s0f0-TxRx-1 0,1,2,4 ixgbe - 68 enp21s0f0-TxRx-2 0,1,2,4 ixgbe - 69 enp21s0f0-TxRx-3 0,1,2,4 ixgbe -[root@emilia git]# cat /proc/irq/default_smp_affinity -17 ->>> hex((1 << 0) | (1 << 1) | (1 << 2) | (1 << 4)) -'0x17' - -Requested-by: Luiz Capitulino -Cc: Clark Williams -Cc: Guy Streeter -Cc: Jeremy Eder -Cc: Jiri Kastner -Cc: John Kacur -Cc: Marcelo Tosatti -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: John Kacur ---- - tuna/tuna.py | 25 +++++++++++++++++++++++-- - 1 file changed, 23 insertions(+), 2 deletions(-) - -diff --git a/tuna/tuna.py b/tuna/tuna.py -index 7b839f1e2d96..0efa84fdf314 100755 ---- a/tuna/tuna.py -+++ b/tuna/tuna.py -@@ -3,6 +3,7 @@ - - import copy, ethtool, os, procfs, re, schedutils - import help, fnmatch -+from procfs import utilist - - try: - set -@@ -92,9 +93,10 @@ def has_threaded_irqs(ps): - irq_re = re.compile("(irq/[0-9]+-.+|IRQ-[0-9]+)") - return len(ps.find_by_regex(irq_re)) > 0 - --def set_irq_affinity(irq, bitmasklist): -+def set_irq_affinity_filename(filename, bitmasklist): -+ pathname="/proc/irq/%s" % filename -+ f = file(pathname, "w") - text = ",".join(map(lambda a: "%x" % a, bitmasklist)) -- f = file("/proc/irq/%d/smp_affinity" % irq, "w") - f.write("%s\n" % text) - try: - f.close() -@@ -103,6 +105,9 @@ def set_irq_affinity(irq, bitmasklist): - return False - return True - -+def set_irq_affinity(irq, bitmasklist): -+ return set_irq_affinity_filename("%d/smp_affinity" % irq, bitmasklist) -+ - def cpustring_to_list(cpustr): - """Convert a string of numbers to an integer list. - -@@ -307,6 +312,14 @@ def affinity_remove_cpus(affinity, cpus, nr_cpus): - affinity = list(set(affinity) - set(cpus)) - return affinity - -+# Shound be moved to python_linux_procfs.interrupts, shared with interrupts.parse_affinity, etc. -+def parse_irq_affinity_filename(filename, nr_cpus): -+ f = file("/proc/irq/%s" % filename) -+ line = f.readline() -+ f.close() -+ return utilist.bitmasklist(line, nr_cpus) -+ -+ - def isolate_cpus(cpus, nr_cpus): - ps = procfs.pidstats() - ps.reload_threads() -@@ -369,6 +382,10 @@ def isolate_cpus(cpus, nr_cpus): - procfs.hexbitmask(affinity, - nr_cpus)) - -+ affinity = parse_irq_affinity_filename("default_smp_affinity", nr_cpus) -+ affinity = affinity_remove_cpus(affinity, cpus, nr_cpus) -+ set_irq_affinity_filename("default_smp_affinity", procfs.hexbitmask(affinity, nr_cpus)) -+ - return (previous_pid_affinities, previous_irq_affinities) - - def include_cpus(cpus, nr_cpus): -@@ -432,6 +449,10 @@ def include_cpus(cpus, nr_cpus): - set_irq_affinity(int(irq), - procfs.hexbitmask(affinity, nr_cpus)) - -+ affinity = parse_irq_affinity_filename("default_smp_affinity", nr_cpus) -+ affinity = list(set(affinity + cpus)) -+ set_irq_affinity_filename("default_smp_affinity", procfs.hexbitmask(affinity, nr_cpus)) -+ - return (previous_pid_affinities, previous_irq_affinities) - - def get_irq_users(irqs, irq, nics = None): --- -1.8.3.1 - diff --git a/SOURCES/tuna-config-Fix-pygtk-import.patch b/SOURCES/tuna-config-Fix-pygtk-import.patch deleted file mode 100644 index 4cabb01..0000000 --- a/SOURCES/tuna-config-Fix-pygtk-import.patch +++ /dev/null @@ -1,46 +0,0 @@ -From f1d14ac0012745a7ef6079f4fee03636d539487b Mon Sep 17 00:00:00 2001 -From: Arnaldo Carvalho de Melo -Date: Wed, 29 Apr 2015 11:26:45 -0300 -Subject: [PATCH 09/15] tuna config: Fix pygtk import - -We should 'import gtk', not 'import pygtk', fixes bugs when the error -paths try to use gtk.messageDialog(): - -[root@ssdandy tuna]# tuna -Traceback (most recent call last): - File "/home/acme/git/tuna/tuna-cmd.py", line 654, in - main() - File "/home/acme/git/tuna/tuna-cmd.py", line 648, in main - app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered) - File "/home/acme/git/tuna/tuna/tuna_gui.py", line 64, in __init__ - self.profileview.init_default_file() - File "/home/acme/git/tuna/tuna/gui/profileview.py", line 141, in -init_default_file - not self.config.load(self.config.config['lastfile']): - File "/home/acme/git/tuna/tuna/config.py", line 48, in load - if(self.tuned2Tuna(profileName) < 0): - File "/home/acme/git/tuna/tuna/config.py", line 66, in tuned2Tuna - dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR,\ -NameError: global name 'gtk' is not defined -[root@ssdandy tuna]# - -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: John Kacur ---- - tuna/config.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tuna/config.py b/tuna/config.py -index 77cc4d800c03..7e19a28f967f 100644 ---- a/tuna/config.py -+++ b/tuna/config.py -@@ -1,5 +1,5 @@ - import io, os, re, fnmatch --import sys, pygtk -+import sys, gtk - import codecs, ConfigParser - from time import localtime, strftime - from subprocess import Popen, PIPE, STDOUT, call --- -1.8.3.1 - diff --git a/SOURCES/tuna-cpuview.py-Omit-offline-cpus-in-socket_ids-list.patch b/SOURCES/tuna-cpuview.py-Omit-offline-cpus-in-socket_ids-list.patch new file mode 100644 index 0000000..065ec84 --- /dev/null +++ b/SOURCES/tuna-cpuview.py-Omit-offline-cpus-in-socket_ids-list.patch @@ -0,0 +1,53 @@ +From 6e19631d5e5e27b28e02d0a3f612b95c56e9ba4c Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 30 May 2016 12:57:44 +0200 +Subject: [PATCH] tuna: cpuview.py: Omit offline cpus in socket_ids list + +sysfy.py inserts None for offline cpus in class cpus, method reload, via +class cpu method reload. + +This is potentially useful, so we don't want to change these classes. +However in cpuview.py - class cpuview, we don't want to display these +offline cpus, so we only need to recognize that the type None can be +returned and then skip over it. + +This fixes Bugzilla 1036156 +First detected on some ppc + +./tuna-cmd.py +Traceback (most recent call last): + File "./tuna-cmd.py", line 656, in + main() + File "./tuna-cmd.py", line 650, in main + app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered) + File "/home/jkacur/tuna/tuna/tuna_gui.py", line 49, in __init__ + self.procview, self.irqview, cpus_filtered) + File "/home/jkacur/tuna/tuna/gui/cpuview.py", line 253, in __init__ + socket_ids = [ int(id) for id in self.cpus.sockets.keys() ] + +Signed-off-by: John Kacur +--- + tuna/gui/cpuview.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py +index 41a3d9bbbfc3..c84ecd739c70 100755 +--- a/tuna/gui/cpuview.py ++++ b/tuna/gui/cpuview.py +@@ -250,7 +250,12 @@ class cpuview: + self.irqview = irqview + + vbox = window.get_child().get_child() +- socket_ids = [ int(id) for id in self.cpus.sockets.keys() ] ++ socket_ids = [] ++ for id in self.cpus.sockets.keys(): ++ try: ++ socket_ids.append(int(id)) ++ except TypeError: # Skip over offline cpus - type None ++ continue + socket_ids.sort() + + self.nr_sockets = len(socket_ids) +-- +2.4.11 + diff --git a/SOURCES/tuna-fix-the-check-of-PF_NO_SETAFFINITY-flag-for-thr.patch b/SOURCES/tuna-fix-the-check-of-PF_NO_SETAFFINITY-flag-for-thr.patch deleted file mode 100644 index 4ead67a..0000000 --- a/SOURCES/tuna-fix-the-check-of-PF_NO_SETAFFINITY-flag-for-thr.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 92aa193749be6d1e531e05abef22b9092c577bb3 Mon Sep 17 00:00:00 2001 -From: Daniel Bristot de Oliveira -Date: Fri, 27 Nov 2015 16:36:54 -0200 -Subject: [PATCH] tuna: fix the check of PF_NO_SETAFFINITY flag for threads - -commit 95c4e2ad2603cd29af1357c0ceb780da8dc161cc upstream - -The following is the commit that caused the regression -commit 29fbb6e82357c87be652c6717ef52d808ec0af78 -tuna: Decide whether to isolate a thread based on PF_NO_SETAFFINITY - -Tuna checks if PF_NO_SETAFFINITY is set on /proc/PID/stat's 'flag' field -to verify if it is possible to migrate a process/thread. This is -working fine for process, but not for threads. - -For threads, the file /proc/TID/stat is being checked, but this file -does not exist as the stat file of a thread is at -/proc/PID/task/TID/stat. Hence, the check was failing and threads were -not being migrated. - -This patch adds a function to check thread's stat file, and this -function is called to verify the PF_NO_SETAFFINITY flag for threads. - -Committer note: - -Before, doing: - - # tuna --cpu 3 --isolate - # tuna -t firefox -CP - thread ctxt_switches - pid SCHED_ rtpri affinity voluntary nonvoluntary cmd - 14838 OTHER 0 0,1,2 873954 27498 firefox - 14857 OTHER 0 0,1,2,3 3 1 Gecko_IOThread - 14858 OTHER 0 0,1,2,3 1 0 Link Monitor - 14859 OTHER 0 0,1,2,3 126717 12214 Socket Thread - - -So it affected just the main thread, all the children remained with -their existing affinity mask. - -After the patch: - - # tuna --cpu 3 --isolate - # tuna -t firefox -CP - thread ctxt_switches - pid SCHED_ rtpri affinity voluntary nonvoluntary cmd - 14838 OTHER 0 0,1,2 877488 27583 firefox - 14857 OTHER 0 0,1,2 3 1 Gecko_IOThread - 14858 OTHER 0 0,1,2 1 0 Link Monitor - 14859 OTHER 0 0,1,2 126933 12235 Socket Thread - - -Signed-off-by: Daniel Bristot de Oliveira -Tested-by: Arnaldo Carvalho de Melo -Cc: Jiri Kastner -Cc: John Kacur -Cc: Luiz Capitulino -Cc: Tuna -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1286221 -Signed-off-by: Arnaldo Carvalho de Melo -Resolves: rhbz#1286221 -Signed-off-by: John Kacur ---- - tuna/tuna.py | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/tuna/tuna.py b/tuna/tuna.py -index 3c30f03ea134..1de63b07a5ee 100755 ---- a/tuna/tuna.py -+++ b/tuna/tuna.py -@@ -181,6 +181,15 @@ def cannot_set_affinity(self, pid): - except: - return True - -+# FIXME: move to python-linux-procfs -+def cannot_set_thread_affinity(self, pid, tid): -+ PF_NO_SETAFFINITY = 0x04000000 -+ try: -+ return int(self.processes[pid].threads[tid]["stat"]["flags"]) & \ -+ PF_NO_SETAFFINITY and True or False -+ except: -+ return True -+ - def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None, - spread = False): - changed = False -@@ -357,7 +366,7 @@ def isolate_cpus(cpus, nr_cpus): - continue - threads = ps[pid]["threads"] - for tid in threads.keys(): -- if cannot_set_affinity(ps, tid): -+ if cannot_set_thread_affinity(ps, pid, tid): - continue - try: - affinity = schedutils.get_affinity(tid) -@@ -425,7 +434,7 @@ def include_cpus(cpus, nr_cpus): - continue - threads = ps[pid]["threads"] - for tid in threads.keys(): -- if cannot_set_affinity(ps, tid): -+ if cannot_set_thread_affinity(ps, pid, tid): - continue - try: - affinity = schedutils.get_affinity(tid) --- -2.4.3 - diff --git a/SOURCES/tuna-modified-sysctl-settings-in-example.conf.patch b/SOURCES/tuna-modified-sysctl-settings-in-example.conf.patch deleted file mode 100644 index dcbf150..0000000 --- a/SOURCES/tuna-modified-sysctl-settings-in-example.conf.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 40d6203ec11daf500bc24b30b962565e4551c372 Mon Sep 17 00:00:00 2001 -From: Petr Oros -Date: Tue, 4 Feb 2014 08:51:07 +0100 -Subject: [PATCH 05/15] tuna: modified sysctl settings in example.conf - -Signed-off-by: Petr Oros -Signed-off-by: Jiri Kastner -Signed-off-by: John Kacur ---- - etc/tuna/example.conf | 75 +++++++++++++++++++++++++++------------------------ - 1 file changed, 40 insertions(+), 35 deletions(-) - -diff --git a/etc/tuna/example.conf b/etc/tuna/example.conf -index 7448a4ecd2af..7bb293e3d2ed 100644 ---- a/etc/tuna/example.conf -+++ b/etc/tuna/example.conf -@@ -1,54 +1,59 @@ - #List of enabled categories - [categories] --kernel=Kernel scheduler --vm=VM --ipv4=Network IPv4 --ipv6=Network IPv6 --net=Network Core -+kernel = Kernel scheduler -+vm = VM -+ipv4 = Network IPv4 -+ipv6 = Network IPv6 -+net = Network Core - - [kernel] --kernel.sched_latency_ns=1000,50000000, --kernel.sched_min_granularity_ns=,, --kernel.sched_nr_migrate=0,128, --kernel.sched_rt_period_us=,, --kernel.sched_rt_runtime_us= 1000,2000000, --kernel.sched_tunable_scaling=0,10, --kernel.sched_wakeup_granularity_ns=1000,10000000, --kernel.core_pattern = -+kernel.sched_latency_ns = 1000,50000000, -+kernel.sched_min_granularity_ns = ,, -+kernel.sched_nr_migrate = 0,128, -+kernel.sched_rt_period_us = ,, -+kernel.sched_rt_runtime_us = 1000,2000000, -+kernel.sched_tunable_scaling = 0,10, -+kernel.sched_wakeup_granularity_ns = 1000,20000000, -+kernel.sched_migration_cost_ns = ,, -+kernel.sched_autogroup_enabled = 0,1, -+kernel.core_pattern = -+kernel.sem = - - [vm] --vm.dirty_ratio=0,100, --vm.dirty_writeback_centisecs=,, --vm.dirty_expire_centisecs=,, --vm.laptop_mode=0,5, --vm.swappiness =0,100, -+vm.dirty_ratio = 0,100, -+vm.dirty_background_ratio = ,, -+vm.dirty_writeback_centisecs = ,, -+vm.dirty_expire_centisecs = ,, -+vm.laptop_mode = 0,5, -+vm.swappiness = 0,100, -+vm.max_map_count = ,, - vm.memory_failure_early_kill = 0,1,0 - - [net] --net.core.rmem_default=100000,1000000, --net.core.rmem_max=100000,1000000, --net.core.wmem_default=100000,1000000, --net.core.wmem_max=100000,1000000, -+net.core.rmem_default = 100000,1000000, -+net.core.rmem_max = 100000,1000000, -+net.core.wmem_default = 100000,1000000, -+net.core.wmem_max = 100000,1000000, - - [ipv4] --net.ipv4.tcp_window_scaling= --net.ipv4.conf.all.forwarding=0,1, --net.ipv4.conf.all.rp_filter= --net.ipv4.tcp_congestion_control= --net.ipv4.tcp_max_syn_backlog= --net.ipv4.tcp_mem= --net.ipv4.tcp_slow_start_after_idle=0,1, --net.ipv4.tcp_window_scaling=0,1, -+net.ipv4.tcp_window_scaling = 0,1, -+net.ipv4.conf.all.forwarding = 0,1, -+net.ipv4.conf.all.rp_filter = -+net.ipv4.tcp_congestion_control = -+net.ipv4.tcp_max_syn_backlog = -+net.ipv4.tcp_mem = -+net.ipv4.tcp_slow_start_after_idle = 0,1, - - [ipv6] --net.ipv6.conf.*.forwarding=0,1, -+net.ipv6.conf.*.forwarding = 0,1, - - #special section for gui alias - [guiAlias] --net.ipv4=ipv4 --net.ipv6=ipv6 --net.core=core -+net.ipv4 = ipv4 -+net.ipv6 = ipv6 -+net.core = core - - #special section for this file description - [fileDescription] --text=This file contain some features for tunning kernel params.Mainly this is example file for demonstrate tuna new features. Params are set as default or most uses value -+text = This file contain some features for tunning kernel params.Mainly this is example file for demonstrate tuna new features. Params are set as default or most uses value -+ --- -1.8.3.1 - diff --git a/SPECS/tuna.spec b/SPECS/tuna.spec index 4a14c5c..9c6081e 100644 --- a/SPECS/tuna.spec +++ b/SPECS/tuna.spec @@ -2,34 +2,19 @@ %{!?python_ver: %define python_ver %(%{__python} -c "import sys ; print sys.version[:3]")} Name: tuna -Version: 0.11.1 -Release: 12%{?dist} +Version: 0.13 +Release: 5%{?dist} License: GPLv2 Summary: Application tuning GUI & command line utility Group: Applications/System -Source: http://userweb.kernel.org/~acme/tuna/%{name}-%{version}.tar.bz2 - -Patch1: spec-Mark-configuration-files-with-config.patch -Patch2: docs-Remove-stray-a.patch -Patch3: CLI-fix-ps_show_thread-call-with-bad-args-count.patch -Patch4: CLI-fix-traceback-where-enter-p-policy-without-prio.patch -Patch5: CLI-fix-traceback-due-unavailable-display.patch -Patch6: tuna-modified-sysctl-settings-in-example.conf.patch -Patch7: CLI-fix-traceback-when-p-is-used-with-unsupported-va.patch -Patch8: Add-a-tuna.desktop-file.patch -Patch9: CLI-Introduce-nohz_full-N-entity.patch -Patch10: tuna-config-Fix-pygtk-import.patch -Patch11: tuna-Make-isolate-include-operations-affect-proc-irq.patch -Patch12: tuna-Decide-whether-to-isolate-a-thread-based-on-PF_.patch -Patch13: tuna-Fix-race-in-is_hardirq_handler.patch -Patch14: CLI-Do-not-show-column-headers-when-not-outputting-t.patch -Patch15: Fix-behavior-for-dot-inside-proc-sys-path.patch -Patch16: Correct-a-typo-in-the-net.ipv4.ipfrag_time-help-stri.patch -Patch17: spec-Show-where-the-original-source-comes-from-in-co.patch -Patch18: tuna-fix-the-check-of-PF_NO_SETAFFINITY-flag-for-thr.patch - -URL: http://userweb.kernel.org/~acme/tuna/ -# Real source is now at git://git.kernel.org/pub/scm/utils/tuna/tuna +Source: https://www.kernel.org/pub/software/utils/tuna/%{name}-%{version}.tar.xz + +Patch1: tuna-cpuview.py-Omit-offline-cpus-in-socket_ids-list.patch +Patch2: display-usage-instead-of-traceback-when-c-missing-args.patch +Patch3: CLI-start-a-process-from-tuna.patch +Patch4: docs-upgrade-tuna.8-man-page-with-option-r.patch + +URL: https://git.kernel.org/pub/scm/utils/tuna/tuna.git BuildArch: noarch BuildRequires: python-devel, gettext, desktop-file-utils Requires: python-ethtool @@ -70,21 +55,6 @@ priority is changed, be it using tuna or plain chrt & taskset. %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 - %build %{__python} setup.py build @@ -139,9 +109,29 @@ rm -rf %{buildroot} %doc docs/oscilloscope+tuna.pdf %changelog -* Tue Dec 22 2015 John Kacur - 0.11.1-12 -- rebuilt for rhel-7.2.z -Resolves: rhbz#1293353 +* Mon Jun 13 2016 John Kacur - 0.13-5 +- Rebuild to document + tuna thows an exception instead of an error message when sched_setaffinity returns EINVAL + This was actually fixed in v0.13-1 +Resolves: rhbz#1290445 + +* Mon May 30 2016 John Kacur - 0.13-4 +- CLI-start-a-process-from-tuna +- docs: upgrade tuna.8 man page with option -r +Resolves: rhbz#1235829 + +* Mon May 30 2016 John Kacur - 0.13-3 +- Display usage instead of traceback when -c missing args or args is incorrect +Resolves: rhbz#1268287 + +* Mon May 30 2016 John Kacur - 0.13-2 +- tuna: cpuview.py: Omit offline cpus in socket_ids list +Resolves: rhbz#1036156 + +* Tue May 24 2016 John Kacur - 0.13-1 +- Upgrade to v0.13 +- Remove patches that are included in 0.13 +Resolves: rhbz#1235828 * Mon Dec 21 2015 John Kacur - 0.11.1-11 - tuna-fix-the-check-of-PF_NO_SETAFFINITY-flag-for-thr.patch