Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3096645rdb; Wed, 13 Sep 2023 01:40:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUFZjxNUTbqtLhXA6e6CHvjopC2vC7bwN9nj6vE2pbrjtWokRhrq76pvBR2cH8OxKgCwM9 X-Received: by 2002:a17:902:b618:b0:1b8:954c:1f6 with SMTP id b24-20020a170902b61800b001b8954c01f6mr1759368pls.36.1694594433618; Wed, 13 Sep 2023 01:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694594433; cv=none; d=google.com; s=arc-20160816; b=u2YXEl8kj5Gtx9RrR6eSXV6gzlskyB/vKjjMd6M3acYo8tHpT9DusqCPXgFXMna43c WSdVGFdL9qFsWP9ROCEoT5IVOAY1UnCo2+RxnqgnKS0g+9tV3os9+IM0psoCXmSouQNK 69BP478W6CnFCz+dyCgifQ2bp5sIrKlyqGCUd0mULo4P4HUJiLWhg+q5zoVMl0KpkzrU lBsAlNtWLSd/bzJIQ2XBu8Xo+8uBWWaV1TgK630ocQl+1V9HVAqfjTvIOQW1yRMWeYl7 vm3wJ62oVctvk7Nd+hiweSLDb/NOaQrmtIWv+OHYDVQSvyPPVszOb2WYK9M0ry5OzCAD EIow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=s/7HacCX0xGqIGUfT+a571cZYihdeAyXlozHSLyLovw=; fh=FTBKtFVIy4mp9vb6cq/isJwe81uJ6srAyEDXAbMAX2Q=; b=o1l2aI5ri21z60wKOe2f4IZUbyGi1yz2P9rBsGE/pwkHvgtP975zjeHfX2gfROps+k bx8VwSWplw2JA8PB5vOWtbLAo+v0A8gEi6UrDzYNRLQKpsw1wiliu/aL4lbCeC2oiY2n IqaonXcdsg7SMjzKv3+1q1rLtMwjHrqiti4Oj0nov3ux1pn3zk6RhFvnlD6mCRLwVkV3 y89v2JHPRQ2U/B+R2VRzIV5R0HQqi34ZDCVhIwoyWGae7e5xcLwp37BYSOqDDgX8pkeO vijZuczp2wiRnYXeUKRuwYE3JHF2GAgz5C9wUKUXaygsxVMtSJJf7/RvDka1sl36Gxzk hndw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gueWZCpF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id kw3-20020a170902f90300b001bc02b730f3si9493327plb.242.2023.09.13.01.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:40:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=gueWZCpF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E399B827A736; Wed, 13 Sep 2023 00:03:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238418AbjIMHDW (ORCPT + 99 others); Wed, 13 Sep 2023 03:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238362AbjIMHDU (ORCPT ); Wed, 13 Sep 2023 03:03:20 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C2E1738 for ; Wed, 13 Sep 2023 00:03:16 -0700 (PDT) Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by madras.collabora.co.uk (Postfix) with ESMTPSA id 7E9886607326; Wed, 13 Sep 2023 08:03:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694588594; bh=s/7HacCX0xGqIGUfT+a571cZYihdeAyXlozHSLyLovw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gueWZCpFSELP2GjG8g78iBgvnZgS12lJTmqxaWbQQcOaNCywcqYBaCfwAVtTJPg/T KtMrArPxoFvbv2AO+/QP3r7VlYxBSE5OdnY5QMkFeBUS2r2wmn1NkkYrBKOXyP8yvt wVne0QR2NWPTXqR+HEih//MV8e2O9favQHq1yEvijNLH6N4Tm4pi3emvif0Un8omrn V0QeZQzdz8JgSVjOoFTULmbIacsfh14IcrRTIzPa0l0diPmNX2XccAVzbcQBp0UGP6 DY4Cdes2w9ca8y+y2OgGm1X+HxHMbCjpQ3XwcuxvF22cphedQLkImNExvxQPncT9hh HxXU82RnoP62g== Date: Wed, 13 Sep 2023 09:03:11 +0200 From: Boris Brezillon To: Thomas =?UTF-8?B?SGVsbHN0csO2bQ==?= Cc: Danilo Krummrich , airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com, sarah.walker@imgtec.com, donald.robson@imgtec.com, christian.koenig@amd.com, faith.ekstrand@collabora.com, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH drm-misc-next v3 6/7] drm/gpuvm: generalize dma_resv/extobj handling and GEM validation Message-ID: <20230913090311.5eeb026a@collabora.com> In-Reply-To: References: <20230909153125.30032-1-dakr@redhat.com> <20230909153125.30032-7-dakr@redhat.com> Organization: Collabora X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Sep 2023 00:03:45 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email On Tue, 12 Sep 2023 18:20:32 +0200 Thomas Hellstr=C3=B6m wrote: > > +/** > > + * get_next_vm_bo_from_list() - get the next vm_bo element > > + * @__gpuvm: The GPU VM > > + * @__list_name: The name of the list we're iterating on > > + * @__local_list: A pointer to the local list used to store already it= erated items > > + * @__prev_vm_bo: The previous element we got from drm_gpuvm_get_next_= cached_vm_bo() > > + * > > + * This helper is here to provide lockless list iteration. Lockless as= in, the > > + * iterator releases the lock immediately after picking the first elem= ent from > > + * the list, so list insertion deletion can happen concurrently. =20 >=20 > Are the list spinlocks needed for that async state update from within=20 > the dma-fence critical section we've discussed previously? Any driver calling _[un]link() from its drm_gpu_scheduler::run_job() hook will be in this situation (Panthor at the moment, PowerVR soon). I get that Xe and Nouveau don't need that because they update the VM state early (in the ioctl path), but I keep thinking this will hurt us if we don't think it through from the beginning, because once you've set this logic to depend only on resv locks, it will be pretty hard to get back to a solution which lets synchronous VM_BINDs take precedence on asynchronous request, and, with vkQueueBindSparse() passing external deps (plus the fact the VM_BIND queue might be pretty deep), it can take a long time to get your synchronous VM_BIND executed... Now, maybe the solution is something different, with early VM state update for everyone (creation of to-be-[un]mapped drm_gpuva entries, some of them being shadowed by already existing drm_gpuva that's encoding the currently mapped region), and VM state patching when a synchronous VM_BIND kicks in (we need to patch the previously queued requests too, so they always have enough resources for the map/unmap operations to succeed).