From 9a1fd29a82c9762c3676f613075d44a8d1fcbe82 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Wed, 12 Jul 2023 08:59:45 +0200 Subject: [PATCH 5/7] activate_mapping: report error reason If a given IRQ affinity cannot be set, include strerror in the warning message. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2184735 Signed-off-by: Robin Jarry --- activate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/activate.c b/activate.c index a4112e0..4418cda 100644 --- a/activate.c +++ b/activate.c @@ -25,10 +25,12 @@ * of interrupts to the kernel. */ #include "config.h" +#include #include #include #include #include +#include #include "irqbalance.h" @@ -48,7 +50,7 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un { char buf[PATH_MAX]; FILE *file; - int ret = 0; + int errsave, ret; cpumask_t applied_mask; /* @@ -79,11 +81,18 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un cpumask_scnprintf(buf, PATH_MAX, applied_mask); ret = fprintf(file, "%s", buf); - if (fclose(file) || ret < 0) + errsave = errno; + if (fclose(file)) { + errsave = errno; + goto error; + } + if (ret < 0) goto error; info->moved = 0; /*migration is done*/ error: - log(TO_ALL, LOG_WARNING, "cannot change IRQ %i affinity, will never try again\n", info->irq); + log(TO_ALL, LOG_WARNING, + "Cannot change IRQ %i affinity: %s. Will never try again.\n", + info->irq, strerror(errsave)); info->flags |= IRQ_FLAG_AFFINITY_UNMANAGED; } -- 2.40.1