Commit 87e7677
drm/amdgpu: Refactor amdgpu_gem_va_ioctl for Handling Last Fence Update and Timeline Management v7
[ Upstream commit efdc66f ]
When GPU memory mappings are updated, the driver returns a fence so
userspace knows when the update is finished.
The previous refactor could pick the wrong fence or rely on checks that
are not safe for GPU mappings that stay valid even when memory is
missing. In some cases this could return an invalid fence or cause fence
reference counting problems.
Fix this by (v5,v6, per Christian):
- Starting from the VM’s existing last update fence, so a valid and
meaningful fence is always returned even when no new work is required.
- Selecting the VM-level fence only for always-valid / PRT mappings using
the required combined bo_va + bo guard.
- Using the per-BO page table update fence for normal MAP and REPLACE
operations.
- For UNMAP and CLEAR, returning the fence provided by
amdgpu_vm_clear_freed(), which may remain unchanged when nothing needs
clearing.
- Keeping fence reference counting balanced.
v7: Drop the extra bo_va/bo NULL guard since
amdgpu_vm_is_bo_always_valid() handles NULL BOs correctly (including
PRT). (Christian)
This makes VM timeline fences correct and prevents crashes caused by
incorrect fence handling.
Fixes: bd8150a ("drm/amdgpu: Refactor amdgpu_gem_va_ioctl for Handling Last Fence Update and Timeline Management v4")
Suggested-by: Christian König <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>1 parent 9788e24 commit 87e7677
1 file changed
Lines changed: 37 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
723 | | - | |
724 | | - | |
725 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
726 | 728 | | |
727 | 729 | | |
728 | | - | |
| 730 | + | |
729 | 731 | | |
730 | | - | |
731 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
732 | 740 | | |
733 | 741 | | |
734 | 742 | | |
| |||
746 | 754 | | |
747 | 755 | | |
748 | 756 | | |
749 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
750 | 762 | | |
751 | | - | |
752 | | - | |
753 | | - | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
754 | 766 | | |
755 | | - | |
756 | | - | |
757 | | - | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
758 | 770 | | |
759 | 771 | | |
760 | 772 | | |
761 | 773 | | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
771 | 784 | | |
772 | 785 | | |
773 | 786 | | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | 787 | | |
| 788 | + | |
778 | 789 | | |
779 | 790 | | |
780 | 791 | | |
781 | 792 | | |
782 | 793 | | |
783 | 794 | | |
784 | 795 | | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
| 796 | + | |
796 | 797 | | |
797 | 798 | | |
798 | 799 | | |
| |||
0 commit comments