All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
To: christian.koenig-5C7GfCeVMHo@public.gmane.org,
	Andrey Grodzovsky
	<andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
Cc: Alexander.Deucher-5C7GfCeVMHo@public.gmane.org,
	hersenxs.wu-5C7GfCeVMHo@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	shirish.s-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH v5 2/4] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC
Date: Fri, 26 Jul 2019 18:09:36 +0200	[thread overview]
Message-ID: <ed295b9a-5d38-aabc-d47a-9b681d790894@daenzer.net> (raw)
In-Reply-To: <973beeaf-735c-777d-c493-cdfdde2dd2f1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 2019-07-26 6:02 p.m., Christian König wrote:
> Am 26.07.19 um 16:53 schrieb Michel Dänzer:
>> On 2019-07-26 1:55 p.m., Christian König wrote:
>>> Am 26.07.19 um 10:54 schrieb Michel Dänzer:
>>>> On 2019-07-26 9:11 a.m., Christian König wrote:
>>>>> Am 25.07.19 um 16:24 schrieb Andrey Grodzovsky:
>>>>>> Move the logic to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC in
>>>>>> amdgpu_bo_do_create into standalone helper so it can be reused
>>>>>> in other functions.
>>>>>>
>>>>>> v4:
>>>>>> Switch to return bool.
>>>>>>
>>>>>> v5: Fix typos.
>>>>>>
>>>>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>>>>>> ---
>>>>>>     drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 61
>>>>>> +++++++++++++++++-------------
>>>>>>     drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  2 +
>>>>>>     2 files changed, 37 insertions(+), 26 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> index 989b7b5..8702062 100644
>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> @@ -413,6 +413,40 @@ static bool amdgpu_bo_validate_size(struct
>>>>>> amdgpu_device *adev,
>>>>>>         return false;
>>>>>>     }
>>>>>>     +bool amdgpu_bo_support_uswc(u64 bo_flags)
>>>>>> +{
>>>>>> +
>>>>>> +#ifdef CONFIG_X86_32
>>>>>> +    /* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit
>>>>>> +     * See https://bugs.freedesktop.org/show_bug.cgi?id=84627
>>>>>> +     */
>>>>>> +    return false;
>>>>>> +#elif defined(CONFIG_X86) && !defined(CONFIG_X86_PAT)
>>>>>> +    /* Don't try to enable write-combining when it can't work, or
>>>>>> things
>>>>>> +     * may be slow
>>>>>> +     * See https://bugs.freedesktop.org/show_bug.cgi?id=88758
>>>>>> +     */
>>>>>> +
>>>>>> +#ifndef CONFIG_COMPILE_TEST
>>>>>> +#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better
>>>>>> performance \
>>>>>> +     thanks to write-combining
>>>>>> +#endif
>>>>>> +
>>>>>> +    if (bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC)
>>>>>> +        DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT
>>>>>> for "
>>>>>> +                  "better performance thanks to write-combining\n");
>>>>> I don't think this message belongs here.
>>>>>
>>>>> [...]
>>>>>> @@ -466,33 +500,8 @@ static int amdgpu_bo_do_create(struct
>>>>>> [...]
>>>>>> +    if (!amdgpu_bo_support_uswc(bo->flags))
>>>>>>             bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
>>>>> Rather here we should do "if (bo_flags &
>>>>> AMDGPU_GEM_CREATE_CPU_GTT_USWC
>>>>> && !amdgpu_bo_support_uswc())" and then clear the flag and also print
>>>>> the warning.
>>>> That would require duplicating the CONFIG_X86_PAT related logic here as
>>>> well, which is a bit ugly.
>>> Actually I would say we should drop this extra check and always emit a
>>> message that USWC is disabled for this platform.
>>>
>>> We now need it for more than just better performance and it should be
>>> explicitly noted that this is not available in the logs.
>> A log message which doesn't explain why it's disabled / how to enable it
>> would probably cause us user support pain.
> 
> Mhm, sounds like you didn't got what I wanted to say.
> 
> No log message was fine as long as USWC was only a performance
> optimization, but now it becomes mandatory for correct operation in some
> settings.
> 
> In other words in very low VRAM configurations it can be that we can't
> enable higher resolution because the kernel is not compiled with the
> necessary flags for USWC support.

With an APU which supports scatter/gather scanout, sure.

> Printing that when the driver loads sounds like the best place to me.

Works for me, but it still needs to explain why it's disabled / how to
enable it... Something like "enable PAT" or "use a 64-bit kernel".


-- 
Earthling Michel Dänzer               |              https://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-07-26 16:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 14:24 [PATCH v5 0/4] Enable S/G for Picasso Andrey Grodzovsky
     [not found] ` <1564064683-31796-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-07-25 14:24   ` [PATCH v5 1/4] drm/amdgpu: Fix hard hang for S/G display BOs Andrey Grodzovsky
2019-07-25 14:24   ` [PATCH v5 2/4] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC Andrey Grodzovsky
     [not found]     ` <1564064683-31796-3-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-07-26  7:11       ` Christian König
     [not found]         ` <1723b531-097f-2687-6dc9-9de6e3e378a1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26  8:54           ` Michel Dänzer
     [not found]             ` <fdf2600a-b0ef-bdca-f22b-51427bef9531-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-07-26 11:55               ` Christian König
     [not found]                 ` <881edbab-df57-a1d7-bcf3-987fdbb384db-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26 14:53                   ` Michel Dänzer
     [not found]                     ` <7c62edf1-0e3b-d57e-fd33-f98198b6c23a-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-07-26 16:02                       ` Christian König
     [not found]                         ` <973beeaf-735c-777d-c493-cdfdde2dd2f1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26 16:09                           ` Michel Dänzer [this message]
2019-07-25 14:24   ` [PATCH v5 3/4] drm/amdgpu: Add check for USWC support for amdgpu_display_supported_domains Andrey Grodzovsky
2019-07-25 14:24   ` [PATCH v5 4/4] drm/amd/display: enable S/G for RAVEN chip Andrey Grodzovsky
     [not found]     ` <1564064683-31796-5-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-07-25 14:33       ` Kazlauskas, Nicholas
2019-07-26  7:14       ` Christian König
     [not found]         ` <a1e2755c-142c-ceaf-9be4-1ffff4d25cea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26  9:03           ` Michel Dänzer
     [not found]             ` <8046a45b-bf49-ad47-8902-ad928dcc97b4-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-07-26 12:47               ` Grodzovsky, Andrey
2019-07-25 14:39   ` [PATCH v5 0/4] Enable S/G for Picasso Michel Dänzer

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=ed295b9a-5d38-aabc-d47a-9b681d790894@daenzer.net \
    --to=michel-otuistvhuppr7s880joybq@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=hersenxs.wu-5C7GfCeVMHo@public.gmane.org \
    --cc=shirish.s-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.