From patchwork Mon Feb 14 15:22:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 83096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CDE39B711C for ; Tue, 15 Feb 2011 02:42:55 +1100 (EST) Received: from localhost ([127.0.0.1]:37338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pp0Xw-00019y-MC for incoming@patchwork.ozlabs.org; Mon, 14 Feb 2011 10:41:04 -0500 Received: from [140.186.70.92] (port=57921 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pp0IQ-0000Dp-NO for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pp0IM-00042H-JZ for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:25:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pp0IL-00040y-OG for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:24:58 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1EFOv3Z010253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Feb 2011 10:24:57 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1EFOuQg018473; Mon, 14 Feb 2011 10:24:56 -0500 Received: from amt.cnet (vpn-11-144.rdu.redhat.com [10.11.11.144]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p1EFOt22006274; Mon, 14 Feb 2011 10:24:55 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 57AEB6520C4; Mon, 14 Feb 2011 13:24:01 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p1EFNxWV031982; Mon, 14 Feb 2011 13:23:59 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Mon, 14 Feb 2011 13:22:47 -0200 Message-Id: <46d62fac8a6a43453322b3305ab2fcb8ee594443.1297696986.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 18/37] Introduce VCPU self-signaling service X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka Introduce qemu_cpu_kick_self to send SIG_IPI to the calling VCPU context. First user will be kvm. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- cpus.c | 21 +++++++++++++++++++++ qemu-common.h | 1 + 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/cpus.c b/cpus.c index 9a3fc31..6a85dc8 100644 --- a/cpus.c +++ b/cpus.c @@ -529,6 +529,17 @@ void qemu_cpu_kick(void *env) return; } +void qemu_cpu_kick_self(void) +{ +#ifndef _WIN32 + assert(cpu_single_env); + + raise(SIG_IPI); +#else + abort(); +#endif +} + void qemu_notify_event(void) { CPUState *env = cpu_single_env; @@ -831,6 +842,16 @@ void qemu_cpu_kick(void *_env) } } +void qemu_cpu_kick_self(void) +{ + assert(cpu_single_env); + + if (!cpu_single_env->thread_kicked) { + qemu_thread_signal(cpu_single_env->thread, SIG_IPI); + cpu_single_env->thread_kicked = true; + } +} + int qemu_cpu_self(void *_env) { CPUState *env = _env; diff --git a/qemu-common.h b/qemu-common.h index c7ff280..a4d9c21 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -288,6 +288,7 @@ void qemu_notify_event(void); /* Unblock cpu */ void qemu_cpu_kick(void *env); +void qemu_cpu_kick_self(void); int qemu_cpu_self(void *env); /* work queue */