Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Make enforce_isolation setting per GPU

This commit makes enforce_isolation setting to be per GPU and per
partition by adding the enforce_isolation array to the adev structure.
The adev variable is set based on the global enforce_isolation module
parameter during device initialization.

In amdgpu_ids.c, the adev->enforce_isolation value for the current GPU
is used to determine whether to enforce isolation between graphics and
compute processes on that GPU.

In amdgpu_ids.c, the adev->enforce_isolation value for the current GPU
and partition is used to determine whether to enforce isolation between
graphics and compute processes on that GPU and partition.

This allows the enforce_isolation setting to be controlled individually
for each GPU and each partition, which is useful in a system with
multiple GPUs and partitions where different isolation settings might be
desired for different GPUs and partitions.

v2: fix loop in amdgpu_vmid_mgr_init() (Alex)

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>

authored by

Srinivasan Shanmugam and committed by
Alex Deucher
96595204 ee7a846e

+21 -8
+2
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1162 1162 bool debug_disable_soft_recovery; 1163 1163 bool debug_use_vram_fw_buf; 1164 1164 bool debug_enable_ras_aca; 1165 + 1166 + bool enforce_isolation[MAX_XCP]; 1165 1167 }; 1166 1168 1167 1169 static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
··· 1110 1110 struct drm_gpu_scheduler *sched = entity->rq->sched; 1111 1111 struct amdgpu_ring *ring = to_amdgpu_ring(sched); 1112 1112 1113 - if (amdgpu_vmid_uses_reserved(vm, ring->vm_hub)) 1113 + if (amdgpu_vmid_uses_reserved(adev, vm, ring->vm_hub)) 1114 1114 return -EINVAL; 1115 1115 } 1116 1116 }
+5
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1916 1916 */ 1917 1917 static int amdgpu_device_check_arguments(struct amdgpu_device *adev) 1918 1918 { 1919 + int i; 1920 + 1919 1921 if (amdgpu_sched_jobs < 4) { 1920 1922 dev_warn(adev->dev, "sched jobs (%d) must be at least 4\n", 1921 1923 amdgpu_sched_jobs); ··· 1971 1969 amdgpu_device_check_block_size(adev); 1972 1970 1973 1971 adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type); 1972 + 1973 + for (i = 0; i < MAX_XCP; i++) 1974 + adev->enforce_isolation[i] = !!enforce_isolation; 1974 1975 1975 1976 return 0; 1976 1977 }
+11 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
··· 424 424 if (r || !idle) 425 425 goto error; 426 426 427 - if (amdgpu_vmid_uses_reserved(vm, vmhub)) { 427 + if (amdgpu_vmid_uses_reserved(adev, vm, vmhub)) { 428 428 r = amdgpu_vmid_grab_reserved(vm, ring, job, &id, fence); 429 429 if (r || !id) 430 430 goto error; ··· 476 476 477 477 /* 478 478 * amdgpu_vmid_uses_reserved - check if a VM will use a reserved VMID 479 + * @adev: amdgpu_device pointer 479 480 * @vm: the VM to check 480 481 * @vmhub: the VMHUB which will be used 481 482 * 482 483 * Returns: True if the VM will use a reserved VMID. 483 484 */ 484 - bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub) 485 + bool amdgpu_vmid_uses_reserved(struct amdgpu_device *adev, 486 + struct amdgpu_vm *vm, unsigned int vmhub) 485 487 { 486 488 return vm->reserved_vmid[vmhub] || 487 - (enforce_isolation && AMDGPU_IS_GFXHUB(vmhub)); 489 + (adev->enforce_isolation[(vm->root.bo->xcp_id != AMDGPU_XCP_NO_PARTITION) ? 490 + vm->root.bo->xcp_id : 0] && 491 + AMDGPU_IS_GFXHUB(vmhub)); 488 492 } 489 493 490 494 int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, ··· 604 600 } 605 601 } 606 602 /* alloc a default reserved vmid to enforce isolation */ 607 - if (enforce_isolation) 608 - amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(0)); 609 - 603 + for (i = 0; i < (adev->xcp_mgr ? adev->xcp_mgr->num_xcps : 1); i++) { 604 + if (adev->enforce_isolation[i]) 605 + amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i)); 606 + } 610 607 } 611 608 612 609 /**
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h
··· 78 78 79 79 bool amdgpu_vmid_had_gpu_reset(struct amdgpu_device *adev, 80 80 struct amdgpu_vmid *id); 81 - bool amdgpu_vmid_uses_reserved(struct amdgpu_vm *vm, unsigned int vmhub); 81 + bool amdgpu_vmid_uses_reserved(struct amdgpu_device *adev, 82 + struct amdgpu_vm *vm, unsigned int vmhub); 82 83 int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, 83 84 unsigned vmhub); 84 85 void amdgpu_vmid_free_reserved(struct amdgpu_device *adev,