1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

ips/intc: don't fail if setting IRQ affinity is not possible

This is the case when the application is not executed as root which is
now possible, with the drawback that we cannot set the IRQ affinity
anymore.
This commit is contained in:
Daniel Krebs 2018-02-14 14:32:07 +01:00
parent e2ce250288
commit 6cb3b77c7a
2 changed files with 16 additions and 3 deletions

View file

@ -21,6 +21,7 @@
*********************************************************************************/
#include <unistd.h>
#include <errno.h>
#include "config.h"
#include "log.h"
@ -60,8 +61,19 @@ InterruptController::init()
/* For each IRQ */
for (int i = 0; i < num_irqs; i++) {
/* Pin to core */
if(kernel_irq_setaffinity(nos[i], card->affinity, nullptr) != 0) {
/* Try pinning to core */
int ret = kernel_irq_setaffinity(nos[i], card->affinity, nullptr);
switch(ret) {
case 0:
// everything is fine
break;
case EACCES:
logger->warn("No permission to change affinity of VFIO-MSI interrupt. "
"This may degrade performance (increasing jitter)");
break;
default:
logger->error("Failed to change affinity of VFIO-MSI interrupt");
return false;
}

View file

@ -25,6 +25,7 @@
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/utsname.h>
@ -268,7 +269,7 @@ int kernel_irq_setaffinity(unsigned irq, uintmax_t affinity, uintmax_t *old)
f = fopen(fn, "w+");
if (!f)
return -1; /* IRQ does not exist */
return errno;
if (old)
ret = fscanf(f, "%jx", old);