Skip to contentSkip to conversation

kvm tools: Signal only one thread when injecting console interrupts

PATCH In review Sasha Levin 3 participants 4 messages Jun 15, 2011 – Jun 24, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm tools: Signal only one thread when injecting console interrupts

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.

---
 tools/kvm/kvm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
tools/kvm/kvm.c +3 -1
index 2c56a79..22871db 100644
@@ -28,6 +28,7 @@
 #include <fcntl.h>
 #include <time.h>
 #include <sys/eventfd.h>
+#include <asm/unistd.h>
 
 #define DEFINE_KVM_EXIT_REASON(reason) [reason] = #reason
 
@@ -529,8 +530,9 @@ void kvm__start_timer(struct kvm *kvm)
 
 	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()");
Signature · 1 line
1.7.5.3
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Sasha Levin

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.

This one is much simpler than the sig_block patches and also resolves the getaddrinfo() problem for me in virtio net thread.

Signature · 2 lines
Best Regards,
Asias He
Acked-by
#2 lore raw
Quoted 7 lines · Asias He
Quoted 6 lines · Sasha Levin

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.

Quoted 8 lines
Quoted 2 lines

This one is much simpler than the sig_block patches and also resolves the getaddrinfo() problem for me in virtio net thread.

yep, very nice!

Thanks,

Ingo

#3 lore raw
Quoted 18 lines · Ingo Molnar
Quoted 7 lines · Asias He
Quoted 6 lines · Sasha Levin

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.

Quoted 8 lines
Quoted 2 lines

This one is much simpler than the sig_block patches and also resolves the getaddrinfo() problem for me in virtio net thread.

Quoted 8 lines

yep, very nice!

Thanks,

Ingo

Hi, Pekka

Ping. Mind to merge this patch?

Signature · 2 lines
Best Regards,
Asias He