From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bn3nam01on0131.outbound.protection.outlook.com ([104.47.33.131]:56088 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032310AbeCAPcX (ORCPT ); Thu, 1 Mar 2018 10:32:23 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Felix Kuehling , shaoyun liu , Oded Gabbay , Sasha Levin Subject: [added to the 4.1 stable tree] drm/amdkfd: Fix SDMA oversubsription handling Date: Thu, 1 Mar 2018 15:25:22 +0000 Message-ID: <20180301152116.1486-262-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Felix Kuehling This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 8c946b8988acec785bcf67088b6bd0747f36d2d3 ] SDMA only supports a fixed number of queues. HWS cannot handle oversubscription. Signed-off-by: shaoyun liu Signed-off-by: Felix Kuehling Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 18 ++++++++++++++= ++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drive= rs/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c index 530b82c4e78b..7c736e8d7f33 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c @@ -189,6 +189,24 @@ int pqm_create_queue(struct process_queue_manager *pqm= , =20 switch (type) { case KFD_QUEUE_TYPE_SDMA: + if (dev->dqm->queue_count >=3D + CIK_SDMA_QUEUES_PER_ENGINE * CIK_SDMA_ENGINE_NUM) { + pr_err("Over-subscription is not allowed for SDMA.\n"); + retval =3D -EPERM; + goto err_create_queue; + } + + retval =3D create_cp_queue(pqm, dev, &q, properties, f, *qid); + if (retval !=3D 0) + goto err_create_queue; + pqn->q =3D q; + pqn->kq =3D NULL; + retval =3D dev->dqm->ops.create_queue(dev->dqm, q, &pdd->qpd, + &q->properties.vmid); + pr_debug("DQM returned %d for create_queue\n", retval); + print_queue(q); + break; + case KFD_QUEUE_TYPE_COMPUTE: /* check if there is over subscription */ if ((sched_policy =3D=3D KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION) && --=20 2.14.1