Send signals only to the thread which handles console injection
instead of the entire process.
This prevents every single thread from having to ignore SIGALRM
and will help scaling when running large amount of VCPU threads.
Tested-by: Asias He <asias.hejun@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
#include <fcntl.h>
#include <time.h>
#include <sys/eventfd.h>
+#include <asm/unistd.h>
#define DEFINE_KVM_EXIT_REASON(reason) [reason] = #reason
memset(&sev, 0, sizeof(struct sigevent));
sev.sigev_value.sival_int = 0;
- sev.sigev_notify = SIGEV_SIGNAL;
+ sev.sigev_notify = SIGEV_THREAD_ID;
sev.sigev_signo = SIGALRM;
+ sev._sigev_un._tid = syscall(__NR_gettid);
if (timer_create(CLOCK_REALTIME, &sev, &kvm->timerid) < 0)
die("timer_create()");