From patchwork Mon Jul 1 20:01:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2809281 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5ACB59F3EB for ; Mon, 1 Jul 2013 20:04:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F66820182 for ; Mon, 1 Jul 2013 20:04:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 436722017E for ; Mon, 1 Jul 2013 20:04:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 25622E60E8 for ; Mon, 1 Jul 2013 13:04:32 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id ADAA6E5C25 for ; Mon, 1 Jul 2013 13:04:14 -0700 (PDT) Received: by mail-ea0-f177.google.com with SMTP id j14so2303352eak.22 for ; Mon, 01 Jul 2013 13:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer; bh=TJWU6siRsEuOtPhHCucVRBjS15iMMLuMzXO250nUPCg=; b=VrReflKF73hNNHNk4ilLa9hKQoSvqkFZtaVEtza4AL8vr5huy+qAsSnfkr3aNMHxNX JxHXuZcR7nfC3Qozq7IzT/tcXcA6o4/zrOb9zGUECIr6OV5SrgcD+VmZh9eeaHR+gdRM fo/a8XkVcxq6znfEj8hTyYrZubz90M1EGe07c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=TJWU6siRsEuOtPhHCucVRBjS15iMMLuMzXO250nUPCg=; b=k/nnZhs978J7C8RxuAInBOfDBGziVB8/7IpuMVoqBgV2bLrx6/XXA0KwEgWPWoj4Pi lnYoIbmSuGe6ofRfUbYwRoOz9t8v85t5d0DJ+EH/SPSaEUCQ0ixWFYvACiPVF6/aoMig mUigazPs0XxIEqub30X8AftAesjjnAFxKGXbI9Fy37PO3kpOq84DNb/azdiUVX9pebwu ecdS5VktzlaNEJeHc0DZk66ujn6pRFuNQllIduGo4WuJiECT94O2EedyhdDHc3dKTKrn +lPsSg8wVQ8Kck2vogM0cOs2nnEgIWGQlj4CyfB07ia8z8gI3OsDaWykTy2vUr31HG7A YhDw== X-Received: by 10.14.241.136 with SMTP id g8mr22796772eer.104.1372709053913; Mon, 01 Jul 2013 13:04:13 -0700 (PDT) Received: from gina.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id ci50sm31853473eeb.12.2013.07.01.13.04.11 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Jul 2013 13:04:12 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Subject: [PATCH 1/3] drm/mm: fix debug table BUG Date: Mon, 1 Jul 2013 22:01:02 +0200 Message-Id: <1372708864-26963-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.3.1 X-Gm-Message-State: ALoCoQlCxMTn66FXjMsDP10dhiWn7XyjKmU6XNGEMZl6Qm/AewtI8CY0nYbAWPiV2tZR4nHMWCah Cc: Daniel Vetter , DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In commit 3a359f0b21ab218c1bf7a6a1b638b6fd143d0b99 Author: Daniel Vetter Date: Sat Apr 20 12:08:11 2013 +0200 drm/mm: fix dump table BUG I've failed to fix both instances of the regression introduced in commit 9e8944ab564f2e3dde90a518cd32048c58918608 Author: Chris Wilson Date: Thu Nov 15 11:32:17 2012 +0000 drm: Introduce an iterator over holes in the drm_mm range manager Patch this up in the same way by extracting the hole debug logic into it's own function, since that'll also clarify the logic a bit. Cc: Chris Wilson Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_mm.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 07cf99c..f9d4873 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c @@ -716,36 +716,37 @@ void drm_mm_takedown(struct drm_mm * mm) } EXPORT_SYMBOL(drm_mm_takedown); -void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) +static unsigned long drm_mm_debug_hole(struct drm_mm_node *entry, + const char *prefix) { - struct drm_mm_node *entry; - unsigned long total_used = 0, total_free = 0, total = 0; unsigned long hole_start, hole_end, hole_size; - hole_start = drm_mm_hole_node_start(&mm->head_node); - hole_end = drm_mm_hole_node_end(&mm->head_node); - hole_size = hole_end - hole_start; - if (hole_size) + if (entry->hole_follows) { + hole_start = drm_mm_hole_node_start(entry); + hole_end = drm_mm_hole_node_end(entry); + hole_size = hole_end - hole_start; printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", prefix, hole_start, hole_end, hole_size); - total_free += hole_size; + return hole_size; + } + + return 0; +} + +void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) +{ + struct drm_mm_node *entry; + unsigned long total_used = 0, total_free = 0, total = 0; + + total_free += drm_mm_debug_hole(&mm->head_node, prefix); drm_mm_for_each_node(entry, mm) { printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: used\n", prefix, entry->start, entry->start + entry->size, entry->size); total_used += entry->size; - - if (entry->hole_follows) { - hole_start = drm_mm_hole_node_start(entry); - hole_end = drm_mm_hole_node_end(entry); - hole_size = hole_end - hole_start; - printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", - prefix, hole_start, hole_end, - hole_size); - total_free += hole_size; - } + total_free += drm_mm_debug_hole(entry, prefix); } total = total_free + total_used;