[PATCH] drm/amdgpu: fix kernel Oops caused by change_bit in ARM64
Christian König
ckoenig.leichtzumerken at gmail.com
Tue Mar 5 08:23:20 UTC 2019
Am 05.03.19 um 03:37 schrieb 周磊:
> I got this kernel Oops when running ROCm kernel in a ARM64 machine
> with Vega64 card.
>
> ---
> drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 20d7e4775d49..b6945af39b95 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -726,8 +726,8 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
> static int gmc_v9_0_allocate_vm_inv_eng(struct amdgpu_device *adev)
> {
> struct amdgpu_ring *ring;
> - unsigned vm_inv_engs[AMDGPU_MAX_VMHUBS] =
> - {GFXHUB_FREE_VM_INV_ENGS_BITMAP, MMHUB_FREE_VM_INV_ENGS_BITMAP};
> + unsigned long vm_inv_engs[AMDGPU_MAX_VMHUBS] =
> + {GFXHUB_FREE_VM_INV_ENGS_BITMAP, MMHUB_FREE_VM_INV_ENGS_BITMAP};
> unsigned i;
> unsigned vmhub, inv_eng;
>
> @@ -743,7 +743,7 @@ static int gmc_v9_0_allocate_vm_inv_eng(struct amdgpu_device *adev)
> }
>
> ring->vm_inv_eng = inv_eng - 1;
> - change_bit(inv_eng - 1, (unsigned long *)(&vm_inv_engs[vmhub]));
> + change_bit(inv_eng - 1, &vm_inv_engs[vmhub]);
Good catch, but wrong solution. We should just stop using change_bit to
change the bitmask.
E.g. use something like "vm_inv_engs[vmhub] &= ~(1 << (inv_eng - 1));" here.
Christian.
>
> dev_info(adev->dev, "ring %s uses VM inv eng %u on hub %u\n",
> ring->name, ring->vm_inv_eng, ring->funcs->vmhub);
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190305/06ad6be7/attachment.html>
More information about the amd-gfx
mailing list