From patchwork Tue Jul 12 11:46:03 2022 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: 12914827 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 042A5C43334 for ; Tue, 12 Jul 2022 11:46:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6EE92B40B; Tue, 12 Jul 2022 11:46:09 +0000 (UTC) Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9C94F2B891; Tue, 12 Jul 2022 11:46:08 +0000 (UTC) Received: by mail-ej1-x62f.google.com with SMTP id sz17so13808492ejc.9; Tue, 12 Jul 2022 04:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6yXgt6F3apBhQ9ExwIi1N6Ag6ML0IpJudVsjkA/ZOG8=; b=F8UpU6+stuqa7hlN5K0YIi72RAySc4fS61qdG5MaMcqtIAwKkzAg4CKfvqrCfIzYRL yD0TeVbPNzypbiLG9nyqqdres6WLheDTiTdt6TGQAOxwU8ySNUqHN36rEvMpgk417k7q wGIU9qUZIqrgxCZzaD8gaB+bqQ/BY63eLvyzKRluUQYYAUe0uqleCtLzchWMURfpQ3RF HMA0u7z4R8K+rXEJYD2Wh5g/0TbgXtBuj1aKrCedyjlryJnzilJVQmnLwAhF8J/sylFV /rncZQihhCWSH9fAXNnWBkQv/NPTL41IBXPELRw3ODTe9buwPQ6dNr1sov+NSmZ3joQi L33w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6yXgt6F3apBhQ9ExwIi1N6Ag6ML0IpJudVsjkA/ZOG8=; b=hSOhwNygx3xCAqbc9Or11qChYmYIcKygKiSDbsbuVmvG3umnZF4WSw+y+vCmxDSHWf 9QHNs+u+BBgFKRJExhJjxQ6ztSfhBdPcKWqU4uT/uw6BN79av7uTojU9xcMXfR8Y8bYF Jp/poTOo/OCKXdmagBwct0KV3EoenzA3ayHEpOkXSFYK72gBoTPsRM7qj6CcPibQXuFr ROSLYjOw72aHBjDDM8ym4vFkcm5CPHWQgCLZ6iaprJiQjB4AE/8czu4PoqkvMizltfxj b3VM8iE7u0AsNYuwHA1vJ3JZdBKOZSelo6P97dGLMt7vi4l+nla8TcmLSbMNkwGcvdaY wwtg== X-Gm-Message-State: AJIora/rBnVSNxlisgaq3BFi/5MlDBH3641fEzIumeLaizsdDvkv8h75 WcOOoecAN3gBOX9KuNcLK601+FR/TZM= X-Google-Smtp-Source: AGRyM1vg6Vv7fRReUS0cYlZg8aEPYftvKuD8B1jAJEfMGoYHQM3Y8e6d+aC4iniEq31Y/AANgb5kWw== X-Received: by 2002:a17:907:2722:b0:72b:735a:d3b4 with SMTP id d2-20020a170907272200b0072b735ad3b4mr5083978ejl.363.1657626367169; Tue, 12 Jul 2022 04:46:07 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id f10-20020a170906494a00b006fe9f9d0938sm3767200ejt.175.2022.07.12.04.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 04:46:06 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Tue, 12 Jul 2022 13:46:03 +0200 Message-Id: <20220712114605.52369-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/3] drm/i915: audit bo->resource usage X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Make sure we can at least move and alloc TT objects without backing store. Signed-off-by: Christian König --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 6 ++---- drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index 70e2ed4e99df..5449738c262f 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -289,8 +289,6 @@ static struct ttm_tt *i915_ttm_tt_create(struct ttm_buffer_object *bo, { struct drm_i915_private *i915 = container_of(bo->bdev, typeof(*i915), bdev); - struct ttm_resource_manager *man = - ttm_manager_type(bo->bdev, bo->resource->mem_type); struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo); unsigned long ccs_pages = 0; enum ttm_caching caching; @@ -304,8 +302,8 @@ static struct ttm_tt *i915_ttm_tt_create(struct ttm_buffer_object *bo, if (!i915_tt) return NULL; - if (obj->flags & I915_BO_ALLOC_CPU_CLEAR && - man->use_tt) + if (obj->flags & I915_BO_ALLOC_CPU_CLEAR && bo->resource && + ttm_manager_type(bo->bdev, bo->resource->mem_type)->use_tt) page_flags |= TTM_TT_FLAG_ZERO_ALLOC; caching = i915_ttm_select_tt_caching(obj); diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c index a10716f4e717..dcb838dffd7b 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c @@ -490,7 +490,7 @@ int i915_ttm_move(struct ttm_buffer_object *bo, bool evict, bool clear; int ret; - if (GEM_WARN_ON(!obj)) { + if (!bo->resource || GEM_WARN_ON(!obj)) { ttm_bo_move_null(bo, dst_mem); return 0; } From patchwork Tue Jul 12 11:46:04 2022 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: 12914828 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 783CECCA47C for ; Tue, 12 Jul 2022 11:46:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBF798A4E1; Tue, 12 Jul 2022 11:46:10 +0000 (UTC) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 862492B40B; Tue, 12 Jul 2022 11:46:09 +0000 (UTC) Received: by mail-ej1-x62a.google.com with SMTP id h23so13786477ejj.12; Tue, 12 Jul 2022 04:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GDVXf57lCe0NyeriLUBibCB0wZv0NmHVTlMjtAkbPS0=; b=Ru3Wa60S7ExC95v0jy4JdEgpIdyB/6kdRetyQKUju31cH14omGL55Bmg8xoOy+J4Hs nN9RZ3IhvBGnkPi2g30aJPBialf2+mBdb/TOY2/L5PT/oM2FLkGskPXEWm4C32kmBgjd 5F/shs3TKGLg8mBo8jPC3F85uSicaBWax+/ArEDZ2ihmMB1KXGmgGPuznb7OeUYVPt1n MYHQUwDAxWrDij9o6oj5GpBrOGlmBSctJtGt7bSMInxEQjdMglt3LLVI3bS6hmePYPdP GxDIp2DgO/fxDr1xj8/3NiGTURzBPlCtufj5dWtlBbvzy08G0wrn1337S0a1jLVqt6WA TMrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GDVXf57lCe0NyeriLUBibCB0wZv0NmHVTlMjtAkbPS0=; b=G5zUAUE15N9cxrz/2cQ8U5awCA3jKQmneX5ynT/WRjNRq6CxG/wv4gAf2yf2dmcyRk Oq5lyRjkJ2lLRXQa1N+DCiXUXJf2JruFpuPo3gvzz67wtBmyNsGF9kyq5j8wt59F5lKy oS0pqRToHyPsi9SEMriiZ/Eqcd6kTDeatVGJa6FXdmbgdaXOy3ohVeHSgJdSKDGHSFj1 0VquF6th0Mcz7/0P8xSgcSZd/3XnR/MXHqXiE1UC+rAXRjDPSwpsne+K6UBFCFnitshY nVdCEyKHrgdBdq6FuIQnczbbT/w4BKnvRjrG+wbOqQ0rpxQyrcV4g5lLztsKKljXkLUn fumQ== X-Gm-Message-State: AJIora+WFXbqmySc/6ef1vTa6+lhLeSysz0cDuKV0JbUhfBHRXcUoWG3 b5Z0jDUTo9/TlRlEimtlhLOnV6o/Zj4= X-Google-Smtp-Source: AGRyM1s+o1Sf8VwJ6rz/N+nTLZJNxdGWUhKF/Jq+CCcb5BPTKGhU560AoBOQdIWXuzI0TJTRTXFtOQ== X-Received: by 2002:a17:906:106:b0:722:d84c:6df0 with SMTP id 6-20020a170906010600b00722d84c6df0mr23452573eje.203.1657626368100; Tue, 12 Jul 2022 04:46:08 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id f10-20020a170906494a00b006fe9f9d0938sm3767200ejt.175.2022.07.12.04.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 04:46:07 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Tue, 12 Jul 2022 13:46:04 +0200 Message-Id: <20220712114605.52369-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220712114605.52369-1-christian.koenig@amd.com> References: <20220712114605.52369-1-christian.koenig@amd.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/3] drm/ttm: stop allocating dummy resources during BO creation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" That should not be necessary any more when drivers should at least be able to handle the move without a resource. Signed-off-by: Christian König Reviewed-by: Michael J. Ruhl Reported-by: kernel test robot --- drivers/gpu/drm/ttm/ttm_bo.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index c1bd006a5525..a95826be8048 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -960,7 +960,6 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo, struct sg_table *sg, struct dma_resv *resv, void (*destroy) (struct ttm_buffer_object *)) { - static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM }; int ret; kref_init(&bo->kref); @@ -978,12 +977,6 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo, bo->base.resv = &bo->base._resv; atomic_inc(&ttm_glob.bo_count); - ret = ttm_resource_alloc(bo, &sys_mem, &bo->resource); - if (unlikely(ret)) { - ttm_bo_put(bo); - return ret; - } - /* * For ttm_bo_type_device buffers, allocate * address space from the device. From patchwork Tue Jul 12 11:46:05 2022 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: 12914829 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 1FF22CCA482 for ; Tue, 12 Jul 2022 11:46:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B889B2B8D3; Tue, 12 Jul 2022 11:46:11 +0000 (UTC) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C1C82B8D3; Tue, 12 Jul 2022 11:46:10 +0000 (UTC) Received: by mail-ej1-x62c.google.com with SMTP id bp15so3552888ejb.6; Tue, 12 Jul 2022 04:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0VCybhQfKwqy44xprkmnNFSfB9HpKWe+eVeaEdRJWPE=; b=bAt+DuNnGkpegEUPBHgSAOYrxZm7443GmDC7k8qyaLUtloam41NSvxNmQs0bmagjva 5tVTTYev7xbHHHh/jilaUTUCu6jgBiOGhI1bjVw4uWozR6HO8wNOzaTPafmAP6WONsOd pGlfjIutwRZN9HpAqFScXjWECHRKO72znlO1RMqkwHlGQMzStkp/0TFYftsyD0LobbAj j3bhjsG4cEeDslGC85UDDHzwC2eDXPicL/25Bjrpe33BBjC04faARkNJOtBmEwGfiM/t d98dK3+KNPN5yfHnmgFv80XRPl3q1XJKNyXUKeCZMeQqvJokzaRHV2+79TVi43kWRlFs ChMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0VCybhQfKwqy44xprkmnNFSfB9HpKWe+eVeaEdRJWPE=; b=z+NzfEdRvy4mNMV5j2HQGnpdto6hB+ZwH7zcbzGv/itpYFRxS/C/oalUugh3Eddfv0 0MzFzD57ityQza/JwtBC2h2HfPI89+GtZEWcJ/y5eNqJwJOtclOYms98/QV0MYfZLITy JD9rixwALGTSTBxm8PMiLWacYWZknZK1tUbGUTQ8Yu26/CBXVhfljgh/AsE7BrpBk4/U 07WCOPtHTzyZlWpxHrgCVua7XvTtCkzNBbri47iw46LB04rHbriS4KQOepkcdwaGOccN YnVWHjJEYA1WoeIvyjM001H6F4HpTGF6DWpWJWKyUqY64O/XM2h/VJgEyL9e/pN0Dg42 SnMw== X-Gm-Message-State: AJIora90IoN6xe5lXkiX9iwe0d3azC//VUQQdBGhtuAei8YHLIonUuZY YDmLO3lLO8tEWzl4QtK2mu90MCd9MMw= X-Google-Smtp-Source: AGRyM1sl4gVHpUvTMY3UuMPj3pztEPcYLX3cLueljPYkX/uaoPvPDzecd0nkerSNsWtr9QjgH0qWmw== X-Received: by 2002:a17:907:3e13:b0:726:eebc:3461 with SMTP id hp19-20020a1709073e1300b00726eebc3461mr22986782ejc.528.1657626369009; Tue, 12 Jul 2022 04:46:09 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id f10-20020a170906494a00b006fe9f9d0938sm3767200ejt.175.2022.07.12.04.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 04:46:08 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Tue, 12 Jul 2022 13:46:05 +0200 Message-Id: <20220712114605.52369-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220712114605.52369-1-christian.koenig@amd.com> References: <20220712114605.52369-1-christian.koenig@amd.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/3] drm/ttm: stop allocating a dummy resource for pipelined gutting X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" That should not be necessary any more when drivers should at least be able to handle a move without a resource. Signed-off-by: Christian König Reviewed-by: Michael J. Ruhl --- drivers/gpu/drm/ttm/ttm_bo_util.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 1530982338e9..1e76149c62ff 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -603,16 +603,10 @@ EXPORT_SYMBOL(ttm_bo_move_sync_cleanup); */ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) { - static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM }; struct ttm_buffer_object *ghost; - struct ttm_resource *sys_res; struct ttm_tt *ttm; int ret; - ret = ttm_resource_alloc(bo, &sys_mem, &sys_res); - if (ret) - return ret; - /* If already idle, no need for ghost object dance. */ ret = ttm_bo_wait(bo, false, true); if (ret != -EBUSY) { @@ -620,14 +614,13 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) /* See comment below about clearing. */ ret = ttm_tt_create(bo, true); if (ret) - goto error_free_sys_mem; + return ret; } else { ttm_tt_unpopulate(bo->bdev, bo->ttm); if (bo->type == ttm_bo_type_device) ttm_tt_mark_for_clear(bo->ttm); } ttm_resource_free(bo, &bo->resource); - ttm_bo_assign_mem(bo, sys_res); return 0; } @@ -644,7 +637,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) ret = ttm_tt_create(bo, true); swap(bo->ttm, ttm); if (ret) - goto error_free_sys_mem; + return ret; ret = ttm_buffer_object_transfer(bo, &ghost); if (ret) @@ -658,13 +651,9 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) dma_resv_unlock(&ghost->base._resv); ttm_bo_put(ghost); bo->ttm = ttm; - ttm_bo_assign_mem(bo, sys_res); return 0; error_destroy_tt: ttm_tt_destroy(bo->bdev, ttm); - -error_free_sys_mem: - ttm_resource_free(bo, &sys_res); return ret; }