[PATCH v2 0/5] irqbalance: User interface and API availability

Veronika Kabatova vkabatov at redhat.com
Sat Dec 31 09:04:32 PST 2016


Currently, it is not possible to view assignment tree in a different way than
debug output, and there are no possibilities to change the settings during
runtime. This patchset adds the ability for socket communication, creating an
interface for users to change some settings during runtime (sleep interval,
CPU and IRQ banning). Strings needed for retrieving data and setting changes
are described in the first patch's commit message.

The main purpose of this patchset is to create a simple user interface (using
curses library). The user interface is added into configuration script and
makefile and builds as a `irqbalance-ui` command. It uses aforementioned socket
interface to communicate with irqbalance and allows user to view assignment
tree, sleep interval, CPUs and IRQs that irqbalance is working with, and to
setup irqbalance's settings (which was yet possible only with restarting).

The user interface makes it possible for users to check how the IRQs are
balanced in given moment (refresh interval of assignment tree is set to 5s) and
to easily change irqbalance's settings in case the requirements change later.
The socket interface iteslf can also be used for scripting (eg automatic banning
depending on load), which can be useful for system administrators for various
optimizations.

Current plans for future development include unicode / ASCII signs in tree based
on locale settings, lspci and /proc/interrupts integration for IRQ source
information (eg device or kernel driver names) and displaying generic load of
CPUs. Ideas for other enhancements are welcome.

The patches are also available as `ui_v2` branch at GitHub:
https://github.com/veruu/irqbalance/tree/ui_v2

** Changes since v1 **
1) Addressing Neil's comments:
> I like the idea of what you are adding, but some initial comments:
> 
> 1) Setting a fixed socket address limits people to a single irqbalance instance.
> I know of a few cases in which multiple irqbalances may be run on different cpu
> sets, and this would be in conflict with a single socket address.  Suggest that
> you use abstract namespace mode of AF_LOCAL using the irqbalance pid and a
> standard string to create a unique path for each instance.
> 

Fixed. I think having a unique path with regular UNIX sockets (based on PID as
you said) should be enough, but I did implement abstract sockets as you
suggested because of their advantages. Thanks for the idea!

> 2) Security is an issue here.  You've not restricted socket access at all,
> meaning any user on the system can modify irqbalance behavior.  Suggest that you
> use SCM_CREDENTIALS socket option to limit access to root.

AFAIK (and based on my testing), this is not an issue with normal UNIX sockets
because non-root users don't have priviledges to connect to socket created by
root. This doesn't work with abstract sockets and additional Security can never
hurt, so a check for valid root credentials is done before accepting requests.

2) Document socket API in man page

Veronika Kabatova (5):
  Add ability for socket communication
  Add helper functions for user interface
  Add user interface functionality
  Add main user interface files
  Add user interface to configuration and build, document socket API in
    man page

 Makefile.am        |   8 +-
 configure.ac       |   4 +-
 cputree.c          |   9 +-
 irqbalance.1       |  29 +++
 irqbalance.c       | 286 +++++++++++++++++----
 irqbalance.h       |   4 +
 ui/helpers.c       | 169 +++++++++++++
 ui/helpers.h       |  31 +++
 ui/irqbalance-ui.c | 400 +++++++++++++++++++++++++++++
 ui/irqbalance-ui.h |  86 +++++++
 ui/ui.c            | 729 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/ui.h            |  53 ++++
 12 files changed, 1748 insertions(+), 60 deletions(-)
 create mode 100644 ui/helpers.c
 create mode 100644 ui/helpers.h
 create mode 100644 ui/irqbalance-ui.c
 create mode 100644 ui/irqbalance-ui.h
 create mode 100644 ui/ui.c
 create mode 100644 ui/ui.h

-- 
2.7.4




More information about the irqbalance mailing list