From patchwork Fri Jul 2 11:16:39 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: 12355953 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,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 1CFF3C11F68 for ; Fri, 2 Jul 2021 11:16:52 +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 DF630613F5 for ; Fri, 2 Jul 2021 11:16:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF630613F5 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 47E526E106; Fri, 2 Jul 2021 11:16:48 +0000 (UTC) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 85B866E105 for ; Fri, 2 Jul 2021 11:16:46 +0000 (UTC) Received: by mail-ej1-x62d.google.com with SMTP id gn32so15610209ejc.2 for ; Fri, 02 Jul 2021 04:16:46 -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=bAUQPXbSkvT19k/XhsYs0cmL8Bgj7Ny0WAGbdIQQDHQ=; b=htu1X4WFwBHbFRXePki14xQ0DdDNrq5wcPcKSlLx6nrrZ5AbINucJcwmwb65tic2Lm bZuOgKshl8GHe2JteULiueYTBjOlthJ1jAMtLVYW2kmSFUKd4MHc/ei7pXcRSN7Xw5iL M2AuhmqkvFXEnzdOGn3nAgdokUUrwm7pOz/KxxvwXUg5zniEAZaT6IdB52xvPxz/IBgM tMPAe0uE0UYEJazKDHQA+FoInRfHp9mPd1XYtZll9MLG0Rq4eVLhoy1Rjyk/tDCqYc+D zlrRfPaBcBQ1Kmb6s+/4FO0/Ji/uya+VQ4+qVj8+T/ab1iuAp8sO1gGLknWmO37IT+zT B0CQ== 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=bAUQPXbSkvT19k/XhsYs0cmL8Bgj7Ny0WAGbdIQQDHQ=; b=b9IdSRs6bQ58K0bY+8HqdLyQWHGQ1xjrePdKTx2eLMdoF7Q50aiQW7AEg9lnoBDaGE G3ZsYoEZU+YIHmax80c/AFoEaNxn9Dy9QxnCdfo8Ypin6QMUOa2cAB3JQogwjfzfcCF0 pudWFuDae8V3uXJya0mu7t39Yd+RRb6JZhEN4KVK4SltQOcm/g/GXC7S7LrrqLQOCCAq YClnK/N4OF7ngx5NMn0g4XCKJCFnc7Gi3IksONEFWOjwa/3cO64XX1FyQwHM91gjFztx AXT5RrlcejunNO8xwbO4VoWw/FALT8l2GOEBGdxFLSZWitCfhYdOSzrG6LsboWClrXMe DXvA== X-Gm-Message-State: AOAM5312S5YXjUH7/zxyk17mdFsHjgCbZmSJLTGflhsERoLVZ6wTBt9g lmYx2L+YEtrv81x/F+fgqm+PeEFcTvQ= X-Google-Smtp-Source: ABdhPJyRgjzwscGIJoyF9znrXrJnDrwrc90UNbbWde1C3zuxN949aMgabFfCOgc4z8mzNuJLPTN4Yw== X-Received: by 2002:a17:907:948c:: with SMTP id dm12mr4792888ejc.486.1625224605221; Fri, 02 Jul 2021 04:16:45 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:9bc7:a922:a595:15bd]) by smtp.gmail.com with ESMTPSA id g21sm937286ejf.25.2021.07.02.04.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 04:16:44 -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, daniel.vetter@ffwll.ch Subject: [PATCH 1/4] dma-buf: add some more kerneldoc to dma_resv_add_shared_fence Date: Fri, 2 Jul 2021 13:16:39 +0200 Message-Id: <20210702111642.17259-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210702111642.17259-1-christian.koenig@amd.com> References: <20210702111642.17259-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" Explicitly document that code can't assume that shared fences signal after the exclusive fence. Signed-off-by: Christian König --- drivers/dma-buf/dma-resv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c index f26c71747d43..4ab02b6c387a 100644 --- a/drivers/dma-buf/dma-resv.c +++ b/drivers/dma-buf/dma-resv.c @@ -235,7 +235,10 @@ EXPORT_SYMBOL(dma_resv_reset_shared_max); * @fence: the shared fence to add * * Add a fence to a shared slot, obj->lock must be held, and - * dma_resv_reserve_shared() has been called. + * dma_resv_reserve_shared() has been called. The shared fences can signal in + * any order and there is especially no guarantee that shared fences signal + * after the exclusive one. Code relying on any signaling order is broken and + * needs to be fixed. */ void dma_resv_add_shared_fence(struct dma_resv *obj, struct dma_fence *fence) { From patchwork Fri Jul 2 11:16:40 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: 12355955 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,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 90FF7C11F69 for ; Fri, 2 Jul 2021 11:16:54 +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 5B3316141C for ; Fri, 2 Jul 2021 11:16:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B3316141C 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 BCD736E116; Fri, 2 Jul 2021 11:16:48 +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 2F7DC6E106 for ; Fri, 2 Jul 2021 11:16:47 +0000 (UTC) Received: by mail-ej1-x62b.google.com with SMTP id hc16so15533892ejc.12 for ; Fri, 02 Jul 2021 04:16:47 -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=yylOD234iuv0OMUdGg2HNgmrF+LL5FUxi7mZp3iTQtM=; b=oWFzcmFQMVix/X4CnXPXfSwg6tEvBPEI7TWNN/47CdPI09vqB/tiQCa8A55wG3DryN Sy1QPtbTk5HEKcyIMO+pwCiG18e6WvTvIQA02ayAH7jjwEFsqxMsuANnOPSaHJhP9+qv 032ZfLq4iS7eqo3krPmEvd8/fWtrA2IAHMv7hU0FS3Bz8ikSgTplBL8gk1nh5TEiUddt HdBE2aF7u5pFQvROB6bYZo6ewnnVsEtg9HfMkq0yE93+WFe3rTLxGnnvWZpTNDKY2oLb SgQJF/JbYbx1Z4pz7h4lIkCefJY/2RD1HFlRTqdDRhDhrQv9nuA8b8sKctU7AyFsF84+ vUEw== 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=yylOD234iuv0OMUdGg2HNgmrF+LL5FUxi7mZp3iTQtM=; b=poj6Q9hjoZXUEWy+7MdaR7cNzVOmSGZVnTuuYwJPGyHN/xyV0A6Eqwh1Rsulhd3ima x3rRGxsYfJXHeXfjJYEMWu7M4qoeDgcvSuHKF6g0GJaRjgAkPLiQf9+k+a+UNdn1a/fU AuIg+Wy4hwIgGlL/7kqVxqopRe09+Njn/7FfuN7uk/tHAvRBBUFMCIiKe5QtNSHaSTZm NVEKXKf5yAlW0tef2XYA1LBLVGgWUvhAlqtBdVzBpeN3NTDelC7HO8v4CrTHxWLDUHq0 uvyu4516WCWMmSAGRzijhJm9OdwjsxRjaLTqAgo5E0JF6rJwzqCsjbep/pACN7qQWguP p1Nw== X-Gm-Message-State: AOAM532D3L1ae0NPVw3d9tnGIE8skAy7DuY2XXoIUk8I5EtXsR60XZvc ZcPkQyG7D7AUR6aYQ9LGLcwImajbHg8= X-Google-Smtp-Source: ABdhPJw+7ugiGjKWGVtxeaQKsJ31zvdkBMdV6SnOSPskPM/HhRft7dPc68JN6LySfLbHjbh9SO9M+A== X-Received: by 2002:a17:906:2312:: with SMTP id l18mr4940229eja.414.1625224605836; Fri, 02 Jul 2021 04:16:45 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:9bc7:a922:a595:15bd]) by smtp.gmail.com with ESMTPSA id g21sm937286ejf.25.2021.07.02.04.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 04:16:45 -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, daniel.vetter@ffwll.ch Subject: [PATCH 2/4] dma-buf: fix dma_resv_test_signaled test_all handling v2 Date: Fri, 2 Jul 2021 13:16:40 +0200 Message-Id: <20210702111642.17259-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210702111642.17259-1-christian.koenig@amd.com> References: <20210702111642.17259-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" As the name implies if testing all fences is requested we should indeed test all fences and not skip the exclusive one because we see shared ones. v2: fix logic once more Signed-off-by: Christian König Reviewed-by: Daniel Vetter --- drivers/dma-buf/dma-resv.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c index 4ab02b6c387a..18dd5a6ca06c 100644 --- a/drivers/dma-buf/dma-resv.c +++ b/drivers/dma-buf/dma-resv.c @@ -618,25 +618,21 @@ static inline int dma_resv_test_signaled_single(struct dma_fence *passed_fence) */ bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all) { - unsigned int seq, shared_count; + struct dma_fence *fence; + unsigned int seq; int ret; rcu_read_lock(); retry: ret = true; - shared_count = 0; seq = read_seqcount_begin(&obj->seq); if (test_all) { struct dma_resv_list *fobj = dma_resv_shared_list(obj); - unsigned int i; - - if (fobj) - shared_count = fobj->shared_count; + unsigned int i, shared_count; + shared_count = fobj ? fobj->shared_count : 0; for (i = 0; i < shared_count; ++i) { - struct dma_fence *fence; - fence = rcu_dereference(fobj->shared[i]); ret = dma_resv_test_signaled_single(fence); if (ret < 0) @@ -644,24 +640,19 @@ bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all) else if (!ret) break; } - - if (read_seqcount_retry(&obj->seq, seq)) - goto retry; } - if (!shared_count) { - struct dma_fence *fence_excl = dma_resv_excl_fence(obj); - - if (fence_excl) { - ret = dma_resv_test_signaled_single(fence_excl); - if (ret < 0) - goto retry; + fence = dma_resv_excl_fence(obj); + if (ret && fence) { + ret = dma_resv_test_signaled_single(fence); + if (ret < 0) + goto retry; - if (read_seqcount_retry(&obj->seq, seq)) - goto retry; - } } + if (read_seqcount_retry(&obj->seq, seq)) + goto retry; + rcu_read_unlock(); return ret; } From patchwork Fri Jul 2 11:16:41 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: 12355957 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,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 91414C11F68 for ; Fri, 2 Jul 2021 11:16:56 +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 5F5B4613F4 for ; Fri, 2 Jul 2021 11:16:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F5B4613F4 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 11F616E122; Fri, 2 Jul 2021 11:16:49 +0000 (UTC) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by gabe.freedesktop.org (Postfix) with ESMTPS id B54256E106 for ; Fri, 2 Jul 2021 11:16:47 +0000 (UTC) Received: by mail-ed1-x534.google.com with SMTP id w13so12821420edc.0 for ; Fri, 02 Jul 2021 04:16:47 -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=ND7KwC2J9bqQZCM3dXcypP939eYSZ8A7ifwwevA1684=; b=T7j2GMqBtr1BYkg2Ecz4L4GrO0/ALRPPDNMRYXUooaau3hj58MqTnosAInEic+XVEm Cpj2QrNlQL9FCYCWLQXcnJUDX53U9B7JXdjja2jcpjyGN+ZXiVB8xFfFsaonmxPJCUCj QRwkj6R50Pw5Umj/7dL3gpH1Saplo6OSqALYrN7c9ne3820VrFZFLQjZkwkF1ON7NZeo QWqAlCBMC2e7aIIwOUOqJhZvdCWPPycuy+r63/+K0Y57Me7ltKvKQ/SHsnqGZb6HeeXN KE00r+YzQhzk2h1DAtKaLbZul0R4dnQuDHj9f1V7gWnvKAqQ1Bw89HhBxp78iTEz+Kei YkVw== 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=ND7KwC2J9bqQZCM3dXcypP939eYSZ8A7ifwwevA1684=; b=FG36ilorLCZSqzOGr2g0rzUb/cdQEKg8yekFKIuxjOC435N8rQXmo2JhSK9mQwRECv JoLlaB2aDyTxWt0WTlaRd7m2DorxSUxmcD0fQ+pWJabKmtNHWwx3OE+cSrdQDvtArfqk vFg9bfXv7kWZJYSlLqdN4WPx9AniLCd1FHQkvY3TxxKmGidn9eao0Ukxb4I7vI9S0ERe utJtnnSQwTzGYsk8vz6drCyBzQmHDLFO4Wadfse+vJHpUNgZFWip3M4gNgdMGdNOQKTY 9fYQ5umnO29vX8gd9Jyx19p6cbVf2q0LnJ4S9IRwoT+uN1tp1zQX8kvcAfJNcfU4GYAX /oIw== X-Gm-Message-State: AOAM531FBHQ16STla1otXnIER+bhZ5GFBxuqEG9hcPHiSFhMhXsvd5kc Zma88nWDMj8IKMtwlnJX4qd0dC1pEaU= X-Google-Smtp-Source: ABdhPJztuzS49wqVastF48sJJFLKxMx65irXCJVOMSe/P4fou7tJGkGS3p5FHSugavPV492jep58rA== X-Received: by 2002:a50:f692:: with SMTP id d18mr5992965edn.202.1625224606436; Fri, 02 Jul 2021 04:16:46 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:9bc7:a922:a595:15bd]) by smtp.gmail.com with ESMTPSA id g21sm937286ejf.25.2021.07.02.04.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 04:16:46 -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, daniel.vetter@ffwll.ch Subject: [PATCH 3/4] drm/nouveau: always wait for the exclusive fence Date: Fri, 2 Jul 2021 13:16:41 +0200 Message-Id: <20210702111642.17259-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210702111642.17259-1-christian.koenig@amd.com> References: <20210702111642.17259-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" Drivers also need to to sync to the exclusive fence when a shared one is present. Signed-off-by: Christian König Reviewed-by: Daniel Vetter --- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 6b43918035df..05d0b3eb3690 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c @@ -358,7 +358,7 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e fobj = dma_resv_shared_list(resv); fence = dma_resv_excl_fence(resv); - if (fence && (!exclusive || !fobj || !fobj->shared_count)) { + if (fence) { struct nouveau_channel *prev = NULL; bool must_wait = true; From patchwork Fri Jul 2 11:16:42 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: 12355959 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,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 39071C11F68 for ; Fri, 2 Jul 2021 11:16:58 +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 038F1613F5 for ; Fri, 2 Jul 2021 11:16:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 038F1613F5 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 64F626E14C; Fri, 2 Jul 2021 11:16:50 +0000 (UTC) Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by gabe.freedesktop.org (Postfix) with ESMTPS id 740706E116 for ; Fri, 2 Jul 2021 11:16:48 +0000 (UTC) Received: by mail-ej1-x634.google.com with SMTP id i20so15229621ejw.4 for ; Fri, 02 Jul 2021 04:16:48 -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=5WMQmwGHbFSsJZWDXuAJvQZzGWBWH2W4bsFT3at8Zrc=; b=PD2UA12mJPkBkUa3lwwbC865phJeS+GpzwQc8F3qw390Ql6RX0tB/hQhve9o/BsX6M O5qK5KguUm2PYBNd1ZNL60FKqEbC7mLOQ5UZvM+Kce2ZN0vJD0ouDT71ZYTK4pFnLzzM HJWA7BLX0dJXet2tBrjsSUOUQxLmBVqtdM8V5Xthup5/svkzGwoCEry4ZdLA6i7yUdHg vlKje/p9EG7HmBL0BX3m35+yfQltle0Ub9mPA1sQq/QSqIc5ufUQnIsm7PtAdO1G+b8T LmUIBXiqHM9yCFPzutSMjchKZ4uyD7eKhZ8L0CNbooKE6lFf9zXrong29ucptU+Ckv+A RYJA== 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=5WMQmwGHbFSsJZWDXuAJvQZzGWBWH2W4bsFT3at8Zrc=; b=q4y/wt3T7DQ+UEuvsONtLs4N3w52KEZOzmRNoEe2oAt9AGYzdEjALeM+i9NKoMKjPK ULFE/zJNQQ0Locq9MKHut4AkEBq1Caka4Ok3e6S9mKTTPHtjS8/qOnKdBV3l/g7uYp+F 6Bp/Ika+sxU8L9hw/CfDPgjwujsG8Tq0ed4Tu2ewl8vMSHsPN9dCX1C16eWplGdWm9rj yCkkHNd+INt5RoinrRXkzRhjG8UopmqumsYSYOnPtivl1ZoTHh7ztXVZQXjOpj2WrZkw 8j5AKvCoCsmk/IyaUROVWgUX1NfPsCKGidRjhFDNlt1v8EtzdHjCS4d4eahI/s6W6FTp ZD/Q== X-Gm-Message-State: AOAM531o4gHhxrQkbRjK9ukOS0wv9SSOL9k40IxvHDfb/+sY0243YuwF H00DEzNQ6Urxuna04u7extVUx+Z3CqY= X-Google-Smtp-Source: ABdhPJyXBENjMhcM3dGW/+8jFC58E7xornoyh30UcLyKPTroxIgQ4NpCtgaO0cJaXK4YlR4RnwL7cw== X-Received: by 2002:a17:906:1486:: with SMTP id x6mr4795196ejc.69.1625224607138; Fri, 02 Jul 2021 04:16:47 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:9bc7:a922:a595:15bd]) by smtp.gmail.com with ESMTPSA id g21sm937286ejf.25.2021.07.02.04.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 04:16:46 -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, daniel.vetter@ffwll.ch Subject: [PATCH 4/4] drm/msm: always wait for the exclusive fence Date: Fri, 2 Jul 2021 13:16:42 +0200 Message-Id: <20210702111642.17259-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210702111642.17259-1-christian.koenig@amd.com> References: <20210702111642.17259-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" Drivers also need to to sync to the exclusive fence when a shared one is present. Completely untested since the driver won't even compile on !ARM. Signed-off-by: Christian König Reviewed-by: Daniel Vetter --- drivers/gpu/drm/msm/msm_gem.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index a94a43de95ef..72a07e311de3 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -817,17 +817,15 @@ int msm_gem_sync_object(struct drm_gem_object *obj, struct dma_fence *fence; int i, ret; - fobj = dma_resv_shared_list(obj->resv); - if (!fobj || (fobj->shared_count == 0)) { - fence = dma_resv_excl_fence(obj->resv); - /* don't need to wait on our own fences, since ring is fifo */ - if (fence && (fence->context != fctx->context)) { - ret = dma_fence_wait(fence, true); - if (ret) - return ret; - } + fence = dma_resv_excl_fence(obj->resv); + /* don't need to wait on our own fences, since ring is fifo */ + if (fence && (fence->context != fctx->context)) { + ret = dma_fence_wait(fence, true); + if (ret) + return ret; } + fobj = dma_resv_shared_list(obj->resv); if (!exclusive || !fobj) return 0;