[PATCH 2/4] drm/amdgpu: Optimization of critical section

Dave Airlie airlied at gmail.com
Tue Jun 13 23:08:27 UTC 2017


On 13 June 2017 at 16:54, axie <axie at amd.com> wrote:
>
> On 2017-06-12 06:47 PM, Christian König wrote:
>>
>> Am 12.06.2017 um 22:31 schrieb Alex Xie:
>>>
>>> Make the critical section smaller. There is no
>>> need to protect the bo_list, because there is
>>> no other task can access the newly created BO
>>> list yet.
>>
>>
>> NAK, a task can guess the next id number so could get the kernel to use
>> the structure before it is initialized.
>>
>> Christian.
>>
> How did you find such an extreme corner case? I am fine with this comment.
> Tuesday/Wednesday I will address it with next version of patch set.
>
> Currently, there are 2 options:
> Option 1: I may use a write_lock in the create function. And restore the
> original code for the creation of BO list.
> Option 2: I may move the function call of idr_alloc to the end of the
> creation of BO list ioctl. This is more efficient but
> the code look dirty.

You can idr_alloc and idr_replace later btw. We do this in a few
places in the drm.

Dave.


More information about the amd-gfx mailing list