Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3301841rdb; Thu, 16 Nov 2023 06:09:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGuJLErZ3dV63xTjKr3iBzSMT75EOkXCKj59UQplzy8kQgY+ObSgUeTvIlGKLeWMRuLjd1 X-Received: by 2002:a05:6a20:3c92:b0:187:e4a6:10a with SMTP id b18-20020a056a203c9200b00187e4a6010amr738553pzj.53.1700143791935; Thu, 16 Nov 2023 06:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700143791; cv=none; d=google.com; s=arc-20160816; b=KlV0JdIEvcIXk01wbZP6vJ5++9iNOIJc5wU26fSgKtuyP6oIHca9a/5XqVEtFF/FFs imaOR7ujUa01Osqj3tIinkcixE/qPToF2DcDna0DhaKHvlT56YPrpiWDX9PEsq2HS4RN ywuan0XWEiUqcmor5T/LbYhz5CwXMamh9kCwTQOvjQLsMz29zVGxo2CTfz/U9poIMBJ8 yHMEpvpl7iV14sZT1cTQ4KVOR7UBtF2ChIIn2D0KBgzIUPzyYUeKBl+KWc73/RSZPLeP YolaKAn97DrgXo2e49bLhquysw48CjlYhpyT35+Sj/Y5sUaV58wE5BeTvVcSQfmKT1/j Oxug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:organization:references:in-reply-to:date :cc:to:from:subject:message-id:dkim-signature; bh=spRh+yF57jjoBWHvWpo/Tq4zxr8/j2rt/0b9L5ABdn0=; fh=sOdnuwYdgT9bKxo3BGd5ExCbJBc3viXWLurxenBUMLs=; b=oXdnlA100B/XLNFZFnQWqteQc5x3xPXU8ByttQa5OeIXO1MTGIoQUk+mGJS/AP/aZX lmQQy5VQzB5GGktAS4I3n12/fAaulJnIUFfDrPl6HTPkGZBG0LYlM7lyVC1DbbgilXuC Bg708iKAs1sKwyUx0Fph6s1eCY+xyCD4FhA0Jbp7wzHkTNHN+/VozSvEBoo1n3AIAaJw tESFONzFhyEbQeTHIvS0qZ5Lfqrxy17IAWzPeU1U67H+uvF42VbRdJtb3vM2jd85lKqy AK9zGa0l7kdXASfgpu9HVV8bZIO00v3krpz+VAEXRi+mEXeIc/rFrVufDaraN0a0g4Bl 6uYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DXA8MTAd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j71-20020a63804a000000b005bd2b2ffcefsi11937459pgd.523.2023.11.16.06.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 06:09:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DXA8MTAd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 83F5181CAFA9; Thu, 16 Nov 2023 06:09:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231196AbjKPOJW (ORCPT + 99 others); Thu, 16 Nov 2023 09:09:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbjKPOJV (ORCPT ); Thu, 16 Nov 2023 09:09:21 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB6AA7 for ; Thu, 16 Nov 2023 06:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700143758; x=1731679758; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=spRh+yF57jjoBWHvWpo/Tq4zxr8/j2rt/0b9L5ABdn0=; b=DXA8MTAd8QB+6AOFyjYVoPvCtpP/3GlI8as7lgFyKAszoXsc2IZSiyI5 rh4FNaSuZnp6WAJ9ElAFYRP2kYw/YbjF5jFQkZco3C+6gs6qFnWi8BnyF odp7zm7fulxZn61xMVw7ifWn9gCjyrE5ZZC6Ytn1WRLyTFlKTQ0p8ERFI 8+iEwWCXUCtgXHdu1WHmhmmVTzhhtUxK+eVKRzfJWjes4rVaUDNuqFi/D OSU/eLciW6vbJPiFuAFkpton4fwpKgpo7OP5b1YrSlQ09GKl/FAO8uiIp nA8vhy2inuW1oBx6UngJiNWb1nuE3QPJOgYlZUUFR23ComCDiW2ZCXf9v g==; X-IronPort-AV: E=McAfee;i="6600,9927,10896"; a="12641895" X-IronPort-AV: E=Sophos;i="6.04,308,1695711600"; d="scan'208";a="12641895" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 06:09:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,308,1695711600"; d="scan'208";a="6536734" Received: from mcaspar-mobl1.ger.corp.intel.com (HELO [10.249.254.12]) ([10.249.254.12]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2023 06:09:14 -0800 Message-ID: Subject: Re: [PATCH v4] Documentation/gpu: VM_BIND locking document From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Danilo Krummrich , Boris Brezillon Cc: intel-xe@lists.freedesktop.org, Rodrigo Vivi , Matthew Brost , Joonas Lahtinen , Oak Zeng , Daniel Vetter , Maarten Lankhorst , Francois Dugast , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Date: Thu, 16 Nov 2023 15:09:11 +0100 In-Reply-To: References: <20231115124937.6740-1-thomas.hellstrom@linux.intel.com> <20231116104851.114bdb08@collabora.com> <0850281b667c4b88163dab60737dbc945ad742fd.camel@linux.intel.com> Organization: Intel Sweden AB, Registration Number: 556189-6027 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 06:09:40 -0800 (PST) On Thu, 2023-11-16 at 15:02 +0100, Danilo Krummrich wrote: > On 11/16/23 12:48, Thomas Hellstr=C3=B6m wrote: >=20 > >=20 > > > > +Locks used and locking orders > > > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D > > > > + > > > > +One of the benefits of VM_BIND is that local GEM objects share > > > > the > > > > gpu_vm's > > > > +dma_resv object and hence the dma_resv lock. So even with a > > > > huge > > > > +number of local GEM objects, only one lock is needed to make > > > > the > > > > exec > > > > +sequence atomic. > > > > + > > > > +The following locks and locking orders are used: > > > > + > > > > +* The ``gpu_vm->lock`` (optionally an rwsem). Protects how the > > > > gpu_vm is > > > > +=C2=A0 partitioned into gpu_vmas. It can also protect the gpu_vm's > > > > list > > > > of > > > > +=C2=A0 userptr gpu_vmas. With a CPU mm analogy this would > > > > correspond to > > > > the > > > > +=C2=A0 mmap_lock. > > >=20 > > > I don't see any drm_gpuvm::lock field in Danilo's latest > > > patchset, > > > so, > > > unless I missed one version, and this lock is actually provided > > > by > > > drm_gpuvm, I would mention this is a driver-specific lock. This > > > comment > > > applies to all the locks you describe here actually (mention > > > which > > > ones > > > are provided by drm_gpuvm, and which ones are driver-specific). > >=20 > > These will be needed also by gpuvm when implementing userptr vmas, > > so I > > can mention that drm_gpuvm is currently lacking a userptr > > implementation, so "the locks described below are to be considered > > driver-specific for now" >=20 > Since Xe already implements userptr support, are you guys maybe > interested > in extending drm_gpuvm accordingly? :-) >=20 I've been thinking of that but in that case that needs to happen after the xe merge. Also we ofc need to clear it with the people who do resource allocation on our side :) Thanks, Thomas