From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: "Matthew Brost" <matthew.brost@intel.com>,
arunpravin.paneerselvam@amd.com,
"Thomas Hellström (Intel)" <thomas_os@shipmail.org>,
francois.dugast@intel.com, amd-gfx@lists.freedesktop.org,
luben.tuikov@amd.com, dakr@redhat.com,
dri-devel@lists.freedesktop.org, felix.kuehling@amd.com
Subject: Re: [PATCH 01/13] drm: execution context for GEM buffers v4
Date: Mon, 19 Jun 2023 12:23:11 +0200 [thread overview]
Message-ID: <20230619122311.0b26c31b@collabora.com> (raw)
In-Reply-To: <94f9393a-17fe-321d-c4e1-e12663dc3106@amd.com>
On Mon, 19 Jun 2023 11:20:06 +0200
Christian König <christian.koenig@amd.com> wrote:
> Hi guys,
>
> Am 19.06.23 um 10:59 schrieb Thomas Hellström (Intel):
> > [SNIP]
> >>>>
> >>>> I really need to find some time to work on that anyway.
> >> I've been playing with drm_exec for a couple weeks now, and I wanted
> >> to share something I hacked to try and make the API simpler and
> >> more robust against misuse (see the below diff, which is a slightly
> >> adjusted version of your work).
> >
> > It would be good if we could have someone taking charge of this series
> > and address all review comments, I see some of my comments getting
> > lost, we have multiple submitters and I can't find a dri-devel
> > patchwork entry for this. Anyway some comments below.
>
> I can try to find some time for the series this week (As long as nobody
> comes along and has any burning roof).
That's great news!
>
> >
> >>
> >> In this version, the user is no longer in control of the retry
> >> loop. Instead, it provides an expression (a call to a
> >> sub-function) to be re-evaluated each time a contention is
> >> detected. IMHO, this makes the 'prepare-objs' functions easier to
> >> apprehend, and avoids any mistake like calling
> >> drm_exec_continue_on_contention() in an inner loop, or breaking
> >> out of the drm_exec_while_all_locked() loop unintentionally.
> >
> > In i915 we've had a very similar helper to this, and while I agree
> > this newer version would probably help make code cleaner, but OTOH
> > there also are some places where the short drm_exec_while_all_locked()
> > -likeblock don't really motivate a separate function. Porting i915 to
> > the current version will take some work, For the xe driver both
> > versions would work fine.
>
> Yeah, this is actually what my first version of this looked like. But I
> abandoned that approach because we have a lot of cases were we just
> quickly want to lock a few GEM objects and don't want the extra overhead
> of putting all the state into some bag to forward it to a function.
If you're talking about verbosity, it might be the case, though I guess
it mostly a matter of taste (I do like when things are well isolated).
As for runtime overhead, I'd expect the compiler to inline the function
anyway, so it's unlikely to change anything.
> >> +/* Track the locked object in the array */
> >> +static int drm_exec_obj_locked(struct drm_exec *exec,
> >> + struct drm_gem_object *obj)
> >> +{
> >> + if (unlikely(exec->num_objects == exec->max_objects)) {
> >> + size_t size = exec->max_objects * sizeof(void *);
> >> + void *tmp;
> >> +
> >> + tmp = kvrealloc(exec->objects, size, size + PAGE_SIZE,
> >> + GFP_KERNEL);
> >> + if (!tmp)
> >> + return -ENOMEM;
> >
> > Sometimes you need to just temporarily lock an object and then unlock
> > it again if it goes out of scope before reaching the end of
> > _until_all_locked(). In that case you might need to remove a lock from
> > the array. I *think* for all use-cases in i915 it would suffice to
> > take a snapshot of num_objects, and unlock everything above that,
> > having exec->objects behave like a stack, but was ever a list
> > considered instead of a realloced array?
>
> Yes, the problem is that linked lists really suck regarding their cache
> line locality. That's why I've came up with this approach here.
Hm, maybe I'm missing something, but if you place the list_head obj you
use to stack the locked objects close enough to the resv pointer, and
aligned on cache line, it shouldn't really be a problem, given you have
to dereference the GEM object to retrieve its resv anyway.
next prev parent reply other threads:[~2023-06-19 10:23 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-04 11:51 Common DRM execution context v4 Christian König
2023-05-04 11:51 ` [PATCH 01/13] drm: execution context for GEM buffers v4 Christian König
2023-05-04 14:02 ` Thomas Hellström (Intel)
2023-05-25 20:42 ` Danilo Krummrich
2023-06-14 12:23 ` Boris Brezillon
2023-06-14 12:30 ` Christian König
2023-06-14 13:02 ` Boris Brezillon
2023-06-17 11:54 ` Boris Brezillon
2023-06-19 8:59 ` Thomas Hellström (Intel)
2023-06-19 9:20 ` Christian König
2023-06-19 9:33 ` Thomas Hellström (Intel)
2023-06-19 9:48 ` Christian König
2023-06-19 11:06 ` Thomas Hellström (Intel)
2023-06-21 13:35 ` Christian König
2023-06-19 10:23 ` Boris Brezillon [this message]
2023-06-19 10:12 ` Boris Brezillon
2023-06-19 10:44 ` Christian König
2023-06-19 11:05 ` Boris Brezillon
2023-06-19 12:01 ` Boris Brezillon
2023-06-19 12:29 ` Boris Brezillon
2023-06-20 6:47 ` Boris Brezillon
2023-06-20 7:28 ` Christian König
2023-05-04 11:51 ` [PATCH 02/13] drm: add drm_exec selftests v2 Christian König
2023-05-04 12:07 ` Maíra Canal
2023-05-04 12:52 ` Christian König
2023-05-04 11:51 ` [PATCH 03/13] drm/amdkfd: switch over to using drm_exec v2 Christian König
2023-05-04 11:51 ` [PATCH 04/13] drm/amdgpu: use drm_exec for GEM and CSA handling Christian König
2023-05-04 11:51 ` [PATCH 05/13] drm/amdgpu: use drm_exec for MES testing Christian König
2023-05-04 11:51 ` [PATCH 06/13] drm/amdgpu: use the new drm_exec object for CS v2 Christian König
2023-06-12 13:16 ` Tatsuyuki Ishi
2023-06-20 4:07 ` Tatsuyuki Ishi
2023-06-20 4:14 ` Tatsuyuki Ishi
2023-06-20 8:13 ` Christian König
2023-06-20 8:12 ` Christian König
2023-06-20 8:16 ` Tatsuyuki Ishi
2023-06-20 9:04 ` Tatsuyuki Ishi
2023-06-20 8:28 ` Boris Brezillon
2023-06-20 8:44 ` Christian König
2023-06-20 9:09 ` Boris Brezillon
2023-06-20 9:14 ` Christian König
2023-06-20 9:20 ` Boris Brezillon
2023-05-04 11:51 ` [PATCH 07/13] drm/radeon: switch over to drm_exec Christian König
2023-05-04 11:51 ` [PATCH 08/13] drm/qxl: switch to using drm_exec Christian König
2023-06-20 9:13 ` Thomas Zimmermann
2023-06-20 9:15 ` Christian König
2023-05-04 11:51 ` [PATCH 09/13] drm/lima: " Christian König
2023-05-04 11:51 ` [PATCH 10/13] drm/virtgpu: " Christian König
2023-05-04 11:51 ` [PATCH 11/13] drm/panfrost: " Christian König
2023-05-04 11:51 ` [PATCH 12/13] drm/v3d: " Christian König
2023-05-04 11:51 ` [PATCH 13/13] drm: remove drm_gem_(un)lock_reservations 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=20230619122311.0b26c31b@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=arunpravin.paneerselvam@amd.com \
--cc=christian.koenig@amd.com \
--cc=dakr@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=francois.dugast@intel.com \
--cc=luben.tuikov@amd.com \
--cc=matthew.brost@intel.com \
--cc=thomas_os@shipmail.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.