Re: [PATCH] drm/amdgpu: fix an underflow on non-4KB-page systems

From: Dan Horák
Date: Tue Mar 30 2021 - 09:24:04 EST


On Tue, 30 Mar 2021 21:09:12 +0800
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> wrote:

> On 2021-03-30 21:02 +0800, Xi Ruoyao wrote:
> > On 2021-03-30 14:55 +0200, Christian König wrote:
> > >
> > > I rather see this as a kernel bug. Can you test if this code fragment
> > > fixes your issue:
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > > index 64beb3399604..e1260b517e1b 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > > @@ -780,7 +780,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void
> > > *data, struct drm_file *filp)
> > >                  }
> > >                  dev_info->virtual_address_alignment =
> > > max((int)PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE);
> > >                  dev_info->pte_fragment_size = (1 <<
> > > adev->vm_manager.fragment_size) * AMDGPU_GPU_PAGE_SIZE;
> > > -               dev_info->gart_page_size = AMDGPU_GPU_PAGE_SIZE;
> > > +               dev_info->gart_page_size =
> > > dev_info->virtual_address_alignment;
> > >                  dev_info->cu_active_number = adev->gfx.cu_info.number;
> > >                  dev_info->cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
> > >                  dev_info->ce_ram_size = adev->gfx.ce_ram_size;
> >
> > It works.  I've seen it at
> > https://github.com/xen0n/linux/commit/84ada72983838bd7ce54bc32f5d34ac5b5aae191
> > before (with a common sub-expression, though :).
>
> Some comment: on an old version of Fedora ported by Loongson, Xorg just hangs
> without this commit. But on the system I built from source, I didn't see any
> issue before Linux 5.11. So I misbelieved that it was something already fixed.
>
> Dan: you can try it on your PPC 64 with non-4K page as well.

yup, looks good here as well, ppc64le (Power9) system with 64KB pages


Dan