From patchwork Thu Mar 24 17:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12790924 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 7C8D7C433EF for ; Thu, 24 Mar 2022 17:22:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12CB910E307; Thu, 24 Mar 2022 17:22:09 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8121510E307; Thu, 24 Mar 2022 17:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648142528; x=1679678528; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=B1842B3IZQpBwkqKZE0GM5g3374TdUMMQBak/6A9pEA=; b=XJ1jjcXE5dtVOcdlGxELr2+h3zYK2yyMaODqbtRWTcRlPeFVdHmyplcN QX9wSm/6L8rQJvBdgFQV5xWufMOai2Nm4MSc4FgbsF85drUoQPYoqtJy2 mWDQKN8VzD+5oJ2eyG8yIarZN5QmctGHYr4qinCMUYeR8vG8ae66WhEne NVBD7pqBlPnW/ROdkBMcYV81v2FjyxiFbf98nvwaY9+/xq+kZBdfLd58V AHUvL9Sr+UVXwmvo/g4uiJgAWDbfO3n+IMeJfrbNVRAIhnvmSm1EExy8+ jl1m5/j/3Xfg27c3eLuinwbKdQiQ9LY0Xordvyrqpja7sE2voDIqCw/ZP w==; X-IronPort-AV: E=McAfee;i="6200,9189,10296"; a="239043282" X-IronPort-AV: E=Sophos;i="5.90,208,1643702400"; d="scan'208";a="239043282" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 10:22:08 -0700 X-IronPort-AV: E=Sophos;i="5.90,208,1643702400"; d="scan'208";a="637924710" Received: from smurkank-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.19.102]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 10:22:06 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Date: Thu, 24 Mar 2022 17:21:42 +0000 Message-Id: <20220324172143.377104-1-matthew.auld@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915/ttm: limit where we apply TTM_PL_FLAG_CONTIGUOUS 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?Thomas_Hellstr=C3=B6m?= , dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We only need this when allocating device local-memory, where this influences the drm_buddy. Currently there is some funny behaviour where an "in limbo" system memory object is lacking the relevant placement flags etc. before we first allocate the ttm_tt, leading to ttm performing a move when not needed, since the current placement is seen as not compatible. Suggested-by: Thomas Hellström Fixes: 2ed38cec5606 ("drm/i915: opportunistically apply ALLOC_CONTIGIOUS") Signed-off-by: Matthew Auld Cc: Nirmoy Das Reviewed-by: Thomas Hellström Reviewed-by: Nirmoy Das --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index e4a06fcf741a..97e648fa76bd 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -133,6 +133,9 @@ i915_ttm_place_from_region(const struct intel_memory_region *mr, memset(place, 0, sizeof(*place)); place->mem_type = intel_region_to_ttm_type(mr); + if (mr->type == INTEL_MEMORY_SYSTEM) + return; + if (flags & I915_BO_ALLOC_CONTIGUOUS) place->flags |= TTM_PL_FLAG_CONTIGUOUS; if (offset != I915_BO_INVALID_OFFSET) { From patchwork Thu Mar 24 17:21:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12790925 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 7AC3CC433F5 for ; Thu, 24 Mar 2022 17:22:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D2FD10E8ED; Thu, 24 Mar 2022 17:22:13 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id B524510E8D4; Thu, 24 Mar 2022 17:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648142529; x=1679678529; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZEwlbMbyU5BSIhyG6yFv+mG9vNoVsHNGlE4SPcME1vk=; b=eMza8W85Cke8OB4l5ZpcNCNfdeMr/BrZWiV/Yb3PjyAjw4ITJG77QYq4 yIGPkepU4GAuxBpxACW8GQ8c9wZCBqpODSB6lKgXSfjuUF0UNisLIcZZa GGmrm1LQzsPHpEYMWuRjkXgz37fXST7Vqkp5YW76TjO4kR6CDyJy0HYN2 tELAtRcUyeCX4Od0X/xBaHq4nJfcxw1dCzWpr2AbqMXfvDYzPASlQaZ7u 3h89nP9hCZ8MfzCUbmRscdG2/iaK87HtM0TFnAZqJn47qUvuytINq4LsL BbEuDQlNVLSSUghl2L+zLML742e0pq7ohRoJmjP2TS02oENHmFhDVkb1P g==; X-IronPort-AV: E=McAfee;i="6200,9189,10296"; a="239043293" X-IronPort-AV: E=Sophos;i="5.90,208,1643702400"; d="scan'208";a="239043293" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 10:22:09 -0700 X-IronPort-AV: E=Sophos;i="5.90,208,1643702400"; d="scan'208";a="637924730" Received: from smurkank-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.19.102]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 10:22:08 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Date: Thu, 24 Mar 2022 17:21:43 +0000 Message-Id: <20220324172143.377104-2-matthew.auld@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220324172143.377104-1-matthew.auld@intel.com> References: <20220324172143.377104-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/2] drm/i915/migrate: move the sanity check 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?Thomas_Hellstr=C3=B6m?= , dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move the sanity check that both src and dst are never both system memory, which should never happen on discrete, and likely means we have a bug. The only exception is on integrated where we trigger this path in the selftests. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Nirmoy Das Reviewed-by: Thomas Hellström --- drivers/gpu/drm/i915/gt/intel_migrate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c index 20444d6ceb3c..950fd6da146c 100644 --- a/drivers/gpu/drm/i915/gt/intel_migrate.c +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c @@ -530,6 +530,7 @@ intel_context_migrate_copy(struct intel_context *ce, int err; GEM_BUG_ON(ce->vm != ce->engine->gt->migrate.context->vm); + GEM_BUG_ON(IS_DGFX(ce->engine->i915) && (!src_is_lmem && !dst_is_lmem)); *out = NULL; GEM_BUG_ON(ce->ring->size < SZ_64K); @@ -566,8 +567,6 @@ intel_context_migrate_copy(struct intel_context *ce, src_offset = 0; dst_offset = CHUNK_SZ; if (HAS_64K_PAGES(ce->engine->i915)) { - GEM_BUG_ON(!src_is_lmem && !dst_is_lmem); - src_offset = 0; dst_offset = 0; if (src_is_lmem)