[PATCH v2 0/5] irqbalance: User interface and API availability
Neil Horman
nhorman at tuxdriver.com
Tue Jan 3 05:52:45 PST 2017
On Sat, Dec 31, 2016 at 06:04:32PM +0100, Veronika Kabatova wrote:
> 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
>
>
It seems you didn't throughly test this:
gcc -DHAVE_CONFIG_H -I. -I. -W -Wall -Wshadow -Wformat -Wundef -D_GNU_SOURCE
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -g -O2 -c -o classify.o
classify.c
classify.c:38:15: error: static declaration of ‘cl_banned_irqs’ follows
non-static declaration
static GList *cl_banned_irqs = NULL;
^~~~~~~~~~~~~~
In file included from classify.c:10:0:
irqbalance.h:66:15: note: previous declaration of ‘cl_banned_irqs’ was here
extern GList *cl_banned_irqs;
^~~~~~~~~~~~~~
Makefile:572: recipe for target 'classify.o' failed
make[2]: *** [classify.o] Error 1
make[2]: Leaving directory '/home/nhorman/git/irqbalance'
Makefile:639: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/nhorman/git/irqbalance'
Makefile:448: recipe for target 'all' failed
make: *** [all] Error 2
More information about the irqbalance
mailing list