[PATCH 13/34] drm/amdgpu: Convert ctx_handles to XArray
Koenig, Christian
Christian.Koenig at amd.com
Mon Feb 25 16:59:55 UTC 2019
Am 25.02.19 um 17:39 schrieb Matthew Wilcox:
> On Mon, Feb 25, 2019 at 05:07:24PM +0100, Christian König wrote:
>>> -#define AMDGPU_VM_MAX_NUM_CTX 4096
>>> +#define AMDGPU_VM_CTX_LIMIT XA_LIMIT(0, 4095)
>> IIRC we actually use 0 as reserved context value in some places.
> That's OK; the ALLOC1 prevents it from using index 0.
>
> You can change it to be XA_LIMIT(1, 4095) if you think that'll be clearer;
> it'll be slightly less efficient assembly (a 64-bit mov-immediate instead
> of a 32-bit mov-immediate), but it's your driver, so it's up to you.
A code comment should do as well.
But thinking more about it please DON'T actually change the
AMDGPU_VM_MAX_NUM_CTX define.
That one needs to be used to calculate the reserved GPU space to map the
context save area, and I really don't want to deal with a XA_LIMIT in
that calculation :)
I'm really wondering why that doesn't go up in a boom during compilation....
Christian.
>
>>> @@ -533,22 +533,18 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
>>> void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
>>> {
>>> mutex_init(&mgr->lock);
>>> - idr_init(&mgr->ctx_handles);
>>> + xa_init_flags(&mgr->ctx_handles, XA_FLAGS_ALLOC1);
>>> }
>>> void amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr)
>>> {
More information about the dri-devel
mailing list