From patchwork Fri Jul 10 15:19:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fred.konrad@greensocs.com X-Patchwork-Id: 493815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 361961402B1 for ; Sat, 11 Jul 2015 01:22:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=greensocs.com header.i=@greensocs.com header.b=WE5GehYF; dkim=fail reason="signature verification failed" (1024-bit key) header.d=greensocs.com header.i=@greensocs.com header.b=UNKLpSp3; dkim-atps=neutral Received: from localhost ([::1]:45032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDa7t-0003eG-Bs for incoming@patchwork.ozlabs.org; Fri, 10 Jul 2015 11:22:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDa5B-0001Kq-Bq for qemu-devel@nongnu.org; Fri, 10 Jul 2015 11:19:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDa59-0002Us-PF for qemu-devel@nongnu.org; Fri, 10 Jul 2015 11:19:21 -0400 Received: from greensocs.com ([193.104.36.180]:56116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDa59-0002Uo-EG for qemu-devel@nongnu.org; Fri, 10 Jul 2015 11:19:19 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id D5B51185790; Fri, 10 Jul 2015 17:19:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1436541558; bh=ghvcuS9F4Av0l5b/C2m7yMZk+zKwPPQQk9RO5WOhAng=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WE5GehYF8GqBhRTtTmX+rriYYGVqEzg+84Bq5wzKr+4wGuiO9EcmeurE4aFavyLJ+ pJ6w0L5HTrqQfu3TCO8/hHmxDQuosQXbTFXOJkk/OxlxjTN13uK5PolXvF0WfRCfRc BVSr7PoRO5SXMwn0NaG1UvTsN1pBbZMlnhqtO77w= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tPy02riPw4p3; Fri, 10 Jul 2015 17:19:17 +0200 (CEST) Received: from localhost.localdomain (i16-les03-th2-31-36-202-29.sfr.lns.abo.bbox.fr [31.36.202.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: fred.konrad@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id 4937418579A; Fri, 10 Jul 2015 17:19:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1436541556; bh=ghvcuS9F4Av0l5b/C2m7yMZk+zKwPPQQk9RO5WOhAng=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UNKLpSp3/i+IFyW4SS5EUkBraqmhroFASOz7Ji+XX90wqUFMkl1OmqIv5ztyL5T/Y YoSTVJb4LsMrTnJaEsfVZQmcpDVAG9XPc/2S3DLvkYPfXVrpTpai6bx7QpFvxjGSA8 +QQUK2g73Cujb1Dj2HW9Jkog72AolwYlX6ssgUsk= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Date: Fri, 10 Jul 2015 17:19:12 +0200 Message-Id: <1436541553-26576-3-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1436541553-26576-1-git-send-email-fred.konrad@greensocs.com> References: <1436541553-26576-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Cc: mark.burton@greensocs.com, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com, pbonzini@redhat.com, alex.bennee@linaro.org, fred.konrad@greensocs.com Subject: [Qemu-devel] [RFC PATCH 2/3] cpus: add a tcg_executing flag. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: KONRAD Frederic This flag indicates if the VCPU is currently executing TCG code. Signed-off-by: KONRAD Frederic Changes V1 -> V2: * do both tcg_executing = 0 or 1 in cpu_exec(). --- cpu-exec.c | 2 ++ include/qom/cpu.h | 3 +++ qom/cpu.c | 1 + 3 files changed, 6 insertions(+) diff --git a/cpu-exec.c b/cpu-exec.c index 75694f3..2fdf89d 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -371,6 +371,7 @@ int cpu_exec(CPUState *cpu) cpu->halted = 0; } + cpu->tcg_executing = 1; current_cpu = cpu; /* As long as current_cpu is null, up to the assignment just above, @@ -583,5 +584,6 @@ int cpu_exec(CPUState *cpu) /* fail safe : never use current_cpu outside cpu_exec() */ current_cpu = NULL; + cpu->tcg_executing = 0; return ret; } diff --git a/include/qom/cpu.h b/include/qom/cpu.h index efa9624..a2de536 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -226,6 +226,7 @@ struct kvm_run; * @stopped: Indicates the CPU has been artificially stopped. * @tcg_exit_req: Set to force TCG to stop executing linked TBs for this * CPU and return to its top level loop. + * @tcg_executing: This TCG thread is in cpu_exec(). * @singlestep_enabled: Flags for single-stepping. * @icount_extra: Instructions until next timer event. * @icount_decr: Number of cycles left, with interrupt flag in high bit. @@ -322,6 +323,8 @@ struct CPUState { (absolute value) offset as small as possible. This reduces code size, especially for hosts without large memory offsets. */ volatile sig_atomic_t tcg_exit_req; + + volatile int tcg_executing; }; QTAILQ_HEAD(CPUTailQ, CPUState); diff --git a/qom/cpu.c b/qom/cpu.c index 4e12598..62663e5 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -249,6 +249,7 @@ static void cpu_common_reset(CPUState *cpu) cpu->icount_decr.u32 = 0; cpu->can_do_io = 0; cpu->exception_index = -1; + cpu->tcg_executing = 0; memset(cpu->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *)); }