lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8jDsqGc5gXoIBAO@debian.me>
Date:   Thu, 19 Jan 2023 11:14:42 +0700
From:   Bagas Sanjaya <bagasdotme@...il.com>
To:     Danilo Krummrich <dakr@...hat.com>, daniel@...ll.ch,
        airlied@...hat.com, christian.koenig@....com, bskeggs@...hat.com,
        jason@...kstrand.net, tzimmermann@...e.de, mripard@...nel.org,
        corbet@....net
Cc:     dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH drm-next 03/14] drm: manager to keep track of GPUs VA
 mappings

On Wed, Jan 18, 2023 at 07:12:45AM +0100, Danilo Krummrich wrote:
> This adds the infrastructure for a manager implementation to keep track
> of GPU virtual address (VA) mappings.

"Add infrastructure for ..."

> + * Analogue to drm_gpuva_sm_map_ops_create() drm_gpuva_sm_unmap_ops_create()
> + * provides drivers a the list of operations to be executed in order to unmap
> + * a range of GPU VA space. The logic behind this functions is way simpler
> + * though: For all existent mappings enclosed by the given range unmap
> + * operations are created. For mappings which are only partically located within
> + * the given range, remap operations are created such that those mappings are
> + * split up and re-mapped partically.

"Analogous to ..."

