All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
	"Felix Kuehling" <felix.kuehling-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	David1.Zhou-5C7GfCeVMHo@public.gmane.org
Cc: Alexander.Deucher-5C7GfCeVMHo@public.gmane.org,
	Kent.Russell-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH 2/3] drm/amdgpu: Fix Vega10 VM initialization
Date: Wed, 29 Mar 2017 15:09:20 +0800	[thread overview]
Message-ID: <58DB5DA0.9060607@amd.com> (raw)
In-Reply-To: <b0d2a78d-ab7d-f5b7-a35e-a9d6c80771a7-5C7GfCeVMHo@public.gmane.org>

On 03/29/2017 02:47 PM, Christian König wrote:
> Am 29.03.2017 um 03:48 schrieb Felix Kuehling:
>> On 17-03-28 09:39 PM, Zhang, Jerry (Junwei) wrote:
>>> On 03/29/2017 09:00 AM, Felix Kuehling wrote:
>>>> adev->family is not initialized yet when amdgpu_get_block_size is
>>>> called. Use adev->asic_type instead.
>>>>
>>>> Minimum VM size is 512GB, not 256GB, for a single page table entry
>>>> in the root page table.
>>>>
>>>> gmc_v9_0_vm_init is called after adev->vm_manager.max_pfn is
>>>> initialized. Move the minimum VM-size enforcement ahead of max_pfn
>>>> initializtion. Cast to 64-bit before the left-shift.
>>>>
>>>> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
>>> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
>>>
>>> Just note:
>>> For now, it's OK to set the minimum vm size 256G,
>>> In this case, there is no PD bit anyway.
>> With VM size of 256GB, the amdgpu_vm_bo_size(adev, 0) calculates 0, and
>> the page directory allocation with amdgpu_bo_create fails in amdgpu_vm_init.
>>
>> In other words, amdgpu_vm_num_entries(adev, 0) needs to return at least
>> 1. That means vm_size needs to be at least 512GB.
>
> Those fixes are correct, but doesn't address the real problem.
>
> The intention of amdgpu_vm_size and amgpu_vm_block_size is to save memory by
> reducing the size of the PD/PTs.
>
> Since we now use 4 level PDs/PTs the size of each is 4KB, which is usually the
> smallest allocation size anyway.

I remember we use 512B (9-bit) for each PD/PT for Vega10.

>
> So I suggest to just drop support for amdgpu_vm_size for Vega10 and always use
> 256TB instead.
>
> Jerry do you want to take care of this or should I look into it? Should be
> trivial to do.

Do you mean to fix the vm_size for Vega10?
Yes, I will take over it.

Jerry

