Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1308597iob; Thu, 12 May 2022 16:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtQUlB+gGKhqEsE7PHNXRBoqIs/CO857Zqo5DRRUCAhD3/Z8ixv0mYrMvTlj8BWwFy6+W8 X-Received: by 2002:a05:6402:3684:b0:42a:4fc2:644c with SMTP id ej4-20020a056402368400b0042a4fc2644cmr396665edb.56.1652397912445; Thu, 12 May 2022 16:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652397912; cv=none; d=google.com; s=arc-20160816; b=XQrwRZHb0ZB9Dp5AOUOqSVuH3qzkn5rpUQCq57zM6vidJRwUDM+3iGYYuZKiWsngQy mAm+/SbZRdkcV+sBo6qokPz9JCikXtiEuVhVjsc1LrB3BVrO+ZnRtan+U21xdqwNkl6H V+WKNUNU0yCAENLuYQW2nHpoZnkSOTUdhx7BQGFrgj5yxi4jNpXAbTmpBHYNCc0tHPo8 wPwxW60htZa/WXvfhgtpDbsYScQjQiUa1XRUwx/+B9Gd6nZig1Wf/pK94AfnFNXVxNxE HpUgDptb6JkA6sXhz6D/4PfhcRA0FkTTvDT/lWlEA+Ya3KO12p8elGQtD7dkgmXbnODf wPHw== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=n/7pYmQpfwFthS/9oBJ6j9sdvjU7gecjyTu7MlWAR7k=; b=oLJLdN3brNiZnhhIUEjuX9La8Vvqdjyveg4XkzQGC4Jf9+8/82ybHqNjnVA1VjUL+h L449yC7Z5AgpQ3n5+y3L42zSEOR3CuHKGJUAdhqdbroy4DP7uzs3CgMmTDYyrVR6LYhM tdJPWln4+GnBMWIYcsBmjPbybKcmrk2nL3aQQADRRrkoCIYWJsDJd+B4YiNT9QsKUZWf uoBTjK9jdcSQxpTN82YLv0QeMediXXa8WyWYtGcXAWKbVU0UqYUFxkl048lskz1CsNCA CYnLGtqq1gO6agibctJ6t+jRoa8Mm0mM3yaWfZpkSNV4pnt/v2UzzpYqM6DH+aThabR3 cXWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=kUmh1oG6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du1-20020a17090772c100b006efe24498dcsi623749ejc.488.2022.05.12.16.24.45; Thu, 12 May 2022 16:25:12 -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=@ffwll.ch header.s=google header.b=kUmh1oG6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354801AbiELOPq (ORCPT + 99 others); Thu, 12 May 2022 10:15:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236680AbiELOPo (ORCPT ); Thu, 12 May 2022 10:15:44 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464CD21255 for ; Thu, 12 May 2022 07:15:42 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id j25so6454331wrc.9 for ; Thu, 12 May 2022 07:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=n/7pYmQpfwFthS/9oBJ6j9sdvjU7gecjyTu7MlWAR7k=; b=kUmh1oG60Fx0A6U56QVurQQLGKQ7477RCDCtn29lmcK1mpvRBMpGiD6hdcAaMvFXmV qOGgXhg3PVoHSSWjxbVmU5G5zNZqptA0VHiElu7Vy6cSSsGOyRC0I3lk0Tn4mIUNZlAw AsnpIb4hk5Q+SIPopSbDEj41i4yu8DkWC+t4w= 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 :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=n/7pYmQpfwFthS/9oBJ6j9sdvjU7gecjyTu7MlWAR7k=; b=OU5KzEOI9qsy+fd3eRD5uBmp1r5QdaDB0QM3FGStKEmd/HyKWlLm96S/NNC6QdEEHO N6gu9ClFUYp2YdIkWOg7Z09IBglfmFh9hpYKnUAutFCSxnA0tLVFOvqyE5rY9sFjVQJ6 TIob60oYxvP14/iNkm6DhoYWx+XnG3RRU/nJDPy0dPHAFBxOG13NKS6Wg05Uxqu/k7dn CZLrXUh6bFb3JA0BKFEX5zNMyptIgrauUfmVro5ZsFLSEWedJfca9YKE8AbGCIWQz631 q+JjpnMSs4v4chkRDVgkASvyrUuuhVx8HLKyeKPjHBHKVC91kJYNowKheKlRdgs3Y3Ye UskQ== X-Gm-Message-State: AOAM5339VqzlRNuxOxeXsG0lOFka7gYBfxDB/9ZzurDlNDQg3+mbQRQs hEXE6U/+VVKs+KzU0vUg+jjKEg== X-Received: by 2002:a5d:6d8d:0:b0:20c:5f60:d551 with SMTP id l13-20020a5d6d8d000000b0020c5f60d551mr27919826wrs.427.1652364940783; Thu, 12 May 2022 07:15:40 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id c13-20020adfed8d000000b0020c5253d8d7sm4428980wro.35.2022.05.12.07.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 07:15:39 -0700 (PDT) Date: Thu, 12 May 2022 16:15:37 +0200 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Dmitry Osipenko , Thomas Zimmermann , Daniel Stone , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Almeida , Gert Wollny , Gustavo Padovan , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Rob Herring , Steven Price , Alyssa Rosenzweig , Rob Clark , Emil Velikov , Robin Murphy , Dmitry Osipenko , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v4 10/15] drm/shmem-helper: Take reservation lock instead of drm_gem_shmem locks Message-ID: Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , Dmitry Osipenko , Thomas Zimmermann , Daniel Stone , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Almeida , Gert Wollny , Gustavo Padovan , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Rob Herring , Steven Price , Alyssa Rosenzweig , Rob Clark , Emil Velikov , Robin Murphy , Dmitry Osipenko , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org References: <83e68918-68de-c0c6-6f9b-e94d34b19383@collabora.com> <4d08b382-0076-1ea2-b565-893d50b453cb@collabora.com> <56787b70-fb64-64da-6006-d3aa3ed59d12@gmail.com> <3a362c32-870c-1d73-bba6-bbdcd62dc326@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Linux phenom 5.10.0-8-amd64 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,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 Thu, May 12, 2022 at 09:29:35AM +0200, Christian K?nig wrote: > Am 11.05.22 um 21:05 schrieb Daniel Vetter: > > [SNIP] > > > > > It's unclear to me which driver may ever want to do the mapping under > > > > > the dma_resv_lock. But if we will ever have such a driver that will need > > > > > to map imported buffer under dma_resv_lock, then we could always add the > > > > > dma_buf_vmap_locked() variant of the function. In this case the locking > > > > > rule will sound like this: > > > > > > > > > > "All dma-buf importers are responsible for holding the dma-reservation > > > > > lock around the dmabuf->ops->mmap/vmap() calls." > > > Are you okay with this rule? > > Yeah I think long-term it's where we want to be, just trying to find > > clever ways to get there. > > > > And I think Christian agrees with that? > > Yes, completely. > > A design where most DMA-buf functions are supposed to be called with the > reservation lock held is exactly what I have in mind for the long term. > > > > > > > It shouldn't be that hard to clean up. The last time I looked into it my > > > > > > main problem was that we didn't had any easy unit test for it. > > > > > Do we have any tests for dma-bufs at all? It's unclear to me what you > > > > > are going to test in regards to the reservation locks, could you please > > > > > clarify? > > > > Unfortunately not really :-/ Only way really is to grab a driver which > > > > needs vmap (those are mostly display drivers) on an imported buffer, and > > > > see what happens. > > > > > > > > 2nd best is liberally sprinkling lockdep annotations all over the place > > > > and throwing it at intel ci (not sure amd ci is accessible to the public) > > > > and then hoping that's good enough. Stuff like might_lock and > > > > dma_resv_assert_held. > > > Alright > > So throwing it at intel-gfx-ci can't hurt I think, but that only covers > > i915 so doesn't really help with the bigger issue of catching all the > > drivers. > > BTW: We have now somebody working on converting the existing libdrm_amdgpu > unit tests over to igt. This sounds awesome. /me throws a happy dance Cheers, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch