From patchwork Thu Jul 10 21:54:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 4528321 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41175BEECB for ; Thu, 10 Jul 2014 23:33:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E0B8201F2 for ; Thu, 10 Jul 2014 23:33:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B04E42011D for ; Thu, 10 Jul 2014 23:33:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED2BC6E7A1; Thu, 10 Jul 2014 16:33:15 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 50B0A6E01B for ; Thu, 10 Jul 2014 14:57:28 -0700 (PDT) Received: by mail-we0-f178.google.com with SMTP id x48so207392wes.37 for ; Thu, 10 Jul 2014 14:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tl4TEjskL/XtGmnhQpYkjSCB7xHqPlslkBEnPh5SM50=; b=urf41xnZ4fsAJHggbPFLKAEsqgHFBI5O4fWD4g5kE5sXB/1jpHHnIwcuCROpTZSM90 6GMovaQq20bkX4bVhyTsdA6ekWpIauVS8qcUWDzVAmYZAtP3taEkY25sxzdJ4WKKh+kN kHp2rOb3rRQ6eZ/5XqeGtCQaL5hdf3Acl65wW7KeuV2DpG0H5RMGVCgmzPv9rA727ldc sP24iTmfc+Y9NgmWPwHqXN/q6zeIlBxgStYtN15cpYEpB2labNNCZRA61Df8jzRk3Jvd 6SSa4AJ/TGeV4rV7hxXCnXj7N0GteOxVKbX42ks61WbAcP2KgoSNQM5yYOfceqHbMsBY EV9w== X-Received: by 10.194.186.178 with SMTP id fl18mr58516841wjc.83.1405029447291; Thu, 10 Jul 2014 14:57:27 -0700 (PDT) Received: from localhost.localdomain ([77.127.59.49]) by mx.google.com with ESMTPSA id pq9sm831097wjc.35.2014.07.10.14.57.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 14:57:26 -0700 (PDT) From: Oded Gabbay X-Google-Original-From: Oded Gabbay To: David Airlie , Alex Deucher , Jerome Glisse Subject: [PATCH 76/83] hsa/radeon: Check oversubscription before destroying runlist Date: Fri, 11 Jul 2014 00:54:32 +0300 Message-Id: <1405029279-6894-48-git-send-email-oded.gabbay@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405029279-6894-1-git-send-email-oded.gabbay@amd.com> References: <1405029279-6894-1-git-send-email-oded.gabbay@amd.com> X-Mailman-Approved-At: Thu, 10 Jul 2014 16:33:12 -0700 Cc: Andrew Lewycky , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/gpu/hsa/radeon/kfd_packet_manager.c | 3 --- drivers/gpu/hsa/radeon/kfd_process_queue_manager.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/hsa/radeon/kfd_packet_manager.c b/drivers/gpu/hsa/radeon/kfd_packet_manager.c index 5cd23b0..0aef907 100644 --- a/drivers/gpu/hsa/radeon/kfd_packet_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_packet_manager.c @@ -88,9 +88,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)); diff --git a/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c b/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c index 5d7c46d..97b3cc6 100644 --- a/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c @@ -174,6 +174,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;