From patchwork Mon Jul 12 17:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12372235 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 24417C11F67 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 EAF2C611CC for ; Mon, 12 Jul 2021 20:02:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAF2C611CC 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 0B10889E35; Mon, 12 Jul 2021 20:02:16 +0000 (UTC) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC56989DD3 for ; Mon, 12 Jul 2021 20:02:11 +0000 (UTC) Received: by mail-wr1-x435.google.com with SMTP id r11so22000052wro.9 for ; Mon, 12 Jul 2021 13:02:11 -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=A4+2/pgGBCJxzVgU/zlbGWzgj/dEC4nIap1p/ExGlZw=; b=XhL8QyxOXp7z6Hg6bktsegyq+iQE0VwQKJd5eOzrkBbaKaJUAXR7KUnTN/PAHylsZ/ FtW7akJ5YjRHbXteKqQdn9KzqNO50IDz8f0DeZzhP5cNrEIML3c9tx0Z//4Gf/Y3Phyj IXMvzWgqPHCNq9RdnW2KRAdfdERjEKpJZo1tQ= 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=A4+2/pgGBCJxzVgU/zlbGWzgj/dEC4nIap1p/ExGlZw=; b=EKv5+FrqnKRzyubJT0G+P93EVGpBMmMSNpsoDsalMKyQdMfnl7tISf3ktqiXXPeHmT 788YFfB5/W7yd1fFB1uiiJerhVYGbikh1Hkb6wL4Os5/AvOmi25oYSNDe4VhbxOP/gUM btlZszbRUE1z8+xCfhe4a+uFykTcPxkGCH35FCEUxVfyiFGCZu+NanwzjgzpPuoJSeZd mN8AWVHfD0fnzagh0f4Lzcl3WP+5KuLTX+cPbqs+XS8h4KNML1TuhJMJPYDwnDQUuJ9K nHRvcYs1psFmyxZstTige+6qYSSSwac1HDaiiuLiEsKFnLSgMiokojngM+Zr+t3rR69U 8Rsg== X-Gm-Message-State: AOAM530dNKCMdQB4Tr8/UXSOpjUbX/kNmFjaEU0hnBltr8o/xdx2cVZZ 9QWeFLlurUZZ1knfgnCQh7wpehjM5I+m1g== X-Google-Smtp-Source: ABdhPJzBZz63JTQIH2tUHA1ojZohKCYhhXtyA7mYW5eUzZDSgsXk8ZANd0/YxLZA1e1lQp5qwP+0kA== X-Received: by 2002:adf:ef11:: with SMTP id e17mr840935wro.71.1626120130732; Mon, 12 Jul 2021 13:02:10 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 13:02:10 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH v4 13/18] drm/sched: Check locking in drm_sched_job_await_implicit Date: Mon, 12 Jul 2021 19:53:47 +0200 Message-Id: <20210712175352.802687-14-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: Jack Zhang , Daniel Vetter , Intel Graphics Development , Luben Tuikov , Alex Deucher , Daniel Vetter , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" You really need to hold the reservation here or all kinds of funny things can happen between grabbing the dependencies and inserting the new fences. Signed-off-by: Daniel Vetter Cc: "Christian König" Cc: Daniel Vetter Cc: Luben Tuikov Cc: Andrey Grodzovsky Cc: Alex Deucher Cc: Jack Zhang --- drivers/gpu/drm/scheduler/sched_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index fd52db906b90..6fa6ccd30d2a 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -714,6 +714,8 @@ int drm_sched_job_await_implicit(struct drm_sched_job *job, struct dma_fence **fences; unsigned int i, fence_count; + dma_resv_assert_held(obj->resv); + if (!write) { struct dma_fence *fence = dma_resv_get_excl_unlocked(obj->resv);