From patchwork Fri May 9 08:57:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Hahn X-Patchwork-Id: 347345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AC6D1140080 for ; Fri, 9 May 2014 18:57:54 +1000 (EST) Received: from localhost ([::1]:51315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wigcq-0003eb-PG for incoming@patchwork.ozlabs.org; Fri, 09 May 2014 04:57:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WigcU-0003N1-E0 for qemu-devel@nongnu.org; Fri, 09 May 2014 04:57:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WigcP-0007CP-Qy for qemu-devel@nongnu.org; Fri, 09 May 2014 04:57:30 -0400 Received: from mail.univention.de ([82.198.197.8]:2596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WigcP-0007Bt-G0 for qemu-devel@nongnu.org; Fri, 09 May 2014 04:57:25 -0400 Received: from localhost (localhost [127.0.0.1]) by solig.knut.univention.de (Postfix) with ESMTP id D31951053399; Fri, 9 May 2014 10:57:22 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at knut.univention.de Received: from mail.univention.de ([127.0.0.1]) by localhost (solig.knut.univention.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SBdQus29ZFSV; Fri, 9 May 2014 10:57:22 +0200 (CEST) Received: from [192.168.0.191] (mail.univention.de [82.198.197.8]) by solig.knut.univention.de (Postfix) with ESMTPSA id 48CAF104F569; Fri, 9 May 2014 10:57:22 +0200 (CEST) Message-ID: <536C9872.404@univention.de> Date: Fri, 09 May 2014 10:57:22 +0200 From: Philipp Hahn Organization: Univention GmbH User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: xen-devel@lists.xensource.com, qemu-devel@nongnu.org X-Enigmail-Version: 1.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 82.198.197.8 Subject: [Qemu-devel] [BUG] 50MB/min logspam: dma: unregistered DMA channel used nchan=0 dma_pos=0 dma_len=1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hello, a Xen-4.1-3 host system filled its log file with the message dma: unregistered DMA channel used nchan=0 dma_pos=0 dma_len=1 The happened two times was a Windows Server 2003 with GPLPV 0.11.0.372: one VM was migrated to that host and one was directly started there. After a restart of the VM the message no longer gets printed. Looking at both xen-4.1.3/tools/ioemu-qemu-xen/hw/dma.c and qemu-git/hw/dma/i8257.c the message is printed by dma_phony_handler(), which is the default is no other transfer_handler is registered. The function gets run through DMA_run_bh -> DMA_run -> channel_run. In DMA_run() the code checks both the 'mask' and 'status' registers: 383 if ((0 == (d->mask & mask)) && (0 != (d->status & (mask << 4)))) { 384 channel_run (icont, ichan); 385 rearm = 1; 386 } So the messages is printed with maximum frequency, as the BH gets executed each time leading to massive log spam. Looking further I analyzed the following case, which *might* be responsible: While 'mask' is included in the VMStateDescription, 'status' is not. Before the conversion to VMSTATE* the code was commented out from day-one: 512 /* qemu_put_8s (f, &d->status); */ 540 /* qemu_get_8s (f, &d->status); */ 1. Might it be that 'status' is uninitialized after migration? 2. Has someone other seen that message? 3. Could the rate of the message please be limited? See attached patch. 4. Some other ideas or comments? Sincerely Philipp From 5e54adc8f53df4b8c8e8b802049964b2054ad829 Mon Sep 17 00:00:00 2001 Message-Id: <5e54adc8f53df4b8c8e8b802049964b2054ad829.1399625721.git.hahn@univention.de> From: Philipp Hahn Date: Fri, 9 May 2014 10:53:57 +0200 Subject: [PATCH] hw/dma: Print error message only once Organization: Univention GmbH, Bremen, Germany To: qemu-devel@nongnu.org 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 4490372..cd710a9 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 = 0; + 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