[RFC 5/5] drm/amdgpu: Only show VRAM in fdinfo if it exists

Alex Deucher alexdeucher at gmail.com
Fri May 3 14:43:45 UTC 2024


On Fri, May 3, 2024 at 10:01 AM Tvrtko Ursulin
<tvrtko.ursulin at igalia.com> wrote:
>
>
> On 03/05/2024 14:47, Alex Deucher wrote:
> > On Fri, May 3, 2024 at 3:50 AM Tvrtko Ursulin <tvrtko.ursulin at igalia.com> wrote:
> >>
> >>
> >> On 02/05/2024 14:16, Christian König wrote:
> >>> Am 30.04.24 um 19:27 schrieb Tvrtko Ursulin:
> >>>> From: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> >>>>
> >>>> Do not emit the key-value pairs if the VRAM does not exist ie. VRAM
> >>>> placement is not valid and accessible.
> >>>
> >>> Yeah, that's unfortunately rather misleading.
> >>>
> >>> Even APUs have VRAM or rather stolen system memory which is managed by
> >>> the graphics driver.
> >>>
> >>> We only have a single compute model which really doesn't have VRAM at all.
> >>
> >> Hm what is misleading and how more precisely? :) Maybe in other words,
> >> if is_app_apu is not the right criteria to know when TTM_PL_VRAM is
> >> impossible, what is? Is the compute model you mentio the only thing
> >> which sets is_app_apu and uses the dummy vram manager?
> >
> > Probably better to check if adev->gmc.real_vram_size is non-0.
>
> Hmm "real VRAM" - will that handle APUs correctly?

Yes.  In the client APU case "VRAM" will be the UMA carve out region
reserved by the sbios.

>
> I am looking at this:
>
>         if (!adev->gmc.is_app_apu) {
>                 man->func = &amdgpu_vram_mgr_func;
>
>                 err = drm_buddy_init(&mgr->mm, man->size, PAGE_SIZE);
>                 if (err)
>                         return err;
>         } else {
>                 man->func = &amdgpu_dummy_vram_mgr_func;
>                 DRM_INFO("Setup dummy vram mgr\n");
>         }
>
> And assuming that unless the dummy manager is used, TTM_PL_VRAM will be
> valid. Wrong assumption?

Today checking is_app_apu would be fine, but It's supposed to
distinguish datacenter APUs, not whether or not the device has a
"VRAM" pool or not, but its usage has gotten sort of overloaded.  Just
want to avoid overloading what it means in too many more places.

Alex

>
> Regards,
>
> Tvrtko
>
>
> > Alex
> >
> >>
> >> Regards,
> >>
> >> Tvrtko
> >>
> >>> Regards,
> >>> Christian.
> >>>
> >>>>
> >>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> >>>> ---
> >>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 29 +++++++++++++---------
> >>>>    1 file changed, 17 insertions(+), 12 deletions(-)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> >>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> >>>> index a09944104c41..603a5c010f5d 100644
> >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c
> >>>> @@ -83,25 +83,30 @@ void amdgpu_show_fdinfo(struct drm_printer *p,
> >>>> struct drm_file *file)
> >>>>         */
> >>>>        drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
> >>>> -    drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
> >>>>        drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
> >>>>        drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
> >>>> -    drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
> >>>> -           stats.visible_vram/1024UL);
> >>>> -    drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
> >>>> -           stats.evicted_vram/1024UL);
> >>>> -    drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
> >>>> -           stats.evicted_visible_vram/1024UL);
> >>>> -    drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
> >>>> -           stats.requested_vram/1024UL);
> >>>> -    drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
> >>>> -           stats.requested_visible_vram/1024UL);
> >>>>        drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
> >>>>               stats.requested_gtt/1024UL);
> >>>> -    drm_printf(p, "drm-shared-vram:\t%llu KiB\n",
> >>>> stats.vram_shared/1024UL);
> >>>>        drm_printf(p, "drm-shared-gtt:\t%llu KiB\n",
> >>>> stats.gtt_shared/1024UL);
> >>>>        drm_printf(p, "drm-shared-cpu:\t%llu KiB\n",
> >>>> stats.cpu_shared/1024UL);
> >>>> +    if (!adev->gmc.is_app_apu) {
> >>>> +        drm_printf(p, "drm-memory-vram:\t%llu KiB\n",
> >>>> +               stats.vram/1024UL);
> >>>> +        drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
> >>>> +               stats.visible_vram/1024UL);
> >>>> +        drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
> >>>> +               stats.evicted_vram/1024UL);
> >>>> +        drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
> >>>> +               stats.evicted_visible_vram/1024UL);
> >>>> +        drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
> >>>> +               stats.requested_vram/1024UL);
> >>>> +        drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
> >>>> +               stats.requested_visible_vram/1024UL);
> >>>> +        drm_printf(p, "drm-shared-vram:\t%llu KiB\n",
> >>>> +               stats.vram_shared/1024UL);
> >>>> +    }
> >>>> +
> >>>>        for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) {
> >>>>            if (!usage[hw_ip])
> >>>>                continue;
> >>>


More information about the amd-gfx mailing list