From patchwork Mon Jun 19 15:22:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 13284696 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 ED145EB64DB for ; Mon, 19 Jun 2023 15:22:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44D2310E21F; Mon, 19 Jun 2023 15:22:47 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 60D2F10E21F; Mon, 19 Jun 2023 15:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687188165; x=1718724165; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GCMyK+xJ6tV0MhOJSpsZLG7SrNrk3ubg6srKYqjeUnI=; b=eHtMqQsJbrZQJZYAjxynVHHrhFLd9+3B/5PDUi7zmnzvji/syG6bV/gN MmMHJ8kwbFZL8UAOHVQ5Njz1OWF8ne8nkg6KUFuPl6ob/bx3jVERgxIGd OUwvgxodAqEg/BbV/XVAt1gYML29hGwXJftQsMO67ye7t0whySTvaVf4C xwt1Q+NvfFb/zwMamQIxQF5tcUkxtw6lk78PRf5rsZyQKoiU9BBTrwMjg psP5pgspEeMX9f+6nk1Kf2WBf+k62DeynlJrvOL7seRapJGtTvq6KSVRT pGgIXWLl/hsuD+/CnRi6BsCaEuHrbVJazvksApCYJXYDMmvYevO0+YG52 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="349381565" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="349381565" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 08:22:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="858250611" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="858250611" Received: from yeidelbe-mobl.ger.corp.intel.com (HELO thellstr-mobl1.intel.com) ([10.249.254.162]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 08:22:43 -0700 From: =?utf-8?q?Thomas_Hellstr=C3=B6m?= To: intel-xe@lists.freedesktop.org Date: Mon, 19 Jun 2023 17:22:22 +0200 Message-Id: <20230619152222.11733-7-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230619152222.11733-1-thomas.hellstrom@linux.intel.com> References: <20230619152222.11733-1-thomas.hellstrom@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v2 6/6] drm/ttm: Don't shadow the operation context 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?= , intel-gfx@lists.freedesktop.org, =?utf-8?q?Christian_K=C3=B6nig?= , dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" ttm_bo_swapout() shadows the ttm operation context which may cause major confusion in driver callbacks when swapping out !TTM_PL_SYSTEM memory. Fix this by reusing the operation context argument to ttm_bo_swapout(). Cc: "Christian König" Cc: Cc: Signed-off-by: Thomas Hellström Acked-by: Matthew Brost --- drivers/gpu/drm/ttm/ttm_bo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index bd5dae4d1624..615d30c4262d 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1154,7 +1154,6 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, * Move to system cached */ if (bo->resource->mem_type != TTM_PL_SYSTEM) { - struct ttm_operation_ctx ctx = { false, false }; struct ttm_resource *evict_mem; struct ttm_place hop; @@ -1164,7 +1163,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, if (unlikely(ret)) goto out; - ret = ttm_bo_handle_move_mem(bo, evict_mem, true, &ctx, &hop); + ret = ttm_bo_handle_move_mem(bo, evict_mem, true, ctx, &hop); if (unlikely(ret != 0)) { WARN(ret == -EMULTIHOP, "Unexpected multihop in swaput - likely driver bug.\n"); goto out;