From patchwork Mon Oct 1 12:31:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10622043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E4E96CB for ; Mon, 1 Oct 2018 12:33:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9FF2856E for ; Mon, 1 Oct 2018 12:33:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E385287B5; Mon, 1 Oct 2018 12:33:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19D832856E for ; Mon, 1 Oct 2018 12:33:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9C766E1EE; Mon, 1 Oct 2018 12:32:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B51F6E1E4; Mon, 1 Oct 2018 12:32:29 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E1FC960C87; Mon, 1 Oct 2018 12:32:27 +0000 (UTC) Received: from smasetty-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: smasetty@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4553960C64; Mon, 1 Oct 2018 12:32:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4553960C64 From: Sharat Masetty To: freedreno@lists.freedesktop.org Subject: [PATCH 11/13] drm/scheduler: Add a timeout_start_notify function op Date: Mon, 1 Oct 2018 18:01:43 +0530 Message-Id: <1538397105-19581-12-git-send-email-smasetty@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538397105-19581-1-git-send-email-smasetty@codeaurora.org> References: <1538397105-19581-1-git-send-email-smasetty@codeaurora.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, Sharat Masetty , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add an optional backend function op which will let the scheduler clients know when the timeout work got scheduled for a job. This will help drivers with multiple schedulers(one per ring) measure time spent on the ring accurately, eventually helping with better timeout detection. Signed-off-by: Sharat Masetty --- drivers/gpu/drm/scheduler/gpu_scheduler.c | 16 +++++++++++++--- include/drm/gpu_scheduler.h | 6 ++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index bf0e0c9..f5534ff 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c @@ -69,6 +69,16 @@ static void drm_sched_rq_remove_entity(struct drm_sched_rq *rq, spin_unlock(&rq->lock); } +static void drm_sched_queue_delayed_work(struct drm_sched_job *s_job) +{ + struct drm_gpu_scheduler *sched = s_job->sched; + + schedule_delayed_work(&s_job->work_tdr, sched->timeout); + + if (sched->ops->timeout_start_notify) + sched->ops->timeout_start_notify(s_job); +} + /** * Select an entity which could provide a job to run * @@ -467,7 +477,7 @@ static void drm_sched_job_finish(struct work_struct *work) struct drm_sched_job, node); if (next) - schedule_delayed_work(&next->work_tdr, sched->timeout); + drm_sched_queue_delayed_work(next); } spin_unlock(&sched->job_list_lock); dma_fence_put(&s_job->s_fence->finished); @@ -494,7 +504,7 @@ static void drm_sched_job_begin(struct drm_sched_job *s_job) if (sched->timeout != MAX_SCHEDULE_TIMEOUT && list_first_entry_or_null(&sched->ring_mirror_list, struct drm_sched_job, node) == s_job) - schedule_delayed_work(&s_job->work_tdr, sched->timeout); + drm_sched_queue_delayed_work(s_job); spin_unlock(&sched->job_list_lock); } @@ -560,7 +570,7 @@ void drm_sched_job_recovery(struct drm_gpu_scheduler *sched) s_job = list_first_entry_or_null(&sched->ring_mirror_list, struct drm_sched_job, node); if (s_job && sched->timeout != MAX_SCHEDULE_TIMEOUT) - schedule_delayed_work(&s_job->work_tdr, sched->timeout); + drm_sched_queue_delayed_work(s_job); list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) { struct drm_sched_fence *s_fence = s_job->s_fence; diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index dec6558..5c59c38 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -157,6 +157,12 @@ struct drm_sched_backend_ops { * it's time to clean it up. */ void (*free_job)(struct drm_sched_job *sched_job); + + /* + * (Optional) Called to let the driver know that a timeout detection + * timer has been started for this job. + */ + void (*timeout_start_notify)(struct drm_sched_job *sched_job); }; /**