> + *
> + * The following paragraph depicts the basic constellations of existent GPU VA
> + * mappings, a newly requested mapping and the resulting mappings as implemented
> + * by drm_gpuva_sm_map_ops_create()  - it doesn't cover arbitrary combinations
> + * of those constellations.
> + *
> + * ::
> + *
> + *	1) Existent mapping is kept.
> + *	----------------------------
> + *
> + *	     0     a     1
> + *	old: |-----------| (bo_offset=n)
> + *
> + *	     0     a     1
> + *	req: |-----------| (bo_offset=n)
> + *
> + *	     0     a     1
> + *	new: |-----------| (bo_offset=n)
> + *
> + *
> + *	2) Existent mapping is replaced.
> + *	--------------------------------
> + *
> + *	     0     a     1
> + *	old: |-----------| (bo_offset=n)
> + *
> + *	     0     a     1
> + *	req: |-----------| (bo_offset=m)
> + *
> + *	     0     a     1
> + *	new: |-----------| (bo_offset=m)
> + *
> + *
> + *	3) Existent mapping is replaced.
> + *	--------------------------------
> + *
> + *	     0     a     1
> + *	old: |-----------| (bo_offset=n)
> + *
> + *	     0     b     1
> + *	req: |-----------| (bo_offset=n)
> + *
> + *	     0     b     1
> + *	new: |-----------| (bo_offset=n)
> + *
> + *
> + *	4) Existent mapping is replaced.
> + *	--------------------------------
> + *
> + *	     0  a  1
> + *	old: |-----|       (bo_offset=n)
> + *
> + *	     0     a     2
> + *	req: |-----------| (bo_offset=n)
> + *
> + *	     0     a     2
> + *	new: |-----------| (bo_offset=n)
> + *
> + *	Note: We expect to see the same result for a request with a different bo
> + *	      and/or bo_offset.
> + *
> + *
> + *	5) Existent mapping is split.
> + *	-----------------------------
> + *
> + *	     0     a     2
> + *	old: |-----------| (bo_offset=n)
> + *
> + *	     0  b  1
> + *	req: |-----|       (bo_offset=n)
> + *
> + *	     0  b  1  a' 2
> + *	new: |-----|-----| (b.bo_offset=n, a.bo_offset=n+1)
> + *
> + *	Note: We expect to see the same result for a request with a different bo
> + *	      and/or non-contiguous bo_offset.
> + *
> + *
> + *	6) Existent mapping is kept.
> + *	----------------------------
> + *
> + *	     0     a     2
> + *	old: |-----------| (bo_offset=n)
> + *
> + *	     0  a  1
> + *	req: |-----|       (bo_offset=n)
> + *
> + *	     0     a     2
> + *	new: |-----------| (bo_offset=n)
> + *
> + *
> + *	7) Existent mapping is split.
> + *	-----------------------------
> + *
> + *	     0     a     2
> + *	old: |-----------| (bo_offset=n)
> + *
> + *	           1  b  2
> + *	req:       |-----| (bo_offset=m)
> + *
> + *	     0  a  1  b  2
> + *	new: |-----|-----| (a.bo_offset=n,b.bo_offset=m)
> + *
> + *
> + *	8) Existent mapping is kept.
> + *	----------------------------
> + *
> + *	      0     a     2
> + *	old: |-----------| (bo_offset=n)
> + *
> + *	           1  a  2
> + *	req:       |-----| (bo_offset=n+1)
> + *
> + *	     0     a     2
> + *	new: |-----------| (bo_offset=n)
> + *
> + *
> + *	9) Existent mapping is split.
> + *	-----------------------------
> + *
> + *	     0     a     2
> + *	old: |-----------|       (bo_offset=n)
> + *
> + *	           1     b     3
> + *	req:       |-----------| (bo_offset=m)
> + *
> + *	     0  a  1     b     3
> + *	new: |-----|-----------| (a.bo_offset=n,b.bo_offset=m)
> + *
> + *
> + *	10) Existent mapping is merged.
> + *	-------------------------------
> + *
> + *	     0     a     2
> + *	old: |-----------|       (bo_offset=n)
> + *
> + *	           1     a     3
> + *	req:       |-----------| (bo_offset=n+1)
> + *
> + *	     0        a        3
> + *	new: |-----------------| (bo_offset=n)
> + *
> + *
> + *	11) Existent mapping is split.
> + *	------------------------------
> + *
> + *	     0        a        3
> + *	old: |-----------------| (bo_offset=n)
> + *
> + *	           1  b  2
> + *	req:       |-----|       (bo_offset=m)
> + *
> + *	     0  a  1  b  2  a' 3
> + *	new: |-----|-----|-----| (a.bo_offset=n,b.bo_offset=m,a'.bo_offset=n+2)
> + *
> + *
> + *	12) Existent mapping is kept.
> + *	-----------------------------
> + *
> + *	     0        a        3
> + *	old: |-----------------| (bo_offset=n)
> + *
> + *	           1  a  2
> + *	req:       |-----|       (bo_offset=n+1)
> + *
> + *	     0        a        3
> + *	old: |-----------------| (bo_offset=n)
> + *
> + *
> + *	13) Existent mapping is replaced.
> + *	---------------------------------
> + *
> + *	           1  a  2
> + *	old:       |-----| (bo_offset=n)
> + *
> + *	     0     a     2
> + *	req: |-----------| (bo_offset=n)
> + *
> + *	     0     a     2
> + *	new: |-----------| (bo_offset=n)
> + *
> + *	Note: We expect to see the same result for a request with a different bo
> + *	      and/or non-contiguous bo_offset.
> + *
> + *
> + *	14) Existent mapping is replaced.
> + *	---------------------------------
> + *
> + *	           1  a  2
> + *	old:       |-----| (bo_offset=n)
> + *
> + *	     0        a       3
> + *	req: |----------------| (bo_offset=n)
> + *
> + *	     0        a       3
> + *	new: |----------------| (bo_offset=n)
> + *
> + *	Note: We expect to see the same result for a request with a different bo
> + *	      and/or non-contiguous bo_offset.
> + *
> + *
> + *	15) Existent mapping is split.
> + *	------------------------------
> + *
> + *	           1     a     3
> + *	old:       |-----------| (bo_offset=n)
> + *
> + *	     0     b     2
> + *	req: |-----------|       (bo_offset=m)
> + *
> + *	     0     b     2  a' 3
> + *	new: |-----------|-----| (b.bo_offset=m,a.bo_offset=n+2)
> + *
> + *
> + *	16) Existent mappings are merged.
> + *	---------------------------------
> + *
> + *	     0     a     1
> + *	old: |-----------|                        (bo_offset=n)
> + *
> + *	                            2     a     3
> + *	old':                       |-----------| (bo_offset=n+2)
> + *
> + *	                1     a     2
> + *	req:            |-----------|             (bo_offset=n+1)
> + *
> + *	                      a
> + *	new: |----------------------------------| (bo_offset=n)
> + */

Factor out lists from the big code block above:

---- >8 ----

diff --git a/drivers/gpu/drm/drm_gpuva_mgr.c b/drivers/gpu/drm/drm_gpuva_mgr.c
index e665f642689d03..411c0aa80bfa1f 100644
--- a/drivers/gpu/drm/drm_gpuva_mgr.c
+++ b/drivers/gpu/drm/drm_gpuva_mgr.c
@@ -129,15 +129,14 @@
  * the given range, remap operations are created such that those mappings are
  * split up and re-mapped partically.
  *
- * The following paragraph depicts the basic constellations of existent GPU VA
+ * The following diagram depicts the basic relationships of existent GPU VA
  * mappings, a newly requested mapping and the resulting mappings as implemented
- * by drm_gpuva_sm_map_ops_create()  - it doesn't cover arbitrary combinations
- * of those constellations.
+ * by drm_gpuva_sm_map_ops_create()  - it doesn't cover any arbitrary
+ * combinations of these.
  *