>
> Regards,
> Christian.
>
>>
>> Regards,
>>    Felix
>>
>>> Christian also mentioned that PD should be 4k size, then 256T was
>>> required.
>>> When reach an agreement, we may update them all.
>>>
>>>> ---
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  6 +++---
>>>>    drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 17 +++++++----------
>>>>    2 files changed, 10 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> index 3500da3..57ccac4 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> @@ -1042,10 +1042,10 @@ static bool amdgpu_check_pot_argument(int arg)
>>>>    static void amdgpu_get_block_size(struct amdgpu_device *adev)
>>>>    {
>>>>        /* from AI, asic starts to support multiple level VMPT */
>>>> -    if (adev->family >= AMDGPU_FAMILY_AI) {
>>>> +    if (adev->asic_type >= CHIP_VEGA10) {
>>>>            if (amdgpu_vm_block_size != 9)
>>>> -            dev_warn(adev->dev, "Multi-VMPT limits block size to"
>>>> -                 "one page!\n");
>>>> +            dev_warn(adev->dev,
>>>> +                 "Multi-VMPT limits block size to one page!\n");
>>>>            amdgpu_vm_block_size = 9;
>>>>            return;
>>>>        }
>>> Nice catch.
>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>> index 1e4734d..df69aae 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>> @@ -511,12 +511,6 @@ static int gmc_v9_0_vm_init(struct amdgpu_device
>>>> *adev)
>>>>         * amdkfd will use VMIDs 8-15
>>>>         */
>>>>        adev->vm_manager.num_ids = AMDGPU_NUM_OF_VMIDS;
>>>> -    /* Because of four level VMPTs, vm size at least is 256GB.
>>>> -    256TB is OK as well */
>>>> -    if (amdgpu_vm_size < 256) {
>>>> -        DRM_WARN("vm size at least is 256GB!\n");
>>>> -        amdgpu_vm_size = 256;
>>>> -    }
>>> David had a patch to fix it yesterday.
>>> But your patch involves by vm size checking. :)
>>>
>>>>        adev->vm_manager.num_level = 3;
>>>>        amdgpu_vm_manager_init(adev);
>>>>
>>>> @@ -563,11 +557,14 @@ static int gmc_v9_0_sw_init(void *handle)
>>>>        if (r)
>>>>            return r;
>>>>
>>>> -    /* Adjust VM size here.
>>>> -     * Currently default to 64GB ((16 << 20) 4k pages).
>>>> -     * Max GPUVM size is 48 bits.
>>>> +    /* Because of four level VMPTs, vm size is at least 512GB.
>>>> +     * The maximum size is 256TB (48bit).
>>>>         */
>>>> -    adev->vm_manager.max_pfn = amdgpu_vm_size << 18;
>>>> +    if (amdgpu_vm_size < 512) {
>>>> +        DRM_WARN("VM size is at least 512GB!\n");
>>>> +        amdgpu_vm_size = 512;
>>>> +    }
>>>> +    adev->vm_manager.max_pfn = (uint64_t)amdgpu_vm_size << 18;
>>>>
>>>>        /* Set the internal MC address mask
>>>>         * This is the max address of the GPU's
>>>>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-03-29  7:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  1:00 [PATCH 0/3] Fixes for multi-level page tables Felix Kuehling
     [not found] ` <1490749231-16157-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-03-29  1:00   ` [PATCH 1/3] drm/amdgpu: Make max_pfn 64-bit Felix Kuehling
     [not found]     ` <1490749231-16157-2-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-03-29  6:44       ` Christian König
2017-03-29  1:00   ` [PATCH 2/3] drm/amdgpu: Fix Vega10 VM initialization Felix Kuehling
     [not found]     ` <1490749231-16157-3-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-03-29  1:39       ` Zhang, Jerry (Junwei)
     [not found]         ` <58DB1061.7000403-5C7GfCeVMHo@public.gmane.org>
2017-03-29  1:48           ` Felix Kuehling
     [not found]             ` <0091f779-a045-7009-3746-6957ccacd62f-5C7GfCeVMHo@public.gmane.org>
2017-03-29  2:56               ` Zhang, Jerry (Junwei)
2017-03-29  6:47               ` Christian König
     [not found]                 ` <b0d2a78d-ab7d-f5b7-a35e-a9d6c80771a7-5C7GfCeVMHo@public.gmane.org>
2017-03-29  7:09                   ` Zhang, Jerry (Junwei) [this message]
2017-03-29  1:00   ` [PATCH 3/3] drm/amdgpu: Fix multi-level page table bugs for large BOs Felix Kuehling
     [not found]     ` <1490749231-16157-4-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-03-29  2:54       ` Zhang, Jerry (Junwei)
     [not found]         ` <58DB21CB.4090800-5C7GfCeVMHo@public.gmane.org>
2017-03-29  3:24           ` Kuehling, Felix
     [not found]             ` <DM5PR1201MB0235AB2363725D0D8320265292350-grEf7a3NxMBd8L2jMOIKKmrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-03-29  5:58               ` Zhang, Jerry (Junwei)
     [not found]                 ` <58DB4D02.7020903-5C7GfCeVMHo@public.gmane.org>
2017-03-29  6:52                   ` Christian König
     [not found]                     ` <8acdbd65-f99d-3e0e-b61b-318cf27d7a3b-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-03-29  7:18                       ` Zhang, Jerry (Junwei)
2017-03-29 14:32                       ` Felix Kuehling
     [not found]                         ` <bdbacee3-2c61-ebcb-1421-5c0a77dc27e0-5C7GfCeVMHo@public.gmane.org>
2017-03-29 14:46                           ` Michel Dänzer
     [not found]                             ` <a2d6c20e-d35f-e135-342b-47f86683c3e3-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-03-29 15:22                               ` Christian König
     [not found]                                 ` <d7279f4d-023e-a8fb-c08f-4e85fec87bd6-5C7GfCeVMHo@public.gmane.org>
2017-03-29 15:42                                   ` Felix Kuehling
2017-03-29  2:34   ` [PATCH 0/3] Fixes for multi-level page tables zhoucm1
2017-03-29  6:00   ` Zhang, Jerry (Junwei)
     [not found]     ` <58DB4D73.5000408-5C7GfCeVMHo@public.gmane.org>
2017-03-29  7:10       ` Zhang, Jerry (Junwei)

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=58DB5DA0.9060607@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=Kent.Russell-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=felix.kuehling-5C7GfCeVMHo@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.