From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRGCr-0007gO-B0 for qemu-devel@nongnu.org; Tue, 09 Sep 2014 03:51:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRGCl-0005vh-DB for qemu-devel@nongnu.org; Tue, 09 Sep 2014 03:51:17 -0400 Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]:58704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRGCl-0005vX-6a for qemu-devel@nongnu.org; Tue, 09 Sep 2014 03:51:11 -0400 Received: by mail-we0-f175.google.com with SMTP id w61so1797010wes.20 for ; Tue, 09 Sep 2014 00:51:10 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <540EB169.2000707@redhat.com> Date: Tue, 09 Sep 2014 09:51:05 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <99e4360794b046985ff18c584ee6c11858457392.1410246092.git.hahn@univention.de> In-Reply-To: <99e4360794b046985ff18c584ee6c11858457392.1410246092.git.hahn@univention.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hw/dma: Print error message only once List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Philipp Hahn , qemu-devel@nongnu.org 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 > --- > 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