[PATCH 06/13] drm/amdgpu: use the new drm_exec object for CS v2

Christian König ckoenig.leichtzumerken at gmail.com
Tue Jun 20 08:44:26 UTC 2023


Am 20.06.23 um 10:28 schrieb Boris Brezillon:
> On Tue, 20 Jun 2023 10:12:13 +0200
> Christian König <ckoenig.leichtzumerken at gmail.com> wrote:
>
>>> I think Boris's suggestion of having this through a common
>>> DRM_EXEC_FLAG_ALLOW_DUPLICATES flag fits well.
>> No, again. The only driver which should accept duplicates is radeon, for
>> all other drivers especially new ones duplicates should probably be
>> rejected.
>>
>> We only allow this for radeon because it is already UAPI, could be that
>> we need to do this for amdgpu as well but I really hope we don't need this.
> Just want to describe the use case we have: we support submission in
> batch (several jobs passed to the submit ioctl) with a
> submit-all-or-nothing model: if any of the job description is passed
> wrong args or causes an allocation error, we fail the whole group. In
> the submission path, we want to prepare GEMs for all jobs. That means
> adding enough fence slots for the number job finished fences. Given not
> all jobs will access the same set of BOs, I thought I could use
> duplicates support to make my life easier, because otherwise I have to
> collect all BOs upfront, store them in a temporary array, and keep
> track of the number of fence slots needed for each of them. I guess
> the other option would be to over-estimate the number of slots and make
> it equal to num_jobs for all BOs.

Sounds pretty much what amdgpu is doing as well, but question is why 
don't you give just one list of BOs? Do you really want to add the 
fences that fine grained?

For radeon it turned out that we just had stupid userspace which 
sometimes mentioned a BO in the list twice.

On the other hand over estimating the number of fences needed is 
perfectly fine as well, that is rounded up to the next kvmalloc size or 
even next page size anyway.

So IIRC and you have <510 fences you either get 14, 30, 62, 126, 254 and 
above 510 you should get it rounded to the next 512.

Regards,
Christian.


More information about the dri-devel mailing list