- * ::
- *
- *	1) Existent mapping is kept.
- *	----------------------------
+ * 1) Existent mapping is kept.
+ * 
+ *    ::
  *
  *	     0     a     1
  *	old: |-----------| (bo_offset=n)
@@ -149,8 +148,9 @@
  *	new: |-----------| (bo_offset=n)
  *
  *
- *	2) Existent mapping is replaced.
- *	--------------------------------
+ * 2) Existent mapping is replaced.
+ *
+ *    ::
  *
  *	     0     a     1
  *	old: |-----------| (bo_offset=n)
@@ -162,8 +162,9 @@
  *	new: |-----------| (bo_offset=m)
  *
  *
- *	3) Existent mapping is replaced.
- *	--------------------------------
+ * 3) Existent mapping is replaced.
+ *
+ *    ::
  *
  *	     0     a     1
  *	old: |-----------| (bo_offset=n)
@@ -175,8 +176,9 @@
  *	new: |-----------| (bo_offset=n)
  *
  *
- *	4) Existent mapping is replaced.
- *	--------------------------------
+ * 4) Existent mapping is replaced.
+ *
+ *    ::
  *
  *	     0  a  1
  *	old: |-----|       (bo_offset=n)
@@ -187,12 +189,14 @@
  *	     0     a     2
  *	new: |-----------| (bo_offset=n)
  *
- *	Note: We expect to see the same result for a request with a different bo
- *	      and/or bo_offset.
+ *    .. note::
+ *       We expect to see the same result for a request with a different bo
+ *       and/or bo_offset.
  *
  *
- *	5) Existent mapping is split.
- *	-----------------------------
+ * 5) Existent mapping is split.
+ *
+ *    ::
  *
  *	     0     a     2
  *	old: |-----------| (bo_offset=n)
@@ -203,12 +207,14 @@
  *	     0  b  1  a' 2
  *	new: |-----|-----| (b.bo_offset=n, a.bo_offset=n+1)
  *
- *	Note: We expect to see the same result for a request with a different bo
- *	      and/or non-contiguous bo_offset.
+ *    .. note::
+ *       We expect to see the same result for a request with a different bo
+ *       and/or non-contiguous bo_offset.
  *
  *
- *	6) Existent mapping is kept.
- *	----------------------------
+ * 6) Existent mapping is kept.
+ *
+ *    ::
  *
  *	     0     a     2
  *	old: |-----------| (bo_offset=n)
@@ -220,8 +226,9 @@
  *	new: |-----------| (bo_offset=n)
  *
  *
- *	7) Existent mapping is split.
- *	-----------------------------
+ * 7) Existent mapping is split.
+ *
+ *    ::
  *
  *	     0     a     2
  *	old: |-----------| (bo_offset=n)
@@ -233,8 +240,9 @@
  *	new: |-----|-----| (a.bo_offset=n,b.bo_offset=m)
  *
  *
- *	8) Existent mapping is kept.
- *	----------------------------
+ * 8) Existent mapping is kept.
+ *
+ *    ::
  *
  *	      0     a     2
  *	old: |-----------| (bo_offset=n)
@@ -246,8 +254,9 @@
  *	new: |-----------| (bo_offset=n)
  *
  *
- *	9) Existent mapping is split.
- *	-----------------------------
+ * 9) Existent mapping is split.
+ *
+ *    ::
  *
  *	     0     a     2
  *	old: |-----------|       (bo_offset=n)
@@ -259,104 +268,113 @@
  *	new: |-----|-----------| (a.bo_offset=n,b.bo_offset=m)
  *
  *
- *	10) Existent mapping is merged.
- *	-------------------------------
+ * 10) Existent mapping is merged.
  *
- *	     0     a     2
- *	old: |-----------|       (bo_offset=n)
+ *     ::
  *
- *	           1     a     3
- *	req:       |-----------| (bo_offset=n+1)
+ *	      0     a     2
+ *	 old: |-----------|       (bo_offset=n)
  *
- *	     0        a        3
- *	new: |-----------------| (bo_offset=n)
+ *	            1     a     3
+ *	 req:       |-----------| (bo_offset=n+1)
+ *
+ *	      0        a        3
+ *	 new: |-----------------| (bo_offset=n)
  *
  *
- *	11) Existent mapping is split.
- *	------------------------------
+ * 11) Existent mapping is split.
  *
- *	     0        a        3
- *	old: |-----------------| (bo_offset=n)
+ *     ::
  *
- *	           1  b  2
- *	req:       |-----|       (bo_offset=m)
+ *	      0        a        3
+ *	 old: |-----------------| (bo_offset=n)
  *
