Skip to content

Commit

Permalink
hsa/radeon: Check oversubscription before destroying runlist
Browse files Browse the repository at this point in the history
This patch fixes a bug when using the mode of CP hardware
scheduling without oversubscription.

The bug was that the oversubscription check was performed
_after_ the current runlist was destroyed, which caused
the current HSA application to stop working.

This patch moves the oversubscription check before the call
to destroy the current runlist. If there is oversubscription,
the function prints an error to dmesg and simply exits.

Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
  • Loading branch information
Oded Gabbay committed Jun 26, 2014
1 parent 6019fed commit 40ad38e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/gpu/hsa/radeon/kfd_packet_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ static int pm_allocate_runlist_ib(struct packet_manager *pm, unsigned int **rl_b
BUG_ON(is_over_subscription == NULL);

pm_calc_rlib_size(pm, rl_buffer_size, is_over_subscription);
if (*is_over_subscription &&
sched_policy == KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION)
return -EFAULT;

retval = radeon_kfd_vidmem_alloc_map(pm->dqm->dev, &pm->ib_buffer_obj, (void **)rl_buffer,
rl_gpu_buffer, ALIGN(*rl_buffer_size, PAGE_SIZE));
Expand Down
9 changes: 9 additions & 0 deletions drivers/gpu/hsa/radeon/kfd_process_queue_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ int pqm_create_queue(struct process_queue_manager *pqm,

switch (type) {
case KFD_QUEUE_TYPE_COMPUTE:
/* check if there is over subscription */
if ((sched_policy == KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION) &&
((dev->dqm->processes_count >= VMID_PER_DEVICE) ||
(dev->dqm->queue_count >= PIPE_PER_ME_CP_SCHEDULING * QUEUES_PER_PIPE))) {
pr_err("kfd: over-subscription is not allowed in radeon_kfd.sched_policy == 1\n");
retval = -EPERM;
goto err_create_queue;
}

retval = create_cp_queue(pqm, dev, &q, &q_properties, f, *qid);
if (retval != 0)
goto err_create_queue;
Expand Down

0 comments on commit 40ad38e

Please sign in to comment.