All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/dma: Print error message only once
@ 2014-09-09  7:01 Philipp Hahn
  2014-09-09  7:51 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Hahn @ 2014-09-09  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philipp Hahn

otherwise the message
	dma: unregistered DMA channel used nchan=0 dma_pos=0 dma_len=1
gets printed every time and fills up the log-file with 50 MiB / minute.

Signed-off-by: Philipp Hahn <hahn@univention.de>
---
 hw/dma/i8257.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index dd370ed..9673ab6 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -473,8 +473,14 @@ static void dma_reset(void *opaque)
 
 static int dma_phony_handler (void *opaque, int nchan, int dma_pos, int dma_len)
 {
-    dolog ("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n",
-           nchan, dma_pos, dma_len);
+    static int once;
+    int mask = 1 << nchan;
+
+    if (0 == (once & mask)) {
+        once |= mask;
+        dolog("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n",
+              nchan, dma_pos, dma_len);
+    }
     return dma_pos;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/dma: Print error message only once
  2014-09-09  7:01 [Qemu-devel] [PATCH] hw/dma: Print error message only once Philipp Hahn
@ 2014-09-09  7:51 ` Paolo Bonzini
  2014-09-10 11:47   ` [Qemu-devel] [PATCH v2] hw/dma/i8257: Silence phony error message Philipp Hahn
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2014-09-09  7:51 UTC (permalink / raw)
  To: Philipp Hahn, qemu-devel

Il 09/09/2014 09:01, Philipp Hahn ha scritto:
> otherwise the message
> 	dma: unregistered DMA channel used nchan=0 dma_pos=0 dma_len=1
> gets printed every time and fills up the log-file with 50 MiB / minute.
> 
> Signed-off-by: Philipp Hahn <hahn@univention.de>
> ---
>  hw/dma/i8257.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
> index dd370ed..9673ab6 100644
> --- a/hw/dma/i8257.c
> +++ b/hw/dma/i8257.c
> @@ -473,8 +473,14 @@ static void dma_reset(void *opaque)
>  
>  static int dma_phony_handler (void *opaque, int nchan, int dma_pos, int dma_len)
>  {
> -    dolog ("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n",
> -           nchan, dma_pos, dma_len);
> +    static int once;
> +    int mask = 1 << nchan;
> +
> +    if (0 == (once & mask)) {
> +        once |= mask;
> +        dolog("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n",
> +              nchan, dma_pos, dma_len);
> +    }
>      return dma_pos;
>  }
>  
> 

Can you just convert it to a tracepoint and remove the message?

Thanks,

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH v2] hw/dma/i8257: Silence phony error message
  2014-09-09  7:51 ` Paolo Bonzini
@ 2014-09-10 11:47   ` Philipp Hahn
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Hahn @ 2014-09-10 11:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Philipp Hahn

Convert into trace event. Otherwise the message
	dma: unregistered DMA channel used nchan=0 dma_pos=0 dma_len=1
gets printed every time and fills up the log-file with 50 MiB / minute.

Signed-off-by: Philipp Hahn <hahn@univention.de>
---
 v2:
   Convert into trace event instead of tracking once per static bitmap.
---
 hw/dma/i8257.c | 4 ++--
 trace-events   | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index dd370ed..a414029 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,6 +24,7 @@
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
 #include "qemu/main-loop.h"
+#include "trace.h"
 
 /* #define DEBUG_DMA */
 
@@ -473,8 +474,7 @@ static void dma_reset(void *opaque)
 
 static int dma_phony_handler (void *opaque, int nchan, int dma_pos, int dma_len)
 {
-    dolog ("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n",
-           nchan, dma_pos, dma_len);
+    trace_i8257_unregistered_dma(nchan, dma_pos, dma_len);
     return dma_pos;
 }
 
diff --git a/trace-events b/trace-events
index 03ac5d2..c12afc0 100644
--- a/trace-events
+++ b/trace-events
@@ -1318,3 +1318,6 @@ mhp_pc_dimm_assigned_address(uint64_t addr) "0x%"PRIx64
 # target-s390x/kvm.c
 kvm_enable_cmma(int rc) "CMMA: enabling with result code %d"
 kvm_clear_cmma(int rc) "CMMA: clearing with result code %d"
+
+# hw/dma/i8257.c
+i8257_unregistered_dma(int nchan, int dma_pos, int dma_len) "unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d"
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-10 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09  7:01 [Qemu-devel] [PATCH] hw/dma: Print error message only once Philipp Hahn
2014-09-09  7:51 ` Paolo Bonzini
2014-09-10 11:47   ` [Qemu-devel] [PATCH v2] hw/dma/i8257: Silence phony error message Philipp Hahn

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.