From patchwork Fri Feb 4 10:04:26 2022 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: 12735063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0F06FC433EF for ; Fri, 4 Feb 2022 13:25:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FA6810EDB0; Fri, 4 Feb 2022 13:25: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 0BDC110F181; Fri, 4 Feb 2022 10:04:40 +0000 (UTC) Received: by mail-ej1-x62b.google.com with SMTP id s13so17837787ejy.3; Fri, 04 Feb 2022 02:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OIMpCxdpOEYcnoEMYTLid8nSDucpIJk7Qs0av1g9rGU=; b=kEdyeBND1+sjQQEgBxCKwTD2jfD5hj01xe2rH5ufH1ohwmTGz9JuokXVS2loUz67cR Sgt0CJ88ZsTTlD499CNTbHz7n2mfp45kjtGliVjkRHcf4JFIPh0flrY1XW+1hCSLTGyN a3gssbVWS6MDk7MCK8sC++Gx8N2juQJuJe+RGaYof7Viu0fN41zThohPFYML9aQhT86/ i6BoDpIpea36irSI9yRq+kekYL+auv2MI+iBlqBxZM5KtTDZM+6y6UoNjvORoLTMuurL 0McJxS0QOz8cB/lUJdxfkHcsSzp3z8l6D4iOQI8cJVoHqamzqszYvBCOu6CGzatfOQ4O uShg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OIMpCxdpOEYcnoEMYTLid8nSDucpIJk7Qs0av1g9rGU=; b=ruhhu4MixAwpabi1EgwBhLDQZ9KHY7w39grW9MPQapluV+al2u9KVu7IZz1T1xogfw ym77FFfRDdH8lHoCflOOPNGTvxwxzSkb8zpBEbjlGTHFYWvHPsdz6IeRqifIVnL/9gW4 m2RqgianFKd23iQdV2bW2HWXrK6JT/1PmCyz5Ba3qy3tvWCP3jcXEqAdcQmGqSNNe0B3 7GK1QmiCgd/crxzc51UthOMhlznhpJWxJJUihGxVekNL45rFi6/+/D/ogVRZB/a3QgVg ZA9ggbo1jqkzeVb/FxAsR8k+h4ubYRMme+ZqqzKN/THNXGayf3O8JxwFbxVBtvQtyoNg 8jpQ== X-Gm-Message-State: AOAM533KZxa1aVdZpD3aexNRAvNFQm0+GzSOB7wiqopL+tdkQ2y8X4uC AAaZSDbaUbu0p3TFp0KuOFk= X-Google-Smtp-Source: ABdhPJy/MXdEppNWsn3y2eTv52qm/Awi+bfFn7NIw30r0IajdZozc69ofz3XjihpMxxDUZtMTpsxLA== X-Received: by 2002:a17:907:d20:: with SMTP id gn32mr1914593ejc.55.1643969079533; Fri, 04 Feb 2022 02:04:39 -0800 (PST) Received: from able.fritz.box (p57b0bff8.dip0.t-ipconnect.de. [87.176.191.248]) by smtp.gmail.com with ESMTPSA id z10sm633943edl.54.2022.02.04.02.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 02:04:39 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: sumit.semwal@linaro.org, thomas.hellstrom@linux.intel.com, daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org Date: Fri, 4 Feb 2022 11:04:26 +0100 Message-Id: <20220204100429.2049-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204100429.2049-1-christian.koenig@amd.com> References: <20220204100429.2049-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 04 Feb 2022 13:25:44 +0000 Subject: [Intel-gfx] [PATCH 3/6] dma-buf: Warn about dma_fence_chain container rules v2 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Chaining of dma_fence_chain objects is only allowed through the prev fence and not through the contained fence. Warn about that when we create a dma_fence_chain. v2: fix comment style Signed-off-by: Christian König Reviewed-by: Daniel Vetter Reviewed-by: Thomas Hellström --- drivers/dma-buf/dma-fence-chain.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c index 1b4cb3e5cec9..084c6927b735 100644 --- a/drivers/dma-buf/dma-fence-chain.c +++ b/drivers/dma-buf/dma-fence-chain.c @@ -254,5 +254,14 @@ void dma_fence_chain_init(struct dma_fence_chain *chain, dma_fence_init(&chain->base, &dma_fence_chain_ops, &chain->lock, context, seqno); + + /* + * Chaining dma_fence_chain container together is only allowed through + * the prev fence and not through the contained fence. + * + * The correct way of handling this is to flatten out the fence + * structure into a dma_fence_array by the caller instead. + */ + WARN_ON(dma_fence_is_chain(fence)); } EXPORT_SYMBOL(dma_fence_chain_init);