From patchwork Fri Jul 24 11:56:11 2020 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: 11683093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 894AC138A for ; Fri, 24 Jul 2020 11:57:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 66446206E3 for ; Fri, 24 Jul 2020 11:57:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qFgiaU0Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66446206E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AC4B6E964; Fri, 24 Jul 2020 11:56:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3844E6E957 for ; Fri, 24 Jul 2020 11:56:14 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id d18so6828354edv.6 for ; Fri, 24 Jul 2020 04:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ps9+xQPfhPrna3QhEcqhAU0UoKfo559zZYMd9ZBOWWw=; b=qFgiaU0ZOtqVH4uo70kLhBqlkprZ3wodYBfTvTwu7kY7wlcT3q/qV85lo5cw0pb6Nh SKZLiOJcAnpUH83l5/guO5lpS6SycItr28G5AUvD+v0bwBJUV/5pFHem2NwdJhXTQ+Jj 1xUfOkhpmo6UBi+liz/C0Gig8CM5hFld7xl7dbdUTG7REgN5cNGrHRZoi1MqnJpKK8B1 xMskU8/+nUQHnTxQzfqkzh0W1fGW3Quooowen/16Ho2u/UiKfOv9lAL+n7Vn96BmGSql 6Rb+YYwkNuSAymlVSLV4ilQBRH0EIHKbXSrE8yyb0Db0ezbKR2cUOPDe7rx2TeLBfDpx aMfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ps9+xQPfhPrna3QhEcqhAU0UoKfo559zZYMd9ZBOWWw=; b=klgFmefiKrskle0Tfna1WcYamT5F/vAuES0FB1EfLfYIEdGdpXwV3gK9yOltkQJg+P E+uLH8dFgb1Of5HsuWPVsqVRgZm+3fJAtQx2w7ge4eJuZJStnqOFSwKp7ooicS7nkZCw oLYp68JZh8QTDONFxJpY4pn9cjP8Y3NYaXN7BHL33INq8GDTeT2n2lLocyNtfYCWyGhT xXEH3kNRmGpnZnLThcAVqBPnNOxmSH8hNn8kgqiRSu7Utl21xb1lXB2tPjQuyv1wGAcd ODKM5zThs1oBRrIGrfz3yk3Gv7Tl3p4YRp/Oh0Z/3XM43X0bT0r7ph6CA2N5Y/vgx+Ku qR+A== X-Gm-Message-State: AOAM532P2EiU5h57alxDBQFyBl5QiYKHLxMTaYrL5Adl8ROZ9yKK0Z05 JLo8Qx+r2/XbdhnDo0tlFk+91BkO X-Google-Smtp-Source: ABdhPJz0jEuVeuclJOzg0rusJwk5TJ05nnl13iBgKJ2yLRIuNcWJHVbQplnR7kXy6xpQPsfM4A7CJA== X-Received: by 2002:a05:6402:319b:: with SMTP id di27mr8692795edb.133.1595591772547; Fri, 24 Jul 2020 04:56:12 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:1969:d8fc:c333:bd5a]) by smtp.gmail.com with ESMTPSA id dj22sm560020edb.54.2020.07.24.04.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 04:56:12 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/ttm: fix pipelined gutting for evictions v2 Date: Fri, 24 Jul 2020 13:56:11 +0200 Message-Id: <20200724115611.15375-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 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: Alex.Sierra@amd.com, Philip.Yang@amd.com, Felix.Kuehling@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We can't pipeline that during eviction because the memory needs to be available immediately. v2: fix how we cleanup the BOs resources Signed-off-by: Christian König Reviewed-by: Felix Kuehling Tested-by: Alex Sierra --- drivers/gpu/drm/ttm/ttm_bo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 0768a054a916..469aa93ea317 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -652,8 +652,12 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, placement.num_busy_placement = 0; bdev->driver->evict_flags(bo, &placement); - if (!placement.num_placement && !placement.num_busy_placement) - return ttm_bo_pipeline_gutting(bo); + if (!placement.num_placement && !placement.num_busy_placement) { + ttm_bo_wait(bo, false, false); + + ttm_bo_cleanup_memtype_use(bo); + return 0; + } evict_mem = bo->mem; evict_mem.mm_node = NULL;