Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4690136ioo; Tue, 31 May 2022 09:26:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWfxQgViXAQU219EwEePNqn01V6R+QVztZGsTRveoN10igTooIj5IUzgG9NjDGibl+PMLf X-Received: by 2002:a17:90a:4cc2:b0:1dd:1010:d10d with SMTP id k60-20020a17090a4cc200b001dd1010d10dmr29454240pjh.205.1654014412650; Tue, 31 May 2022 09:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654014412; cv=none; d=google.com; s=arc-20160816; b=LK0gZXATSQd7V5lZvv6OquosBZYepkgTDgS+vmJwyzNR6lyUDWmvsf/raHaiWP3JFm OzGyqNGRzh3qRxBFWmanh363RAs+6oWJptWzdh76KU3UfsallokH1X3U6ATa4IKkOyuB Kou/SSe1ZvZU3Y6ca3BYCfgiHa20i2+9URvXdFPyMY/RzIeAFrX8lXwcsYJNQv12z9rG 5VLp6FfwD3LrgM50LprqJbkXMrcHCWDzPV43KUG/3VuNvchWUsqKugLKCs/VINBDoyA4 TJobV+cwoMrKEJFh/RNX6S/Nup7yX9c0dp+OCIUr88Vb0NYdKfEeIiR4M8Y3nzlozHSp skdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UzXLXm8vq0opPbH6M8k2y8y+ok1gbqPBfw980V3Tkyk=; b=U5dliv7rsLVnLxQRQne+Rrm3dAQjN3RhrI/Ak8xXNMrLHKWlNonIV7gKAhI7LE85Np hIMRvMxZNojST9vv88hoeBmQWy3Y5tCTd5PXQv5C83neSCWZ+QUipjoOW7V7q6CWi6Me uBNahnd0oS6wcrAbvXDyh2r7DpQIFMqonpPWoIU/mLxhKmtKDUhHCDPm71DhKJDm4enW ahjIR6LBZ5rzASwAbt/mNu2adbC1EaXOsdpjDMDRQGTVTGrH23COazPpfphLuT+vDG+8 JI1TOxW3L/BhXYU+Q6mgk6y+xCiiTOpXOsdQmyUAzlBAnrYHGrMrXiEX7YUosByaVdc2 Fc2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="OC//hEgQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i28-20020a63541c000000b003ab938b9b53si19708230pgb.242.2022.05.31.09.26.26; Tue, 31 May 2022 09:26:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="OC//hEgQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240495AbiE3P5T (ORCPT + 99 others); Mon, 30 May 2022 11:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241127AbiE3P4y (ORCPT ); Mon, 30 May 2022 11:56:54 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC67D41FB7 for ; Mon, 30 May 2022 08:45:16 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id y189so10857810pfy.10 for ; Mon, 30 May 2022 08:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=UzXLXm8vq0opPbH6M8k2y8y+ok1gbqPBfw980V3Tkyk=; b=OC//hEgQZz5hudScLXcI+3NIXxxiRgV/eBvm2OMmnz0Z8udrwsrpuPPA72m7d0+4ad YH8xRKqUWhJqk6c2VBbCRt1rsr3umJ9xr10B6r+YoN88npTj2HUNhET6FKAGQ9FpP5sa grwNjNYIahG7tnWRMWx/Fv5XTCPwE9/Gvf/AU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=UzXLXm8vq0opPbH6M8k2y8y+ok1gbqPBfw980V3Tkyk=; b=ugFHr5jnh7Cx3//y8QU49K89SypMIG+XyqjPKWkzyugg7BruUW9yeIiQKYDvB3WvA2 mqe4BSKBqmdERwBYE75/txO18vjx2gz46HECQJ4UooVTjTO1vf4GXasQ0GcwyS/CyGqn I9yfOKxGqIlQyh3I6HavUXtGchlKYwxqsDJ93mYO9/VSMwdOUkzARZ3gvE7Y4gAXPAu6 WOQKz8h1WwMGtCnjbh8FCxgiP3AeY1rrlMsL5HJf9TAknz1qTjiamFfqt8hCdiCSdVgt XwZ7azW/m8X4CSmnaWe97sC1gq/oWyC+uvziXT2I+g+natYCC6qF48W9GN1J58bbIrFq vtdg== X-Gm-Message-State: AOAM532xVpq1uRX77GlPTUtbPXaX2AyZ3OPfoDO9Q8mPtucA+dZwZFnE 24RiSXd15VZKTAO72hhzkDXiPw== X-Received: by 2002:a63:1163:0:b0:3fa:5e1c:f86f with SMTP id 35-20020a631163000000b003fa5e1cf86fmr32724131pgr.543.1653925516458; Mon, 30 May 2022 08:45:16 -0700 (PDT) Received: from google.com ([240f:75:7537:3187:7d2a:ad1f:afa1:7770]) by smtp.gmail.com with ESMTPSA id 65-20020a620644000000b0050dc7628166sm8935262pfg.64.2022.05.30.08.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 08:45:15 -0700 (PDT) Date: Tue, 31 May 2022 00:45:10 +0900 From: Sergey Senozhatsky To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Sergey Senozhatsky , Sumit Semwal , Gustavo Padovan , Tomasz Figa , Ricardo Ribalda , Christoph Hellwig , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dma-fence: allow dma fence to have their own lock Message-ID: References: <20220530142232.2871634-1-senozhatsky@chromium.org> <7eee4274-bd69-df8d-9067-771366217804@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7eee4274-bd69-df8d-9067-771366217804@amd.com> X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (22/05/30 16:55), Christian K?nig wrote: > > If you just want to create a single dma_fence which is also only bound to a > single context you can embed the lock into the fence without much problem. > > See how the dma_fence_array does that for example: https://elixir.bootlin.com/linux/latest/source/include/linux/dma-fence-array.h#L37 Christian, I'm not sure I'm following you on the "embed the lock into the fence without much problem" part. If I understand it correctly this should be something like: fences = kmalloc_array(1, sizeof(*fences), GFP_KERNEL); for_each_fence(...) { // what spinlock should I use here? dma_fence_init(&fences[i], .. &lock ..); dma_fence_get(&fences[i]); } fence_array = dma_fence_array_create(1, fences, ....); sync_file_create(&fence_array->base);