From patchwork Thu Jun 17 11:15:54 2021 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: 12327497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33741C48BE5 for ; Thu, 17 Jun 2021 11:16:29 +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 0708E61209 for ; Thu, 17 Jun 2021 11:16:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0708E61209 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 1788C6E8F2; Thu, 17 Jun 2021 11:16:26 +0000 (UTC) Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCD7A6E115 for ; Thu, 17 Jun 2021 11:16:10 +0000 (UTC) Received: by mail-ej1-x62b.google.com with SMTP id my49so9189719ejc.7 for ; Thu, 17 Jun 2021 04:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=f1nM/lpdSyfhiokJoYKLwhEgbv1/4gmOk1Dy2ivEHic=; b=A/XrqU2+MWOuAkqSgZ6QRPi/OX8NnlSLG59pLX7MWTJdq/uJfCYBGgj1uNqm7KnshJ ONHeTwD04CBs29Zlu+QbB018Sjbj1EbD2PRqZl9cKBh9SMmhDZBsCQ46OxPgp1o8Qq3w pms9himFZh0TiGjmbDTagV+cT2IlGLWj033t58n/sVW92evl7E/bIIeKVakNk8213Kzl UTL+AemGi/lA9fyKp0bn74Khf/YY4mATHujl7EeUiZ+n3ts5rQ09gb7MWWAyOeljamEW VF9NakYitalSgDIqNGl7UvP+t0K2cS4irujtjxI07D3cwQaBxKs0atuYZ9O1iAdeGK0k 9j6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f1nM/lpdSyfhiokJoYKLwhEgbv1/4gmOk1Dy2ivEHic=; b=i8q6ALI659a+FR+BekMmBmglRXl8JZQ3JIc9VtR48p+W1AwOQQO4Gw5mLZN7iU5SaW apTC7AG2TPW2mvPiAt0uxim3Tksx9vvARTnTSWwECdJDrLuXEbP9j9HlC01Mk6vRSCgn BJbyL5YjQ6x//PlSNIAyeZVKWjE1P6RsA/zFa3U1F7CjFxJ1424sJOnznozDMiZ7otOH osqHxSVEyCRYaeqpW3jGHu1TgJowJI5cAFJJi6SPLEjDigy7IWxZHPMtZq/FjoRpHJb7 2D41TIG+cBdDs7iT4+5PGiZM/n9ZW2L7RK8K1zg6sAl1RRqvsXqD9nRLs68HyGIrQrHO 3uUg== X-Gm-Message-State: AOAM532zYZj9HVH38rL8n7SPjkR1LKUM9fAAdSXoLff3hMU8AtzHrLp7 91oIoii3EBW2n5pCKdy0doYQP6AYqcA= X-Google-Smtp-Source: ABdhPJwpl+Y35NzWtOSjv3T8c0k5bgUp2ObFD77ixFfDk+LP3QdJI72JcZJK2ppOJ0uA8hoXgx4CfQ== X-Received: by 2002:a17:906:86cc:: with SMTP id j12mr4762643ejy.548.1623928569570; Thu, 17 Jun 2021 04:16:09 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:8534:5e76:1ee5:f3ad]) by smtp.gmail.com with ESMTPSA id y10sm3531353ejm.76.2021.06.17.04.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 04:16:09 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: daniel@ffwll.ch, sumit.semwal@linaro.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org Subject: [PATCH 12/16] drm/amdgpu: use new iterator in amdgpu_ttm_bo_eviction_valuable Date: Thu, 17 Jun 2021 13:15:54 +0200 Message-Id: <20210617111558.28486-13-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210617111558.28486-1-christian.koenig@amd.com> References: <20210617111558.28486-1-christian.koenig@amd.com> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Simplifying the code a bit. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 80dff29f2bc7..d86b0cbff889 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -1334,10 +1334,9 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, const struct ttm_place *place) { unsigned long num_pages = bo->resource->num_pages; + struct dma_resv_cursor resv_cursor; struct amdgpu_res_cursor cursor; - struct dma_resv_list *flist; struct dma_fence *f; - int i; /* Swapout? */ if (bo->resource->mem_type == TTM_PL_SYSTEM) @@ -1351,14 +1350,9 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, * If true, then return false as any KFD process needs all its BOs to * be resident to run successfully */ - flist = dma_resv_shared_list(bo->base.resv); - if (flist) { - for (i = 0; i < flist->shared_count; ++i) { - f = rcu_dereference_protected(flist->shared[i], - dma_resv_held(bo->base.resv)); - if (amdkfd_fence_check_mm(f, current->mm)) - return false; - } + dma_resv_for_each_fence(bo->base.resv, &resv_cursor, true, f) { + if (amdkfd_fence_check_mm(f, current->mm)) + return false; } switch (bo->resource->mem_type) {