From: Sasha Levin Subject: [PATCH] kvm tools: Signal only one thread when injecting console interrupts Date: Wed, 15 Jun 2011 17:33:06 -0400 Message-ID: <1308173586-5344-1-git-send-email-levinsasha928@gmail.com> Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, Sasha Levin To: penberg@kernel.org Return-path: Received: from mail-qy0-f174.google.com ([209.85.216.174]:42060 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754211Ab1FOViO (ORCPT ); Wed, 15 Jun 2011 17:38:14 -0400 Received: by qyk7 with SMTP id 7so2219773qyk.19 for ; Wed, 15 Jun 2011 14:38:13 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: 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. Suggested-by: Ingo Molnar Signed-off-by: Sasha Levin --- tools/kvm/kvm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index 2c56a79..22871db 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -28,6 +28,7 @@ #include #include #include +#include #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()"); -- 1.7.5.3