From patchwork Tue Nov 17 16:33:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11912855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C80A5C5519F for ; Tue, 17 Nov 2020 16:33:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5924121734 for ; Tue, 17 Nov 2020 16:33:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GGhuwmY5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5924121734 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FA626E03C; Tue, 17 Nov 2020 16:33:44 +0000 (UTC) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id 211D56E03F for ; Tue, 17 Nov 2020 16:33:44 +0000 (UTC) Received: by mail-ed1-x532.google.com with SMTP id m16so8239054edr.3 for ; Tue, 17 Nov 2020 08:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kF3bqSWe+zzbiz62ZROClH4N2gkr3yMVa2LLfDL/JLs=; b=GGhuwmY5uJYHForfTmKB2tyIeHU4+O94A+e4wCSbygOHeXuZ2M1xgF2R2aWjoorUgJ bUQm/pds5n4OGZx4nqkbdmnnNjtFAR/RjWid9Up80XPS8T9WVWdVwGpIFLwp0Aii3E9k JGHeiEaN2/PBw7ayhtAmuuSPDg71jXjuLIDmB0P5JHzAzmIyBlUrRFoDKK8WKPb/hNOG gdwZcGtAAy/a019udo4Re7PA8tZ8jM7NFl0TG9TL6GVrfwHL01D00BM+xDaRVIFP5agz OyoaksXEUnif81tyhhwSjd5nII+Rn/fD0nd81ZlJ3PA866sSQXSoJ+sKv9M4gSun55qb FCHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kF3bqSWe+zzbiz62ZROClH4N2gkr3yMVa2LLfDL/JLs=; b=ig4TLKtH55cQEyL+nDmnbQK8uK/BkR6KPg3z+fj0uHa3YHVWC8droQZ0+R7sbU9FrJ pxCtMcOVHGBnQxid+Wq1hdZfZpuyI3nOTWCyHthe+MDe8uBntOdjX/CT7n4C1rR/Q6MN 7FbYhOeMN0RLBCX9mzMcV5pC1nrdw+OiGDiV+94Fhh/WCiV3Ih3MDqixTfuGzogdUuKs SeW++f60LBj7gCzOiA/OZeDbMLZn2ptiPTGY1ZLmZFM3+IWGMO1DSOFUB+xxvJCHWXk6 nO7Xn7gGp+3sqn3DdDg28lyX0y/PMbMUscIbFNQgSDY9VjmVnGb+1q3AF4DhcEQLRdvz Qa9w== X-Gm-Message-State: AOAM532gj2L2ouK+p8G+X2ZsUZLxgOtaFgTIBi4uippzDbRJZISu3Qdw JpgHKxndv1ogi/kgeqbQHuuaNsbhiJY= X-Google-Smtp-Source: ABdhPJxLME8JtVTzp89/IZRlUirqZl1sBv4ZcKqhAs5vifZxqRB5PLTceQBF2ElwygYKrUVzx+qxhw== X-Received: by 2002:a17:906:b783:: with SMTP id dt3mr19663056ejb.534.1605630819934; Tue, 17 Nov 2020 08:33:39 -0800 (PST) Received: from abel.fritz.box ([2a02:908:1252:fb60:dd48:f15c:7bed:4c52]) by smtp.gmail.com with ESMTPSA id dn16sm12225351edb.19.2020.11.17.08.33.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 08:33:39 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/4] drm/ttm/drivers: remove unecessary ttm_module.h include Date: Tue, 17 Nov 2020 17:33:35 +0100 Message-Id: <20201117163338.1784-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" ttm_module.h deals with internals of TTM and should never be include outside of it. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 - drivers/gpu/drm/nouveau/nouveau_drv.h | 1 - drivers/gpu/drm/qxl/qxl_drv.h | 1 - drivers/gpu/drm/qxl/qxl_ttm.c | 1 - drivers/gpu/drm/radeon/radeon.h | 1 - drivers/gpu/drm/radeon/radeon_ttm.c | 1 - drivers/gpu/drm/ttm/ttm_agp_backend.c | 1 - drivers/gpu/drm/ttm/ttm_bo_vm.c | 1 - drivers/gpu/drm/ttm/ttm_range_manager.c | 1 - drivers/gpu/drm/vmwgfx/ttm_object.c | 1 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 - drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 1 - drivers/gpu/drm/vmwgfx/vmwgfx_thp.c | 1 - include/drm/ttm/ttm_bo_driver.h | 1 - 16 files changed, 16 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 183b09d71b64..6e042b4ed13d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -55,7 +55,6 @@ #include #include #include -#include #include #include diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index c438d290a6db..967859c6be3c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 8e90b3e47bbe..700fa0979d14 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -54,7 +54,6 @@ #include #include #include -#include #include diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 8bd0f916dfbc..83b54f0dad61 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include "qxl_dev.h" diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index 128c38c8a837..0cc661df2258 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "qxl_drv.h" diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 28cb8ced91b9..428c561a4e2c 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -75,7 +75,6 @@ #include #include #include -#include #include #include diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 0ca381b95d3d..2259d3811a45 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include "radeon_reg.h" diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index 03c86628e4ac..8f9fa4188897 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c @@ -32,7 +32,6 @@ #define pr_fmt(fmt) "[TTM] " fmt -#include #include #include #include diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 2944fa0af493..144a4940b6b6 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -31,7 +31,6 @@ #define pr_fmt(fmt) "[TTM] " fmt -#include #include #include #include diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c index ea77919569a2..4c0c756c9124 100644 --- a/drivers/gpu/drm/ttm/ttm_range_manager.c +++ b/drivers/gpu/drm/ttm/ttm_range_manager.c @@ -29,7 +29,6 @@ * Authors: Thomas Hellstrom */ -#include #include #include #include diff --git a/drivers/gpu/drm/vmwgfx/ttm_object.c b/drivers/gpu/drm/vmwgfx/ttm_object.c index 16077785ad47..0fe869d0fad1 100644 --- a/drivers/gpu/drm/vmwgfx/ttm_object.c +++ b/drivers/gpu/drm/vmwgfx/ttm_object.c @@ -59,7 +59,6 @@ #define pr_fmt(fmt) "[TTM] " fmt -#include #include #include #include diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 1310857879e7..e6de876a016a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include "ttm_object.h" diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index b45becbb00f8..5b9a28157dd3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -39,7 +39,6 @@ #include #include -#include #include "ttm_lock.h" #include "ttm_object.h" diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c index be325a62c178..8fe26e32f920 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c @@ -29,7 +29,6 @@ */ #include "vmwgfx_drv.h" -#include #include #include #include diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c b/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c index 155ca3a5c7e5..e8e79de255cf 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_thp.c @@ -5,7 +5,6 @@ * Copyright (C) 2007-2019 Vmware, Inc. All rights reservedd. */ #include "vmwgfx_drv.h" -#include #include #include diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 54788a5160a0..fdf01c7f1f99 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -38,7 +38,6 @@ #include #include "ttm_bo_api.h" -#include "ttm_module.h" #include "ttm_placement.h" #include "ttm_tt.h" #include "ttm_pool.h" From patchwork Tue Nov 17 16:33:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11912853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADEA4C2D0E4 for ; Tue, 17 Nov 2020 16:33:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33EBA216C4 for ; Tue, 17 Nov 2020 16:33:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bzlsn5f6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33EBA216C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DCE46E03F; Tue, 17 Nov 2020 16:33:45 +0000 (UTC) Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by gabe.freedesktop.org (Postfix) with ESMTPS id A7BAB6E03C for ; Tue, 17 Nov 2020 16:33:43 +0000 (UTC) Received: by mail-ej1-x642.google.com with SMTP id k27so2914326ejs.10 for ; Tue, 17 Nov 2020 08:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PchTq9pBWco3KprvJ1j/lo5yNyEtD7jqJKvWp8PECG8=; b=Bzlsn5f6ETrDyYsPXDqR1OY5Ewpi+dhGnm6cV4CFjb1R5i4212N7EzEXUrXpYx2Iyy VTJxzbin9aqsrcVI2ObHdjfZcdYIz0SBe5Uj3W7u04W9cW+ozn4RxvUALO0HAAfFcuyL Kh0oSn04aKSk5OdXME6EUo6zm+wdfJcguBAPKik40FT+xkTh2dXJZNl8NWgv8igZdTG1 siZxzG3blI0kY+CN9E5PLfrPbzeKiFxg8+Gpt4sIfbUxRuyhksCZhoaKW/6N2CwphUvW W5PYPZRBOF3D+WhYR/j3oizhLU1aWXPxM8GYJpmtqRQT8UCCeR9Jmky32I607cDoGBnI Y3kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PchTq9pBWco3KprvJ1j/lo5yNyEtD7jqJKvWp8PECG8=; b=Mm1yr1G1sH5vWBMihT2Lvmmokn4oveNPuvaroX0K3BvGwkOOfu/QBWu/WhZxmLAWSy ZFvz7ItDKAxWu1fyw2fi7H9ipxQQmhsCo3sCIyolmBJCootxst1Pcw6YqZ0puzJ0962T TmwiTgSV5PbEyAK1k686rGjA60B69ewwDqtNaj9dIWN29LmTRUjusF3LHMxGY0OsBSeJ oHGdSJPwAwZaDL1GGK+TJICKJ7KZpWGNwiY4f5jbhHZH+8fVbTQk/E+4CHyMXppAIFiE kYKySmiFwaSHplB0j2fVEyS7tUF0FjbpPiKwiuPEPDn3zhLhV/mvAMiFWLOWq+lYqJS1 LHwA== X-Gm-Message-State: AOAM531d/1BPTqZJmD5xzLnLXi6joPoR2l7gKJpAZAGnaccvTzX/INnk UqfWsB+evNomBqmt5sMDL7CsNQZ5pLE= X-Google-Smtp-Source: ABdhPJzyCCAalP7dwqMyWZeHpCIIouYf7tt0VvrR6uLlYXosrnpzFg0o7fW8F4aE4NmfvdQnACkNLA== X-Received: by 2002:a17:906:c18c:: with SMTP id g12mr19755982ejz.334.1605630820776; Tue, 17 Nov 2020 08:33:40 -0800 (PST) Received: from abel.fritz.box ([2a02:908:1252:fb60:dd48:f15c:7bed:4c52]) by smtp.gmail.com with ESMTPSA id dn16sm12225351edb.19.2020.11.17.08.33.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 08:33:40 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] drm/ttm: replace sysfs with debugfs Date: Tue, 17 Nov 2020 17:33:36 +0100 Message-Id: <20201117163338.1784-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201117163338.1784-1-christian.koenig@amd.com> References: <20201117163338.1784-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As far as I can tell this has never been used by any userspace application. The number of BOs in the system is far better suited in debugfs than sysfs and we now should be able to add other information here as well. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 51 ++-------------- drivers/gpu/drm/ttm/ttm_module.c | 58 ++----------------- {include => drivers/gpu}/drm/ttm/ttm_module.h | 8 +-- include/drm/ttm/ttm_bo_driver.h | 1 - 4 files changed, 13 insertions(+), 105 deletions(-) rename {include => drivers/gpu}/drm/ttm/ttm_module.h (94%) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 0a93df93dba4..cd1273c76c51 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -31,7 +31,6 @@ #define pr_fmt(fmt) "[TTM] " fmt -#include #include #include #include @@ -43,7 +42,7 @@ #include #include -static void ttm_bo_global_kobj_release(struct kobject *kobj); +#include "ttm_module.h" /** * ttm_global_mutex - protecting the global BO state @@ -53,11 +52,6 @@ unsigned ttm_bo_glob_use_count; struct ttm_bo_global ttm_bo_glob; EXPORT_SYMBOL(ttm_bo_glob); -static struct attribute ttm_bo_count = { - .name = "bo_count", - .mode = S_IRUGO -}; - /* default destructor */ static void ttm_bo_default_destroy(struct ttm_buffer_object *bo) { @@ -83,32 +77,6 @@ static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, } } -static ssize_t ttm_bo_global_show(struct kobject *kobj, - struct attribute *attr, - char *buffer) -{ - struct ttm_bo_global *glob = - container_of(kobj, struct ttm_bo_global, kobj); - - return snprintf(buffer, PAGE_SIZE, "%d\n", - atomic_read(&glob->bo_count)); -} - -static struct attribute *ttm_bo_global_attrs[] = { - &ttm_bo_count, - NULL -}; - -static const struct sysfs_ops ttm_bo_global_ops = { - .show = &ttm_bo_global_show -}; - -static struct kobj_type ttm_bo_glob_kobj_type = { - .release = &ttm_bo_global_kobj_release, - .sysfs_ops = &ttm_bo_global_ops, - .default_attrs = ttm_bo_global_attrs -}; - static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo, struct ttm_resource *mem) { @@ -1216,14 +1184,6 @@ int ttm_bo_init(struct ttm_bo_device *bdev, } EXPORT_SYMBOL(ttm_bo_init); -static void ttm_bo_global_kobj_release(struct kobject *kobj) -{ - struct ttm_bo_global *glob = - container_of(kobj, struct ttm_bo_global, kobj); - - __free_page(glob->dummy_read_page); -} - static void ttm_bo_global_release(void) { struct ttm_bo_global *glob = &ttm_bo_glob; @@ -1233,9 +1193,8 @@ static void ttm_bo_global_release(void) goto out; ttm_pool_mgr_fini(); + __free_page(glob->dummy_read_page); - kobject_del(&glob->kobj); - kobject_put(&glob->kobj); memset(glob, 0, sizeof(*glob)); out: mutex_unlock(&ttm_global_mutex); @@ -1288,10 +1247,8 @@ static int ttm_bo_global_init(void) INIT_LIST_HEAD(&glob->device_list); atomic_set(&glob->bo_count, 0); - ret = kobject_init_and_add( - &glob->kobj, &ttm_bo_glob_kobj_type, ttm_get_kobj(), "buffer_objects"); - if (unlikely(ret != 0)) - kobject_put(&glob->kobj); + debugfs_create_atomic_t("buffer_objects", 0444, ttm_debugfs_root, + &glob->bo_count); out: mutex_unlock(&ttm_global_mutex); return ret; diff --git a/drivers/gpu/drm/ttm/ttm_module.c b/drivers/gpu/drm/ttm/ttm_module.c index 6ff40c041d79..ac295861a688 100644 --- a/drivers/gpu/drm/ttm/ttm_module.c +++ b/drivers/gpu/drm/ttm/ttm_module.c @@ -30,69 +30,21 @@ * Jerome Glisse */ #include -#include -#include -#include -#include +#include -static DECLARE_WAIT_QUEUE_HEAD(exit_q); -static atomic_t device_released; +#include "ttm_module.h" -static struct device_type ttm_drm_class_type = { - .name = "ttm", - /** - * Add pm ops here. - */ -}; - -static void ttm_drm_class_device_release(struct device *dev) -{ - atomic_set(&device_released, 1); - wake_up_all(&exit_q); -} - -static struct device ttm_drm_class_device = { - .type = &ttm_drm_class_type, - .release = &ttm_drm_class_device_release -}; - -struct kobject *ttm_get_kobj(void) -{ - struct kobject *kobj = &ttm_drm_class_device.kobj; - BUG_ON(kobj == NULL); - return kobj; -} +struct dentry *ttm_debugfs_root; static int __init ttm_init(void) { - int ret; - - ret = dev_set_name(&ttm_drm_class_device, "ttm"); - if (unlikely(ret != 0)) - return ret; - - atomic_set(&device_released, 0); - ret = drm_class_device_register(&ttm_drm_class_device); - if (unlikely(ret != 0)) - goto out_no_dev_reg; - + ttm_debugfs_root = debugfs_create_dir("ttm", NULL); return 0; -out_no_dev_reg: - atomic_set(&device_released, 1); - wake_up_all(&exit_q); - return ret; } static void __exit ttm_exit(void) { - drm_class_device_unregister(&ttm_drm_class_device); - - /** - * Refuse to unload until the TTM device is released. - * Not sure this is 100% needed. - */ - - wait_event(exit_q, atomic_read(&device_released) == 1); + debugfs_remove(ttm_debugfs_root); } module_init(ttm_init); diff --git a/include/drm/ttm/ttm_module.h b/drivers/gpu/drm/ttm/ttm_module.h similarity index 94% rename from include/drm/ttm/ttm_module.h rename to drivers/gpu/drm/ttm/ttm_module.h index 45fa318c1585..d7cac5d4b835 100644 --- a/include/drm/ttm/ttm_module.h +++ b/drivers/gpu/drm/ttm/ttm_module.h @@ -31,10 +31,10 @@ #ifndef _TTM_MODULE_H_ #define _TTM_MODULE_H_ -#include -struct kobject; - #define TTM_PFX "[TTM] " -extern struct kobject *ttm_get_kobj(void); + +struct dentry; + +extern struct dentry *ttm_debugfs_root; #endif /* _TTM_MODULE_H_ */ diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index fdf01c7f1f99..9b2d34303734 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -245,7 +245,6 @@ extern struct ttm_bo_global { * Constant after init. */ - struct kobject kobj; struct page *dummy_read_page; spinlock_t lru_lock; From patchwork Tue Nov 17 16:33:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11912851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA528C2D0E4 for ; Tue, 17 Nov 2020 16:33:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 493A3216C4 for ; Tue, 17 Nov 2020 16:33:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bUN349d3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 493A3216C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89FC86E045; Tue, 17 Nov 2020 16:33:50 +0000 (UTC) Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by gabe.freedesktop.org (Postfix) with ESMTPS id A38F16E03F for ; Tue, 17 Nov 2020 16:33:44 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id z21so30953848lfe.12 for ; Tue, 17 Nov 2020 08:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yHenESt0YCXt7Dke2MvZKSdiLhMjPYH5mUI6oiXVzEs=; b=bUN349d3QGzxFTSVnRDxbj4W8yhvD5cxoR8bQmdamvmTKc3ROxHva2XPyGfxcUcF35 hZ/umZO+iSVVu1lbuOrKFvl2/czmy/woGshVOgwJZmLmNjcLiefnQGigXpVT2ZTQ+lXf 7gtsWQTQTA0H1zYOhZE85BYhVaIKx9FsHtThuLJvLGn846OCPv/4obIW1YIjq58wko0X 0aB3Da3hRVeOiNgjfys5zKDzRfnQE+KJKVRQVQ2gv2/oMTgSO3KE41UDdyNmoTrGK1i8 LdAZRYXqSYzc+pA5nTPXUNyHII6XAocp0f+Tb+QV7XR98jUd7YihITHBZWPsgHWVai35 ubXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yHenESt0YCXt7Dke2MvZKSdiLhMjPYH5mUI6oiXVzEs=; b=a2U4uyL8DKKuYOHOesTgS+jE3Kn5/DM86dZ2pAPQJLduNy5zR4kweyHtfZBcRZm3Hu 8sL3ogfsQtUZO78DtG4/5TDdy1Rbp/O7Dse/szMLnHd7XgArHFDJrIojTmXEVfQ6P1w4 Q4PmAgMtnNLHRwjiDDYCSTC4BtQN1tMgBh1ITs9RO6K5kOeRNiwS2aLNc3z8TSM+BCpc RT1aMyOW+iU1fgqxG0i2GuSdOeD1tcZZaoGvG7eQ9Ku+SJNdhLqHSXpEh0Loxk0o2Cf1 pp84KnaosWuK/5jKXv+R7zFmiJ6MF1Yn3WmJcj5znBN0J0EbfzmKbXXYiiDr6B1lIRWp bmAw== X-Gm-Message-State: AOAM5300biHjALTmqzjswwhYxyprtkZr/hg4oJvdZkYxnU2i2dTn4iiK PzW5fu5cdI4CQQSLnMPiVepHvkVOhDw= X-Google-Smtp-Source: ABdhPJy0cSzD2RVcvXDxxYOokr1If7g+QKAaPpoRnrocuABRrnkDnSO6BKEaucT2VyliCjwY3ztTEA== X-Received: by 2002:a17:906:b01:: with SMTP id u1mr20742472ejg.427.1605630821710; Tue, 17 Nov 2020 08:33:41 -0800 (PST) Received: from abel.fritz.box ([2a02:908:1252:fb60:dd48:f15c:7bed:4c52]) by smtp.gmail.com with ESMTPSA id dn16sm12225351edb.19.2020.11.17.08.33.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 08:33:41 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/4] drm/ttm: add a debugfs file for the global page pools Date: Tue, 17 Nov 2020 17:33:37 +0100 Message-Id: <20201117163338.1784-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201117163338.1784-1-christian.koenig@amd.com> References: <20201117163338.1784-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of printing this on the per device pool. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_pool.c | 70 ++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 24ae7c23cfd0..5daf812551ee 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -42,6 +42,8 @@ #include #include +#include "ttm_module.h" + /** * struct ttm_pool_dma - Helper object for coherent DMA mappings * @@ -533,6 +535,17 @@ EXPORT_SYMBOL(ttm_pool_fini); #ifdef CONFIG_DEBUG_FS +/* Print a nice header for the order */ +static void ttm_pool_debugfs_header(struct seq_file *m) +{ + unsigned int i; + + seq_puts(m, "\t "); + for (i = 0; i < MAX_ORDER; ++i) + seq_printf(m, " ---%2u---", i); + seq_puts(m, "\n"); +} + /* Dump information about the different pool types */ static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt, struct seq_file *m) @@ -544,6 +557,35 @@ static void ttm_pool_debugfs_orders(struct ttm_pool_type *pt, seq_puts(m, "\n"); } +/* Dump the total amount of allocated pages */ +static void ttm_pool_debugfs_footer(struct seq_file *m) +{ + seq_printf(m, "\ntotal\t: %8lu of %8lu\n", + atomic_long_read(&allocated_pages), page_pool_size); +} + +/* Dump the information for the global pools */ +static int ttm_pool_debugfs_globals_show(struct seq_file *m, void *data) +{ + ttm_pool_debugfs_header(m); + + spin_lock(&shrinker_lock); + seq_puts(m, "wc\t:"); + ttm_pool_debugfs_orders(global_write_combined, m); + seq_puts(m, "uc\t:"); + ttm_pool_debugfs_orders(global_uncached, m); + seq_puts(m, "wc 32\t:"); + ttm_pool_debugfs_orders(global_dma32_write_combined, m); + seq_puts(m, "uc 32\t:"); + ttm_pool_debugfs_orders(global_dma32_uncached, m); + spin_unlock(&shrinker_lock); + + ttm_pool_debugfs_footer(m); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(ttm_pool_debugfs_globals); + /** * ttm_pool_debugfs - Debugfs dump function for a pool * @@ -556,23 +598,9 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m) { unsigned int i; - spin_lock(&shrinker_lock); - - seq_puts(m, "\t "); - for (i = 0; i < MAX_ORDER; ++i) - seq_printf(m, " ---%2u---", i); - seq_puts(m, "\n"); - - seq_puts(m, "wc\t:"); - ttm_pool_debugfs_orders(global_write_combined, m); - seq_puts(m, "uc\t:"); - ttm_pool_debugfs_orders(global_uncached, m); - - seq_puts(m, "wc 32\t:"); - ttm_pool_debugfs_orders(global_dma32_write_combined, m); - seq_puts(m, "uc 32\t:"); - ttm_pool_debugfs_orders(global_dma32_uncached, m); + ttm_pool_debugfs_header(m); + spin_lock(&shrinker_lock); for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) { seq_puts(m, "DMA "); switch (i) { @@ -588,12 +616,9 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m) } ttm_pool_debugfs_orders(pool->caching[i].orders, m); } - - seq_printf(m, "\ntotal\t: %8lu of %8lu\n", - atomic_long_read(&allocated_pages), page_pool_size); - spin_unlock(&shrinker_lock); + ttm_pool_debugfs_footer(m); return 0; } EXPORT_SYMBOL(ttm_pool_debugfs); @@ -650,6 +675,11 @@ int ttm_pool_mgr_init(unsigned long num_pages) ttm_uncached, i); } +#ifdef CONFIG_DEBUG_FS + debugfs_create_file("page_pool", 0444, ttm_debugfs_root, NULL, + &ttm_pool_debugfs_globals_fops); +#endif + mm_shrinker.count_objects = ttm_pool_shrinker_count; mm_shrinker.scan_objects = ttm_pool_shrinker_scan; mm_shrinker.seeks = 1; From patchwork Tue Nov 17 16:33:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11912857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 607F9C5519F for ; Tue, 17 Nov 2020 16:33:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 05976216C4 for ; Tue, 17 Nov 2020 16:33:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QNKFaM+5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05976216C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6FB26E055; Tue, 17 Nov 2020 16:33:52 +0000 (UTC) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id D5E036E03F for ; Tue, 17 Nov 2020 16:33:44 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id k2so23857821wrx.2 for ; Tue, 17 Nov 2020 08:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5RsanfRMYtRZA34lNmf+rYEAQYFMbVrpX6WJujlT6tI=; b=QNKFaM+5LUQOGP8rG/b6WOyWh/yALFulKhu7QdeT9qRvy3vu0rWkc9yL+OcusfOmO2 WV6HRBSSjOngsEoV6AuBpJ+i7jtl4QcsDsnNknC6rn/VqIwzO5NOYHuG/2grJCXcN7m8 iaHkSZIJLRAmNSVdbKnuh5bx/ogwcO5pUnw5wnZkdvcnajAFRurEkNvW8pTD41c5qv5P CEeNKgeEC5sKWBM3S6YETpgt+EdKZsTqGTTwTdfhyI+bDFRkd/9614T+J2t3dOBMth3m 9ZB/HRSVNzGa0631O43oeX84zhAykfoPUoOR4Uqe5Gk2rpTltbLwRuCxdegyW0JMVB5s RwXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5RsanfRMYtRZA34lNmf+rYEAQYFMbVrpX6WJujlT6tI=; b=b+Lac5UIDUVWdeUSC9DlCUzzMnabFkFKHF2HH64uoVXJidikojnQd5zNc3r+GZJ70Z Y5h4WKumiNEtxE8wMoJteTS51CkGNlq8YQQtJNU/jnVJ3yKesda71J1a647Y5MFBxdzQ ss7Goy9NbaUQKkugiBwM6XfIL5jNVk8w1klMX9TzFjm30DtDyJLcTacjNBVtOPDSAm75 12C1W9xGzn0BfQ+4K6uKNoLNXd/UwrpGeGP7OzmmYXBFSkzV++7dsSvaq0opfU5PgP9A rnDaoGe1a8MJe96nnZsR774CAUK0YGuEuSJ68TvyBrGSTkS1iTxjLmrft8iXfirx6SSk QSig== X-Gm-Message-State: AOAM532abhqBJ572EAoegqVabQer7hT91JFsJgFgRepYRhQsldBz0Tr7 Q79KtVgnvk5EsigWmK9wswMhqZmu39U= X-Google-Smtp-Source: ABdhPJzepOp7tOHOIIAYzanqvCsnXmXLWfk9bPQuwuV7nVK1x6xdUpn21vpmY6f039DQnwjGQ+9lwg== X-Received: by 2002:a17:906:13d2:: with SMTP id g18mr1682881ejc.76.1605630822495; Tue, 17 Nov 2020 08:33:42 -0800 (PST) Received: from abel.fritz.box ([2a02:908:1252:fb60:dd48:f15c:7bed:4c52]) by smtp.gmail.com with ESMTPSA id dn16sm12225351edb.19.2020.11.17.08.33.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 08:33:42 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/ttm: optimize ttm pool shrinker a bit Date: Tue, 17 Nov 2020 17:33:38 +0100 Message-Id: <20201117163338.1784-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201117163338.1784-1-christian.koenig@amd.com> References: <20201117163338.1784-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Only initialize the DMA coherent pools if they are used. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_pool.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 5daf812551ee..54253aa09ffb 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -508,10 +508,12 @@ void ttm_pool_init(struct ttm_pool *pool, struct device *dev, pool->use_dma_alloc = use_dma_alloc; pool->use_dma32 = use_dma32; - for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) - for (j = 0; j < MAX_ORDER; ++j) - ttm_pool_type_init(&pool->caching[i].orders[j], - pool, i, j); + if (use_dma_alloc) { + for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) + for (j = 0; j < MAX_ORDER; ++j) + ttm_pool_type_init(&pool->caching[i].orders[j], + pool, i, j); + } } EXPORT_SYMBOL(ttm_pool_init); @@ -527,9 +529,11 @@ void ttm_pool_fini(struct ttm_pool *pool) { unsigned int i, j; - for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) - for (j = 0; j < MAX_ORDER; ++j) - ttm_pool_type_fini(&pool->caching[i].orders[j]); + if (pool->use_dma_alloc) { + for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) + for (j = 0; j < MAX_ORDER; ++j) + ttm_pool_type_fini(&pool->caching[i].orders[j]); + } } EXPORT_SYMBOL(ttm_pool_fini); @@ -598,6 +602,11 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m) { unsigned int i; + if (!pool->use_dma_alloc) { + seq_puts(m, "unused\n"); + return 0; + } + ttm_pool_debugfs_header(m); spin_lock(&shrinker_lock);