All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Grodzovsky <Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>
To: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>,
	"Alex Deucher"
	<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	"Ranjbar, Ramin" <ramin.ranjbar-5C7GfCeVMHo@public.gmane.org>,
	Huang Rui <ray.huang-5C7GfCeVMHo@public.gmane.org>,
	Christian Koenig <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH v4 2/2] drm/amdgpu: Free VGA stolen memory as soon as possible.
Date: Thu, 12 Apr 2018 15:59:20 -0400	[thread overview]
Message-ID: <8bb5e2f0-072e-8725-a163-55b275a5ed7d@amd.com> (raw)
In-Reply-To: <cf801752-d1e7-f8de-3312-c7b4677dcf49-otUistvHUpPR7s880joybQ@public.gmane.org>



On 04/12/2018 11:10 AM, Michel Dänzer wrote:
> On 2018-04-12 04:58 PM, Andrey Grodzovsky wrote:
>> On 04/12/2018 10:33 AM, Michel Dänzer wrote:
>>> On 2018-04-12 03:33 PM, Alex Deucher wrote:
>>>> On Thu, Apr 12, 2018 at 7:17 AM, Andrey Grodzovsky
>>>> <Andrey.Grodzovsky@amd.com> wrote:
>>>>> On 04/12/2018 12:32 AM, Alex Deucher wrote:
>>>>>> On Thu, Apr 12, 2018 at 12:08 AM, Andrey Grodzovsky
>>>>>> <andrey.grodzovsky@amd.com> wrote:
>>>>>>> Reserved VRAM is used to avoid overriding pre OS FB.
>>>>>>> Once our display stack takes over we don't need the reserved
>>>>>>> VRAM anymore.
>>>>>>>
>>>>>>> v2:
>>>>>>> Remove comment, we know actually why we need to reserve the stolen
>>>>>>> VRAM.
>>>>>>> Fix return type for amdgpu_ttm_late_init.
>>>>>>> v3:
>>>>>>> Return 0 in amdgpu_bo_late_init, rebase on changes to previous patch
>>>>>>> v4:
>>>>>>> Don't release stolen memory for GMC9 ASICs untill GART corruption
>>>>>>> on S3 resume is resolved.
>>>>>>>
>>>>>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>>>>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>> [...]
>> Not sure what it means ?
> It means I trimmed some quoted text. Would it be clearer if I put
> quotation markers before it?

Got it now.

>
>
>>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>>>>> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>>>>> index 252a6c69..099e3ce5 100644
>>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>>>>>> @@ -659,6 +659,16 @@ static int gmc_v9_0_late_init(void *handle)
>>>>>>>            unsigned i;
>>>>>>>            int r;
>>>>>>>
>>>>>>> +       /*
>>>>>>> +        * TODO:
>>>>>>> +        * Currently there is a bug where some memory client outside
>>>>>>> +        * of the driver writes to first 8M of VRAM on S3 resume,
>>>>>>> +        * this overrides GART which by default gets placed in
>>>>>>> first 8M
>>>>>>> and
>>>>>>> +        * causes VM_FAULTS once GTT is accessed.
>>>>>>> +        * Keep the stolen memory reservation until this solved.
>>>>>>> +        */
>>>>>>> +       /* amdgpu_bo_late_init(adev); /
>>>>>>> +
>>>>>> We still need to free this somewhere.  I'd suggest calling it in
>>>>>> gmc_v9_0_sw_fini() and add a comment there about moving it when we fix
>>>>>> the issue.
>>>>>>
>>>>>>>            for(i = 0; i < adev->num_rings; ++i) {
>>>>>>>                    struct amdgpu_ring *ring = adev->rings[i];
>>>>>>>                    unsigned vmhub = ring->funcs->vmhub;
>>>>>>> @@ -884,10 +894,6 @@ static int gmc_v9_0_sw_init(void *handle)
>>>>>>>             */
>>>>>>>            adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
>>>>>>>
>>>>>>> -       /*
>>>>>>> -        * It needs to reserve 8M stolen memory for vega10
>>>>>>> -        * TODO: Figure out how to avoid that...
>>>>>>> -        */
>>>>>>>            adev->gmc.stolen_size = gmc_v9_0_get_vbios_fb_size(adev);
>>>>>> We may also just want to return 8MB or 9MB temporarily in
>>>>>> gmc_v9_0_get_vbios_fb_size until we sort out the root cause of the S3
>>>>>> issue otherwise we're potentially wasting a lot more memory.
>>>>> But what if we have 4k display ? In this case returning 9M probably
>>>>> will not
>>>>> hide the corruption  we were originally dealing with. I remember in
>>>>> that
>>>>> case pre OS FB size would be 32M.
>>>> I guess it's a trade off, possible garbage monentary during bios to
>>>> driver transition vs. wasting an additional 24 MB of CPU accessible
>>>> vram for the life of the driver.
>>> Can we free the reserved memory after initialization, then reserve it
>>> again on resume?
>> The issue here was that someone overrides the first 8M of VRAM and
>> corrupts the GART table, which causes VM_FAULTS. Until we find who is
>> writing into this area of VRAM and when exactly I think we cannot allow
>> any data to be placed there since it's might get corrupted (even if we
>> avoid placing the GART table there).
> I think it shouldn't be too hard in general to make sure the GART table,
> and any other BOs which stay in VRAM across suspend/resume, don't fall
> in the affected area.

