From patchwork Wed May 19 08:24:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12266621 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 83D94C433B4 for ; Wed, 19 May 2021 08:24:18 +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 AEB3861184 for ; Wed, 19 May 2021 08:24:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEB3861184 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 04CAF6ECDE; Wed, 19 May 2021 08:24:17 +0000 (UTC) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by gabe.freedesktop.org (Postfix) with ESMTPS id 914E66ECDE for ; Wed, 19 May 2021 08:24:15 +0000 (UTC) Received: by mail-wm1-x331.google.com with SMTP id f6-20020a1c1f060000b0290175ca89f698so2904055wmf.5 for ; Wed, 19 May 2021 01:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pt9LL0+CuDm+kdoZO8QVUQbhMgcl5obcxGIsILddiNI=; b=MQ9aFrBz0PeaXFmhxuJJKRsXWsV4ojKWOestex1JmpswITEMtO7NyCITY+f/B6cfEd YuaJOcN4AJzF/aASgepJ5vLaUTnCWQGxKO2WN7amvEcX41c5CUOL0a+UegdDJJS99tcR 1QmoE4V0/6jWslb0qdA4Hn0PMftILf1T7rg6E= 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=pt9LL0+CuDm+kdoZO8QVUQbhMgcl5obcxGIsILddiNI=; b=fyTM+SIkYKFMkI1Ivsi4Y+4g/+vNA4eFsocH/Kltwe4ZdJnhsvkHHjHlYraUcro+Ap /g1RKP+cjfRxFG8TzGP2L+o9Mnl3+sd+SszqHFTRwJXA3msTkJnT4z+vqE5TVlXgp1F6 oFFEPAVpU+NQO8wAxlg3If8rXkNCj6GFxm3F8GU3LTxKKefthi3MGbzZ2WJsPS23YCaR OdABwqLG2lJbWQvOZCZl3WEttj7768nWL69Jd+mM2vHEoA/I0Tnw+pr7fnbDIyoRfpcl lRofPdrhXytVhzJtoIPisOFEjPnR1jZsGwySRyEoyMm8dD+zSXRyBUBywRjJQwvtHorQ syYw== X-Gm-Message-State: AOAM531RA80o710N0czP89npq8StTYDkN9BebFyO6GLplJ/y2n6J+dx9 1npti2jPtgDWg4bmxDYG9V6wN96Yj5kCXA== X-Google-Smtp-Source: ABdhPJy60MiCzS26siZjbWIAx4MDQVgb7vOKb6uiXB4Ce87EFFEx9z+DjmAN9pkVppwvnVbK/nrSBQ== X-Received: by 2002:a05:600c:896:: with SMTP id l22mr10257596wmp.164.1621412654302; Wed, 19 May 2021 01:24:14 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id v18sm29602687wro.18.2021.05.19.01.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 01:24:13 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm/ttm: Explain why ttm_bo_add_move_fence uses a shared slot Date: Wed, 19 May 2021 10:24:09 +0200 Message-Id: <20210519082409.672016-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.31.0 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: =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Daniel Vetter , Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= , Daniel Vetter , Christian Koenig Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Motivated because I got confused and Christian confirmed why this works. I think this is non-obvious enough that it merits a slightly longer comment. Cc: Christian König Cc: Christian Koenig Cc: Huang Rui Cc: Thomas Hellström Signed-off-by: Daniel Vetter Reviewed-by: Christian König Acked-by: Huang Rui --- drivers/gpu/drm/ttm/ttm_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index ca1b098b6a56..51a94fd63bd7 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -682,7 +682,9 @@ int ttm_mem_evict_first(struct ttm_device *bdev, } /* - * Add the last move fence to the BO and reserve a new shared slot. + * Add the last move fence to the BO and reserve a new shared slot. We only use + * a shared slot to avoid unecessary sync and rely on the subsequent bo move to + * either stall or use an exclusive fence respectively set bo->moving. */ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, struct ttm_resource_manager *man,