From patchwork Wed Aug 31 09:34:26 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: 12960596 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 AD3EAECAAD1 for ; Wed, 31 Aug 2022 09:34:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C0FC10E2B5; Wed, 31 Aug 2022 09:34:35 +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 3492A10E2B4; Wed, 31 Aug 2022 09:34:32 +0000 (UTC) Received: by mail-ej1-x62a.google.com with SMTP id qh18so6908136ejb.7; Wed, 31 Aug 2022 02:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=j9NYpONVCYEnfzxzBKtYaOJ5hkA5r7Om/u6+8tt8uBg=; b=kHOSUm6rhjlfZ9F6R6gkEVdPVcHDpn6Oy2+4bu39Izd6OpDi+M937vo2bva325GTAu ulsW4NxCn5hqxH6XS7qf8EOR+q0nvN5G4O6Xpl/XNyvkW7KBSbKYL88Ed9TbQ+CXKtrz PWdxiv0kMAzJfRXst6iDAzEg63g6k1wiWMV84CXHXKfXyKB2W2+3pwl7aECERTgMXMRZ hp+mo2jT7W1+OjoaaLe9I/CvjN1XTCyuOnZJDYXr6OUJDMxJ8drTl7Gy76PmlP3ZvgbX 8Uuj/rSsz2RaxnTVuZPZJgX913AkfvXiXyL94Q+tUrVXPSLRorHUs1fh1CFKqH9cyz/5 TvZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=j9NYpONVCYEnfzxzBKtYaOJ5hkA5r7Om/u6+8tt8uBg=; b=gPZrkLamzoumxjAThLwkOHhtL2u8XxgV5bI4iEqiS8Jiz6EHb8loneNFbNbZxL5t88 q8mewpiIsvmKWRWL6N8v58TuEkclcIo2A9q83slrXd206JCvq/xSPSQwzceyySgYoV4k 5t2nnui2FA4a5u3GBRLLqQ16DqNQFTiNik/p18ITDnFPbasEjoIXVB3SYM6aJy/e5BSF FdoH4ajBYASzHtTtemA0THzkfeoSvSHZvlwTRjvLSGaWbyxpbrJ4g5PHe6x/G1fsxrwJ mTxuASwjRBi2eUSscz4VzIqU+Wi03QZjRfHDBLb7Rkue4w3LXPQ0dAnkHVkvTsbDejmP s0JA== X-Gm-Message-State: ACgBeo0Qn7snLgLFREabxMtmS6xE27QvzFNctjWvInfBSOKr5ygNH38w klOH+obO/xr0IA9/pVhdv6HV1x41A7c= X-Google-Smtp-Source: AA6agR6/2JgtZGJIHrVX452QeSEukQ7OCE6UY7WA2bOkGrBTBpgeG3VNmdWNPe/Q8q4CfjNOLnTG1A== X-Received: by 2002:a17:907:96a5:b0:73d:d16c:60ac with SMTP id hd37-20020a17090796a500b0073dd16c60acmr19312462ejc.707.1661938470758; Wed, 31 Aug 2022 02:34:30 -0700 (PDT) Received: from able.fritz.box (p4fc20ad4.dip0.t-ipconnect.de. [79.194.10.212]) by smtp.gmail.com with ESMTPSA id d5-20020a056402400500b004466f5375a5sm5608983eda.53.2022.08.31.02.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 02:34:29 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.auld@intel.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 31 Aug 2022 11:34:26 +0200 Message-Id: <20220831093428.1397-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 v2 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. v2: clear the tt object even when no resource is allocated. 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 bc9c432edffe..a81063e5aa93 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -271,8 +271,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; @@ -286,8 +284,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 9a7e50534b84..c420d1ab605b 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c @@ -560,7 +560,7 @@ int i915_ttm_move(struct ttm_buffer_object *bo, bool evict, bool clear; int ret; - if (GEM_WARN_ON(!obj)) { + if (GEM_WARN_ON(!obj) || !bo->resource) { ttm_bo_move_null(bo, dst_mem); return 0; } From patchwork Wed Aug 31 09:34:27 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: 12960597 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 1FAECECAAD1 for ; Wed, 31 Aug 2022 09:34:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7B6710E2B6; Wed, 31 Aug 2022 09:34:37 +0000 (UTC) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6D5C10E2B4; Wed, 31 Aug 2022 09:34:33 +0000 (UTC) Received: by mail-ej1-x62d.google.com with SMTP id h5so15601479ejb.3; Wed, 31 Aug 2022 02:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=LyzVEZpAcOs03g6cb7ZXFSVg5DeiSEyIliByIbzxjy0=; b=XSokJLxe6P7UTrsiWvl1wwt4OOZsbK+5wwsIUk7d8SBFd5X+tY+tObxfxvDLjWEGQn dZEjqhI0gtUTuSC1No3ORTG/KYFl7iiSVUVGI3AfG+BLIIQvmclITM0mH7YCP4671FCH 9BV3j6vsJ01Ue6vYeIHj9Cj1gL9r6FaNzoXHWpev+yF9K/s9/CYHo3EEYTLWS2U5Nbrn PBdbULNBmyPPfmE9ryW/6TSjkNPXVa0vUukDG3Lbwo6q9PafLxAYUVUx6WjffYM+fnYt E8aho3UKS+uJYC8hyV6xOJc17BtMgJ8cv3cv4ekCnOG1XoPUzh99LWJVNL2BPXqubLf4 ogzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=LyzVEZpAcOs03g6cb7ZXFSVg5DeiSEyIliByIbzxjy0=; b=Yd2W/1yO+xZWw78qy+TCfS54qYETOriNpHEolhl4D5M7I1v2wYtDp+WpojnovmXn+A 6SJzJLaLe7SRtoj1QcAiIwAauJltGdnZjSyIGV1H2ifY7S40cvzrBw2H07XJ/+tVV+ZR ldJSNfRoV6xRU9Wb8Wb6aQgDG5mUTCuyItvIuU8ecW6n9DSADkH7dGarBujNJgn8+qh4 ynHQsnYhb0ZHMD7jbSFt4IBPWT8hYGEs4g8UoQQWnQl7vqPROA5PYHgSvMMAlCbElOo5 jYYX9HbgFu0bZBgMG2A2SPG9zB/yDsjTpb+/qHwQLfJjx0ItAClej6fDdTUX1TBRGpOs v3yg== X-Gm-Message-State: ACgBeo17Y9pvuMQ9vjf7pHSAnoPC9hUkyfeE9FN8acAImy7i9Btshu8S 5fo++BH2tyIh4JL/2x5+ld0= X-Google-Smtp-Source: AA6agR5vjAbum1imghVUmQE8sbTSfHUd+Y9Enu1vC7vpsh+8A7LQQBUb8/xrwYp2QmiGtq3OLiFK2A== X-Received: by 2002:a17:907:c002:b0:73d:d96c:c632 with SMTP id ss2-20020a170907c00200b0073dd96cc632mr18121224ejc.543.1661938472111; Wed, 31 Aug 2022 02:34:32 -0700 (PDT) Received: from able.fritz.box (p4fc20ad4.dip0.t-ipconnect.de. [79.194.10.212]) by smtp.gmail.com with ESMTPSA id d5-20020a056402400500b004466f5375a5sm5608983eda.53.2022.08.31.02.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 02:34:31 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.auld@intel.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 31 Aug 2022 11:34:27 +0200 Message-Id: <20220831093428.1397-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220831093428.1397-1-christian.koenig@amd.com> References: <20220831093428.1397-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 --- 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 f066e8124c50..d7ed891d3887 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -959,7 +959,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); @@ -977,12 +976,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 Wed Aug 31 09:34:28 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: 12960598 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 A511CECAAD1 for ; Wed, 31 Aug 2022 09:34:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF8F010E2BA; Wed, 31 Aug 2022 09:34:39 +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 040CE10E2B4; Wed, 31 Aug 2022 09:34:34 +0000 (UTC) Received: by mail-ej1-x62c.google.com with SMTP id kk26so27138329ejc.11; Wed, 31 Aug 2022 02:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Pm2PIhgkaQI0IQXl/jfQ/qZntTY2KRA5ZgN/UOEW2eM=; b=SDhcJuyu00n4FttfDffQcpRJ7ILf4g4As3QfzKrYw7HtOvGvTu9uErhpo8ZRo9VDKW r9f6np/c5J90s33gO9nTWa6KSxNSg/9TBqygQ+4f6BrzOhpICEaGOsAEBXbHDFxOs3qa whlNAhnt9AsFxSu/VBixPN7yV7Qic4huIVPJLelGOfamArlMwL4ZO968xNv6wQ+tQp4o y5oZHuU0MBrVOmP4khj/kavI4TUQjND+s6MYUEtyj0x98cq5wbtMRQbF91K9CDpXeca3 ssW6qblkf4DWmlNfElUF0oSiQnCNvybQ/IW6ctGOcprtgaJUn90xDO0hLNb7J1S03mv7 FDIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Pm2PIhgkaQI0IQXl/jfQ/qZntTY2KRA5ZgN/UOEW2eM=; b=6xth/nKHYKHsl70xzZHPRA5oDJZQLO5Nk8aCiH/LOehYXtufchrb1GX69B2I9Se4vE A3miaZNxfJ3diO5C08onSr+BgiNeBI4RLhxN/fr6+vAWxQQMB0C3aI5nV+iIMx9+i+uR JxQGx9iy9JmKZfTLy+oG1HZkDZtPSPORIqaK3WIFoUHyAAasY9VTKh9vnlWSmUy73Rgr jz/tT6Nv2uCSD1BMUHxrRyL4gGBbPGqDEKBDiAxYWW7sJgTqKV0cqKnWGZHlrQynWVYe Y1RfPMmZstXN9RjiKc6rFdDg/exZD3WlYF/aZlY7wq7esnkC3AzUhu/DUSAqzjuYxCGw q9Qw== X-Gm-Message-State: ACgBeo2GzCx9GHUXAluqarIKmRO7UbBUbNOYjCDwp4jVJUgKLI4cWU5D sxUgRRFdvAPgAdint5JsxFI= X-Google-Smtp-Source: AA6agR6RVplwAUonaZw4sIT64EaGUTW5iSY5vI58OT7E8J5zc0VBOk0J0Szb2rQBRlke3ku8GSK7IA== X-Received: by 2002:a17:907:75c6:b0:741:75a0:b82b with SMTP id jl6-20020a17090775c600b0074175a0b82bmr11099539ejc.465.1661938473470; Wed, 31 Aug 2022 02:34:33 -0700 (PDT) Received: from able.fritz.box (p4fc20ad4.dip0.t-ipconnect.de. [79.194.10.212]) by smtp.gmail.com with ESMTPSA id d5-20020a056402400500b004466f5375a5sm5608983eda.53.2022.08.31.02.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 02:34:32 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.auld@intel.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 31 Aug 2022 11:34:28 +0200 Message-Id: <20220831093428.1397-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220831093428.1397-1-christian.koenig@amd.com> References: <20220831093428.1397-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 497ee1fdbad7..a1c4dc031cae 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -607,16 +607,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) { @@ -624,14 +618,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; } @@ -648,7 +641,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) @@ -662,13 +655,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; }