Not sure I understand how easily to search for all this kind of objects 
across all IPs. Also how can we be sure the
effected region is ran over only during resume, we know that GART table 
is ran over during resume but we can't be
sure other areas in that region are not ran over during other times and 
if so it's dangerous to allow allocations there.

Andrey

>
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-04-12 19:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12  4:08 [PATCH v4 1/2] drm/amdgpu/gmc: steal the appropriate amount of vram for fw hand-over Andrey Grodzovsky
     [not found] ` <1523506110-14002-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2018-04-12  4:08   ` [PATCH v4 2/2] drm/amdgpu: Free VGA stolen memory as soon as possible Andrey Grodzovsky
     [not found]     ` <1523506110-14002-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2018-04-12  4:32       ` Alex Deucher
     [not found]         ` <CADnq5_PssA-Cz5q1Z-na88REbLn6pzz5T2eby12LUoyTj5F9dQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-12 11:17           ` Andrey Grodzovsky
     [not found]             ` <9abad4d7-8ca7-30fa-6bb7-cadb4ae01799-5C7GfCeVMHo@public.gmane.org>
2018-04-12 13:33               ` Alex Deucher
     [not found]                 ` <CADnq5_OrReLdTq6-K9ohDXRG7GDUd5MofoMpyOCUTwH2oufosw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-12 14:33                   ` Michel Dänzer
     [not found]                     ` <5968a37a-a89c-2c08-dfc4-dd6bc49f29be-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-04-12 14:58                       ` Andrey Grodzovsky
     [not found]                         ` <21a9adee-bec8-f86f-92a3-fcfca185458f-5C7GfCeVMHo@public.gmane.org>
2018-04-12 15:10                           ` Michel Dänzer
     [not found]                             ` <cf801752-d1e7-f8de-3312-c7b4677dcf49-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-04-12 19:59                               ` Andrey Grodzovsky [this message]
2018-04-12  4:16   ` [PATCH v4 1/2] drm/amdgpu/gmc: steal the appropriate amount of vram for fw hand-over Alex Deucher
     [not found]     ` <CADnq5_Nw0Cwh-pg9==CWLRC2E709b2S8LEWMd93Eo+ZRfZ7GCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-04-12  4:25       ` Andrey Grodzovsky
     [not found]         ` <5e42d9cf-2581-14e1-80fd-0378323617c5-5C7GfCeVMHo@public.gmane.org>
2018-04-12  7:49           ` Michel Dänzer
2018-04-12  9:09           ` Huang Rui

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=8bb5e2f0-072e-8725-a163-55b275a5ed7d@amd.com \
    --to=andrey.grodzovsky-5c7gfcevmho@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=michel-otUistvHUpPR7s880joybQ@public.gmane.org \
    --cc=ramin.ranjbar-5C7GfCeVMHo@public.gmane.org \
    --cc=ray.huang-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.