[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] hw/dma: Print error message only once
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] hw/dma: Print error message only once |
Date: |
Tue, 09 Sep 2014 09:51:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
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 <address@hidden>
> ---
> 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