aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorSean Christopherson <[email protected]>2025-05-16 21:35:38 +0000
committerSean Christopherson <[email protected]>2025-06-20 20:41:02 +0000
commitee188dea1677a0d9b3a8097e71b803896b8aaed7 (patch)
tree7ba1b2eb9623c0429d8571b42523eb63f493d29d /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parentKVM: Conditionally reschedule when resetting the dirty ring (diff)
downloadkernel-ee188dea1677a0d9b3a8097e71b803896b8aaed7.tar.gz
kernel-ee188dea1677a0d9b3a8097e71b803896b8aaed7.zip
KVM: Check for empty mask of harvested dirty ring entries in caller
When resetting a dirty ring, explicitly check that there is work to be done before calling kvm_reset_dirty_gfn(), e.g. if no harvested entries are found and/or on the loop's first iteration, and delete the extremely misleading comment "This is only needed to make compilers happy". KVM absolutely relies on mask to be zero-initialized, i.e. the comment is an outright lie. Furthermore, the compiler is right to complain that KVM is calling a function with uninitialized data, as there are no guarantees the implementation details of kvm_reset_dirty_gfn() will be visible to kvm_dirty_ring_reset(). While the flaw could be fixed by simply deleting (or rewording) the comment, and duplicating the check is unfortunate, checking mask in the caller will allow for additional cleanups. Opportunistically drop the zero-initialization of cur_slot and cur_offset. If a bug were introduced where either the slot or offset was consumed before mask is set to a non-zero value, then it is highly desirable for the compiler (or some other sanitizer) to yell. Cc: Peter Xu <[email protected]> Cc: Yan Zhao <[email protected]> Cc: Maxim Levitsky <[email protected]> Cc: Binbin Wu <[email protected]> Reviewed-by: Pankaj Gupta <[email protected]> Reviewed-by: James Houghton <[email protected]> Reviewed-by: Binbin Wu <[email protected]> Reviewed-by: Yan Zhao <[email protected]> Reviewed-by: Peter Xu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
0 files changed, 0 insertions, 0 deletions