public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: penberg@kernel.org
Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com,
	gorcunov@gmail.com, prasadjoshi124@gmail.com,
	Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH] kvm tools: Signal only one thread when injecting console interrupts
Date: Wed, 15 Jun 2011 17:33:06 -0400	[thread overview]
Message-ID: <1308173586-5344-1-git-send-email-levinsasha928@gmail.com> (raw)

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 <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 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 <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()");
-- 
1.7.5.3


             reply	other threads:[~2011-06-15 21:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 21:33 Sasha Levin [this message]
2011-06-16  0:31 ` [PATCH] kvm tools: Signal only one thread when injecting console interrupts Asias He
2011-06-16  7:29   ` Ingo Molnar
2011-06-24 13:19     ` Asias He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308173586-5344-1-git-send-email-levinsasha928@gmail.com \
    --to=levinsasha928@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox