amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Alex Deucher" <alexdeucher@gmail.com>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: amd-gfx list <amd-gfx@lists.freedesktop.org>,
	Arunpravin <arunpravin.paneerselvam@amd.com>
Subject: Re: [PATCH 1/2] drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new
Date: Tue, 10 May 2022 17:08:39 +0200	[thread overview]
Message-ID: <3ccd38e7-2877-2b75-940b-0c41102084dd@amd.com> (raw)
In-Reply-To: <CADnq5_OkTfJO0KWRpfeoTZpXxU5Doi4Uw0xaHGVLxRVgdCKT2g@mail.gmail.com>

Am 10.05.22 um 16:42 schrieb Alex Deucher:
> On Tue, May 10, 2022 at 7:36 AM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
>> We still need to calculate a virtual start address for the resource to
>> aid checking of it is visible or not.
> Does this fix a known issue or is it just something you noticed?

Just something I've noticed. Judging from the bug reports we get large 
BAR systems are so common by now that only a few people are left where 
that actually matters.

Christian.

>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 22 +++++++++++++-------
>>   1 file changed, 14 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> index 49e4092f447f..51d9d3a4456c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
>> @@ -496,16 +496,22 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
>>                          list_splice_tail(trim_list, &vres->blocks);
>>          }
>>
>> -       list_for_each_entry(block, &vres->blocks, link)
>> -               vis_usage += amdgpu_vram_mgr_vis_size(adev, block);
>> +       vres->base.start = 0;
>> +       list_for_each_entry(block, &vres->blocks, link) {
>> +               unsigned long start;
>>
>> -       block = amdgpu_vram_mgr_first_block(&vres->blocks);
>> -       if (!block) {
>> -               r = -EINVAL;
>> -               goto error_fini;
>> -       }
>> +               start = amdgpu_vram_mgr_block_start(block) +
>> +                       amdgpu_vram_mgr_block_size(block);
>> +               start >>= PAGE_SHIFT;
>>
>> -       vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT;
>> +               if (start > vres->base.num_pages)
>> +                       start -= vres->base.num_pages;
>> +               else
>> +                       start = 0;
>> +               vres->base.start = max(vres->base.start, start);
>> +
>> +               vis_usage += amdgpu_vram_mgr_vis_size(adev, block);
>> +       }
>>
>>          if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks))
>>                  vres->base.placement |= TTM_PL_FLAG_CONTIGUOUS;
>> --
>> 2.25.1
>>


  reply	other threads:[~2022-05-10 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 11:36 [PATCH 1/2] drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new Christian König
2022-05-10 11:36 ` [PATCH 2/2] drm/amdgpu: move internal vram_mgr function into the C file Christian König
2022-05-10 14:39   ` Alex Deucher
2022-05-10 15:35   ` Arunpravin Paneer Selvam
2022-05-10 14:42 ` [PATCH 1/2] drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new Alex Deucher
2022-05-10 15:08   ` Christian König [this message]
2022-05-10 15:12     ` Alex Deucher
2022-05-10 15:20 ` Arunpravin Paneer Selvam
2022-05-10 15:26   ` Christian König
2022-05-10 15:40     ` Arunpravin Paneer Selvam

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=3ccd38e7-2877-2b75-940b-0c41102084dd@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).