From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C494CCA0ECA for ; Tue, 12 Sep 2023 11:49:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E874F10E3F4; Tue, 12 Sep 2023 11:49:39 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 14B3C10E3F4 for ; Tue, 12 Sep 2023 11:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694519378; x=1726055378; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cIjekBuJBTYO8ec295f7x/5WqT0cM0DHPS2gRWVZJB4=; b=O0+UfIS5dKMgSbL9dyQ6n3/WRuqcD5myQ8GDp1cnAZDgg+3vxOUuv1NI VyGWLaKuxo2RsKPttBUIddrj7OZqFbl4ljA/PE5qrMK1Pm+ydYWgP71gq kxFj/Kt/zus8AHMQ9tRuhDscBwFkfOgIxT9mZoVCdlAqtjSeLGGLhU4cG 0iW06jz7CaKYfRkJ69yWOQ8Z5u0+WOo2OWft23SrlAU391P90gJ2fa/6Z B+WdY4/pB0VlTVMU8vmWmfp0whfyPjCz66KFNdlyhTcSHh1rKuJL1Hj4g /nAORPmi00Jb86IJs5n5Oyu6vFTANUQRdaD/nB6KmRaiBPl/HekhmU7KY g==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="382161496" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="382161496" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 04:49:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="772969412" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="772969412" Received: from kwasilew-mobl8.ger.corp.intel.com (HELO kdrobnik-desk.intel.com) ([10.213.3.126]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 04:49:35 -0700 From: Karolina Stolarek To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 0/4] Improve test coverage of TTM Date: Tue, 12 Sep 2023 13:49:17 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Karolina Stolarek , =?UTF-8?q?Christian=20K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add tests for building blocks of the TTM subsystem, such as ttm_resource, ttm_resource_manager, ttm_tt and ttm_buffer_object. This series covers basic functions such as initialization, allocation and clean-up of each struct. Testing of ttm_buffer_object also includes locking and unlocking the object for validation, with special scenarios such as an interrupted wait or deadlock. Some of the test cases check the bulk move mechanism and how it interacts with pinned buffers. This is to be seen if we want to add dedicated testing for bulk move or not. The resource allocation subtests use ttm_sys_manager for now. Resources that don't use system memory will be indirectly tested via tests for ttm_bo_validate()/ttm_bo_init_validate(), using a mock resource manager. Use kunit_tool script to manually run all the tests: $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/ttm/tests To build a kernel with TTM KUnit tests, first enable CONFIG_KUNIT, and then CONFIG_DRM_TTM_KUNIT_TEST. Many thanks, Karolina v3: - Instead of modifying the main TTM Makefile, use EXPORT_SYMBOL_FOR_TESTS_ONLY() macro for symbols that are tested but not widely exported. Thanks to this change, TTM tests can be built as modules, even when non-exported functions are used - Change the description of a patch that fixes ttm_pool_pre_populated() v2: - Remove Makefile for KUnit tests and move the definitions to the TTM's one - Switch on CONFIG_DRM_TTM_KUNIT_TEST=m so the tests and TTM module are built as one. This allows building the tests as a module, even if it uses functions that are not exported - Fix ttm_pool_pre_populated(); a wrong flag was passed to ttm_tt_kunit_init() function Karolina Stolarek (4): drm/ttm/tests: Add tests for ttm_resource and ttm_sys_man drm/ttm/tests: Add tests for ttm_tt drm/ttm/tests: Add tests for ttm_bo functions drm/ttm/tests: Fix argument in ttm_tt_kunit_init() drivers/gpu/drm/ttm/tests/Makefile | 3 + drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 620 ++++++++++++++++++ drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 48 ++ drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h | 4 + drivers/gpu/drm/ttm/tests/ttm_pool_test.c | 3 +- drivers/gpu/drm/ttm/tests/ttm_resource_test.c | 335 ++++++++++ drivers/gpu/drm/ttm/tests/ttm_tt_test.c | 277 ++++++++ drivers/gpu/drm/ttm/ttm_resource.c | 3 + drivers/gpu/drm/ttm/ttm_tt.c | 3 + 9 files changed, 1294 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/ttm/tests/ttm_bo_test.c create mode 100644 drivers/gpu/drm/ttm/tests/ttm_resource_test.c create mode 100644 drivers/gpu/drm/ttm/tests/ttm_tt_test.c -- 2.25.1