diff --git a/SOURCES/tuna-Fix-matching-irqs-in-ps_show_thread.patch b/SOURCES/tuna-Fix-matching-irqs-in-ps_show_thread.patch new file mode 100644 index 0000000..3d7cf16 --- /dev/null +++ b/SOURCES/tuna-Fix-matching-irqs-in-ps_show_thread.patch @@ -0,0 +1,52 @@ +From 3f1fbb092f5ef07d04fef7ddec9e538f36d84450 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Fri, 2 Sep 2022 11:55:07 -0400 +Subject: [PATCH] tuna: Fix matching irqs in ps_show_thread + +The new format to match irqs is "irqs/" +We already test this when we call is_irq_thread(cmd): + +With this fix if you do + +tuna show_threads + +You will get nic information that was previously missed such as + + 986 FIFO 50 9 69286 2 irq/164-iwlwifi:default_que +ue iwlwifi:default_queue + +Signed-off-by: John Kacur +--- + tuna-cmd.py | 15 +++++---------- + 1 file changed, 5 insertions(+), 10 deletions(-) + +diff --git a/tuna-cmd.py b/tuna-cmd.py +index b13b25b8a801..80e27523acc6 100755 +--- a/tuna-cmd.py ++++ b/tuna-cmd.py +@@ -351,17 +351,12 @@ def ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info, sock_inodes, + try: + if not irqs: + irqs = procfs.interrupts() +- if cmd[:4] == "IRQ-": +- users = irqs[tuna.irq_thread_number(cmd)]["users"] +- for u in users: +- if u in get_nics(): +- users[users.index(u)] = "%s(%s)" % ( +- u, ethtool.get_module(u)) +- users = ",".join(users) +- else: +- u = cmd[cmd.find('-') + 1:] ++ users = irqs[tuna.irq_thread_number(cmd)]["users"] ++ for u in users: + if u in get_nics(): +- users = ethtool.get_module(u) ++ users[users.index(u)] = "%s(%s)" % ( ++ u, ethtool.get_module(u)) ++ users = ",".join(users) + except: + users = "Not found in /proc/interrupts!" + +-- +2.37.3 + diff --git a/SOURCES/tuna-Replace-python_ethtool-with-builtin-funtionalit.patch b/SOURCES/tuna-Replace-python_ethtool-with-builtin-funtionalit.patch new file mode 100644 index 0000000..8a5542e --- /dev/null +++ b/SOURCES/tuna-Replace-python_ethtool-with-builtin-funtionalit.patch @@ -0,0 +1,104 @@ +From ff1963daf4d5a23e5f9476710e983ab781210608 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Tue, 27 Sep 2022 12:59:54 -0400 +Subject: [PATCH 1/2] tuna: Replace python_ethtool with builtin funtionality + +This patch replaces the dependency on python_ethtool with some +simplified functions to achieve the same result. + +Reviewed-by: Federico Pellegrin +- return 'tun' only if tun_flags exists +Signed-off-by: John Kacur +--- + tuna-cmd.py | 2 +- + tuna/gui/irqview.py | 2 +- + tuna/new_eth.py | 37 +++++++++++++++++++++++++++++++++++++ + tuna/tuna.py | 2 +- + 4 files changed, 40 insertions(+), 3 deletions(-) + create mode 100755 tuna/new_eth.py + +diff --git a/tuna-cmd.py b/tuna-cmd.py +index bdaa70ffc156..21a70cf1d37d 100755 +--- a/tuna-cmd.py ++++ b/tuna-cmd.py +@@ -25,7 +25,7 @@ import fnmatch + import gettext + import locale + from functools import reduce +-import ethtool ++import tuna.new_eth as ethtool + import tuna.tuna_sched as tuna_sched + import procfs + from tuna import tuna, sysfs +diff --git a/tuna/gui/irqview.py b/tuna/gui/irqview.py +index 35fc3fd0b0ca..5143d6dc0df5 100755 +--- a/tuna/gui/irqview.py ++++ b/tuna/gui/irqview.py +@@ -7,7 +7,7 @@ from gi.repository import Gtk + from gi.repository import GObject + import os + from functools import reduce +-import ethtool ++import tuna.new_eth as ethtool + import tuna.tuna_sched as tuna_sched + + import gi +diff --git a/tuna/new_eth.py b/tuna/new_eth.py +new file mode 100755 +index 000000000000..98f9179d5695 +--- /dev/null ++++ b/tuna/new_eth.py +@@ -0,0 +1,37 @@ ++# Copyright (C) 2022 John Kacur ++""" A few functions similar to ethtool """ ++import os ++import socket ++ ++def get_active_devices(): ++ """ return a list of network devices """ ++ ret = [] ++ ++ for device in socket.if_nameindex(): ++ ret.append(device[1]) ++ ++ return ret ++ ++def get_module(intf): ++ """ return the kernel module for the given network interface """ ++ if intf == 'lo': ++ return "" ++ myp = f'/sys/class/net/{intf}/device/driver' ++ if os.path.exists(myp): ++ return os.path.basename(os.readlink(myp)) ++ if os.path.exists(f'/sys/class/net/{intf}/bridge'): ++ return 'bridge' ++ if os.path.exists(f'/sys/class/net/{intf}/tun_flags'): ++ return 'tun' ++ return "" ++ ++if __name__ == "__main__": ++ nics = get_active_devices() ++ print(f'nics = {nics}') ++ ++ for intf in nics: ++ driver = get_module(intf) ++ if driver: ++ print(f'{intf}, {driver}') ++ else: ++ print(f'{intf}') +diff --git a/tuna/tuna.py b/tuna/tuna.py +index 31707c9cb69c..84419c957b1b 100755 +--- a/tuna/tuna.py ++++ b/tuna/tuna.py +@@ -9,7 +9,7 @@ import sys + import shlex + import fnmatch + import platform +-import ethtool ++import tuna.new_eth as ethtool + import procfs + from procfs import utilist + from tuna import help +-- +2.37.3 + diff --git a/SPECS/tuna.spec b/SPECS/tuna.spec index 736259e..1e04418 100644 --- a/SPECS/tuna.spec +++ b/SPECS/tuna.spec @@ -1,6 +1,6 @@ Name: tuna Version: 0.18 -Release: 1%{?dist} +Release: 3%{?dist} License: GPLv2 Summary: Application tuning GUI & command line utility Group: Applications/System @@ -9,13 +9,14 @@ URL: https://git.kernel.org/pub/scm/utils/tuna/tuna.git BuildArch: noarch BuildRequires: python3-devel, gettext -Requires: python3-ethtool Requires: python3-linux-procfs >= 0.6 # This really should be a Suggests... # Requires: python-inet_diag BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) # PATCHES +Patch1: tuna-Replace-python_ethtool-with-builtin-funtionalit.patch +Patch2: tuna-Fix-matching-irqs-in-ps_show_thread.patch %description Provides interface for changing scheduler and IRQ tunables, at whole CPU and at @@ -28,6 +29,8 @@ installed. %prep %setup -q +%patch1 -p1 +%patch2 -p1 %build %{__python3} setup.py build @@ -74,6 +77,14 @@ rm -rf %{buildroot} %{_datadir}/polkit-1/actions/org.tuna.policy %changelog +* Mon Oct 03 2022 John Kacur - 0.18-5 +- Match irqs with "irqs/" +Resolves: rhbz#2131353 + +* Fri Sep 30 2022 John Kacur - 0.18-2 +- Replace dependency on python-ethtool with built-in functionality +Resolves: rhbz#2123753 + * Wed Jun 29 2022 Leah Leshchinsky - 0.18-1 - Rebase to upstream version 0.18 Resolves: rhbz#2073555