Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp908045rdg; Fri, 13 Oct 2023 05:06:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjnvA6Mqa9moq4aOqTVXfraN/Hv1AJqmjcmmzuZi3Q887TC3WYP+nFOUKzJco6qiHwmImm X-Received: by 2002:a05:6a20:9754:b0:174:2286:81f4 with SMTP id hs20-20020a056a20975400b00174228681f4mr4868783pzc.14.1697198779457; Fri, 13 Oct 2023 05:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697198779; cv=none; d=google.com; s=arc-20160816; b=t1mShqZSRFVycT7SidgfMYFjsBSpdBqnw4ibAkET/dcfhIQe5nL3TcUjJDYjuWLESI VRpj9uFAS8rEVi4y9YWRy7n+wRR8bH5nxWkB3wp8hGhnfq4L3v5btOG2QnHAFVvlKV5B NxFR80Cfbn7Rh42QBfkh45zdX+Qxt8VhDnInAxCEHctSr+yELMtetOq/a180XtnkVDTn RFH1fky6BVO8r8N+HxVOAdFGF/uY0AI7hPxKu2fBpa2zrvoXl3/EXOLkE3Vcipe4n14S y0SZ2vghbbWK7ygdkRwtmVgiVuE0XAqWyO5IvlBU6ECeokihX8YQdqU7B7/YWEMBDdbr goAw== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=+dcXEP+GxfBYG20ABDjpqfoHUMaa+MeG9Y3QKfP39fY=; fh=O16NhvANMyz2hJ3rFLgU03XllihTbCbpAGpJmys9qF8=; b=TLqZmM6ncsNFK2GLCdz0W8zI6Oc7O3Dmzo0Ee2WdZGqy/Gv1IJKc+oBYuJ+GPycD0E PNE8OBgNBPswv879SEyxFwAPewGrPtPs4xo3nZT3/NOoZzyjlW4kWV7eQHuujuL1mNUV o85zc9nuyWtDp5PNsL0AcrbWYlySKn+P+d4KX3UUAjt59LgcyK3+IpJd+1SW+aXRdB0x lG55AtL2h74ITBkS3CM8qXGfj9PO8b7hKg4EdV5a13SPQhABUt1JgI+qicTQFF1zo7mb TQQ4A7pNB9PKw7HA6xIzDrJoTAQug1yeT0RqcQ7FkoTXpHLfHam9/fvjVLOob/IksGMR +SlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gB4QGzwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x9-20020a63f709000000b00565e39e7b80si4362986pgh.678.2023.10.13.05.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 05:06:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gB4QGzwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 88D7381D230D; Fri, 13 Oct 2023 05:06:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231523AbjJMMGF (ORCPT + 99 others); Fri, 13 Oct 2023 08:06:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231443AbjJMMGE (ORCPT ); Fri, 13 Oct 2023 08:06:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F641A9 for ; Fri, 13 Oct 2023 05:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697198715; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+dcXEP+GxfBYG20ABDjpqfoHUMaa+MeG9Y3QKfP39fY=; b=gB4QGzwL7Ks3Q32L7IefYfiX/FcxLqa3zZKKRKVixMwoalCHR8WW/1VA9/QNtcloiRYgh8 2ule8vtdVxUdh6z+b9rjF6Q8LjDlasn4YUwyhy30+RboLZ/a2pHLFLsxvIzjZUShnV932D cIc6/i2GmPKQESmttO/53Nza3ujbGXo= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-Ewg-rkO2MiqkWiUaKQx7kw-1; Fri, 13 Oct 2023 08:05:14 -0400 X-MC-Unique: Ewg-rkO2MiqkWiUaKQx7kw-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9ae686dafedso152126066b.3 for ; Fri, 13 Oct 2023 05:05:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697198712; x=1697803512; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+dcXEP+GxfBYG20ABDjpqfoHUMaa+MeG9Y3QKfP39fY=; b=dS/JKbczhPDHK9SzBseqjygXESHckZFYhZldry7PcBcpXVCEM7epDD+Y1tZkASbjTn V+BTta47kqw8AZZBVh1Tn2P9ayqzVYWnos6YqVzOuxaN7mG2mz8CJHkh/bbnzdSZjQT+ DSc3F80mGKVmumZF9unLW+TlobLrVBiOXJyMMFOYq46XG5x9ltS302paRy8cIMAeOuOK djwbGHkpfUacqXPvzjeamw8e5VoufQrvVQrvD/kJWP4p2Pnq+GWKLAAGVty0YOKPAlSn 1cxOf+jZD7gejcO4ZMSI7HTrdEYX/MDpTXUAnqADouMSX4lOBoPw/JEOAUUufeK05IBE 2K7A== X-Gm-Message-State: AOJu0YyrOGDmmZkFEiFJRajhZn5Jzz6jHQfykECsMv3hA8pCp5gLuA3W t17W9ZQ9xl9mQNdzdMU5JTbg7rCDyNExB12SCHqvMp8HP06MsmkuSCFscBJz24U7ConsAf4vdeD NzriBrkHneRbPH5z37K6KOPgL X-Received: by 2002:a17:907:2723:b0:9a5:d657:47ee with SMTP id d3-20020a170907272300b009a5d65747eemr22847162ejl.58.1697198712760; Fri, 13 Oct 2023 05:05:12 -0700 (PDT) X-Received: by 2002:a17:907:2723:b0:9a5:d657:47ee with SMTP id d3-20020a170907272300b009a5d65747eemr22847132ejl.58.1697198712443; Fri, 13 Oct 2023 05:05:12 -0700 (PDT) Received: from ?IPV6:2a02:810d:4b3f:de9c:642:1aff:fe31:a15c? ([2a02:810d:4b3f:de9c:642:1aff:fe31:a15c]) by smtp.gmail.com with ESMTPSA id l12-20020a170906078c00b009b94fe3fc47sm12267409ejc.159.2023.10.13.05.05.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Oct 2023 05:05:12 -0700 (PDT) Message-ID: Date: Fri, 13 Oct 2023 14:05:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH drm-misc-next v6 4/6] drm/gpuvm: track/lock/validate external/evicted objects Content-Language: en-US To: =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , 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: Danilo Krummrich Organization: RedHat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 05:06:16 -0700 (PDT) On 10/10/23 08:40, Thomas Hellström wrote: > > 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? Good catch, will fix. > > >> +    } >> +} >> +EXPORT_SYMBOL_GPL(drm_gpuvm_resv_add_fence); >> + > > Thanks, > > Thomas > >