From patchwork Thu Apr 11 20:21:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 16048 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-fa0-f71.google.com (mail-fa0-f71.google.com [209.85.161.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 761CD238FF for ; Thu, 11 Apr 2013 20:22:17 +0000 (UTC) Received: by mail-fa0-f71.google.com with SMTP id w1sf2501654fad.2 for ; Thu, 11 Apr 2013 13:21:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=TBg1MNnrurzZXLu7i2ALaUsDwvPtg/TUWEDDdeOKYsI=; b=b4UdyfY7WI84wX/vDAyBwh80Upvw0wBbrk05pwdU/AeI1ZVBOVSm4RQcKJV1AGhtA9 0jeM38m5e3aF5+rJlPxDrB05KiW+E1gE0jFU3/tKdNQy8ak2Rdiy8JwqZHI0azL1pSrc +jVD84EIdUfHFoK8FIynTb1W/0m2yJcb+VRAvTnEUVoYfr1MffdT6VoTZAeqKvqov9xp r52sew6Xoex8d+DLfJTdfrY4vSbhUGixXJ1zB5XX1WK38j6oryhc3gvfx8KSwAdLvxJI CORxAvbj2oeXhgEInhGgJ+3rPw84JB3LP+H09fmhmXVOt8fxUYJK4j9+rw4ZZcW4Tdls J8Rg== X-Received: by 10.180.75.82 with SMTP id a18mr2707309wiw.0.1365711714448; Thu, 11 Apr 2013 13:21:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.94.38 with SMTP id cz6ls360539wib.5.canary; Thu, 11 Apr 2013 13:21:54 -0700 (PDT) X-Received: by 10.180.206.205 with SMTP id lq13mr12159077wic.21.1365711714349; Thu, 11 Apr 2013 13:21:54 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id uk4si2128882wjc.18.2013.04.11.13.21.54 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 13:21:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jz10so1781326veb.19 for ; Thu, 11 Apr 2013 13:21:53 -0700 (PDT) X-Received: by 10.52.93.235 with SMTP id cx11mr5198703vdb.51.1365711713175; Thu, 11 Apr 2013 13:21:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp37302veb; Thu, 11 Apr 2013 13:21:52 -0700 (PDT) X-Received: by 10.180.72.165 with SMTP id e5mr35975028wiv.7.1365711711834; Thu, 11 Apr 2013 13:21:51 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id mb1si2096844wjb.238.2013.04.11.13.21.50 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Apr 2013 13:21:51 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UQO0A-0006Et-F4; Thu, 11 Apr 2013 21:21:46 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org, Anthony Liguori Subject: [PATCH] cpu-exec: Allow "-d exec" in non-debug builds (drop CONFIG_DEBUG_EXEC) Date: Thu, 11 Apr 2013 21:21:46 +0100 Message-Id: <1365711706-23960-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQmxcwoAFtaLNOAph5FhPypfwOtMXIH71FbXBpfT1rfh7hUX2JWMfVOzjIXjNL3DraxT6AGZ X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- I've been burnt at least once by asking a user to do a '-d exec' log only to find it didn't actually log anything... 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. */