Use TASKSET variable of GNU make to set CPU affinity.

Don't use Linux-specific sched_setaffinity from <sched.h>.
On Linux it calls taskset(1) from util-linux.

Add your logic to the makefile if you run other platform.
This commit is contained in:
Ivan Baravy 2020-03-08 01:44:13 +03:00
parent 5822be9942
commit fcba0e2fa3
2 changed files with 5 additions and 6 deletions

View File

@ -1,4 +1,8 @@
UMKA_SHELL=../umka_shell
ifneq ($(COVERAGE),)
TASKSET=taskset 1
endif
UMKA_SHELL=$(TASKSET) ../umka_shell
xfs_tests := $(addsuffix .out.log, $(basename $(wildcard *\#xfs_*.t)))
s05k_tests := $(addsuffix .out.log, $(basename $(wildcard *\#s05k_*.t)))

View File

@ -7,7 +7,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <sched.h>
#include "kolibri.h"
#define MSR_IA32_DEBUGCTLMSR 0x1d9
@ -82,10 +81,6 @@ void trace_lbr_begin() {
action.sa_flags = SA_SIGINFO;
sigaction(SIGTRAP, &action, NULL);
cpu_set_t my_set;
CPU_ZERO(&my_set);
CPU_SET(0, &my_set);
sched_setaffinity(0, sizeof(cpu_set_t), &my_set);
wrmsr(MSR_IA32_DEBUGCTLMSR, 3);
msrfd = open("/dev/cpu/0/msr", O_RDONLY);
if (msrfd < 0) {