All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: peter.maydell@linaro.org
Cc: agraf@suse.de, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Laurent Vivier <lvivier@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PULL 17/44] spapr_drc: convert to trace framework instead of DPRINTF
Date: Thu, 22 Sep 2016 16:37:15 +1000	[thread overview]
Message-ID: <1474526262-27011-18-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1474526262-27011-1-git-send-email-david@gibson.dropbear.id.au>

From: Laurent Vivier <lvivier@redhat.com>

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr_drc.c  | 54 ++++++++++++++++++++---------------------------------
 hw/ppc/trace-events | 21 +++++++++++++++++++++
 2 files changed, 41 insertions(+), 34 deletions(-)

diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 4b1a943..6e54fd4 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -20,20 +20,7 @@
 #include "qapi/visitor.h"
 #include "qemu/error-report.h"
 #include "hw/ppc/spapr.h" /* for RTAS return codes */
-
-/* #define DEBUG_SPAPR_DRC */
-
-#ifdef DEBUG_SPAPR_DRC
-#define DPRINTF(fmt, ...) \
-    do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#define DPRINTFN(fmt, ...) \
-    do { DPRINTF(fmt, ## __VA_ARGS__); fprintf(stderr, "\n"); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-    do { } while (0)
-#define DPRINTFN(fmt, ...) \
-    do { } while (0)
-#endif
+#include "trace.h"
 
 #define DRC_CONTAINER_PATH "/dr-connector"
 #define DRC_INDEX_TYPE_SHIFT 28
@@ -69,7 +56,7 @@ static uint32_t set_isolation_state(sPAPRDRConnector *drc,
 {
     sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
 
-    DPRINTFN("drc: %x, set_isolation_state: %x", get_index(drc), state);
+    trace_spapr_drc_set_isolation_state(get_index(drc), state);
 
     if (state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) {
         /* cannot unisolate a non-existant resource, and, or resources
@@ -94,11 +81,11 @@ static uint32_t set_isolation_state(sPAPRDRConnector *drc,
          */
         if (drc->awaiting_release) {
             if (drc->configured) {
-                DPRINTFN("finalizing device removal");
+                trace_spapr_drc_set_isolation_state_finalizing(get_index(drc));
                 drck->detach(drc, DEVICE(drc->dev), drc->detach_cb,
                              drc->detach_cb_opaque, NULL);
             } else {
-                DPRINTFN("deferring device removal on unconfigured device\n");
+                trace_spapr_drc_set_isolation_state_deferring(get_index(drc));
             }
         }
         drc->configured = false;
@@ -110,7 +97,7 @@ static uint32_t set_isolation_state(sPAPRDRConnector *drc,
 static uint32_t set_indicator_state(sPAPRDRConnector *drc,
                                     sPAPRDRIndicatorState state)
 {
-    DPRINTFN("drc: %x, set_indicator_state: %x", get_index(drc), state);
+    trace_spapr_drc_set_indicator_state(get_index(drc), state);
     drc->indicator_state = state;
     return RTAS_OUT_SUCCESS;
 }
@@ -120,7 +107,7 @@ static uint32_t set_allocation_state(sPAPRDRConnector *drc,
 {
     sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
 
-    DPRINTFN("drc: %x, set_allocation_state: %x", get_index(drc), state);
+    trace_spapr_drc_set_allocation_state(get_index(drc), state);
 
     if (state == SPAPR_DR_ALLOCATION_STATE_USABLE) {
         /* if there's no resource/device associated with the DRC, there's
@@ -137,7 +124,7 @@ static uint32_t set_allocation_state(sPAPRDRConnector *drc,
         drc->allocation_state = state;
         if (drc->awaiting_release &&
             drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
-            DPRINTFN("finalizing device removal");
+            trace_spapr_drc_set_allocation_state_finalizing(get_index(drc));
             drck->detach(drc, DEVICE(drc->dev), drc->detach_cb,
                          drc->detach_cb_opaque, NULL);
         } else if (drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE) {
@@ -167,12 +154,11 @@ static const void *get_fdt(sPAPRDRConnector *drc, int *fdt_start_offset)
 
 static void set_configured(sPAPRDRConnector *drc)
 {
-    DPRINTFN("drc: %x, set_configured", get_index(drc));
+    trace_spapr_drc_set_configured(get_index(drc));
 
     if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_UNISOLATED) {
         /* guest should be not configuring an isolated device */
-        DPRINTFN("drc: %x, set_configured: skipping isolated device",
-                 get_index(drc));
+        trace_spapr_drc_set_configured_skipping(get_index(drc));
         return;
     }
     drc->configured = true;
@@ -222,7 +208,7 @@ static uint32_t entity_sense(sPAPRDRConnector *drc, sPAPRDREntitySense *state)
         }
     }
 
-    DPRINTFN("drc: %x, entity_sense: %x", get_index(drc), state);
+    trace_spapr_drc_entity_sense(get_index(drc), *state);
     return RTAS_OUT_SUCCESS;
 }
 
@@ -336,7 +322,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name,
 static void attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt,
                    int fdt_start_offset, bool coldplug, Error **errp)
 {
-    DPRINTFN("drc: %x, attach", get_index(drc));
+    trace_spapr_drc_attach(get_index(drc));
 
     if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) {
         error_setg(errp, "an attached device is still awaiting release");
@@ -389,7 +375,7 @@ static void detach(sPAPRDRConnector *drc, DeviceState *d,
                    spapr_drc_detach_cb *detach_cb,
                    void *detach_cb_opaque, Error **errp)
 {
-    DPRINTFN("drc: %x, detach", get_index(drc));
+    trace_spapr_drc_detach(get_index(drc));
 
     drc->detach_cb = detach_cb;
     drc->detach_cb_opaque = detach_cb_opaque;
@@ -415,21 +401,21 @@ static void detach(sPAPRDRConnector *drc, DeviceState *d,
     }
 
     if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) {
-        DPRINTFN("awaiting transition to isolated state before removal");
+        trace_spapr_drc_awaiting_isolated(get_index(drc));
         drc->awaiting_release = true;
         return;
     }
 
     if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI &&
         drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
-        DPRINTFN("awaiting transition to unusable state before removal");
+        trace_spapr_drc_awaiting_unusable(get_index(drc));
         drc->awaiting_release = true;
         return;
     }
 
     if (drc->awaiting_allocation) {
         drc->awaiting_release = true;
-        DPRINTFN("awaiting allocation to complete before removal");
+        trace_spapr_drc_awaiting_allocation(get_index(drc));
         return;
     }
 
@@ -460,7 +446,7 @@ static void reset(DeviceState *d)
     sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
     sPAPRDREntitySense state;
 
-    DPRINTFN("drc reset: %x", drck->get_index(drc));
+    trace_spapr_drc_reset(drck->get_index(drc));
     /* immediately upon reset we can safely assume DRCs whose devices
      * are pending removal can be safely removed, and that they will
      * subsequently be left in an ISOLATED state. move the DRC to this
@@ -502,7 +488,7 @@ static void realize(DeviceState *d, Error **errp)
     gchar *child_name;
     Error *err = NULL;
 
-    DPRINTFN("drc realize: %x", drck->get_index(drc));
+    trace_spapr_drc_realize(drck->get_index(drc));
     /* NOTE: we do this as part of realize/unrealize due to the fact
      * that the guest will communicate with the DRC via RTAS calls
      * referencing the global DRC index. By unlinking the DRC
@@ -513,7 +499,7 @@ static void realize(DeviceState *d, Error **errp)
     root_container = container_get(object_get_root(), DRC_CONTAINER_PATH);
     snprintf(link_name, sizeof(link_name), "%x", drck->get_index(drc));
     child_name = object_get_canonical_path_component(OBJECT(drc));
-    DPRINTFN("drc child name: %s", child_name);
+    trace_spapr_drc_realize_child(drck->get_index(drc), child_name);
     object_property_add_alias(root_container, link_name,
                               drc->owner, child_name, &err);
     if (err) {
@@ -521,7 +507,7 @@ static void realize(DeviceState *d, Error **errp)
         object_unref(OBJECT(drc));
     }
     g_free(child_name);
-    DPRINTFN("drc realize complete");
+    trace_spapr_drc_realize_complete(drck->get_index(drc));
 }
 
 static void unrealize(DeviceState *d, Error **errp)
@@ -532,7 +518,7 @@ static void unrealize(DeviceState *d, Error **errp)
     char name[256];
     Error *err = NULL;
 
-    DPRINTFN("drc unrealize: %x", drck->get_index(drc));
+    trace_spapr_drc_unrealize(drck->get_index(drc));
     root_container = container_get(object_get_root(), DRC_CONTAINER_PATH);
     snprintf(name, sizeof(name), "%x", drck->get_index(drc));
     object_property_del(root_container, name, &err);
diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events
index dfeab93..59caffd 100644
--- a/hw/ppc/trace-events
+++ b/hw/ppc/trace-events
@@ -35,6 +35,27 @@ spapr_iommu_ddw_create(uint64_t buid, uint32_t cfgaddr, uint64_t pg_size, uint64
 spapr_iommu_ddw_remove(uint32_t liobn) "liobn=%"PRIx32
 spapr_iommu_ddw_reset(uint64_t buid, uint32_t cfgaddr) "buid=%"PRIx64" addr=%"PRIx32
 
+# hw/ppc/spapr_drc.c
+spapr_drc_set_isolation_state(uint32_t index, int state) "drc: 0x%"PRIx32", state: %"PRIx32
+spapr_drc_set_isolation_state_finalizing(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_set_isolation_state_deferring(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_set_indicator_state(uint32_t index, int state) "drc: 0x%"PRIx32", state: 0x%x"
+spapr_drc_set_allocation_state(uint32_t index, int state) "drc: 0x%"PRIx32", state: 0x%x"
+spapr_drc_set_allocation_state_finalizing(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_set_configured(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_set_configured_skipping(uint32_t index) "drc: 0x%"PRIx32", isolated device"
+spapr_drc_entity_sense(uint32_t index, int state) "drc: 0x%"PRIx32", state: 0x%x"
+spapr_drc_attach(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_detach(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_awaiting_isolated(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_awaiting_unusable(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_awaiting_allocation(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_reset(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_realize(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_realize_child(uint32_t index, char *childname) "drc: 0x%"PRIx32", child name: %s"
+spapr_drc_realize_complete(uint32_t index) "drc: 0x%"PRIx32
+spapr_drc_unrealize(uint32_t index) "drc: 0x%"PRIx32
+
 # hw/ppc/ppc.c
 ppc_tb_adjust(uint64_t offs1, uint64_t offs2, int64_t diff, int64_t seconds) "adjusted from 0x%"PRIx64" to 0x%"PRIx64", diff %"PRId64" (%"PRId64"s)"
 
-- 
2.7.4

  parent reply	other threads:[~2016-09-22  6:38 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22  6:36 [Qemu-devel] [PULL 00/44] ppc-for-2.8 queue 20160922 David Gibson
2016-09-22  6:36 ` [Qemu-devel] [PULL 01/44] MAINTAINERS: Add some missing ppc-related files David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 02/44] ppc: restrict the use of the rfi instruction David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 03/44] target-ppc: add vector insert instructions David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 04/44] target-ppc: add vector extract instructions David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 05/44] target-ppc: add vector count trailing zeros instructions David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 06/44] target-ppc: add vector bit permute doubleword instruction David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 07/44] target-ppc: add vector permute right indexed instruction David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 08/44] ppc: Fix signal delivery in ppc-user and ppc64-user David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 09/44] qtest: replace strtoXX() by qemu_strtoXX() David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 10/44] libqos: define SPAPR libqos functions David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 11/44] tests: add RTAS command in the protocol David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 12/44] MAINTAINERS: add sPAPR tests David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 13/44] adb-keys.h: initial commit David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 14/44] adb.c: add support for QKeyCode David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 15/44] adb.c: correct several key assignments David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 16/44] adb.c: prevent NO_KEY value from going to guest David Gibson
2016-09-22  6:37 ` David Gibson [this message]
2016-09-22  6:37 ` [Qemu-devel] [PULL 18/44] spapr_rtas: convert to trace framework instead of DPRINTF David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 19/44] spapr_vio: " David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 20/44] spapr_llan: " David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 21/44] spapr_vscsi: " David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 22/44] target-ppc: consolidate load operations David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 23/44] target-ppc: convert ld64 to use new macro David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 24/44] target-ppc: convert ld[16, 32, 64]ur " David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 25/44] target-ppc: consolidate store operations David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 26/44] target-ppc: convert st64 to use new macro David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 27/44] target-ppc: convert st[16, 32, 64]r " David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 28/44] target-ppc: consolidate load with reservation David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 29/44] target-ppc: move out stqcx impementation David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 30/44] target-ppc: consolidate store conditional David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 31/44] target-ppc: add xxspltib instruction David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 32/44] target-ppc: add lxsi[bw]zx instruction David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 33/44] target-ppc: add stxsi[bh]x instruction David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 34/44] target-ppc: implement darn instruction David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 35/44] spapr: Introduce sPAPRCPUCoreClass David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 36/44] target-ppc: add TLB_NEED_LOCAL_FLUSH flag David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 37/44] target-ppc: add flag in check_tlb_flush() David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 38/44] target-ppc: tlbie/tlbivax should have global effect David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 39/44] Enable H_CLEAR_MOD and H_CLEAR_REF hypercalls on KVM/PPC64 David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 40/44] ppc/xics: account correct irq status David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 41/44] ppc/xics: An ICS with offset 0 is assumed to be uninitialized David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 42/44] ppc/kvm: Mark 64kB page size support as disabled if not available David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 43/44] linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP David Gibson
2016-09-22  6:37 ` [Qemu-devel] [PULL 44/44] monitor: fix crash for platforms without a CPU 0 David Gibson
2016-09-22  7:54 ` [Qemu-devel] [PULL 00/44] ppc-for-2.8 queue 20160922 no-reply
2016-09-22 14:03 ` Peter Maydell
2016-09-22 17:38   ` [Qemu-devel] [Qemu-ppc] " Nikunj A Dadhania
2016-09-22 19:12     ` Nikunj A Dadhania
2016-09-22 19:41     ` Richard Henderson
2016-09-23  2:40   ` [Qemu-devel] " David Gibson
2016-09-23  7:42     ` Alex Bennée
2016-09-24  1:19       ` David Gibson
2016-09-24 14:31         ` Alex Bennée
2016-09-25 10:59           ` David Gibson
2016-09-26  9:04           ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
2016-09-26 23:11             ` Alex Bennée

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=1474526262-27011-18-git-send-email-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.