linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Xi Ruoyao" <xry111@mengyan1223.wang>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Cc: "David Airlie" <airlied@linux.ie>,
	"Felix Kuehling" <Felix.Kuehling@amd.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Dan Horák" <dan@danny.cz>,
	amd-gfx@lists.freedesktop.org, "Daniel Vetter" <daniel@ffwll.ch>,
	stable@vger.kernel.org
Subject: Re: [PATCH] drm/amdgpu: fix an underflow on non-4KB-page systems
Date: Mon, 29 Mar 2021 20:10:45 +0200	[thread overview]
Message-ID: <9a11c873-a362-b5d1-6d9c-e937034e267d@gmail.com> (raw)
In-Reply-To: <be9042b9294bda450659d3cd418c5e8759d57319.camel@mengyan1223.wang>

Am 29.03.21 um 20:08 schrieb Xi Ruoyao:
> On 2021-03-29 20:04 +0200, Christian König wrote:
>> Am 29.03.21 um 19:53 schrieb Xℹ Ruoyao:
>>> If the initial value of `num_entires` (calculated at line 1654) is not
>>> an integral multiple of `AMDGPU_GPU_PAGES_IN_CPU_PAGE`, in line 1681 a
>>> value greater than the initial value will be assigned to it.  That causes
>>> `start > last + 1` after line 1708.  Then in the next iteration an
>>> underflow happens at line 1654.  It causes message
>>>
>>>       *ERROR* Couldn't update BO_VA (-12)
>>>
>>> printed in kernel log, and GPU hanging.
>>>
>>> Fortify the criteria of the loop to fix this issue.
>> NAK the value of num_entries must always be a multiple of
>> AMDGPU_GPU_PAGES_IN_CPU_PAGE or otherwise we corrupt the page tables.
>>
>> How do you trigger that?
> Simply run "OpenGL area" from gtk3-demo (which just renders a triangle with GL)
> under Xorg, on MIPS64.  See the BugLink.

You need to identify the root cause of this, most likely start or last 
are not a multiple of AMDGPU_GPU_PAGES_IN_CPU_PAGE.

Christian.

>
>> Christian.
>>
>>> BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1549
>>> Fixes: a39f2a8d7066 ("drm/amdgpu: nuke amdgpu_vm_bo_split_mapping v2")
>>> Reported-by: Xi Ruoyao <xry111@mengyan1223.wang>
>>> Reported-by: Dan Horák <dan@danny.cz>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Xi Ruoyao <xry111@mengyan1223.wang>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> index ad91c0c3c423..cee0cc9c8085 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> @@ -1707,7 +1707,7 @@ static int amdgpu_vm_bo_update_mapping(struct
>>> amdgpu_device *adev,
>>>                  }
>>>                  start = tmp;
>>>    
>>> -       } while (unlikely(start != last + 1));
>>> +       } while (unlikely(start < last + 1));
>>>    
>>>          r = vm->update_funcs->commit(&params, fence);
>>>    
>>>
>>> base-commit: a5e13c6df0e41702d2b2c77c8ad41677ebb065b3


  reply	other threads:[~2021-03-29 18:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 17:53 [PATCH] drm/amdgpu: fix an underflow on non-4KB-page systems Xℹ Ruoyao
2021-03-29 18:04 ` Christian König
2021-03-29 18:08   ` Xi Ruoyao
2021-03-29 18:10     ` Christian König [this message]
2021-03-29 18:21       ` Xi Ruoyao
2021-03-29 18:30         ` Xi Ruoyao
2021-03-29 19:27           ` Xi Ruoyao
2021-03-29 19:36             ` Christian König
2021-03-29 19:40               ` Xi Ruoyao
2021-03-30 12:04                 ` Xi Ruoyao
2021-03-30 12:55                   ` Christian König
2021-03-30 13:00                     ` Dan Horák
2021-03-30 13:02                       ` Christian König
2021-03-30 13:02                     ` Xi Ruoyao
2021-03-30 13:09                       ` Xi Ruoyao
2021-03-30 13:23                         ` Dan Horák
2021-03-30 13:24                           ` Christian König
2021-03-30 15:46                             ` Xi Ruoyao

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=9a11c873-a362-b5d1-6d9c-e937034e267d@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dan@danny.cz \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xry111@mengyan1223.wang \
    /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).