drm/amdgpu: Use READ_ONCE() when reading the values in 'sdma_v4_4_2_ring_get_rptr'
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Fri, 4 Aug 2023 05:46:41 +0000 (11:16 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 Aug 2023 19:51:17 +0000 (15:51 -0400)
commitbf227a4f0558320513b86c279996021480f9e750
treedaf32c9e6e4e6143165ea41b1263c096d31b1b0d
parent4d5dc6260c2d00d603ae9c4ab452b6b4587f0d9f
drm/amdgpu: Use READ_ONCE() when reading the values in 'sdma_v4_4_2_ring_get_rptr'

Use READ_ONCE() instead of declaring the pointer volatile. To prevent
the compiler from refetching or reordering the read, so that the read
value is always consistent.

Link: https://lwn.net/Articles/624126/
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: Le Ma <le.ma@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c