public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* [ANNOUNCE] tuna v0.20
@ 2025-11-07 18:57 John Kacur
  2025-11-07 18:57 ` [PATCH 01/23] Add SPDX license identifiers John Kacur
                   ` (22 more replies)
  0 siblings, 23 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

To fetch tuna:
Clone one of the following
git://git.kernel.org/pub/scm/utils/tuna/tuna.git
https://git.kernel.org/pub/scm/utils/tuna/tuna.git
https://kernel.googlesource.com/pub/scm/utils/tuna/tuna.git

Branch: main
Tag: v0.20

Tarballs are here:
https://kernel.org/pub/software/utils/tuna/
older ones are here
https://kernel.org/pub/software/utils/tuna/older

Enjoy!

John Kacur


Clark Williams (1):
  Add SPDX license identifiers

John B. Wyatt IV (9):
  tuna: Fix string syntax warnings with raw strings
  tuna: Fix help.py syntax warnings
  tuna: extract common cpu and nics determination code into a utils.py
    file
  tuna: Add idle_state control functionality
  tuna: Add Pyright helper
  tuna: Update man page with cpu_power command
  tuna: replace match with if statements
  tuna: Proofreading fixes
  tuna: Remove broken testuna

John Kacur (13):
  tuna: Remove spec file from git
  tuna: Don't start the gui if a display is not available
  tuna: help.py
  tuna: utils: A few tweaks
  tuna: Fix show_threads -t and show_irqs -q
  tuna: Fix run command failing to apply BATCH policy
  tuna: Add -U and -K to the move command
  tuna: Add -U and -K to the spread command
  tuna: Fix setting a realtime scheduling policy
  tuna: Update setup.py with co-author and metadata improvements
  tuna: Add pyproject.toml for modern Python packaging
  tuna: Update version to 0.20
  tuna: Fix pyproject.toml build issues

 .gitignore              |   1 +
 MANIFEST                |  30 ------
 Makefile                |  42 ++------
 __builtins__.pyi        |   1 +
 docs/tuna.8             |  18 ++++
 etc/tuna/example.conf   |   2 +-
 org.tuna.policy         |   1 +
 oscilloscope-cmd.py     |  15 +--
 pyproject.toml          |  42 ++++++++
 rpm/SPECS/tuna.spec     | 137 ------------------------
 setup.py                |  20 ++--
 testuna                 | 230 ----------------------------------------
 tuna-cmd.py             | 110 +++++++++++--------
 tuna.desktop            |   1 +
 tuna/__init__.py        |   2 +-
 tuna/config.py          |   2 +
 tuna/cpupower.py        | 176 ++++++++++++++++++++++++++++++
 tuna/gui/__init__.py    |   2 +
 tuna/gui/commonview.py  |   2 +
 tuna/gui/cpuview.py     |   1 +
 tuna/gui/irqview.py     |   1 +
 tuna/gui/procview.py    |   1 +
 tuna/gui/profileview.py |   3 +-
 tuna/gui/util.py        |   9 +-
 tuna/help.py            |   6 +-
 tuna/new_eth.py         |   1 +
 tuna/oscilloscope.py    |  15 +--
 tuna/sysfs.py           |   2 +
 tuna/tuna.py            |  24 +++--
 tuna/tuna_gui.py        |   1 +
 tuna/tuna_sched.py      |   1 +
 tuna/utils.py           |  30 ++++++
 32 files changed, 399 insertions(+), 530 deletions(-)
 delete mode 100644 MANIFEST
 create mode 100644 __builtins__.pyi
 create mode 100644 pyproject.toml
 delete mode 100644 rpm/SPECS/tuna.spec
 delete mode 100755 testuna
 create mode 100755 tuna/cpupower.py
 create mode 100644 tuna/utils.py



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/23] Add SPDX license identifiers
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-12-18  2:45   ` Kate Stewart
  2025-11-07 18:57 ` [PATCH 02/23] tuna: Remove spec file from git John Kacur
                   ` (21 subsequent siblings)
  22 siblings, 1 reply; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, Clark Williams, John Kacur

From: Clark Williams <clrkwllms@kernel.org>

use SPDX license identifiers to clarify the licences under which
tuna is released.

Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 Makefile                |  3 +++
 org.tuna.policy         |  1 +
 oscilloscope-cmd.py     | 15 +--------------
 setup.py                |  1 +
 testuna                 | 10 +++++-----
 tuna-cmd.py             |  9 +--------
 tuna.desktop            |  1 +
 tuna/__init__.py        |  2 +-
 tuna/config.py          |  2 ++
 tuna/gui/__init__.py    |  2 ++
 tuna/gui/commonview.py  |  2 ++
 tuna/gui/cpuview.py     |  1 +
 tuna/gui/irqview.py     |  1 +
 tuna/gui/procview.py    |  1 +
 tuna/gui/profileview.py |  1 +
 tuna/gui/util.py        |  1 +
 tuna/new_eth.py         |  1 +
 tuna/oscilloscope.py    | 15 +--------------
 tuna/sysfs.py           |  2 ++
 tuna/tuna.py            |  7 ++++---
 tuna/tuna_gui.py        |  1 +
 tuna/tuna_sched.py      |  1 +
 22 files changed, 35 insertions(+), 45 deletions(-)

diff --git a/Makefile b/Makefile
index 50ded3985743..a3d71d2de896 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
 PACKAGE := tuna
 VERSION := $(shell rpm -q --qf '%{VERSION} ' --specfile rpm/SPECS/$(PACKAGE).spec | cut -d' ' -f1)
 
diff --git a/org.tuna.policy b/org.tuna.policy
index 4f71d4ad65f4..b3b3900a4d76 100644
--- a/org.tuna.policy
+++ b/org.tuna.policy
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- SPDX-License-Identifier: GPL-2.0-only -->
 <!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD polkit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
 <policyconfig>
diff --git a/oscilloscope-cmd.py b/oscilloscope-cmd.py
index 2ca87e9edc62..a65117637160 100755
--- a/oscilloscope-cmd.py
+++ b/oscilloscope-cmd.py
@@ -5,20 +5,7 @@
 # http://git.kernel.org/?p=linux/kernel/git/acme/tuna.git;a=tree
 # For newer versions and to see it integrated with tuna
 #
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation;
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
+# SPDX-License-Identifier: LGPL-2.1-only
 
 import getopt
 import sys
diff --git a/setup.py b/setup.py
index db0f00735524..f119e75abdeb 100755
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
 #!/usr/bin/python3
+# SPDX-License-Identifier: GPL-2.0-only
 import os
 import sysconfig
 from os.path import isfile, relpath
diff --git a/testuna b/testuna
index 4bf91ebdb76f..cb98640c0167 100755
--- a/testuna
+++ b/testuna
@@ -2,7 +2,7 @@
 # Regression tests for tuna
 # (c) 2008 Red Hat Inc.
 # Arnaldo Carvalho de Melo <acme@redhat.com>
-# Released under the GPLv2
+# SPDX-License-Identifier: GPL-2.0-only
 
 dprint() {
 	[ -n "$VERBOSE" ] && echo $1
@@ -111,21 +111,21 @@ PID=$(ktpidof "watchdog")
 RTPRIO=$(get_rtprio $PID)
 POLICY=$(get_policy $PID)
 POLICY=$(echo ${POLICY:6:1} | tr 'A-Z' 'a-z')
-chrt -$POLICY -p $((RTPRIO - 1)) $PID 
+chrt -$POLICY -p $((RTPRIO - 1)) $PID
 
 die_if_not_saved 1 'Saving changes to a kernel thread priority'
 
-chrt -$POLICY -p $RTPRIO $PID 
+chrt -$POLICY -p $RTPRIO $PID
 
 die_if_conf_changed 'Restoring kernel thread priority'
 
 new_policy=$(echo $POLICY | tr fr rf)
 
-chrt -$new_policy -p $RTPRIO $PID 
+chrt -$new_policy -p $RTPRIO $PID
 
 die_if_not_saved 1 'Changing kernel thread sched policy'
 
-chrt -$POLICY -p $RTPRIO $PID 
+chrt -$POLICY -p $RTPRIO $PID
 
 die_if_conf_changed 'Restoring kernel thread sched policy'
 
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 6a980598526f..e953869c4f48 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -5,14 +5,7 @@
 #   Copyright (C) 2008, 2009, 2010, 2011 Red Hat Inc.
 #   Arnaldo Carvalho de Melo <acme@redhat.com>
 #
-#   This application is free software; you can redistribute it and/or
-#   modify it under the terms of the GNU General Public License
-#   as published by the Free Software Foundation; version 2.
-#
-#   This application is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#   General Public License for more details.
+# SPDX-License-Identifier: GPL-2.0-only
 
 """ tuna - Application Tuning Program"""
 
diff --git a/tuna.desktop b/tuna.desktop
index 603011f79467..87ca3a35ce63 100644
--- a/tuna.desktop
+++ b/tuna.desktop
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 [Desktop Entry]
 Name=tuna
 GenericName=Application Tuner
diff --git a/tuna/__init__.py b/tuna/__init__.py
index 30924a00cf96..614e3e4c7ed8 100755
--- a/tuna/__init__.py
+++ b/tuna/__init__.py
@@ -4,4 +4,4 @@ Copyright (c) 2008, 2009 Red Hat Inc.
 Application Tuning GUI
 """
 __author__ = "Arnaldo Carvalho de Melo <acme@redhat.com>"
-__license__ = "GPLv2 License"
+__license__ = "SPDX-License-Identifier: GPL-2.0-only"
diff --git a/tuna/config.py b/tuna/config.py
index 09d26dd87029..63c9f23bb09b 100644
--- a/tuna/config.py
+++ b/tuna/config.py
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 import io
 import os
 import re
diff --git a/tuna/gui/__init__.py b/tuna/gui/__init__.py
index ad1191c13d8d..a40f86292e6f 100755
--- a/tuna/gui/__init__.py
+++ b/tuna/gui/__init__.py
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 """
 Copyright (c) 2009  Red Hat Inc.
 
diff --git a/tuna/gui/commonview.py b/tuna/gui/commonview.py
index cc8f913819a2..8089ed154dae 100644
--- a/tuna/gui/commonview.py
+++ b/tuna/gui/commonview.py
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
 from gi.repository import Gtk
 from tuna import tuna
 
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index cc3f0f905ae7..844705a4bb21 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
@@ -1,5 +1,6 @@
 # -*- python -*-
 # -*- coding: utf-8 -*-
+# SPDX-License-Identifier: GPL-2.0-only
 
 from functools import reduce
 
diff --git a/tuna/gui/irqview.py b/tuna/gui/irqview.py
index 5143d6dc0df5..e89fb70197fc 100755
--- a/tuna/gui/irqview.py
+++ b/tuna/gui/irqview.py
@@ -1,5 +1,6 @@
 # -*- python -*-
 # -*- coding: utf-8 -*-
+# SPDX-License-Identifier: GPL-2.0-only
 from tuna import tuna, gui
 import procfs
 from gi.repository import Gdk
diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
index 440a289a1b29..78d5f573dd49 100755
--- a/tuna/gui/procview.py
+++ b/tuna/gui/procview.py
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 import re
 import os
 import tuna.tuna_sched as tuna_sched
diff --git a/tuna/gui/profileview.py b/tuna/gui/profileview.py
index 26f58cbc8f4f..7570bc0e57ce 100644
--- a/tuna/gui/profileview.py
+++ b/tuna/gui/profileview.py
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 import os
 import shutil
 import gi
diff --git a/tuna/gui/util.py b/tuna/gui/util.py
index ec368ae4b2c9..92bd368179cc 100644
--- a/tuna/gui/util.py
+++ b/tuna/gui/util.py
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 import errno
 import os
 import gi
diff --git a/tuna/new_eth.py b/tuna/new_eth.py
index 98f9179d5695..e2888d4cef36 100755
--- a/tuna/new_eth.py
+++ b/tuna/new_eth.py
@@ -1,4 +1,5 @@
 # Copyright (C) 2022 John Kacur
+# SPDX-License-Identifier: GPL-2.0-only
 """ A few functions similar to ethtool """
 import os
 import socket
diff --git a/tuna/oscilloscope.py b/tuna/oscilloscope.py
index 317fe4554c60..a44ace53ec27 100755
--- a/tuna/oscilloscope.py
+++ b/tuna/oscilloscope.py
@@ -8,20 +8,7 @@
 # http://git.kernel.org/?p=linux/kernel/git/acme/tuna.git;a=tree
 # For newer versions and to see it integrated with tuna
 #
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation;
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
+# SPDX-License-Identifier: LGPL-2.1-only
 
 import os
 import sys
diff --git a/tuna/sysfs.py b/tuna/sysfs.py
index 1c903e106a44..cd2377a8df26 100755
--- a/tuna/sysfs.py
+++ b/tuna/sysfs.py
@@ -1,5 +1,7 @@
 # -*- python -*-
 # -*- coding: utf-8 -*-
+# SPDX-License-Identifier: GPL-2.0-only
+
 """
 classes for /sys/devices/system/cpu/
 so we can get topology information and do CPU hotplug operations
diff --git a/tuna/tuna.py b/tuna/tuna.py
index e527facb151c..bd678e2dc7ae 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -1,5 +1,6 @@
 # -*- python -*-
 # -*- coding: utf-8 -*-
+# SPDX-License-Identifier: GPL-2.0-only
 
 import copy
 import errno
@@ -647,12 +648,12 @@ def generate_rtgroups(filename, kthreads, nr_cpus):
     f.write('''# Generated by tuna
 #
 # Use it with rtctl:
-# 
+#
 # rtctl --file %s reset
 #
 # Please use 'man rtctl' for more operations
 #
-# Associate processes into named groups with default priority and 
+# Associate processes into named groups with default priority and
 # scheduling policy.
 #
 # Format is: <groupname>:<sched>:<prio>:<regex>
@@ -661,7 +662,7 @@ def generate_rtgroups(filename, kthreads, nr_cpus):
 # sched must be one of: 'f' (fifo)
 #                       'b' (batch)
 #                       'r' (round-robin)
-#                       'o' (other) 
+#                       'o' (other)
 #                       '*' (leave alone)
 # regex is an awk regex
 #
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
index 459f90303ed5..cefee4a57697 100755
--- a/tuna/tuna_gui.py
+++ b/tuna/tuna_gui.py
@@ -1,5 +1,6 @@
 # -*- python -*-
 # -*- coding: utf-8 -*-
+# SPDX-License-Identifier: GPL-2.0-only
 
 import sys
 import os
diff --git a/tuna/tuna_sched.py b/tuna/tuna_sched.py
index de9846bb5fae..1051983e53f9 100644
--- a/tuna/tuna_sched.py
+++ b/tuna/tuna_sched.py
@@ -1,5 +1,6 @@
 #!/usr/bin/python3
 #   Copyright (C) 2022 John Kacur
+# SPDX-License-Identifier: GPL-2.0-only
 """
 Functions to translate a scheduling policy into either a string name or an
 equivalent integer
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/23] tuna: Remove spec file from git
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
  2025-11-07 18:57 ` [PATCH 01/23] Add SPDX license identifiers John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 03/23] tuna: Don't start the gui if a display is not available John Kacur
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

The specfile should be maintained in the distribution and not upstream
The specfile that is upstream is largely unmaintained anyway.
This change also guts the Makefile which uses the specfile.
Most of the functionality in the Makefile is available through tools
such as rpmbuild anyway. Leaving the Makefile in place for a few
minor things like makeing tagfiles

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 Makefile            |  39 +------------
 rpm/SPECS/tuna.spec | 137 --------------------------------------------
 2 files changed, 3 insertions(+), 173 deletions(-)
 delete mode 100644 rpm/SPECS/tuna.spec

diff --git a/Makefile b/Makefile
index a3d71d2de896..a55821a8f908 100644
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,8 @@
 #
 # SPDX-License-Identifier: GPL-2.0-only
 #
-PACKAGE := tuna
-VERSION := $(shell rpm -q --qf '%{VERSION} ' --specfile rpm/SPECS/$(PACKAGE).spec | cut -d' ' -f1)
-
-rpmdirs:
-	@[ -d rpm/BUILD ]   || mkdir rpm/BUILD
-	@[ -d rpm/RPMS ]    || mkdir rpm/RPMS
-	@[ -d rpm/SRPMS ]   || mkdir rpm/SRPMS
-	@[ -d rpm/SOURCES ] || mkdir rpm/SOURCES
-
-bz2: rpmdirs
-	git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ HEAD | \
-	bzip2 -9 > rpm/SOURCES/$(PACKAGE)-$(VERSION).tar.bz2
-
-rpm: bz2 rpmdirs
-	rpmbuild -ba --define "_topdir $(PWD)/rpm" rpm/SPECS/$(PACKAGE).spec
-
-bz2dev: rpmdirs
-	@mkdir -p /tmp/$(PACKAGE)-$(VERSION)
-	@tar cf - `cat MANIFEST` | (cd /tmp/$(PACKAGE)-$(VERSION) ; tar xf -)
-	@(cd /tmp; tar cf - $(PACKAGE)-$(VERSION)) | bzip2 -9 > rpm/SOURCES/$(PACKAGE)-$(VERSION).tar.bz2
-
-rpmdev: bz2dev rpmdirs
-	rpmbuild -ba --define "_topdir $(PWD)/rpm" rpm/SPECS/$(PACKAGE).spec
-
-po/$(PACKAGE).pot:
-	xgettext -k_ -kN_ -f po/POTFILES.in -o $@
-
-po/%.po: po/$(PACKAGE).pot
-	msgmerge --suffix=.old -U $@ $< && rm -f $@.old
-
-rpmclean:
-	@rm -f rpm/RPMS/*/$(PACKAGE)-$(VERSION)-*.rpm
-	@rm -f rpm/SRPMS/$(PACKAGE)-$(VERSION)-*.src.rpm
-	@rm -f rpm/SOURCES/$(PACKAGE)-$(VERSION).tar.bz2
-	@rm -rf rpm/BUILD/$(PACKAGE)-$(VERSION)*
 
+.PHONY: pyclean
 pyclean:
 	@find . -type f \( -name \*~ -o -name \*.pyc \) -delete
 
@@ -52,4 +18,5 @@ cleantags:
 cleanlogs:
 	rm -rf tuna-20*
 
-clean: pyclean rpmclean
+.PHONY: clean
+clean: pyclean
diff --git a/rpm/SPECS/tuna.spec b/rpm/SPECS/tuna.spec
deleted file mode 100644
index eca96c833265..000000000000
--- a/rpm/SPECS/tuna.spec
+++ /dev/null
@@ -1,137 +0,0 @@
-Name: tuna
-Version: 0.15
-Release: 1%{?dist}
-License: GPLv2
-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/
-BuildArch: noarch
-BuildRequires: python-devel, gettext, desktop-file-utils
-Requires: python-ethtool
-Requires: python-linux-procfs >= 0.6
-# This really should be a Suggests...
-# Requires: python-inet_diag
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-
-%description
-Provides interface for changing scheduler and IRQ tunables, at whole CPU and at
-per thread/IRQ level. Allows isolating CPUs for use by a specific application
-and moving threads and interrupts to a CPU by just dragging and dropping them.
-Operations can be done on CPU sockets, understanding CPU topology.
-
-Can be used as a command line utility without requiring the GUI libraries to be
-installed.
-
-%package -n oscilloscope
-Summary: Generic graphical signal plotting tool
-Group: Applications/System
-Requires: python-matplotlib
-Requires: numpy
-Requires: pygtk2
-Requires: tuna = %{version}-%{release}
-
-%description -n oscilloscope
-Plots stream of values read from standard input on the screen together with
-statistics and a histogram.
-
-Allows to instantly see how a signal generator, such as cyclictest, signaltest
-or even ping, reacts when, for instance, its scheduling policy or real time
-priority is changed, be it using tuna or plain chrt & taskset.
-
-%prep
-%setup -q
-
-%build
-%{python3} setup.py build
-
-%install
-rm -rf %{buildroot}
-%{python3} setup.py install --skip-build --root %{buildroot}
-mkdir -p %{buildroot}/%{_sysconfdir}/tuna/
-mkdir -p %{buildroot}/{%{_bindir},%{_datadir}/tuna/help/kthreads,%{_mandir}/man8}
-mkdir -p %{buildroot}/%{_datadir}/polkit-1/actions/
-install -p -m644 tuna/tuna_gui.glade %{buildroot}/%{_datadir}/tuna/
-install -p -m755 tuna-cmd.py %{buildroot}/%{_bindir}/tuna
-install -p -m755 oscilloscope-cmd.py %{buildroot}/%{_bindir}/oscilloscope
-install -p -m644 help/kthreads/* %{buildroot}/%{_datadir}/tuna/help/kthreads/
-install -p -m644 docs/tuna.8 %{buildroot}/%{_mandir}/man8/
-install -p -m644 etc/tuna/example.conf %{buildroot}/%{_sysconfdir}/tuna/
-install -p -m644 etc/tuna.conf %{buildroot}/%{_sysconfdir}/
-install -p -m644 org.tuna.policy %{buildroot}/%{_datadir}/polkit-1/actions/
-desktop-file-install --dir=%{buildroot}/%{_datadir}/applications tuna.desktop
-
-# l10n-ed message catalogues
-for lng in `cat po/LINGUAS`; do
-        po=po/"$lng.po"
-        mkdir -p %{buildroot}/%{_datadir}/locale/${lng}/LC_MESSAGES
-        msgfmt $po -o %{buildroot}/%{_datadir}/locale/${lng}/LC_MESSAGES/%{name}.mo
-done
-
-%find_lang %name
-
-%clean
-rm -rf %{buildroot}
-
-%files -f %{name}.lang
-%defattr(-,root,root,-)
-%doc ChangeLog
-%if "%{python_ver}" >= "2.5"
-%{python2_sitelib}/*.egg-info
-%endif
-%{_bindir}/tuna
-%{_datadir}/tuna/
-%{python3_sitelib}/tuna/
-%{_mandir}/man8/tuna.8*
-%{_sysconfdir}/tuna.conf
-%{_sysconfdir}/tuna/*
-%{_datadir}/polkit-1/actions/org.tuna.policy
-%{_datadir}/applications/tuna.desktop
-
-%files -n oscilloscope
-%defattr(-,root,root,-)
-%{_bindir}/oscilloscope
-%doc docs/oscilloscope+tuna.html
-%doc docs/oscilloscope+tuna.pdf
-
-%changelog
-* Fri Feb  1 2013 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.10.4-1
-- New upstream release
-
-* Fri Aug 24 2012 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.10.3-1
-- New upstream release
-
-* Thu Jul 28 2011 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.10.2-1
-- New upstream release
-
-* Wed Feb 23 2011 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.10.1-1
-- New upstream release
-
-* Wed Feb 23 2011 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.10-1
-- New upstream release
-
-* Mon May 17 2010 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.9.3-1
-- New upstream release
-- Fixes the folowing bugzilla.redhat.com tickets:
-- 563355 error in tuna --help output
-- 574950 cannot use cpu ranges in the tuna GUI
-- 559770 tuna backtrace when moving threads
-- 563352 tuna backtrace when no thread list is given for --priority
-- 563350 tuna backtrace when scheduler is mis-typed.
-
-* Thu Nov 12 2009 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.9.2-1
-- New upstream release
-
-* Thu Sep 03 2009 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.9.1-1
-- New upstream release
-
-* Wed Aug 26 2009 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.9-3
-- Rewrite the oscilloscope package summary
-- Remove the shebang in tuna/oscilloscope.py
-
-* Mon Aug 17 2009 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.9-2
-- Use install -p
-- Add BuildRequires for gettext
-
-* Fri Jul 10 2009 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.9-1
-- Fedora package reviewing changes: introduce ChangeLog file
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/23] tuna: Don't start the gui if a display is not available
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
  2025-11-07 18:57 ` [PATCH 01/23] Add SPDX license identifiers John Kacur
  2025-11-07 18:57 ` [PATCH 02/23] tuna: Remove spec file from git John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 04/23] tuna: Fix string syntax warnings with raw strings John Kacur
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

This is intended for the main branch of tuna.

Don't start the gui if a display is not available.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna-cmd.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tuna-cmd.py b/tuna-cmd.py
index e953869c4f48..f37e286bffdb 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -736,6 +736,12 @@ def main():
             thread_help(tid)
 
     elif args.command in ['g', 'gui']:
+        # Don't try to start the gui if no display is available
+        display = os.getenv("DISPLAY")
+        if not display:
+            parser.print_help()
+            return
+
         try:
             from tuna import tuna_gui
         except ImportError:
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/23] tuna: Fix string syntax warnings with raw strings
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (2 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 03/23] tuna: Don't start the gui if a display is not available John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 05/23] tuna: Fix help.py syntax warnings John Kacur
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, John B. Wyatt IV, John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

tuna save <filename> allows you to save your kthreads tunables to
a file to be used by rtctl. There were several backslashes that produce
an error that pylint and Python (at least 3.12) gives a SyntaxWarning:
invalid escape sequence

Switch the strings written to the file with raw strings to resolve the
warning for this section of the code.

Tested by comparing the diffs of the files.

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/tuna.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tuna/tuna.py b/tuna/tuna.py
index bd678e2dc7ae..d4c3e2c1a661 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -669,7 +669,7 @@ def generate_rtgroups(filename, kthreads, nr_cpus):
 # The regex is matched against process names as printed by "ps -eo cmd".
 
 ''' % filename)
-    f.write("kthreads:*:1:*:\[.*\]$\n\n")
+    f.write(r"kthreads:*:1:*:\[.*\]$" + "\n\n")
 
     per_cpu_kthreads = []
     names = list(kthreads.keys())
@@ -688,7 +688,7 @@ def generate_rtgroups(filename, kthreads, nr_cpus):
             elif common[:8] == "softirq-":
                 common = "(sirq|softirq)" + common[7:]
                 name = "s" + name[4:]
-            regex = common + "\/.*"
+            regex = common + r"\/.*"
         except:
             idx = 0
             regex = name
@@ -701,9 +701,9 @@ def generate_rtgroups(filename, kthreads, nr_cpus):
         else:
             mask = ",".join([hex(a) for a in \
                      procfs.hexbitmask(kt.affinity, nr_cpus)])
-        f.write("%s:%c:%d:%s:\[%s\]$\n" % (name, \
+        f.write(r"%s:%c:%d:%s:\[%s\]$" % (name, \
                            tuna_sched.sched_str(kt.policy)[6].lower(), \
-                            kt.rtprio, mask, regex))
+                            kt.rtprio, mask, regex) + "\n")
     f.close()
 
 
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/23] tuna: Fix help.py syntax warnings
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (3 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 04/23] tuna: Fix string syntax warnings with raw strings John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 06/23] tuna: help.py John Kacur
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, John B. Wyatt IV, John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

Fix two syntax warnings with what looks like should have been a new line
like the other help entries.

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
- edited commit message
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/help.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tuna/help.py b/tuna/help.py
index fa47ae835962..c913a16f4a40 100644
--- a/tuna/help.py
+++ b/tuna/help.py
@@ -44,7 +44,7 @@ PROC_SYS_HELP = {
 	'net.core.rmem_default':N_('The default setting of the socket receive buffer in bytes.'),
 	'net.core.rmem_max':N_('The maximum receive socket buffer size in bytes.'),
 	'net.core.rps_sock_flow_entries':N_('This controls the maximum number of sockets/flows that the kernel can steer towards any specified CPU. This is a system-wide, shared limit.'),
-	'net.core.somaxconn':N_('Limit of socket listen() backlog, known in userspace as SOMAXCONN. See also tcp_max_syn_backlog for additional tuning for TCP sockets.\Default: 128.'),
+	'net.core.somaxconn':N_('Limit of socket listen() backlog, known in userspace as SOMAXCONN. See also tcp_max_syn_backlog for additional tuning for TCP sockets.\nDefault: 128.'),
 	'net.core.warnings':N_('This controls console messages from the networking stack that can occur because of problems on the network like duplicate address or bad checksums. Normally, this should be enabled, but if the problem persists the messages can be disabled.'),
 	'net.core.wmem_default':N_('The default setting (in bytes) of the socket send buffer.'),
 	'net.core.wmem_max':N_('The maximum send socket buffer size in bytes.'),
@@ -118,7 +118,7 @@ PROC_SYS_HELP = {
 	'net.ipv4.tcp_reordering':N_('Maximal reordering of packets in a TCP stream.\nDefault: 3'),
 	'net.ipv4.tcp_retrans_collapse':N_('Bug-to-bug compatibility with some broken printers. On retransmit try to send bigger packets to work around bugs in certain TCP stacks.'),
 	'net.ipv4.tcp_retries1':N_('This value influences the time, after which TCP decides, that something is wrong due to unacknowledged RTO retransmissions, and reports this suspicion to the network layer.\nRFC 1122 recommends at least 3 retransmissions, which is the default.\nDefault: 3'),
-	'net.ipv4.tcp_retries2':N_('This value influences the timeout of an alive TCP connection, when RTO retransmissions remain unacknowledged. Given a value of N, a hypothetical TCP connection following exponential backoff with an initial RTO of TCP_RTO_MIN would retransmit N times before killing the connection at the (N+1)th RTO. The default value of 15 yields a hypothetical timeout of 924.6 seconds and is a lower bound for the effective timeout. TCP will effectively time out at the first RTO which exceeds the hypothetical timeout. RFC 1122 recommends at least 100 seconds for the timeout,	which corresponds to a value of at least 8.\Default: 8'),
+	'net.ipv4.tcp_retries2':N_('This value influences the timeout of an alive TCP connection, when RTO retransmissions remain unacknowledged. Given a value of N, a hypothetical TCP connection following exponential backoff with an initial RTO of TCP_RTO_MIN would retransmit N times before killing the connection at the (N+1)th RTO. The default value of 15 yields a hypothetical timeout of 924.6 seconds and is a lower bound for the effective timeout. TCP will effectively time out at the first RTO which exceeds the hypothetical timeout. RFC 1122 recommends at least 100 seconds for the timeout,	which corresponds to a value of at least 8.\nDefault: 8'),
 	'net.ipv4.tcp_rfc1337':N_('If set, the TCP stack behaves conforming to RFC1337. If unset, we are not conforming to RFC, but prevent TCP TIME_WAIT assassination.\nDefault: 0'),
 	'net.ipv4.tcp_rmem':N_('Vector of 3 values: min, default, max\n - min: Minimal size of receive buffer used by TCP sockets. It is guaranteed to each TCP socket, even under moderate memory pressure.\nDefault: 8K\n - default: initial size of receive buffer used by TCP sockets. This value overrides net.core.rmem_default used by other protocols. Default: 87380 bytes. This value results in window of 65535 with default setting of tcp_adv_win_scale and tcp_app_win:0 and a bit less for default tcp_app_win. See below about these variables. - max: maximal size of receive buffer allowed for automatically selected receiver buffers for TCP socket. This value does not override net.core.rmem_max.  Calling setsockopt() with SO_RCVBUF disables automatic tuning of that socket\'s receive buffer size, in which case this value is ignored.\nDefault: between 87380B and 4MB, depending on RAM size.'),
 	'net.ipv4.tcp_sack':N_('Enable select acknowledgments (SACKS).'),
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/23] tuna: help.py
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (4 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 05/23] tuna: Fix help.py syntax warnings John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 07/23] tuna: extract common cpu and nics determination code into a utils.py file John Kacur
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

Fix bad indentation in help.py. (Change 8 spaces to 4)

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/help.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tuna/help.py b/tuna/help.py
index c913a16f4a40..db8b4c84df63 100644
--- a/tuna/help.py
+++ b/tuna/help.py
@@ -4,7 +4,7 @@ _ = gettext.gettext
 
 # gettext_noop
 def N_(s):
-        return s
+    return s
 
 KTHREAD_HELP = {
 'kthreadd':N_('Used to create kernel threads via kthread_create(). It is the parent of all the other kernel threads.'),
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/23] tuna: extract common cpu and nics determination code into a utils.py file
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (5 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 06/23] tuna: help.py John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 08/23] tuna: Add idle_state control functionality John Kacur
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, Crystal Wood, John B. Wyatt IV,
	John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

Extracting the code allows these previously local (global to the file)
variables and functions to be used in other files of tuna. Reducing
the number of globals makes the code cleaner and reduces the size of
tuna-cmd.py.

Included a suggestion by Crystal to move a function from the latter
patch into utils.py and make it dependent on get_nr_cpus() (v2).

Included a request by John Kacur to place the SPDX message at the top of
the file (v4).

Suggested-by: Crystal Wood <crwood@redhat.com>

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
- minor spelling error fix
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna-cmd.py   | 34 +++++++---------------------------
 tuna/utils.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 27 deletions(-)
 create mode 100644 tuna/utils.py

diff --git a/tuna-cmd.py b/tuna-cmd.py
index f37e286bffdb..d0323f510750 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -21,7 +21,7 @@ from functools import reduce
 import tuna.new_eth as ethtool
 import tuna.tuna_sched as tuna_sched
 import procfs
-from tuna import tuna, sysfs
+from tuna import tuna, sysfs, utils
 import logging
 import time
 import shutil
@@ -76,7 +76,6 @@ except:
 
 # FIXME: ETOOMANYGLOBALS, we need a class!
 
-nr_cpus = None
 ps = None
 irqs = None
 
@@ -233,25 +232,6 @@ def gen_parser():
     return parser
 
 
-def get_nr_cpus():
-    """ Get all cpus including disabled cpus """
-    global nr_cpus
-    if nr_cpus:
-        return nr_cpus
-    nr_cpus = os.sysconf('SC_NPROCESSORS_CONF')
-    return nr_cpus
-
-nics = None
-
-
-def get_nics():
-    global nics
-    if nics:
-        return nics
-    nics = ethtool.get_active_devices()
-    return nics
-
-
 def thread_help(tid):
     global ps
     if not ps:
@@ -277,7 +257,7 @@ def save(cpu_list, thread_list, filename):
         if (cpu_list and not set(kt.affinity).intersection(set(cpu_list))) or \
            (thread_list and kt.pid not in thread_list):
             del kthreads[name]
-    tuna.generate_rtgroups(filename, kthreads, get_nr_cpus())
+    tuna.generate_rtgroups(filename, kthreads, utils.get_nr_cpus())
 
 
 def ps_show_header(has_ctxt_switch_info, cgroups=False):
@@ -328,7 +308,7 @@ def format_affinity(affinity):
     if len(affinity) <= 4:
         return ",".join(str(a) for a in affinity)
 
-    return ",".join(str(hex(a)) for a in procfs.hexbitmask(affinity, get_nr_cpus()))
+    return ",".join(str(hex(a)) for a in procfs.hexbitmask(affinity, utils.get_nr_cpus()))
 
 def ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info, sock_inodes,
                    sock_inode_re, cgroups, columns=None, compact=True):
@@ -351,7 +331,7 @@ def ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info, sock_inodes,
                 irqs = procfs.interrupts()
             users = irqs[tuna.irq_thread_number(cmd)]["users"]
             for u in users:
-                if u in get_nics():
+                if u in utils.get_nics():
                     users[users.index(u)] = "%s(%s)" % (
                         u, ethtool.get_module(u))
             users = ",".join(users)
@@ -486,7 +466,7 @@ def do_ps(thread_list, cpu_list, irq_list, show_uthreads, show_kthreads,
 
 
 def find_drivers_by_users(users):
-    nics = get_nics()
+    nics = utils.get_nics()
     drivers = []
     for u in users:
         try:
@@ -689,10 +669,10 @@ def main():
         apply_config(args.profilename)
 
     elif args.command in ['include', 'I']:
-        tuna.include_cpus(args.cpu_list, get_nr_cpus())
+        tuna.include_cpus(args.cpu_list, utils.get_nr_cpus())
 
     elif args.command in ['isolate', 'i']:
-        tuna.isolate_cpus(args.cpu_list, get_nr_cpus())
+        tuna.isolate_cpus(args.cpu_list, utils.get_nr_cpus())
 
     elif args.command in ['run', 'r']:
 
diff --git a/tuna/utils.py b/tuna/utils.py
new file mode 100644
index 000000000000..f55432dbbbb0
--- /dev/null
+++ b/tuna/utils.py
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0-only
+# Copyright (C) 2024 John B. Wyatt IV
+
+import os
+
+import tuna.new_eth as ethtool
+
+# Collect a few globals and functions so they can be reused in other modules
+nr_cpus = None
+nics = None
+
+def get_nr_cpus():
+    """ Get all cpus including disabled cpus """
+    global nr_cpus
+    if nr_cpus != None:
+        return nr_cpus
+    nr_cpus = os.sysconf('SC_NPROCESSORS_CONF')
+    return nr_cpus
+
+def get_all_cpu_list():
+    return list(range(get_nr_cpus()))
+
+def get_nics():
+    global nics
+    if nics != None:
+        return nics
+    nics = ethtool.get_active_devices()
+    return nics
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/23] tuna: Add idle_state control functionality
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (6 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 07/23] tuna: extract common cpu and nics determination code into a utils.py file John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 09/23] tuna: utils: A few tweaks John Kacur
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, John Kacur, John B. Wyatt IV

From: "John B. Wyatt IV" <jwyatt@redhat.com>

Allows Tuna to control cpu idle-state functionality on the system,
including querying, enabling, disabling of cpu idle-states to control
power usage or to test functionality.

This requires cpupower, a utility in the Linux kernel repository and
the cpupower Python bindings added in Linux 6.12 to control cpu
idle-states.

This patch revision includes text snippet & Python suggestions by Crystal
Wood (v2-4) and small Python suggestions & code snippets by John Kacur
(v3-5).

Suggested-by: John Kacur <jkacur@redhat.com>

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna-cmd.py      |  30 +++++++-
 tuna/cpupower.py | 177 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 204 insertions(+), 3 deletions(-)
 create mode 100755 tuna/cpupower.py

diff --git a/tuna-cmd.py b/tuna-cmd.py
index d0323f510750..4997eaa5de92 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -25,6 +25,7 @@ from tuna import tuna, sysfs, utils
 import logging
 import time
 import shutil
+import tuna.cpupower as cpw
 
 def get_loglevel(level):
     if level.isdigit() and int(level) in range(0,5):
@@ -115,8 +116,12 @@ def gen_parser():
             "disable_perf": dict(action='store_true', help="Explicitly disable usage of perf in GUI for process view"),
             "refresh": dict(default=2500, metavar='MSEC', type=int, help="Refresh the GUI every MSEC milliseconds"),
             "priority": dict(default=(None, None), metavar="POLICY:RTPRIO", type=tuna.get_policy_and_rtprio, help="Set thread scheduler tunables: POLICY and RTPRIO"),
-            "background": dict(action='store_true', help="Run command as background task")
-         }
+            "background": dict(action='store_true', help="Run command as background task"),
+            "idle_info": dict(dest='idle_info', action='store_const', const=True, help='Print general idle information for the selected CPUs, including index values for IDLE-STATE.'),
+            "idle_state_disabled_status": dict(dest='idle_state_disabled_status', metavar='IDLE-STATE', type=int, help='Print whether IDLE-STATE is enabled on the selected CPUs.'),
+            "disable_idle_state": dict(dest='disable_idle_state', metavar='IDLE-STATE', type=int, help='Disable IDLE-STATE on the selected CPUs.'),
+            "enable_idle_state": dict(dest='enable_idle_state', metavar='IDLE-STATE', type=int, help='Enable IDLE-STATE on the selected CPUs.')
+    }
 
     parser = HelpMessageParser(description="tuna - Application Tuning Program")
 
@@ -127,6 +132,9 @@ def gen_parser():
 
     subparser = parser.add_subparsers(dest='command')
 
+    idle_set = subparser.add_parser('cpu_power',
+                                    description='Manage CPU idle state disabling (requires libcpupower and it\'s Python bindings)',
+                                    help='Set all idle states on a given CPU-LIST.')
     isolate = subparser.add_parser('isolate', description="Move all allowed threads and IRQs away from CPU-LIST",
                                     help="Move all allowed threads and IRQs away from CPU-LIST")
     include = subparser.add_parser('include', description="Allow all threads to run on CPU-LIST",
@@ -146,7 +154,6 @@ def gen_parser():
     show_threads = subparser.add_parser('show_threads', description='Show thread list', help='Show thread list')
     show_irqs = subparser.add_parser('show_irqs', description='Show IRQ list', help='Show IRQ list')
     show_configs = subparser.add_parser('show_configs', description='List preloaded profiles', help='List preloaded profiles')
-
     what_is = subparser.add_parser('what_is', description='Provides help about selected entities', help='Provides help about selected entities')
     gui = subparser.add_parser('gui', description="Start the GUI", help="Start the GUI")
 
@@ -218,6 +225,13 @@ def gen_parser():
     show_irqs_group.add_argument('-S', '--sockets', **MODS['sockets'])
     show_irqs.add_argument('-q', '--irqs', **MODS['irqs'])
 
+    idle_set_group = idle_set.add_mutually_exclusive_group(required=True)
+    idle_set_group.add_argument('-i', '--idle-info', **MODS['idle_info'])
+    idle_set_group.add_argument('-s', '--status', **MODS['idle_state_disabled_status'])
+    idle_set_group.add_argument('-d', '--disable', **MODS['disable_idle_state'])
+    idle_set_group.add_argument('-e', '--enable', **MODS['enable_idle_state'])
+    idle_set.add_argument('-c', '--cpus', **MODS['cpus'])
+
     what_is.add_argument('thread_list', **POS['thread_list'])
 
     gui.add_argument('-d', '--disable_perf', **MODS['disable_perf'])
@@ -647,6 +661,16 @@ def main():
             print("Valid log levels: NOTSET, DEBUG, INFO, WARNING, ERROR")
             print("Log levels may be specified numerically (0-4)\n")
 
+    if args.command == 'cpu_power':
+        if not cpw.have_cpupower:
+            print(f"Error: libcpupower bindings are not detected; please install libcpupower bindings from at least kernel {cpw.cpupower_required_kernel}.", file=sys.stderr)
+            sys.exit(1)
+
+        my_cpupower = cpw.Cpupower(args.cpu_list)
+        ret = my_cpupower.idle_set_handler(args)
+        if ret > 0:
+            sys.exit(ret)
+
     if 'irq_list' in vars(args):
         ps = procfs.pidstats()
         if tuna.has_threaded_irqs(ps):
diff --git a/tuna/cpupower.py b/tuna/cpupower.py
new file mode 100755
index 000000000000..ec04b908855a
--- /dev/null
+++ b/tuna/cpupower.py
@@ -0,0 +1,177 @@
+# SPDX-License-Identifier: GPL-2.0-only
+# Copyright (C) 2025 John B. Wyatt IV
+
+import sys
+from typing import List
+from tuna import utils
+
+cpupower_required_kernel = "6.12"
+have_cpupower = None
+
+try:
+    import raw_pylibcpupower as lcpw
+    lcpw.cpufreq_get_available_frequencies(0)
+    have_cpupower = True
+except ImportError:
+    lcpw = None
+    have_cpupower = False
+
+if have_cpupower:
+    class Cpupower:
+        """The Cpupower class allows you to query and change the power states of the
+        cpu.
+
+        You may query or change the cpus all at once or a list of the cpus provided to the constructor's cpulist argument.
+
+        The bindings must be detected on the $PYTHONPATH variable.
+
+        You must use have_cpupower variable to determine if the bindings were
+        detected in your code."""
+
+        LCPW_ERROR_TWO_CASE = 1 # enum for common error messages
+        LCPW_ERROR_THREE_CASE = 2
+
+        def __init__(self, cpu_list=None):
+            if cpu_list and not cpu_list == []:
+                self.__cpu_list = cpu_list
+            else:
+                self.__cpu_list = utils.get_all_cpu_list()
+
+        def handle_common_lcpw_errors(self, e, error_type, idle_name):
+            match e:
+                case 0:
+                    pass
+                case -1:
+                    print(f"Idlestate {idle_name} not available", file=sys.stderr)
+                case -2:
+                    print("Disabling is not supported by the kernel", file=sys.stderr)
+                case -3:
+                    if error_type == Cpupower.LCPW_ERROR_THREE_CASE:
+                        print("No write access to disable/enable C-states: try using sudo", file=sys.stderr)
+                    else:
+                        print(f"Not documented: {e}", file=sys.stderr)
+                case _:
+                    print(f"Not documented: {e}", file=sys.stderr)
+
+        def get_idle_states(self, cpu):
+            """
+            Get the c-states of a cpu.
+
+            You can capture the return values with:
+            states_list, states_amt = get_idle_states()
+
+            Returns
+                List[String]: list of cstates
+                Int: amt of cstates
+            """
+            ret = []
+            for cstate in range(lcpw.cpuidle_state_count(cpu)):
+                ret.append(lcpw.cpuidle_state_name(cpu,cstate))
+            return ret, lcpw.cpuidle_state_count(cpu)
+
+        def get_idle_info(self, cpu):
+            idle_states, idle_states_amt = self.get_idle_states(cpu)
+            idle_states_list = []
+            for idle_state, idle_state_name in enumerate(idle_states):
+                idle_states_list.append(
+                    {
+                        "CPU ID": cpu,
+                        "Idle State Name": idle_state_name,
+                        "Flags/Description": lcpw.cpuidle_state_desc(cpu, idle_state),
+                        "Latency": lcpw.cpuidle_state_latency(cpu, idle_state),
+                        "Usage": lcpw.cpuidle_state_usage(cpu, idle_state),
+                        "Duration": lcpw.cpuidle_state_time(cpu, idle_state)
+                    }
+                )
+            idle_info = {
+                "CPUidle-driver": lcpw.cpuidle_get_driver(),
+                "CPUidle-governor": lcpw.cpuidle_get_governor(),
+                "idle-states-count": idle_states_amt,
+                "available-idle-states": idle_states,
+                "cpu-states": idle_states_list
+            }
+            return idle_info
+
+        def print_idle_info(self, cpu_list):
+            for cpu in cpu_list:
+                idle_info = self.get_idle_info(cpu)
+                print(
+f"""CPUidle driver: {idle_info["CPUidle-driver"]}
+CPUidle governor: {idle_info["CPUidle-governor"]}
+analyzing CPU {cpu}
+
+Number of idle states: {idle_info["idle-states-count"]}
+Available idle states: {idle_info["available-idle-states"]}""")
+                for state in idle_info["cpu-states"]:
+                    print(
+f"""{state["Idle State Name"]}
+Flags/Description: {state["Flags/Description"]}
+Latency: {state["Latency"]}
+Usage: {state["Usage"]}
+Duration: {state["Duration"]}""")
+
+        def idle_set_handler(self, args) -> int:
+            if args.idle_state_disabled_status is not None:
+                cstate_index = args.idle_state_disabled_status
+                cstate_list, cstate_amt = self.get_idle_states(self.__cpu_list[0]) # Assuming all cpus have the same idle state
+                if cstate_index < 0 or cstate_index >= cstate_amt:
+                    print(f"Invalid idle state range. Total for this cpu is {cstate_amt}", file=sys.stderr)
+                    return 1
+                cstate_name = cstate_list[cstate_index]
+                ret = self.is_disabled_idle_state(cstate_index)
+                for i,e in enumerate(ret):
+                    if e == 1:
+                        print(f"CPU: {self.__cpu_list[i]} Idle state \"{cstate_name}\" is disabled.")
+                    elif e == 0:
+                        print(f"CPU: {self.__cpu_list[i]} Idle state \"{cstate_name}\" is enabled.")
+                    else:
+                        self.handle_common_lcpw_errors(e, self.LCPW_ERROR_TWO_CASE, cstate_name)
+            elif args.idle_info is not None:
+                self.print_idle_info(self.__cpu_list)
+                return 0
+            elif args.disable_idle_state is not None:
+                cstate_index = args.disable_idle_state
+                cstate_list, cstate_amt = self.get_idle_states(self.__cpu_list[0]) # Assuming all cpus have the same idle state
+                if cstate_index < 0 or cstate_index >= cstate_amt:
+                    print(f"Invalid idle state range. Total for this cpu is {cstate_amt}")
+                    return 1
+                cstate_name = cstate_list[cstate_index]
+                ret = self.disable_idle_state(cstate_index, 1)
+                for e in ret:
+                    self.handle_common_lcpw_errors(e, self.LCPW_ERROR_THREE_CASE, cstate_name)
+            elif args.enable_idle_state is not None:
+                cstate_index = args.enable_idle_state
+                cstate_list, cstate_amt = self.get_idle_states(self.__cpu_list[0]) # Assuming all cpus have the same idle state
+                if cstate_index < 0 or cstate_index >= cstate_amt:
+                    print(f"Invalid idle state range. Total for this cpu is {cstate_amt}")
+                    return 1
+                cstate_name = cstate_list[cstate_index]
+                ret = self.disable_idle_state(cstate_index, 0)
+                for e in ret:
+                    self.handle_common_lcpw_errors(e, self.LCPW_ERROR_THREE_CASE, cstate_name)
+            return 0
+
+        def disable_idle_state(self, state, disabled) -> List[int]:
+            """
+            Disable or enable an idle state using the object's stored list of cpus.
+
+            Args:
+                state (int): The cpu idle state index to disable or enable as an int starting from 0.
+                disabled (int): set to 1 to disable or 0 to enable. Less than 0 is an error.
+            """
+            ret = []
+            for cpu in self.__cpu_list:
+                ret.append(lcpw.cpuidle_state_disable(cpu, state, disabled))
+            return ret
+
+        def is_disabled_idle_state(self, state) -> List[int]:
+            """
+            Query the idle state.
+
+            Args:
+                state: The cpu idle state. 1 is disabled, 0 is enabled. Less than 0 is an error.
+            """
+            ret = []
+            for cpu in self.__cpu_list:
+                ret.append(lcpw.cpuidle_is_state_disabled(cpu, state))
+            return ret
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/23] tuna: utils: A few tweaks
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (7 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 08/23] tuna: Add idle_state control functionality John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 10/23] tuna: Add Pyright helper John Kacur
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

- Change copyright to 2025
- Use is not None instead of !=
- Add a few document strings

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/utils.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tuna/utils.py b/tuna/utils.py
index f55432dbbbb0..75900bde3d51 100644
--- a/tuna/utils.py
+++ b/tuna/utils.py
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
-# Copyright (C) 2024 John B. Wyatt IV
+# Copyright (C) 2025 John B. Wyatt IV
+""" Module to return cpus and nics """
 
 import os
-
 import tuna.new_eth as ethtool
 
 # Collect a few globals and functions so they can be reused in other modules
@@ -12,17 +12,19 @@ nics = None
 def get_nr_cpus():
     """ Get all cpus including disabled cpus """
     global nr_cpus
-    if nr_cpus != None:
+    if nr_cpus is not None:
         return nr_cpus
     nr_cpus = os.sysconf('SC_NPROCESSORS_CONF')
     return nr_cpus
 
 def get_all_cpu_list():
+    """ Return a list of all cpus """
     return list(range(get_nr_cpus()))
 
 def get_nics():
+    """ Return a list of network devices """
     global nics
-    if nics != None:
+    if nics is not None:
         return nics
     nics = ethtool.get_active_devices()
     return nics
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/23] tuna: Add Pyright helper
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (8 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 09/23] tuna: utils: A few tweaks John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 11/23] tuna: Update man page with cpu_power command John Kacur
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, John B. Wyatt IV, John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

Pyright is a common tool to assist with linting and finding errors in
Python programs with an LSP like Visual Studio Code, Neovim, and Emacs. _("")
syntax convention is used by gettext for translations and is a common default
but Pyright needs to be set to not give an error for it. Add __builtins__.pyi
with the _() convention to satisfy Pyright.

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 __builtins__.pyi | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 __builtins__.pyi

diff --git a/__builtins__.pyi b/__builtins__.pyi
new file mode 100644
index 000000000000..0e3a4b2d50e8
--- /dev/null
+++ b/__builtins__.pyi
@@ -0,0 +1 @@
+def _(s: str) -> str: ...
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/23] tuna: Update man page with cpu_power command
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (9 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 10/23] tuna: Add Pyright helper John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 12/23] tuna: Fix show_threads -t and show_irqs -q John Kacur
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, John B. Wyatt IV, John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

[1] added support for the Python libcpupower bindings to control the
cpu power state. This patch documents those changes.

[1]
https://lore.kernel.org/linux-rt-users/20250409193136.44411-1-jwyatt@redhat.com/

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 docs/tuna.8 | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/docs/tuna.8 b/docs/tuna.8
index 242389455f83..6e30537e9509 100644
--- a/docs/tuna.8
+++ b/docs/tuna.8
@@ -24,6 +24,24 @@ Log application details to file for given LOG-LEVEL
 Print DEBUG level logging details to console
 .SH "COMMANDS"
 .TP
+\fBtuna cpu_power\fR
+usage: tuna-cmd.py cpu_power [-h] (-c CPU-LIST)
+
+Set or query the idle (power) states of all or a selection of cpus in the CPU-LIST. Modifiers \fB\-c\fR may be used to pass the CPU-LIST of cpus to perform the command on.
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -i, --idle-info       Print general idle information for the selected CPUs, including
+                        index values for IDLE-STATE.
+  -s, --status IDLE-STATE
+                        Print whether IDLE-STATE is enabled on the selected CPUs.
+  -d, --disable IDLE-STATE
+                        Disable IDLE-STATE on the selected CPUs.
+  -e, --enable IDLE-STATE
+                        Enable IDLE-STATE on the selected CPUs.
+  -c CPU-LIST, --cpus CPU-LIST
+                        CPU-LIST affected by commands
+.TP
 \fBtuna isolate\fR
 usage: tuna-cmd.py isolate [-h] (-c CPU-LIST | -S CPU-SOCKET-LIST | -N)
 
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/23] tuna: Fix show_threads -t and show_irqs -q
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (10 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 11/23] tuna: Update man page with cpu_power command John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 13/23] tuna: Fix run command failing to apply BATCH policy John Kacur
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

Fix show_threads -t and show_irqs -q to not match everything if there is
no match.

jkacur@fionn:~/src/tuna$ ./tuna-cmd.py show_threads | wc -l
428
jkacur@fionn:~/src/tuna$ ./tuna-cmd.py show_threads -t "nosuchthread" | wc -l
0
jkacur@fionn:~/src/tuna$ ./tuna-cmd.py show_threads -t "Isolated*" | wc -l
55

jkacur@fionn:~/src/tuna$ ./tuna-cmd.py show_irqs -q "iwlwifi*" | wc -l
14
jkacur@fionn:~/src/tuna$ ./tuna-cmd.py show_irqs | wc -l
58
jkacur@fionn:~/src/tuna$ ./tuna-cmd.py show_irqs -q "nosuchirq" | wc -l
0

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna-cmd.py | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/tuna-cmd.py b/tuna-cmd.py
index 4997eaa5de92..9496c61f0c2b 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -79,6 +79,7 @@ except:
 
 ps = None
 irqs = None
+match_requested = False
 
 class HelpMessageParser(argparse.ArgumentParser):
     def error(self, message):
@@ -391,6 +392,8 @@ def ps_show(ps, affect_children, thread_list, cpu_list,
             irq_list_numbers, show_uthreads, show_kthreads,
             has_ctxt_switch_info, sock_inodes, sock_inode_re, cgroups, compact):
 
+    global match_requested
+
     ps_list = []
     for pid in list(ps.keys()):
         iskth = tuna.iskthread(pid)
@@ -422,7 +425,11 @@ def ps_show(ps, affect_children, thread_list, cpu_list,
             raise e
         if cpu_list and not set(cpu_list).intersection(set(affinity)):
             continue
-        ps_list.append(pid)
+        if match_requested and thread_list and pid in thread_list:
+            ps_list.append(pid)
+        elif not match_requested:
+            ps_list.append(pid)
+
 
     ps_list.sort()
 
@@ -498,6 +505,7 @@ def find_drivers_by_users(users):
 
 def show_irqs(irq_list, cpu_list):
     global irqs
+    global match_requested
     if not irqs:
         irqs = procfs.interrupts()
 
@@ -515,7 +523,11 @@ def show_irqs(irq_list, cpu_list):
 
         if cpu_list and not set(cpu_list).intersection(set(affinity)):
             continue
-        sorted_irqs.append(irqn)
+
+        if match_requested and irq_list and irqn in irq_list:
+            sorted_irqs.append(irqn)
+        elif not match_requested:
+            sorted_irqs.append(irqn)
 
     sorted_irqs.sort()
     for irq in sorted_irqs:
@@ -540,6 +552,9 @@ def do_list_op(op, current_list, op_list):
 
 def threadstring_to_list(threadstr):
     global ps
+    global match_requested
+    if threadstr:
+        match_requested = True
     thread_list = []
     thread_strings = list(set(threadstr.split(',')))
     for s in thread_strings:
@@ -555,6 +570,9 @@ def threadstring_to_list(threadstr):
 
 def irqstring_to_list(irqstr):
 
+    global match_requested
+    if irqstr:
+        match_requested = True
     irq_list = []
     irq_strings = list(set(irqstr.split(',')))
     for s in irq_strings:
@@ -636,6 +654,7 @@ def nohz_full_to_cpu():
               _(" needs nohz_full=cpulist on the kernel command line"))
         sys.exit(2)
 
+
 def main():
     global ps
 
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 13/23] tuna: Fix run command failing to apply BATCH policy
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (11 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 12/23] tuna: Fix show_threads -t and show_irqs -q John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 14/23] tuna: Add -U and -K to the move command John Kacur
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

When using tuna run with -p BATCH the newly spawned process is created
with SCHED_OTHER instead of SCHED_BATCH

Fix this by calling thread_set_priority if the policy is not zero

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/tuna.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tuna/tuna.py b/tuna/tuna.py
index d4c3e2c1a661..1380df0dadba 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -621,7 +621,7 @@ def run_command(cmd, policy, rtprio, cpu_list, background):
     if newpid == 0:
         cmd_list = shlex.split(cmd)
         pid = os.getpid()
-        if rtprio:
+        if rtprio or policy:
             try:
                 thread_set_priority(pid, policy, rtprio)
             except (SystemError, OSError) as err:
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 14/23] tuna: Add -U and -K to the move command
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (12 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 13/23] tuna: Fix run command failing to apply BATCH policy John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 15/23] tuna: Add -U and -K to the spread command John Kacur
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

Add the following options to the move command (like in the show_threads
command)
  -U, --no_uthreads     Operations will not affect user threads
  -K, --no_kthreads     Operations will not affect kernel threads

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna-cmd.py  | 4 +++-
 tuna/tuna.py | 7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tuna-cmd.py b/tuna-cmd.py
index 9496c61f0c2b..d0a3e6b7dbf8 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -174,6 +174,8 @@ def gen_parser():
     move_group.add_argument('-N', '--nohz_full', **MODS['nohz_full'])
     move.add_argument('-t', '--threads', **MODS['threads'])
     move.add_argument('-q', '--irqs', **MODS['irqs'])
+    move.add_argument('-U', '--no_uthreads', **MODS['no_uthreads'])
+    move.add_argument('-K', '--no_kthreads', **MODS['no_kthreads'])
 
     spread_group = spread.add_mutually_exclusive_group(required=True)
     spread_group.add_argument('-c', '--cpus', **MODS['cpus'])
@@ -746,7 +748,7 @@ def main():
             parser.error(f"tuna: {args.command} requires a thread/irq list!\n")
 
         if args.thread_list:
-            tuna.move_threads_to_cpu(args.cpu_list, args.thread_list, spread=spread)
+            tuna.move_threads_to_cpu(args.cpu_list, args.thread_list, args.uthreads, args.kthreads, spread=spread)
 
         if args.irq_list:
             tuna.move_irqs_to_cpu(args.cpu_list, args.irq_list, spread=spread)
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 1380df0dadba..ef60c033362d 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -174,7 +174,7 @@ def is_hardirq_handler(self, pid):
     except:
         return False
 
-def move_threads_to_cpu(cpus, pid_list, set_affinity_warning=None, spread=False):
+def move_threads_to_cpu(cpus, pid_list, show_uthreads, show_kthreads, set_affinity_warning=None, spread=False):
     changed = False
 
     ps = procfs.pidstats()
@@ -183,6 +183,11 @@ def move_threads_to_cpu(cpus, pid_list, set_affinity_warning=None, spread=False)
     new_affinity = cpus
     last_cpu = max(cpus) + 1
     for pid in pid_list:
+        iskth = iskthread(pid)
+        if not show_uthreads and not iskth:
+            continue
+        if not show_kthreads and iskth:
+            continue
         if spread:
             new_affinity = [cpus[cpu_idx]]
             cpu_idx += 1
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 15/23] tuna: Add -U and -K to the spread command
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (13 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 14/23] tuna: Add -U and -K to the move command John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 16/23] tuna: replace match with if statements John Kacur
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

commit 4e10e5b34593052e6ce4a166796b10c72f978efd
add the feature
	-U, --no_uthreads	Operations will not affect user threads
	-K, --no_kthreads	Operations will not affect kernel
threads

to the move command

This also works for the spread command but the arguments need to be
added. Without this you also get an
AttributeError: 'Namespace' object has no attribute 'uthreads'

Fix this by adding the options to the spread group for argparse.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna-cmd.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tuna-cmd.py b/tuna-cmd.py
index d0a3e6b7dbf8..9f5ce918054d 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -183,6 +183,8 @@ def gen_parser():
     spread_group.add_argument('-N', '--nohz_full', **MODS['nohz_full'])
     spread.add_argument('-t', '--threads', **MODS['threads'])
     spread.add_argument('-q', '--irqs', **MODS['irqs'])
+    spread.add_argument('-U', '--no_uthreads', **MODS['no_uthreads'])
+    spread.add_argument('-K', '--no_kthreads', **MODS['no_kthreads'])
 
     priority.add_argument('priority', **POS['priority'])
     priority.add_argument('-t', '--threads', **MODS['threads'], required=True)
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 16/23] tuna: replace match with if statements
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (14 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 15/23] tuna: Add -U and -K to the spread command John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 17/23] tuna: Proofreading fixes John Kacur
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John B. Wyatt IV, John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

The match-case keyword statements were introduced in Python 3.10.
This patch will accomodate older distributions that only have Python 3.9
This patch will make it easier for older distributions to use newer versions
of Tuna.

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
- modified commit message
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/cpupower.py | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/tuna/cpupower.py b/tuna/cpupower.py
index ec04b908855a..ecb2507b2127 100755
--- a/tuna/cpupower.py
+++ b/tuna/cpupower.py
@@ -38,20 +38,19 @@ if have_cpupower:
                 self.__cpu_list = utils.get_all_cpu_list()
 
         def handle_common_lcpw_errors(self, e, error_type, idle_name):
-            match e:
-                case 0:
-                    pass
-                case -1:
-                    print(f"Idlestate {idle_name} not available", file=sys.stderr)
-                case -2:
-                    print("Disabling is not supported by the kernel", file=sys.stderr)
-                case -3:
-                    if error_type == Cpupower.LCPW_ERROR_THREE_CASE:
-                        print("No write access to disable/enable C-states: try using sudo", file=sys.stderr)
-                    else:
-                        print(f"Not documented: {e}", file=sys.stderr)
-                case _:
+            if e == 0:
+                pass
+            elif e == -1:
+                print(f"Idlestate {idle_name} not available", file=sys.stderr)
+            elif e == -2:
+                print("Disabling is not supported by the kernel", file=sys.stderr)
+            elif e == -3:
+                if error_type == Cpupower.LCPW_ERROR_THREE_CASE:
+                    print("No write access to disable/enable C-states: try using sudo", file=sys.stderr)
+                else:
                     print(f"Not documented: {e}", file=sys.stderr)
+            else:
+                print(f"Not documented: {e}", file=sys.stderr)
 
         def get_idle_states(self, cpu):
             """
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 17/23] tuna: Proofreading fixes
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (15 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 16/23] tuna: replace match with if statements John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 18/23] tuna: Remove broken testuna John Kacur
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, John B. Wyatt IV, John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

Fix some small proofreading errors.

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 etc/tuna/example.conf   | 2 +-
 tuna/gui/profileview.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/etc/tuna/example.conf b/etc/tuna/example.conf
index 7bb293e3d2ed..0d3353f4132f 100644
--- a/etc/tuna/example.conf
+++ b/etc/tuna/example.conf
@@ -55,5 +55,5 @@ 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 contains some features for tuning kernel params. Mainly this is an example file for demonstrating Tuna's new features. Params are set as default or the most used value.
 
diff --git a/tuna/gui/profileview.py b/tuna/gui/profileview.py
index 7570bc0e57ce..e5022b8b6dc1 100644
--- a/tuna/gui/profileview.py
+++ b/tuna/gui/profileview.py
@@ -104,7 +104,7 @@ class profileview:
                         "%s\n\n%s\n%s" % \
                         (_("Config file was changed!"),
                          _("All changes will be lost"),
-                         _("Realy continue?"),))
+                         _("Really continue?"),))
                 ret = dialog.run()
                 dialog.destroy()
                 if ret == Gtk.ResponseType.NO:
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 18/23] tuna: Remove broken testuna
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (16 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 17/23] tuna: Proofreading fixes John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 19/23] tuna: Fix setting a realtime scheduling policy John Kacur
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Clark Williams, John B. Wyatt IV, John B. Wyatt IV, John Kacur

From: "John B. Wyatt IV" <jwyatt@redhat.com>

This script relies on the older, incompatible Tuna syntax, and
rtctl which is no longer packaged for most distributions. No one
has complained so remove it since the changes to update it would
be extensive with no users.

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 testuna | 230 --------------------------------------------------------
 1 file changed, 230 deletions(-)
 delete mode 100755 testuna

diff --git a/testuna b/testuna
deleted file mode 100755
index cb98640c0167..000000000000
--- a/testuna
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/bin/bash
-# Regression tests for tuna
-# (c) 2008 Red Hat Inc.
-# Arnaldo Carvalho de Melo <acme@redhat.com>
-# SPDX-License-Identifier: GPL-2.0-only
-
-dprint() {
-	[ -n "$VERBOSE" ] && echo $1
-}
-
-ktpidof() {
-	echo $(ps ax -To pid,cmd | grep "\[$1.*\]" | head -1 | cut -d'[' -f 1)
-}
-
-get_rtprio() {
-	echo $(chrt -p $1 | grep priority | cut -d ':' -f 2)
-}
-
-get_policy() {
-	echo $(chrt -p $1 | grep policy | cut -d ':' -f 2)
-}
-
-get_affinity() {
-	echo $(taskset -p $1 | grep 'current affinity' | cut -d ':' -f 2)
-}
-
-get_nr_processors() {
-	echo $(grep -i "^processor.*: " /proc/cpuinfo | tail -1 | cut -d ':' -f 2)
-}
-
-get_nr_cpu_sockets() {
-	echo $(grep "^physical id" /proc/cpuinfo | cut -d: -f2 | sort -u | wc -l)
-}
-
-die() {
-	[ -z "$VERBOSE" ] && echo -n "$2: "
-	echo $1
-	rtctl --file $INITIAL reset
-	taskset -p $INITIAL_INIT_AFFINITY 1 > /dev/null
-	rm -rf $TESTUNA_DIR
-	exit 1
-}
-
-die_with_a_diff() {
-	[ -n "$VERBOSE" ] && diff -u $INITIAL $NEW
-	die "$1"
-}
-
-tuna_save() {
-	tuna --save $TEMPCONF
-	grep -v '^# rtctl --file ' $TEMPCONF > $1
-	rm -f $TEMPCONF
-}
-
-die_if_not_saved() {
-	dprint "$2"
-	tuna_save $NEW
-	(diff -u $INITIAL $NEW | diffstat | \
-	grep -q "[ \t]*1 file changed, $1 insertions*(+), $1 deletions*(-)") ||
-	die_with_a_diff 'FAILED!' "$2"
-}
-
-die_if_conf_changed() {
-	dprint "$1"
-	tuna_save $NEW
-	diff -qu $INITIAL $NEW > /dev/null || die_with_a_diff 'FAILED!' "$1":
-}
-
-die_if_zero() {
-	dprint "$2"
-	[ $1 -eq 0 ] && die 'FAILED!' "$2"
-}
-
-die_if_not_zero() {
-	dprint "$2"
-	[ $1 -ne 0 ] && die 'FAILED!' "$2"
-}
-
-die_if_not_equal() {
-	dprint "$3"
-	[ $1 -ne $2 ] && die 'FAILED!' "$3"
-}
-
-die_if_not_str_equal() {
-	dprint "$3"
-	[ $1 != $2 ] && die 'FAILED!' "$3"
-}
-
-TESTUNA_DIR=$(mktemp -d -t testuna.XXXXXX) || exit 1
-INITIAL=$TESTUNA_DIR/initial.tuna
-INITIAL_INIT_AFFINITY=$(get_affinity 1)
-TEMPCONF=$TESTUNA_DIR/tempnew.tuna
-NEW=$TESTUNA_DIR/new.tuna
-
-[ $# -eq 1 ] && VERBOSE=1
-
-dprint "Saving initial configuration"
-
-tuna_save $INITIAL
-
-TUNA_RPM_VERSION=$(rpm -q --qf "%{version}\n" tuna)
-TUNA_BIN_VERSION=$(tuna --version)
-die_if_not_str_equal "$TUNA_RPM_VERSION" "$TUNA_BIN_VERSION" \
-	"Verifying --version ($TUNA_BIN_VERSION) matches package version ($TUNA_RPM_VERSION)"
-
-rtctl --file $INITIAL reset
-
-die_if_conf_changed "Replaying initial config"
-
-PID=$(ktpidof "watchdog")
-RTPRIO=$(get_rtprio $PID)
-POLICY=$(get_policy $PID)
-POLICY=$(echo ${POLICY:6:1} | tr 'A-Z' 'a-z')
-chrt -$POLICY -p $((RTPRIO - 1)) $PID
-
-die_if_not_saved 1 'Saving changes to a kernel thread priority'
-
-chrt -$POLICY -p $RTPRIO $PID
-
-die_if_conf_changed 'Restoring kernel thread priority'
-
-new_policy=$(echo $POLICY | tr fr rf)
-
-chrt -$new_policy -p $RTPRIO $PID
-
-die_if_not_saved 1 'Changing kernel thread sched policy'
-
-chrt -$POLICY -p $RTPRIO $PID
-
-die_if_conf_changed 'Restoring kernel thread sched policy'
-
-PID=$(ktpidof "kthreadd")
-AFFINITY=$(get_affinity $PID)
-
-taskset -p 0x2 $PID > /dev/null
-
-die_if_not_saved 1 'Changing kernel thread SMP affinity mask'
-
-taskset -p $AFFINITY $PID > /dev/null
-
-die_if_conf_changed 'Restoring kernel thread SMP affinity mask'
-
-NR_PROCESSORS=$(get_nr_processors)
-for PROCESSOR in $(seq 0 $NR_PROCESSORS) ; do
-	taskset -p 0xff 1 > /dev/null
-
-	PROCESSOR_AFFINITY=$(printf "%#x\n" $((1 << PROCESSOR)))
-	tuna --cpu $PROCESSOR --isolate
-
-	AFFINITY=0x$(get_affinity 1)
-
-	die_if_not_zero $((AFFINITY & PROCESSOR_AFFINITY)) "Isolating CPU $PROCESSOR"
-
-	tuna --cpu $PROCESSOR --include
-
-	AFFINITY=0x$(get_affinity 1)
-
-	die_if_zero $((AFFINITY & PROCESSOR_AFFINITY)) "Including CPU $PROCESSOR"
-done
-
-NEW_AFFINITY=$((1 << NR_PROCESSORS | 1))
-
-if [ $NR_PROCESSORS -gt 2 ]; then
-	tuna --cpu=0,$NR_PROCESSORS --isolate
-
-	for PID in $(cd /proc; ls -d [0-9]*) ; do
-		[ -n "$(cat /proc/$PID/cmdline 2> /dev/null)" ] || continue
-		AFFINITY=0x$(get_affinity $PID) || continue
-
-		die_if_not_zero $((AFFINITY & NEW_AFFINITY)) \
-			"Verifying isolation of first and last processor for PID $PID"
-	done
-fi
-
-tuna --cpu=0,$NR_PROCESSORS --include
-
-AFFINITY=0x$(get_affinity 1)
-
-die_if_not_equal $((AFFINITY & NEW_AFFINITY)) $NEW_AFFINITY "Including first and last processor"
-
-taskset -p 0xff 1 > /dev/null
-
-NEW_AFFINITY=$((1 << NR_PROCESSORS | 1))
-
-tuna --cpu=0,$NR_PROCESSORS --thread 1 --move
-
-AFFINITY=0x$(get_affinity 1)
-
-die_if_not_equal $((AFFINITY & NEW_AFFINITY)) $NEW_AFFINITY "Moving init to just first and last processor"
-
-NR_CPU_SOCKETS=$(get_nr_cpu_sockets)
-if [ $NR_CPU_SOCKETS -ge 2 ]; then
-	CPU1_SIBLINGS=$(printf "%d" 0x$(cat /sys/devices/system/cpu/cpu1/topology/core_siblings | cut -d',' -f2))
-	CPU1_SOCKET=$(cat /sys/devices/system/cpu/cpu1/topology/physical_package_id)
-
-	tuna --sockets=$CPU1_SOCKET --isolate
-	AFFINITY=0x$(get_affinity 1)
-	die_if_not_zero $((AFFINITY & CPU1_SIBLINGS)) \
-		"Verifying isolation of socket $CPU1_SOCKET"
-
-	tuna --sockets=$CPU1_SOCKET --include
-	AFFINITY=0x$(get_affinity 1)
-	die_if_not_equal $((AFFINITY & CPU1_SIBLINGS)) $CPU1_SIBLINGS \
-		"Verifying inclusion of socket $CPU1_SOCKET"
-
-	tuna --sockets=$CPU1_SOCKET --isolate
-	tuna --sockets=$CPU1_SOCKET --thread 1 --move
-	AFFINITY=0x$(get_affinity 1)
-	die_if_not_equal $((AFFINITY & CPU1_SIBLINGS)) $CPU1_SIBLINGS "Moving init to CPU socket $CPU1_SOCKET"
-fi
-
-if [ $NR_PROCESSORS -gt 2 ]; then
-	THREAD_PREFIX="watchdog/"
-	PID=$(ps h -C ${THREAD_PREFIX}0 -o pid)
-	RTPRIO=$(get_rtprio $PID)
-	NEW_RTPRIO=$((RTPRIO - 1))
-	tuna -t $THREAD_PREFIX* -p $NEW_RTPRIO
-	for CPU in $(seq 0 $((NR_PROCESSORS - 1))); do
-		PID=$(ps h -C ${THREAD_PREFIX}$CPU -o pid)
-		RTPRIO=$(get_rtprio $PID)
-		die_if_not_equal $RTPRIO $NEW_RTPRIO "Using --thread globbing"
-	done
-fi
-
-taskset -p $INITIAL_INIT_AFFINITY 1 > /dev/null
-rtctl --file $INITIAL reset
-
-echo 'PASS: Healthy tuna, no lead found, eat!'
-
-exit 0
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 19/23] tuna: Fix setting a realtime scheduling policy
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (17 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 18/23] tuna: Remove broken testuna John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 20/23] tuna: Update setup.py with co-author and metadata improvements John Kacur
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

According to the tuna documentation if a user specifies a real-time
scheduling policy then the default priority is 1 if not specified.

Fix this in the gui by explicitly setting it to one in
thread_set_attributes

There were also some incorrect debugging messages in
thread_set_attributes because the affinity was sometimes treated as a
list and sometimes treated as a set.

Fix this by converting the results of os.sched_getscheduler(pid) to a
list

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tuna/gui/util.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tuna/gui/util.py b/tuna/gui/util.py
index 92bd368179cc..68bd7578f1c8 100644
--- a/tuna/gui/util.py
+++ b/tuna/gui/util.py
@@ -68,6 +68,9 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
     curr_prio = int(pid_info["stat"]["rt_priority"])
     if new_policy == os.SCHED_OTHER:
         new_prio = 0
+    if new_policy == os.SCHED_FIFO or new_policy == os.SCHED_RR:
+        if not new_prio:
+            new_prio = 1
     if curr_policy != new_policy or curr_prio != new_prio:
         param = os.sched_param(new_prio)
         try:
@@ -82,6 +85,7 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
             dialog.destroy()
             return False
 
+
         curr_policy = os.sched_getscheduler(pid)
         if curr_policy != new_policy:
             print(_("couldn't change pid %(pid)d from %(cpol)s(%(cpri)d) to %(npol)s(%(npri)d)!") % \
@@ -93,7 +97,7 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
             changed = True
 
     try:
-        curr_affinity = os.sched_getaffinity(pid)
+        curr_affinity = list(os.sched_getaffinity(pid))
     except OSError as err:
         if err.args[0] == errno.ESRCH:
             return False
@@ -116,7 +120,7 @@ def thread_set_attributes(pid_info, new_policy, new_prio, new_affinity, nr_cpus)
             return invalid_affinity()
 
         try:
-            curr_affinity = os.sched_getaffinity(pid)
+            curr_affinity = list(os.sched_getaffinity(pid))
         except OSError as err:
             if err.args[0] == errno.ESRCH:
                 return False
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 20/23] tuna: Update setup.py with co-author and metadata improvements
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (18 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 19/23] tuna: Fix setting a realtime scheduling policy John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 21/23] tuna: Add pyproject.toml for modern Python packaging John Kacur
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur, Claude

- Add John Kacur as co-author alongside Arnaldo Carvalho de Melo
- Add explicit maintainer fields
- Update URL to current kernel.org location
- Add project_urls with source repository link

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 setup.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py
index f119e75abdeb..00a79727ba02 100755
--- a/setup.py
+++ b/setup.py
@@ -18,9 +18,14 @@ PYTHONLIB = relpath(sysconfig.get_path('platlib', SCHEME), '/usr')
 setup(name="tuna",
       version = "0.19",
       description = "Application tuning GUI",
-      author = "Arnaldo Carvalho de Melo",
-      author_email = "acme@redhat.com",
-      url = "http://userweb.kernel.org/tuna",
+      author = "Arnaldo Carvalho de Melo, John Kacur",
+      author_email = "acme@redhat.com, jkacur@redhat.com",
+      maintainer = "John Kacur",
+      maintainer_email = "jkacur@redhat.com",
+      url = "https://www.kernel.org/pub/software/utils/tuna",
+      project_urls = {
+          "Source": "git.kernel.org/pub/scm/utils/tuna/tuna.git/",
+      },
       license = "GPLv2",
       long_description =
 """\
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 21/23] tuna: Add pyproject.toml for modern Python packaging
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (19 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 20/23] tuna: Update setup.py with co-author and metadata improvements John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 22/23] tuna: Update version to 0.20 John Kacur
  2025-11-07 18:57 ` [PATCH 23/23] tuna: Fix pyproject.toml build issues John Kacur
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur, Claude

Add pyproject.toml to support PEP 517/518 modern Python packaging
while maintaining backwards compatibility with setup.py.

Configuration includes:
- Build system using setuptools>=61.0
- Project metadata (authors, maintainers, version)
- Python version requirement (>=3.10)
- Dependencies (python-linux-procfs)
- Entry points for tuna and oscilloscope commands
- Package classifiers for PyPI

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 .gitignore     |  1 +
 MANIFEST       | 30 ------------------------------
 pyproject.toml | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 30 deletions(-)
 delete mode 100644 MANIFEST
 create mode 100644 pyproject.toml

diff --git a/.gitignore b/.gitignore
index 29b00a0834ab..d8e20215de9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 *~
 *.swp
 tags
+CLAUDE.md
diff --git a/MANIFEST b/MANIFEST
deleted file mode 100644
index 95ae7c5ddd74..000000000000
--- a/MANIFEST
+++ /dev/null
@@ -1,30 +0,0 @@
-help/kthreads/
-oscilloscope-cmd.py
-tuna-cmd.py
-tuna/__init__.py
-tuna/help.py
-tuna/sysfs.py
-tuna/oscilloscope.py
-tuna/tuna.py
-tuna/config.py
-tuna/tuna_gui.py
-tuna/tuna_gui.glade
-tuna/gui/__init__.py
-tuna/gui/cpuview.py
-tuna/gui/irqview.py
-tuna/gui/procview.py
-tuna/gui/commonview.py
-tuna/gui/profileview.py
-tuna/gui/util.py
-setup.py
-rpm/SPECS/tuna.spec
-MANIFEST
-po/LINGUAS
-po/POTFILES.in
-po/ja.po
-po/pt_BR.po
-po/zh_CN.po
-ChangeLog
-docs/oscilloscope+tuna.html
-docs/oscilloscope+tuna.pdf
-docs/tuna.8
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 000000000000..8333a1acb913
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,42 @@
+[build-system]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "tuna"
+version = "0.19"
+description = "Application tuning GUI"
+license = {text = "GPL-2.0-only"}
+authors = [
+    {name = "Arnaldo Carvalho de Melo", email = "acme@redhat.com"},
+    {name = "John Kacur", email = "jkacur@redhat.com"}
+]
+maintainers = [
+    {name = "John Kacur", email = "jkacur@redhat.com"}
+]
+requires-python = ">=3.10"
+dependencies = [
+    "python-linux-procfs",
+]
+classifiers = [
+    "Development Status :: 4 - Beta",
+    "Intended Audience :: System Administrators",
+    "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
+    "Operating System :: POSIX :: Linux",
+    "Programming Language :: Python :: 3",
+    "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
+    "Topic :: System :: Systems Administration",
+]
+
+[project.urls]
+Homepage = "https://www.kernel.org/pub/software/utils/tuna"
+Source = "git.kernel.org/pub/scm/utils/tuna/tuna.git/"
+
+[project.scripts]
+tuna = "tuna.tuna:main"
+oscilloscope = "tuna.oscilloscope:main"
+
+[tool.setuptools.packages.find]
+include = ["tuna*"]
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 22/23] tuna: Update version to 0.20
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (20 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 21/23] tuna: Add pyproject.toml for modern Python packaging John Kacur
@ 2025-11-07 18:57 ` John Kacur
  2025-11-07 18:57 ` [PATCH 23/23] tuna: Fix pyproject.toml build issues John Kacur
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

Update version number from 0.19 to 0.20 in all locations:
- pyproject.toml
- setup.py
- tuna-cmd.py

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 pyproject.toml | 2 +-
 setup.py       | 2 +-
 tuna-cmd.py    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 8333a1acb913..95ec65c55195 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "tuna"
-version = "0.19"
+version = "0.20"
 description = "Application tuning GUI"
 license = {text = "GPL-2.0-only"}
 authors = [
diff --git a/setup.py b/setup.py
index 00a79727ba02..b85673056c9f 100755
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ if SCHEME not in sysconfig.get_scheme_names():
 PYTHONLIB = relpath(sysconfig.get_path('platlib', SCHEME), '/usr')
 
 setup(name="tuna",
-      version = "0.19",
+      version = "0.20",
       description = "Application tuning GUI",
       author = "Arnaldo Carvalho de Melo, John Kacur",
       author_email = "acme@redhat.com, jkacur@redhat.com",
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 9f5ce918054d..886824a4013c 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -102,7 +102,7 @@ def gen_parser():
     MODS = {
             "logging": dict(dest='loglevel', metavar='LOG-LEVEL', type=get_loglevel, help="Log application details to file for given LOG-LEVEL"),
             "debug" : dict(action='store_true', dest='debug', help='Print DEBUG level logging details to console'),
-            "version": dict(action='version', version='0.19', help="show version"),
+            "version": dict(action='version', version='0.20', help="show version"),
             "threads": dict(dest='thread_list', default=[], metavar='THREAD-LIST', type=threadstring_to_list, help="THREAD-LIST affected by commands"),
             "irqs": dict(dest='irq_list', default=[], metavar='IRQ-LIST', type=irqstring_to_list, help="IRQ-LIST affect by commands"),
             "cpus": dict(dest='cpu_list', default=[], metavar='CPU-LIST', type=tuna.cpustring_to_list, help='CPU-LIST affected by commands'),
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 23/23] tuna: Fix pyproject.toml build issues
  2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
                   ` (21 preceding siblings ...)
  2025-11-07 18:57 ` [PATCH 22/23] tuna: Update version to 0.20 John Kacur
@ 2025-11-07 18:57 ` John Kacur
  22 siblings, 0 replies; 25+ messages in thread
From: John Kacur @ 2025-11-07 18:57 UTC (permalink / raw)
  To: linux-rt-users; +Cc: Clark Williams, John Kacur

- Add https:// scheme to Source URL in pyproject.toml
- Remove long_description from setup.py to avoid conflict with pyproject.toml
- This fixes the build error with pyproject-rpm-macros

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 pyproject.toml | 2 +-
 setup.py       | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 95ec65c55195..f0caac6df053 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,7 +32,7 @@ classifiers = [
 
 [project.urls]
 Homepage = "https://www.kernel.org/pub/software/utils/tuna"
-Source = "git.kernel.org/pub/scm/utils/tuna/tuna.git/"
+Source = "https://git.kernel.org/pub/scm/utils/tuna/tuna.git/"
 
 [project.scripts]
 tuna = "tuna.tuna:main"
diff --git a/setup.py b/setup.py
index b85673056c9f..a40f29ef3817 100755
--- a/setup.py
+++ b/setup.py
@@ -27,11 +27,5 @@ setup(name="tuna",
           "Source": "git.kernel.org/pub/scm/utils/tuna/tuna.git/",
       },
       license = "GPLv2",
-      long_description =
-"""\
-Provides interface for changing scheduler and IRQ tunables, at whole CPU and at per
-thread/IRQ level. Allows isolating CPUs for use by a specific application and moving
-threads and interrupts to a CPU by just dragging and dropping them.
-""",
       packages = ["tuna", "tuna/gui"],
 )
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/23] Add SPDX license identifiers
  2025-11-07 18:57 ` [PATCH 01/23] Add SPDX license identifiers John Kacur
@ 2025-12-18  2:45   ` Kate Stewart
  0 siblings, 0 replies; 25+ messages in thread
From: Kate Stewart @ 2025-12-18  2:45 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Clark Williams, Clark Williams, linux-spdx

adding linux-spdx for review

On Mon, Dec 15, 2025 at 1:52 PM John Kacur <jkacur@redhat.com> wrote:
>
> From: Clark Williams <clrkwllms@kernel.org>
>
> use SPDX license identifiers to clarify the licences under which
> tuna is released.
>
> Signed-off-by: Clark Williams <williams@redhat.com>
> Signed-off-by: John Kacur <jkacur@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>


> ---
>  Makefile                |  3 +++
>  org.tuna.policy         |  1 +
>  oscilloscope-cmd.py     | 15 +--------------
>  setup.py                |  1 +
>  testuna                 | 10 +++++-----
>  tuna-cmd.py             |  9 +--------
>  tuna.desktop            |  1 +
>  tuna/__init__.py        |  2 +-
>  tuna/config.py          |  2 ++
>  tuna/gui/__init__.py    |  2 ++
>  tuna/gui/commonview.py  |  2 ++
>  tuna/gui/cpuview.py     |  1 +
>  tuna/gui/irqview.py     |  1 +
>  tuna/gui/procview.py    |  1 +
>  tuna/gui/profileview.py |  1 +
>  tuna/gui/util.py        |  1 +
>  tuna/new_eth.py         |  1 +
>  tuna/oscilloscope.py    | 15 +--------------
>  tuna/sysfs.py           |  2 ++
>  tuna/tuna.py            |  7 ++++---
>  tuna/tuna_gui.py        |  1 +
>  tuna/tuna_sched.py      |  1 +
>  22 files changed, 35 insertions(+), 45 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 50ded3985743..a3d71d2de896 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,3 +1,6 @@
> +#
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
>  PACKAGE := tuna
>  VERSION := $(shell rpm -q --qf '%{VERSION} ' --specfile rpm/SPECS/$(PACKAGE).spec | cut -d' ' -f1)
>
> diff --git a/org.tuna.policy b/org.tuna.policy
> index 4f71d4ad65f4..b3b3900a4d76 100644
> --- a/org.tuna.policy
> +++ b/org.tuna.policy
> @@ -1,4 +1,5 @@
>  <?xml version="1.0" encoding="UTF-8"?>
> +<!-- SPDX-License-Identifier: GPL-2.0-only -->
>  <!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD polkit Policy Configuration 1.0//EN"
>  "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
>  <policyconfig>
> diff --git a/oscilloscope-cmd.py b/oscilloscope-cmd.py
> index 2ca87e9edc62..a65117637160 100755
> --- a/oscilloscope-cmd.py
> +++ b/oscilloscope-cmd.py
> @@ -5,20 +5,7 @@
>  # http://git.kernel.org/?p=linux/kernel/git/acme/tuna.git;a=tree
>  # For newer versions and to see it integrated with tuna
>  #
> -# This library is free software; you can redistribute it and/or
> -# modify it under the terms of the GNU Lesser General Public
> -# License as published by the Free Software Foundation;
> -# version 2.1 of the License.
> -#
> -# This library is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -# Lesser General Public License for more details.
> -#
> -# You should have received a copy of the GNU Lesser General Public
> -# License along with this library; if not, write to the Free Software
> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> -# USA
> +# SPDX-License-Identifier: LGPL-2.1-only
>
>  import getopt
>  import sys
> diff --git a/setup.py b/setup.py
> index db0f00735524..f119e75abdeb 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -1,4 +1,5 @@
>  #!/usr/bin/python3
> +# SPDX-License-Identifier: GPL-2.0-only
>  import os
>  import sysconfig
>  from os.path import isfile, relpath
> diff --git a/testuna b/testuna
> index 4bf91ebdb76f..cb98640c0167 100755
> --- a/testuna
> +++ b/testuna
> @@ -2,7 +2,7 @@
>  # Regression tests for tuna
>  # (c) 2008 Red Hat Inc.
>  # Arnaldo Carvalho de Melo <acme@redhat.com>
> -# Released under the GPLv2
> +# SPDX-License-Identifier: GPL-2.0-only
>
>  dprint() {
>         [ -n "$VERBOSE" ] && echo $1
> @@ -111,21 +111,21 @@ PID=$(ktpidof "watchdog")
>  RTPRIO=$(get_rtprio $PID)
>  POLICY=$(get_policy $PID)
>  POLICY=$(echo ${POLICY:6:1} | tr 'A-Z' 'a-z')
> -chrt -$POLICY -p $((RTPRIO - 1)) $PID
> +chrt -$POLICY -p $((RTPRIO - 1)) $PID
>
>  die_if_not_saved 1 'Saving changes to a kernel thread priority'
>
> -chrt -$POLICY -p $RTPRIO $PID
> +chrt -$POLICY -p $RTPRIO $PID
>
>  die_if_conf_changed 'Restoring kernel thread priority'
>
>  new_policy=$(echo $POLICY | tr fr rf)
>
> -chrt -$new_policy -p $RTPRIO $PID
> +chrt -$new_policy -p $RTPRIO $PID
>
>  die_if_not_saved 1 'Changing kernel thread sched policy'
>
> -chrt -$POLICY -p $RTPRIO $PID
> +chrt -$POLICY -p $RTPRIO $PID
>
>  die_if_conf_changed 'Restoring kernel thread sched policy'
>
> diff --git a/tuna-cmd.py b/tuna-cmd.py
> index 6a980598526f..e953869c4f48 100755
> --- a/tuna-cmd.py
> +++ b/tuna-cmd.py
> @@ -5,14 +5,7 @@
>  #   Copyright (C) 2008, 2009, 2010, 2011 Red Hat Inc.
>  #   Arnaldo Carvalho de Melo <acme@redhat.com>
>  #
> -#   This application is free software; you can redistribute it and/or
> -#   modify it under the terms of the GNU General Public License
> -#   as published by the Free Software Foundation; version 2.
> -#
> -#   This application is distributed in the hope that it will be useful,
> -#   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -#   General Public License for more details.
> +# SPDX-License-Identifier: GPL-2.0-only
>
>  """ tuna - Application Tuning Program"""
>
> diff --git a/tuna.desktop b/tuna.desktop
> index 603011f79467..87ca3a35ce63 100644
> --- a/tuna.desktop
> +++ b/tuna.desktop
> @@ -1,3 +1,4 @@
> +# SPDX-License-Identifier: GPL-2.0-only
>  [Desktop Entry]
>  Name=tuna
>  GenericName=Application Tuner
> diff --git a/tuna/__init__.py b/tuna/__init__.py
> index 30924a00cf96..614e3e4c7ed8 100755
> --- a/tuna/__init__.py
> +++ b/tuna/__init__.py
> @@ -4,4 +4,4 @@ Copyright (c) 2008, 2009 Red Hat Inc.
>  Application Tuning GUI
>  """
>  __author__ = "Arnaldo Carvalho de Melo <acme@redhat.com>"
> -__license__ = "GPLv2 License"
> +__license__ = "SPDX-License-Identifier: GPL-2.0-only"
> diff --git a/tuna/config.py b/tuna/config.py
> index 09d26dd87029..63c9f23bb09b 100644
> --- a/tuna/config.py
> +++ b/tuna/config.py
> @@ -1,3 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
>  import io
>  import os
>  import re
> diff --git a/tuna/gui/__init__.py b/tuna/gui/__init__.py
> index ad1191c13d8d..a40f86292e6f 100755
> --- a/tuna/gui/__init__.py
> +++ b/tuna/gui/__init__.py
> @@ -1,3 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
>  """
>  Copyright (c) 2009  Red Hat Inc.
>
> diff --git a/tuna/gui/commonview.py b/tuna/gui/commonview.py
> index cc8f913819a2..8089ed154dae 100644
> --- a/tuna/gui/commonview.py
> +++ b/tuna/gui/commonview.py
> @@ -1,3 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
>  from gi.repository import Gtk
>  from tuna import tuna
>
> diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
> index cc3f0f905ae7..844705a4bb21 100755
> --- a/tuna/gui/cpuview.py
> +++ b/tuna/gui/cpuview.py
> @@ -1,5 +1,6 @@
>  # -*- python -*-
>  # -*- coding: utf-8 -*-
> +# SPDX-License-Identifier: GPL-2.0-only
>
>  from functools import reduce
>
> diff --git a/tuna/gui/irqview.py b/tuna/gui/irqview.py
> index 5143d6dc0df5..e89fb70197fc 100755
> --- a/tuna/gui/irqview.py
> +++ b/tuna/gui/irqview.py
> @@ -1,5 +1,6 @@
>  # -*- python -*-
>  # -*- coding: utf-8 -*-
> +# SPDX-License-Identifier: GPL-2.0-only
>  from tuna import tuna, gui
>  import procfs
>  from gi.repository import Gdk
> diff --git a/tuna/gui/procview.py b/tuna/gui/procview.py
> index 440a289a1b29..78d5f573dd49 100755
> --- a/tuna/gui/procview.py
> +++ b/tuna/gui/procview.py
> @@ -1,3 +1,4 @@
> +# SPDX-License-Identifier: GPL-2.0-only
>  import re
>  import os
>  import tuna.tuna_sched as tuna_sched
> diff --git a/tuna/gui/profileview.py b/tuna/gui/profileview.py
> index 26f58cbc8f4f..7570bc0e57ce 100644
> --- a/tuna/gui/profileview.py
> +++ b/tuna/gui/profileview.py
> @@ -1,3 +1,4 @@
> +# SPDX-License-Identifier: GPL-2.0-only
>  import os
>  import shutil
>  import gi
> diff --git a/tuna/gui/util.py b/tuna/gui/util.py
> index ec368ae4b2c9..92bd368179cc 100644
> --- a/tuna/gui/util.py
> +++ b/tuna/gui/util.py
> @@ -1,3 +1,4 @@
> +# SPDX-License-Identifier: GPL-2.0-only
>  import errno
>  import os
>  import gi
> diff --git a/tuna/new_eth.py b/tuna/new_eth.py
> index 98f9179d5695..e2888d4cef36 100755
> --- a/tuna/new_eth.py
> +++ b/tuna/new_eth.py
> @@ -1,4 +1,5 @@
>  # Copyright (C) 2022 John Kacur
> +# SPDX-License-Identifier: GPL-2.0-only
>  """ A few functions similar to ethtool """
>  import os
>  import socket
> diff --git a/tuna/oscilloscope.py b/tuna/oscilloscope.py
> index 317fe4554c60..a44ace53ec27 100755
> --- a/tuna/oscilloscope.py
> +++ b/tuna/oscilloscope.py
> @@ -8,20 +8,7 @@
>  # http://git.kernel.org/?p=linux/kernel/git/acme/tuna.git;a=tree
>  # For newer versions and to see it integrated with tuna
>  #
> -# This library is free software; you can redistribute it and/or
> -# modify it under the terms of the GNU Lesser General Public
> -# License as published by the Free Software Foundation;
> -# version 2.1 of the License.
> -#
> -# This library is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -# Lesser General Public License for more details.
> -#
> -# You should have received a copy of the GNU Lesser General Public
> -# License along with this library; if not, write to the Free Software
> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> -# USA
> +# SPDX-License-Identifier: LGPL-2.1-only
>
>  import os
>  import sys
> diff --git a/tuna/sysfs.py b/tuna/sysfs.py
> index 1c903e106a44..cd2377a8df26 100755
> --- a/tuna/sysfs.py
> +++ b/tuna/sysfs.py
> @@ -1,5 +1,7 @@
>  # -*- python -*-
>  # -*- coding: utf-8 -*-
> +# SPDX-License-Identifier: GPL-2.0-only
> +
>  """
>  classes for /sys/devices/system/cpu/
>  so we can get topology information and do CPU hotplug operations
> diff --git a/tuna/tuna.py b/tuna/tuna.py
> index e527facb151c..bd678e2dc7ae 100755
> --- a/tuna/tuna.py
> +++ b/tuna/tuna.py
> @@ -1,5 +1,6 @@
>  # -*- python -*-
>  # -*- coding: utf-8 -*-
> +# SPDX-License-Identifier: GPL-2.0-only
>
>  import copy
>  import errno
> @@ -647,12 +648,12 @@ def generate_rtgroups(filename, kthreads, nr_cpus):
>      f.write('''# Generated by tuna
>  #
>  # Use it with rtctl:
> -#
> +#
>  # rtctl --file %s reset
>  #
>  # Please use 'man rtctl' for more operations
>  #
> -# Associate processes into named groups with default priority and
> +# Associate processes into named groups with default priority and
>  # scheduling policy.
>  #
>  # Format is: <groupname>:<sched>:<prio>:<regex>
> @@ -661,7 +662,7 @@ def generate_rtgroups(filename, kthreads, nr_cpus):
>  # sched must be one of: 'f' (fifo)
>  #                       'b' (batch)
>  #                       'r' (round-robin)
> -#                       'o' (other)
> +#                       'o' (other)
>  #                       '*' (leave alone)
>  # regex is an awk regex
>  #
> diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
> index 459f90303ed5..cefee4a57697 100755
> --- a/tuna/tuna_gui.py
> +++ b/tuna/tuna_gui.py
> @@ -1,5 +1,6 @@
>  # -*- python -*-
>  # -*- coding: utf-8 -*-
> +# SPDX-License-Identifier: GPL-2.0-only
>
>  import sys
>  import os
> diff --git a/tuna/tuna_sched.py b/tuna/tuna_sched.py
> index de9846bb5fae..1051983e53f9 100644
> --- a/tuna/tuna_sched.py
> +++ b/tuna/tuna_sched.py
> @@ -1,5 +1,6 @@
>  #!/usr/bin/python3
>  #   Copyright (C) 2022 John Kacur
> +# SPDX-License-Identifier: GPL-2.0-only
>  """
>  Functions to translate a scheduling policy into either a string name or an
>  equivalent integer
> --
> 2.51.1
>
>

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2025-12-18  2:45 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07 18:57 [ANNOUNCE] tuna v0.20 John Kacur
2025-11-07 18:57 ` [PATCH 01/23] Add SPDX license identifiers John Kacur
2025-12-18  2:45   ` Kate Stewart
2025-11-07 18:57 ` [PATCH 02/23] tuna: Remove spec file from git John Kacur
2025-11-07 18:57 ` [PATCH 03/23] tuna: Don't start the gui if a display is not available John Kacur
2025-11-07 18:57 ` [PATCH 04/23] tuna: Fix string syntax warnings with raw strings John Kacur
2025-11-07 18:57 ` [PATCH 05/23] tuna: Fix help.py syntax warnings John Kacur
2025-11-07 18:57 ` [PATCH 06/23] tuna: help.py John Kacur
2025-11-07 18:57 ` [PATCH 07/23] tuna: extract common cpu and nics determination code into a utils.py file John Kacur
2025-11-07 18:57 ` [PATCH 08/23] tuna: Add idle_state control functionality John Kacur
2025-11-07 18:57 ` [PATCH 09/23] tuna: utils: A few tweaks John Kacur
2025-11-07 18:57 ` [PATCH 10/23] tuna: Add Pyright helper John Kacur
2025-11-07 18:57 ` [PATCH 11/23] tuna: Update man page with cpu_power command John Kacur
2025-11-07 18:57 ` [PATCH 12/23] tuna: Fix show_threads -t and show_irqs -q John Kacur
2025-11-07 18:57 ` [PATCH 13/23] tuna: Fix run command failing to apply BATCH policy John Kacur
2025-11-07 18:57 ` [PATCH 14/23] tuna: Add -U and -K to the move command John Kacur
2025-11-07 18:57 ` [PATCH 15/23] tuna: Add -U and -K to the spread command John Kacur
2025-11-07 18:57 ` [PATCH 16/23] tuna: replace match with if statements John Kacur
2025-11-07 18:57 ` [PATCH 17/23] tuna: Proofreading fixes John Kacur
2025-11-07 18:57 ` [PATCH 18/23] tuna: Remove broken testuna John Kacur
2025-11-07 18:57 ` [PATCH 19/23] tuna: Fix setting a realtime scheduling policy John Kacur
2025-11-07 18:57 ` [PATCH 20/23] tuna: Update setup.py with co-author and metadata improvements John Kacur
2025-11-07 18:57 ` [PATCH 21/23] tuna: Add pyproject.toml for modern Python packaging John Kacur
2025-11-07 18:57 ` [PATCH 22/23] tuna: Update version to 0.20 John Kacur
2025-11-07 18:57 ` [PATCH 23/23] tuna: Fix pyproject.toml build issues John Kacur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox