dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Zack Rusin <zackr@vmware.com>, dri-devel@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v2 6/6] drm/ttm: Clarify that the TTM_PL_SYSTEM buffers need to stay idle
Date: Mon, 8 Nov 2021 12:07:12 +0100	[thread overview]
Message-ID: <3687c5f0-edb9-3cdb-2bb7-e45549a1cfb8@amd.com> (raw)
In-Reply-To: <20211105193845.258816-7-zackr@vmware.com>

Am 05.11.21 um 20:38 schrieb Zack Rusin:
> TTM was designed to allow TTM_PL_SYSTEM buffer to be fenced but over
> the years the code that was meant to handle it was broken and new
> changes can not deal with buffers which have been placed in TTM_PL_SYSTEM
> buf do not remain idle.
> CPU buffers which need to be fenced and shared with accelerators should
> be placed in driver specific placements that can explicitly handle
> CPU/accelerator buffer fencing.
> Currently, apart, from things silently failing nothing is enforcing
> that requirement which means that it's easy for drivers and new
> developers to get this wrong. To avoid the confusion we can document
> this requirement and clarify the solution.
>
> This came up during a discussion on dri-devel:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fdri-devel%2F232f45e9-8748-1243-09bf-56763e6668b3%40amd.com&amp;data=04%7C01%7Cchristian.koenig%40amd.com%7C4f4ed0ab73894a482abd08d9a0942b98%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637717380521122147%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=1lGhEIESDwizXnC7APtlhGws8miB4xeh%2FsTewsEPfBY%3D&amp;reserved=0
>
> Signed-off-by: Zack Rusin <zackr@vmware.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
>   include/drm/ttm/ttm_placement.h | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
> index 76d1b9119a2b..89dfb58ff199 100644
> --- a/include/drm/ttm/ttm_placement.h
> +++ b/include/drm/ttm/ttm_placement.h
> @@ -35,6 +35,16 @@
>   
>   /*
>    * Memory regions for data placement.
> + *
> + * Due to the fact that TTM_PL_SYSTEM BO's can be accessed by the hardware
> + * and are not directly evictable they're handled slightly differently
> + * from other placements. The most important and driver visible side-effect
> + * of that is that TTM_PL_SYSTEM BO's are not allowed to be fenced and have
> + * to remain idle. For BO's which reside in system memory but for which
> + * the accelerator requires direct access (i.e. their usage needs to be
> + * synchronized between the CPU and accelerator via fences) a new, driver
> + * private placement should be introduced that can handle such scenarios.
> + *

That we don't have fences on them is just the tip on the iceberg and 
mostly nice to have.

The major problem is that TTM_PL_SYSTEM are considered under TTMs 
control and swapped out whenever TTMs thinks it is a good idea.

That needs to be handled manually in the driver if a TTM_PL_SYSTEM is 
ever considered a valid placement.

Christian.

>    */
>   
>   #define TTM_PL_SYSTEM           0


  reply	other threads:[~2021-11-08 11:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 19:38 [PATCH v2 0/6] Support module unload and hotunplug Zack Rusin
2021-11-05 19:38 ` [PATCH v2 1/6] drm/vmwgfx: Remove the deprecated lower mem limit Zack Rusin
2021-11-05 19:38 ` [PATCH v2 2/6] drm/vmwgfx: Release ttm memory if probe fails Zack Rusin
2021-11-05 19:38 ` [PATCH v2 3/6] drm/vmwgfx: Fail to initialize on broken configs Zack Rusin
2021-11-05 19:38 ` [PATCH v2 4/6] drm/vmwgfx: Introduce a new placement for MOB page tables Zack Rusin
2021-11-05 19:38 ` [PATCH v2 5/6] drm/vmwgfx: Switch the internal BO's to ttm_bo_type_kernel Zack Rusin
2021-11-05 19:38 ` [PATCH v2 6/6] drm/ttm: Clarify that the TTM_PL_SYSTEM buffers need to stay idle Zack Rusin
2021-11-08 11:07   ` Christian König [this message]
2021-11-08 15:42     ` [PATCH v3] " Zack Rusin
2021-11-10 14:50     ` [PATCH v4] drm/ttm: Clarify that the TTM_PL_SYSTEM is under TTMs control Zack Rusin
2021-11-11 16:44       ` Zack Rusin
2021-11-13 11:26         ` Thomas Hellström
2021-11-16  7:19           ` Christian König
2021-11-16  7:43             ` Thomas Hellström
2021-11-16  8:20               ` Christian König
2021-11-16  8:33                 ` Thomas Hellström
2021-11-16  8:54                   ` Christian König
2021-11-16  9:00                     ` Thomas Hellström
2021-11-16  9:09                       ` Christian König
2021-11-16 15:49                         ` Daniel Vetter
2021-11-16 15:53                 ` Zack Rusin
2021-11-22 14:15                   ` Christian König
2021-11-22 15:05                     ` Zack Rusin
2021-11-24  8:22       ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3687c5f0-edb9-3cdb-2bb7-e45549a1cfb8@amd.com \
    --to=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=zackr@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox