From patchwork Mon Jul 12 17:53:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12372237 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.6 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 F3C4FC07E99 for ; Mon, 12 Jul 2021 20:02:37 +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 CB5AC611CC for ; Mon, 12 Jul 2021 20:02:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB5AC611CC 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 317D389DB2; Mon, 12 Jul 2021 20:02:17 +0000 (UTC) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1815389DFA for ; Mon, 12 Jul 2021 20:02:14 +0000 (UTC) Received: by mail-wr1-x434.google.com with SMTP id d2so27320436wrn.0 for ; Mon, 12 Jul 2021 13:02:14 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0WTGYnK900Sbe5MqmyJ3un5MyLkukJoTVto5awctnjg=; b=GjUhjfEdBwCSiBaDg7Iu6or3rFuGM4d1aNcTzdhvuZfABvGIqLjMGNSloDR8tDDUBu +pZncIjxQ4bi1qxHeZeO4iP1dBgpVGXaGOJCOs9GzMq8eSY8WDXXwJ1jaQdkULnfNvJb 5tDaAAmA6/m9T5+KbjkrZRbz9qZ3gB7H25SYc= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0WTGYnK900Sbe5MqmyJ3un5MyLkukJoTVto5awctnjg=; b=IFKB6mtNpwCUUEeHjMXt8UnjynDJviab0AYYMWhPd2lCC5sakdOMk0njVup61+pEkA 9OhX3p3XTzcyAjeK6xHWCO9b9A9yKV4Omo+lGRNlVfC2mdrIZJxb5nlE16iJcy/VYHio y0mEHkj6FZR6DnXnkJzixPIdPIjyZxM2J2c/4+hE8SaJlhWWe4rwx46RqZFIfrKanmey qLhxWKaF1ObwBI6vqamj9wFiAauWC9Hyg/oSXaTLxDa9NbUJteu+0yweTT8f64PFjYWq IibJQVlCtMN9wZsILgU3TjGmqqI+u6epldAT3LeVFXu9eoY3bwVL5AI2vzKLZWBIn9Qo i1mA== X-Gm-Message-State: AOAM530srd4kUMYU6n74NDkdIBJwgLBTV2E2+BjyjWZUQStoVcnvWNrD iU9lX6DLXFoHHplIkKQG09oVZf35q+L5iw== X-Google-Smtp-Source: ABdhPJxdW9zedwV3kiKEjC+VCqmVxuonv+xxpUAHoAsi+u2hN3Ug9mborlJNXGzl9pdAB2wU4LVuHQ== X-Received: by 2002:a5d:591c:: with SMTP id v28mr803547wrd.373.1626120132395; Mon, 12 Jul 2021 13:02:12 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l14sm9858221wrs.22.2021.07.12.13.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 13:02:12 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH v4 15/18] drm/etnaviv: Don't break exclusive fence ordering Date: Mon, 12 Jul 2021 19:53:49 +0200 Message-Id: <20210712175352.802687-16-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712175352.802687-1-daniel.vetter@ffwll.ch> References: <20210712175352.802687-1-daniel.vetter@ffwll.ch> 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: Daniel Vetter , Intel Graphics Development , etnaviv@lists.freedesktop.org, Russell King , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There's only one exclusive slot, and we must not break the ordering. Adding a new exclusive fence drops all previous fences from the dma_resv. To avoid violating the signalling order we err on the side of over-synchronizing by waiting for the existing fences, even if userspace asked us to ignore them. A better fix would be to us a dma_fence_chain or _array like e.g. amdgpu now uses, but it probably makes sense to lift this into dma-resv.c code as a proper concept, so that drivers don't have to hack up their own solution each on their own. Hence go with the simple fix for now. Another option is the fence import ioctl from Jason: https://lore.kernel.org/dri-devel/20210610210925.642582-7-jason@jlekstrand.net/ v2: Improve commit message per Lucas' suggestion. Signed-off-by: Daniel Vetter Cc: Lucas Stach Cc: Russell King Cc: Christian Gmeiner Cc: etnaviv@lists.freedesktop.org --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 5b97ce1299ad..07454db4b150 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -178,18 +178,20 @@ static int submit_fence_sync(struct etnaviv_gem_submit *submit) for (i = 0; i < submit->nr_bos; i++) { struct etnaviv_gem_submit_bo *bo = &submit->bos[i]; struct dma_resv *robj = bo->obj->base.resv; + bool write = bo->flags & ETNA_SUBMIT_BO_WRITE; - if (!(bo->flags & ETNA_SUBMIT_BO_WRITE)) { + if (!(write)) { ret = dma_resv_reserve_shared(robj, 1); if (ret) return ret; } - if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT) + /* exclusive fences must be ordered */ + if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT && !write) continue; ret = drm_sched_job_await_implicit(&submit->sched_job, &bo->obj->base, - bo->flags & ETNA_SUBMIT_BO_WRITE); + write); if (ret) return ret; }