qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH 3/3] hw/display/qxl.c: Use trace_event_get_state_backends()
Date: Mon, 20 Jan 2020 15:11:42 +0000	[thread overview]
Message-ID: <20200120151142.18954-4-peter.maydell@linaro.org> (raw)
In-Reply-To: <20200120151142.18954-1-peter.maydell@linaro.org>

The preferred way to test whether a trace event is enabled is to
use trace_event_get_state_backends(), because this will give the
correct answer (allowing expensive computations to be skipped)
whether the trace event is compile-time or run-time disabled.
Convert the old-style direct use of TRACE_FOO_ENABLED.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 6d43b7433cf..80a4dcc40e4 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1764,7 +1764,7 @@ async_common:
         qxl_set_mode(d, val, 0);
         break;
     case QXL_IO_LOG:
-        if (TRACE_QXL_IO_LOG_ENABLED || d->guestdebug) {
+        if (trace_event_get_state_backends(TRACE_QXL_IO_LOG) || d->guestdebug) {
             /* We cannot trust the guest to NUL terminate d->ram->log_buf */
             char *log_buf = g_strndup((const char *)d->ram->log_buf,
                                       sizeof(d->ram->log_buf));
-- 
2.20.1



  parent reply	other threads:[~2020-01-20 15:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 15:11 [PATCH 0/3] Use only trace_event_get_state_backends() to check trace enablement Peter Maydell
2020-01-20 15:11 ` [PATCH 1/3] docs/devel/tracing.txt: Recommend only trace_event_get_state_backends() Peter Maydell
2020-01-20 15:11 ` [PATCH 2/3] memory.c: Use trace_event_get_state_backends() Peter Maydell
2020-01-20 15:11 ` Peter Maydell [this message]
2020-01-21  5:54   ` [PATCH 3/3] hw/display/qxl.c: " Gerd Hoffmann
2020-01-21 11:39 ` [PATCH 0/3] Use only trace_event_get_state_backends() to check trace enablement Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200120151142.18954-4-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).