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

moved checks to where they really belong.

improved warnings about non-optimal system
This commit is contained in:
Steffen Vogel 2015-09-30 11:12:16 +02:00
parent c25030f373
commit 901ca4fbb0
4 changed files with 23 additions and 13 deletions

View file

@ -31,6 +31,9 @@ static void gtfpga_debug(char *msg, ...) {
int gtfpga_init(int argc, char * argv[], struct settings *set)
{
if (check_root())
error("The gtfpga node-type requires superuser privileges!");
pacc = pci_alloc(); /* Get the pci_access structure */
if (!pacc)
error("Failed to allocate PCI access structure");

View file

@ -34,7 +34,11 @@ struct interface * if_create(struct rtnl_link *link)
debug(3, "Created interface '%s'", rtnl_link_get_name(i->nl_link));
if_get_irqs(i);
int n = if_get_irqs(i);
if (n > 0)
debug(6, "Found %u IRQs for interface '%s'", n, rtnl_link_get_name(i->nl_link));
else
warn("Did not found any interrupts for interface '%s'", rtnl_link_get_name(i->nl_link));
list_init(&i->sockets, NULL);
list_push(&interfaces, i);
@ -177,8 +181,6 @@ int if_get_irqs(struct interface *i)
closedir(dir);
}
debug(6, "Found %u IRQs for interface '%s'", n, rtnl_link_get_name(i->nl_link));
return 0;
}

View file

@ -60,6 +60,11 @@ static void quit()
static void realtime_init()
{ INDENT
if (check_kernel_cmdline())
warn("You should reserve some cores for the server (see 'isolcpus')");
if (check_kernel_rtpreempt())
warn("We recommend to use an RT_PREEMPT patched kernel!");
/* Use FIFO scheduler with real time priority */
if (settings.priority) {
struct sched_param param = {
@ -68,18 +73,20 @@ static void realtime_init()
if (sched_setscheduler(0, SCHED_FIFO, &param))
serror("Failed to set real time priority");
else
debug(3, "Set task priority to %u", settings.priority);
debug(3, "Set task priority to %u", settings.priority);
}
warn("Use setting 'priority' to enable real-time scheduling!");
/* Pin threads to CPUs by setting the affinity */
if (settings.affinity) {
cpu_set_t cset = to_cpu_set(settings.affinity);
if (sched_setaffinity(0, sizeof(cset), &cset))
serror("Failed to set CPU affinity to '%#x'", settings.affinity);
else
debug(3, "Set affinity to %#x", settings.affinity);
debug(3, "Set affinity to %#x", settings.affinity);
}
warn("Use setting 'affinity' to pin process to isolated CPU cores!");
}
/* Setup exit handler */
@ -149,8 +156,6 @@ int main(int argc, char *argv[])
BLD(MAG(__DATE__)), BLD(MAG(__TIME__)));
/* Checks system requirements*/
if (check_root())
error("The server requires superuser privileges!");
#ifdef LICENSE
if (check_license_trace())
error("This software should not be traced!");
@ -161,10 +166,6 @@ int main(int argc, char *argv[])
#endif
if (check_kernel_version())
error("Your kernel version is to old: required >= %u.%u", KERNEL_VERSION_MAJ, KERNEL_VERSION_MIN);
if (check_kernel_cmdline())
warn("You should reserve some cores for the server (see 'isolcpus')");
if (check_kernel_rtpreempt())
warn("We recommend to use an RT_PREEMPT patched kernel!");
/* Initialize lists */
list_init(&nodes, (dtor_cb_t) node_destroy);

View file

@ -30,6 +30,7 @@
#include "config.h"
#include "utils.h"
#include "socket.h"
#include "checks.h"
/** Linked list of interfaces */
extern struct list interfaces;
@ -39,6 +40,9 @@ static struct list sockets;
int socket_init(int argc, char * argv[], struct settings *set)
{ INDENT
if (check_root())
error("The socket node-type requires superuser privileges!");
nl_init(); /* Fill link cache */
list_init(&interfaces, (dtor_cb_t) if_destroy);