Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2325098rdb; Mon, 9 Oct 2023 23:41:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdKNH0oKnnAqAgQWcts/hlyedbAsH+sSQnuEJcSTTglxe02d5zXV+JPLXEqFke6cH7g13Y X-Received: by 2002:a17:90b:1b4c:b0:267:fc61:5a37 with SMTP id nv12-20020a17090b1b4c00b00267fc615a37mr14253874pjb.39.1696920095064; Mon, 09 Oct 2023 23:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696920095; cv=none; d=google.com; s=arc-20160816; b=fqXK6jKRNo7/ZWeKrrbxD4/Bvm72u4KecajoNK3MQ7UbLSAWYtw6OrQC26UuIr1RcC 9S3Gz7zhheVaqoMXxNfr0KGLpuGMQAl+/r9P+8m0c/+BbIO2hr4JOr5mw/qOkzbI2nns XrsSnszlgiiMxRd3oeDogqGgT7An8Hm1MsQfq+tnwhwWMuzgvnmREBIQAEgoxKzKRQPP tdrSQjsKCjWK+zInqnavyvGXn2ZTxSGDrGTDH2PRuUex8pX+jis7nJGVyHdYBJbqZHM4 swqZI4mnubSkSZVpXsv7V2lPAcf+zeBAx5bDiiO8ipKHbFeMoz7dfr4SoqaOild0x0bd GrrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=JuzlCCn4tollyyR3Isg/XtcxgJFAsuIW3hJAylGeGHk=; fh=htvIroZrbKeU2x4AOko0NW3x9xa19Yggb7QfVOG/ARs=; b=a3UIOFRw9P8V6sqv9SDK/LAzGZCb1V8sCDmW/F0SZfmTYJ29AW6id3cLdsSgYC5oX3 z0BLAOOGbtqSRbfkM99iUbgCDUsyvuyZZAqF+O3QNKU1qdEIb6BF4ErMOVkP0GEO8X+b shA2L4VmmJ2pWBzxShEOl/QkeIpl1bo0kXu7VpZCIuPHeKAbtNWbWHaKTKbF3RBivrYp UHAnfnDAfIP8iifNv2U0Dq/4lTlBakdsPDCM7YKADQz3ldVywZ+8M/AZbZQBwnLwWEwC Kv3WktAdfTuUAF4GGZtE1cPUSEvfaG9s9tMDxt3TL92mPLoi4k6sil2m7HgSCnC0aOQS nTBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LoQPN92x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m18-20020a17090a859200b002774d978e19si10968349pjn.175.2023.10.09.23.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 23:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LoQPN92x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0D038808E654; Mon, 9 Oct 2023 23:40:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442269AbjJJGka (ORCPT + 99 others); Tue, 10 Oct 2023 02:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442233AbjJJGk2 (ORCPT ); Tue, 10 Oct 2023 02:40:28 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B776E9D for ; Mon, 9 Oct 2023 23:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696920026; x=1728456026; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=qyS78X6kgyN72gNbojsrXZvOfLJcf47vxLUxZFdsRK0=; b=LoQPN92xLkHHzmtauf3fImrS9MOlSodoM0lbjWQ0iVU8bm+aWSTxdQV0 98ivgNDUexwFmGjpqk9h/393scAWkPl2WH7wie2U7Q+3Q41JgnLEnZsx5 XPUr0MdyrYlTl9Me3cXvo/0d4Cy52KQ0NjOwt1UQ1uFpOwx14xTMihLMo e99vw685bpl6LAozWHUvUnLqi7/eg3N9uvvWfIpIoNFn59Sju9vmYhscz kR0fh4IfFMOfU6BcTwEbyTB+Ur1AHBdN0FyQebhkb/kzzHQDgUMsA9oZ7 a1My+dsf0IbkQYGUvrRnNSz4ZJOLwvhc4cYzS7TtjizL3SaKL77vbO1um w==; X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="369390597" X-IronPort-AV: E=Sophos;i="6.03,211,1694761200"; d="scan'208";a="369390597" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 23:40:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="746962821" X-IronPort-AV: E=Sophos;i="6.03,211,1694761200"; d="scan'208";a="746962821" Received: from agargas-mobl.ger.corp.intel.com (HELO [10.249.254.164]) ([10.249.254.164]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 23:40:21 -0700 Message-ID: Date: Tue, 10 Oct 2023 08:40:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH drm-misc-next v6 4/6] drm/gpuvm: track/lock/validate external/evicted objects Content-Language: en-US To: Danilo Krummrich , airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com, sarah.walker@imgtec.com, donald.robson@imgtec.com, boris.brezillon@collabora.com, christian.koenig@amd.com, faith@gfxstrand.net Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20231008233212.13815-1-dakr@redhat.com> <20231008233212.13815-5-dakr@redhat.com> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= In-Reply-To: <20231008233212.13815-5-dakr@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 23:40:36 -0700 (PDT) On 10/9/23 01:32, Danilo Krummrich wrote: > Currently the DRM GPUVM offers common infrastructure to track GPU VA > allocations and mappings, generically connect GPU VA mappings to their > backing buffers and perform more complex mapping operations on the GPU VA > space. > > However, there are more design patterns commonly used by drivers, which > can potentially be generalized in order to make the DRM GPUVM represent > a basis for GPU-VM implementations. In this context, this patch aims > at generalizing the following elements. > > 1) Provide a common dma-resv for GEM objects not being used outside of > this GPU-VM. > > 2) Provide tracking of external GEM objects (GEM objects which are > shared with other GPU-VMs). > > 3) Provide functions to efficiently lock all GEM objects dma-resv the > GPU-VM contains mappings of. > > 4) Provide tracking of evicted GEM objects the GPU-VM contains mappings > of, such that validation of evicted GEM objects is accelerated. > > 5) Provide some convinience functions for common patterns. > > Big thanks to Boris Brezillon for his help to figure out locking for > drivers updating the GPU VA space within the fence signalling path. > > Suggested-by: Matthew Brost > Signed-off-by: Danilo Krummrich > > +/** > + * drm_gpuvm_resv_add_fence - add fence to private and all extobj > + * dma-resv > + * @gpuvm: the &drm_gpuvm to add a fence to > + * @exec: the &drm_exec locking context > + * @fence: fence to add > + * @private_usage: private dma-resv usage > + * @extobj_usage: extobj dma-resv usage > + */ > +void > +drm_gpuvm_resv_add_fence(struct drm_gpuvm *gpuvm, > + struct drm_exec *exec, > + struct dma_fence *fence, > + enum dma_resv_usage private_usage, > + enum dma_resv_usage extobj_usage) > +{ > + struct drm_gem_object *obj; > + unsigned long index; > + > + drm_exec_for_each_locked_object(exec, index, obj) { > + dma_resv_assert_held(obj->resv); > + dma_resv_add_fence(obj->resv, fence, > + drm_gpuvm_is_extobj(gpuvm, obj) ? > + private_usage : extobj_usage); It looks like private_usage and extobj_usage are mixed up above? > + } > +} > +EXPORT_SYMBOL_GPL(drm_gpuvm_resv_add_fence); > + Thanks, Thomas