- *	     0  a  1  b  2  a' 3
- *	new: |-----|-----|-----| (a.bo_offset=n,b.bo_offset=m,a'.bo_offset=n+2)
+ *	            1  b  2
+ *	 req:       |-----|       (bo_offset=m)
+ *
+ *	      0  a  1  b  2  a' 3
+ *	 new: |-----|-----|-----| (a.bo_offset=n,b.bo_offset=m,a'.bo_offset=n+2)
  *
  *
- *	12) Existent mapping is kept.
- *	-----------------------------
+ * 12) Existent mapping is kept.
  *
- *	     0        a        3
- *	old: |-----------------| (bo_offset=n)
+ *     ::
  *
- *	           1  a  2
- *	req:       |-----|       (bo_offset=n+1)
+ *	      0        a        3
+ *	 old: |-----------------| (bo_offset=n)
  *
- *	     0        a        3
- *	old: |-----------------| (bo_offset=n)
+ *	            1  a  2
+ *	 req:       |-----|       (bo_offset=n+1)
+ *
+ *	      0        a        3
+ *	 old: |-----------------| (bo_offset=n)
  *
  *
- *	13) Existent mapping is replaced.
- *	---------------------------------
+ * 13) Existent mapping is replaced.
  *
- *	           1  a  2
- *	old:       |-----| (bo_offset=n)
+ *     ::
  *
- *	     0     a     2
- *	req: |-----------| (bo_offset=n)
+ *	            1  a  2
+ *	 old:       |-----| (bo_offset=n)
  *
- *	     0     a     2
- *	new: |-----------| (bo_offset=n)
+ *	      0     a     2
+ *	 req: |-----------| (bo_offset=n)
  *
- *	Note: We expect to see the same result for a request with a different bo
- *	      and/or non-contiguous bo_offset.
+ *	      0     a     2
+ *	 new: |-----------| (bo_offset=n)
+ *
+ *     .. note::
+ *        We expect to see the same result for a request with a different bo
+ *        and/or non-contiguous bo_offset.
  *
  *
- *	14) Existent mapping is replaced.
- *	---------------------------------
+ * 14) Existent mapping is replaced.
  *
- *	           1  a  2
- *	old:       |-----| (bo_offset=n)
+ *     ::
  *
- *	     0        a       3
- *	req: |----------------| (bo_offset=n)
+ *	            1  a  2
+ *	 old:       |-----| (bo_offset=n)
  *
- *	     0        a       3
- *	new: |----------------| (bo_offset=n)
+ *	      0        a       3
+ *	 req: |----------------| (bo_offset=n)
  *
- *	Note: We expect to see the same result for a request with a different bo
- *	      and/or non-contiguous bo_offset.
+ *	      0        a       3
+ *	 new: |----------------| (bo_offset=n)
+ *
+ *     .. note::
+ *        We expect to see the same result for a request with a different bo
+ *        and/or non-contiguous bo_offset.
  *
  *
- *	15) Existent mapping is split.
- *	------------------------------
+ * 15) Existent mapping is split.
  *
- *	           1     a     3
- *	old:       |-----------| (bo_offset=n)
+ *     ::
  *
- *	     0     b     2
- *	req: |-----------|       (bo_offset=m)
+ *	            1     a     3
+ *	 old:       |-----------| (bo_offset=n)
  *
- *	     0     b     2  a' 3
- *	new: |-----------|-----| (b.bo_offset=m,a.bo_offset=n+2)
+ *	      0     b     2
+ *	 req: |-----------|       (bo_offset=m)
+ *
+ *	      0     b     2  a' 3
+ *	 new: |-----------|-----| (b.bo_offset=m,a.bo_offset=n+2)
  *
  *
- *	16) Existent mappings are merged.
- *	---------------------------------
+ * 16) Existent mappings are merged.
  *
- *	     0     a     1
- *	old: |-----------|                        (bo_offset=n)
+ *     ::
  *
- *	                            2     a     3
- *	old':                       |-----------| (bo_offset=n+2)
+ *	      0     a     1
+ *	 old: |-----------|                        (bo_offset=n)
  *
- *	                1     a     2
- *	req:            |-----------|             (bo_offset=n+1)
+ *	                             2     a     3
+ *	 old':                       |-----------| (bo_offset=n+2)
  *
- *	                      a
- *	new: |----------------------------------| (bo_offset=n)
+ *	                 1     a     2
+ *	 req:            |-----------|             (bo_offset=n+1)
+ *
+ *	                       a
+ *	 new: |----------------------------------| (bo_offset=n)
  */
 
 /**

However, the relationship scenario descriptions are too generic (different
diagrams are described by the same text). Please rewrite them, taking into
account bo_offset values in each scenario.

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