From patchwork Tue Feb 1 21:15:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 81412 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 DAA75B70EB for ; Wed, 2 Feb 2011 10:45:39 +1100 (EST) Received: from localhost ([127.0.0.1]:47316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkOBw-0005JO-Sl for incoming@patchwork.ozlabs.org; Tue, 01 Feb 2011 16:55:16 -0500 Received: from [140.186.70.92] (port=47091 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkNhM-0000x6-DF for qemu-devel@nongnu.org; Tue, 01 Feb 2011 16:23:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PkNaq-0003Hc-Km for qemu-devel@nongnu.org; Tue, 01 Feb 2011 16:16:57 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:33868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PkNaq-0003H2-9n for qemu-devel@nongnu.org; Tue, 01 Feb 2011 16:16:56 -0500 Received: from smtp05.web.de ( [172.20.4.166]) by fmmailgate02.web.de (Postfix) with ESMTP id 1344C195B1948; Tue, 1 Feb 2011 22:16:15 +0100 (CET) Received: from [88.65.41.52] (helo=localhost.localdomain) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1PkNaA-0006FM-02; Tue, 01 Feb 2011 22:16:15 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Tue, 1 Feb 2011 22:15:59 +0100 Message-Id: <48dbaa8c097d399a8bca0e76084a657657227eb9.1296594961.git.jan.kiszka@web.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX18Hm5le1zmuHJN/uScN30fv4o1bEpzuWuTbJw+s bBtKSv7bz3aaMFaBh4Q2QUrpyt01glSMxI3q4yV+dub7guSuU4 uTaEmXW8Y= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 217.72.192.227 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH v2 19/24] 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 --- cpus.c | 21 +++++++++++++++++++++ qemu-common.h | 1 + 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/cpus.c b/cpus.c index c4c5914..9c50a34 100644 --- a/cpus.c +++ b/cpus.c @@ -537,6 +537,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; @@ -835,6 +846,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 63d9943..220c8c8 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -287,6 +287,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 */