From patchwork Fri Apr 12 12:23:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 236076 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 132AD2C00A9 for ; Fri, 12 Apr 2013 22:26:04 +1000 (EST) Received: from localhost ([::1]:33327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQd3K-0003UC-9O for incoming@patchwork.ozlabs.org; Fri, 12 Apr 2013 08:26:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQd17-0000L2-Pk for qemu-devel@nongnu.org; Fri, 12 Apr 2013 08:23:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQd14-0003ls-Sy for qemu-devel@nongnu.org; Fri, 12 Apr 2013 08:23:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQd14-0003ln-LD for qemu-devel@nongnu.org; Fri, 12 Apr 2013 08:23:42 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3CCNgMq008576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 12 Apr 2013 08:23:42 -0400 Received: from localhost (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3CCNek9006145; Fri, 12 Apr 2013 08:23:41 -0400 From: Stefan Hajnoczi To: Date: Fri, 12 Apr 2013 14:23:31 +0200 Message-Id: <1365769411-2102-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1365769411-2102-1-git-send-email-stefanha@redhat.com> References: <1365769411-2102-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 4/4] cpu-exec: Allow "-d exec" in non-debug builds (drop CONFIG_DEBUG_EXEC) 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: Peter Maydell The CONFIG_DEBUG_EXEC define compiles out a single qemu_log_mask() call, which is a pretty trivial cost even for something in the main cpu_exec() loop. Having this be conditionally defined means that '-d exec' on a non-debug build will silently do nothing. Drop the define and the configure machinery that sets it, in favour of just always allowing this log option to be enabled at runtime. As a concession to the mainloopiness, we use qemu_loglevel_mask()+qemu_log() rather than qemu_log_mask() to avoid the function call overhead. Note that DEBUG_DISAS is always defined, so removing the '|| defined(CONFIG_DEBUG_EXEC)' from those conditionals makes no behavioural change for that logging. Signed-off-by: Peter Maydell Acked-by: Edgar E. Iglesias Signed-off-by: Stefan Hajnoczi --- configure | 3 --- cpu-exec.c | 15 ++++++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 1ed939a..73df181 100755 --- a/configure +++ b/configure @@ -3471,9 +3471,6 @@ echo "ARCH=$ARCH" >> $config_host_mak if test "$debug_tcg" = "yes" ; then echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak fi -if test "$debug" = "yes" ; then - echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak -fi if test "$strip_opt" = "yes" ; then echo "STRIP=${strip}" >> $config_host_mak fi diff --git a/cpu-exec.c b/cpu-exec.c index e74e556..235ddee 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -23,8 +23,6 @@ #include "qemu/atomic.h" #include "sysemu/qtest.h" -//#define CONFIG_DEBUG_EXEC - bool qemu_cpu_has_work(CPUState *cpu) { return cpu_has_work(cpu); @@ -567,7 +565,7 @@ int cpu_exec(CPUArchState *env) env->exception_index = EXCP_INTERRUPT; cpu_loop_exit(env); } -#if defined(DEBUG_DISAS) || defined(CONFIG_DEBUG_EXEC) +#if defined(DEBUG_DISAS) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { /* restore flags in standard format */ #if defined(TARGET_I386) @@ -582,7 +580,7 @@ int cpu_exec(CPUArchState *env) log_cpu_state(env, 0); #endif } -#endif /* DEBUG_DISAS || CONFIG_DEBUG_EXEC */ +#endif /* DEBUG_DISAS */ spin_lock(&tcg_ctx.tb_ctx.tb_lock); tb = tb_find_fast(env); /* Note: we do it here to avoid a gcc bug on Mac OS X when @@ -594,11 +592,10 @@ int cpu_exec(CPUArchState *env) next_tb = 0; tcg_ctx.tb_ctx.tb_invalidated_flag = 0; } -#ifdef CONFIG_DEBUG_EXEC - qemu_log_mask(CPU_LOG_EXEC, "Trace %p [" TARGET_FMT_lx "] %s\n", - tb->tc_ptr, tb->pc, - lookup_symbol(tb->pc)); -#endif + if (qemu_loglevel_mask(CPU_LOG_EXEC)) { + qemu_log("Trace %p [" TARGET_FMT_lx "] %s\n", + tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); + } /* see if we can patch the calling TB. When the TB spans two pages, we cannot safely do a direct jump. */