When processing the ',' in hex_to_bitmap, it returns '0000\ 0' directly.
The return value will be freed in parse_setup, but it is not requested
through malloc.
Fixes: 85d37098a5 ("Fix several memleak problems found by covscan")
And it treat ',' as "0000", which cause irqbalance-ui will display wrong
Banned CPU numbers.
For example:
# IRQBALANCE_BANNED_CPUS="00000002,00000000,00000000" ./irqbalance
or
# IRQBALANCE_BANNED_CPULIST="65" ./irqbalance
# ./irqbalance-ui
Banned CPU numbers: 73
Fixes: 76d1c9d739 ("Add main user interface files")
Signed-off-by: Liu Chao <liuchao173@huawei.com>
This patch have no functional modification. Just improve the doc and log
for isolcpu, nohz_full and numa node banning cpus, for providing more
info for users.
Signed-off-by: Tao Liu <ltao@redhat.com>
when invoking setup_irqs in settings or invoking settings in setup_irqs, it
doesn't break but enters another while loop.
For example:
# gdb program `pidof irqbalance-ui`
(gdb) bt
#0 0x0000ffffb0dcc7b0 in poll () from /usr/lib64/libc.so.6
#1 0x0000ffffb0e9097c in _nc_timed_wait () from /usr/lib64/libtinfo.so.6
#2 0x0000ffffb0ecc154 in _nc_wgetch () from /usr/lib64/libncursesw.so.6
#3 0x0000ffffb0eccb18 in wgetch () from /usr/lib64/libncursesw.so.6
#4 0x00000000004045d4 in setup_irqs () at ui/ui.c:637
#5 0x0000000000404084 in settings () at ui/ui.c:614
#6 0x0000000000404084 in settings () at ui/ui.c:614
#7 0x0000000000404084 in settings () at ui/ui.c:614
#8 0x0000000000404084 in settings () at ui/ui.c:614
#9 0x0000000000404084 in settings () at ui/ui.c:614
#10 0x0000000000404084 in settings () at ui/ui.c:614
#11 0x0000000000404084 in settings () at ui/ui.c:614
#12 0x0000000000401fac in key_loop (data=<optimized out>) at ui/irqbalance-ui.c:387
#13 0x0000ffffb105371c in ?? () from /usr/lib64/libglib-2.0.so.0
#14 0x0000ffffb1052a84 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#15 0x0000ffffb1052e38 in ?? () from /usr/lib64/libglib-2.0.so.0
#16 0x0000ffffb1053188 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#17 0x000000000040196c in main (argc=<optimized out>, argv=<optimized out>) at ui/irqbalance-ui.c:445
Signed-off-by: Liu Chao <liuchao173@huawei.com>
The Hardware Feedback Interface event is delivered as the Netlink's
THERMAL_GENL_ATTR_CPU_CAPABILITY attribute. Add code to receive and parse
these attributes: logical CPU number, performance, and efficiency
enumeration values (0-1023).
When an event indicates CPU performance and efficiency are zeros, then the
CPU needs to be banned from IRQs. Rebuild object tree to make this banned
list effective.
Creating the banned CPU list here is a bit tricky here because the amount
of data that each Netlink notification can carry out is not enough in some
systems with many cores. This means the handler has to wait for multiple
notifications to determine banned CPUs per thermal event.
Establish a logic to maintain the list based on the kernel behaviors. Also,
always push the current list as of the banned CPUs, because there is no
clear line whether each notification is at the end of a thermal event or
not.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Establish Netlink socket connection in a nonblocking mode and callback
notification.
Tolerate a few times on failures from receiving events. In practice, such
delivery failure is rare. But it may indicate more fundamental issues if
it repeats. So disconnect it unless the failure is transient.
Event-specific handler will be implemented in the next patch.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Intel's new hardware supports Hardware Feedback Interface to provide CPU
performance and energy efficiency information. Every update on this is
delivered via thermal event interrupt. The thermal framework in the Linux
kernel relays these notifications to userspace via a Netlink interface.
When a CPU's performance and efficiency are zero, irqbalance needs to mask
the CPU from interrupts. Introduce a new CPU mask to indicate banned CPUs
for this.
Before supporting this event handling, define functions. Their
implementation will be on the following patches.
This event is available only on x86-64 systems. And it can be subscribed
with help of Netlink libraries. So check them before building it.
Also add a new build option so users may opt out this support. Setting this
option on other systems will result in a build failure.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
This helper is useful when updating a global mask with a local value. The
upcoming thermal-event handler Handling thermal events has the case.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>