From patchwork Fri Nov 2 10:31:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10665243 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 62F4F14E2 for ; Fri, 2 Nov 2018 10:31:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 438502B7B4 for ; Fri, 2 Nov 2018 10:31:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 384322B919; Fri, 2 Nov 2018 10:31:51 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0B162B7B4 for ; Fri, 2 Nov 2018 10:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726104AbeKBTia (ORCPT ); Fri, 2 Nov 2018 15:38:30 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:36238 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbeKBTia (ORCPT ); Fri, 2 Nov 2018 15:38:30 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0BDD660B7F; Fri, 2 Nov 2018 10:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541154709; bh=K1KX/22MsF6RQU7q8IW7aYRS46i+xcwGkJVuD2a18bU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZzOQjQ8WVQZV0PfgDkCY1l78R539U1BIC0vD85Mg/7gzlYE2g8rr2ez4h+OYHfaaI ootrzG5cjYv8tQJWUPHsmZU5V16x3PnXsAdhAq8GDK4WMR7l2psl1JShMNFjkYoIXb 41yIzpK+XsKY7jbN9oSC2ZDBIOLcv4gYOyDSZI8M= 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 0A6F16029D; Fri, 2 Nov 2018 10:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541154708; bh=K1KX/22MsF6RQU7q8IW7aYRS46i+xcwGkJVuD2a18bU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NAmHP+iwm5jYAjCoEIrSanDQL47FggurT80B1VOIjqgvZKNhOjYZMrnAEp66jkcZX 9QzhBm0i0oPIl9R0CLcylLw5Bs2zvaO+7rDokW5pRwrA+ir/hO6A4gHW8Vpz/Uox2e KQTsE2RxpQCF4uisQlw5TseyFF4s4qVMa3T+ANN4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0A6F16029D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=smasetty@codeaurora.org From: Sharat Masetty To: freedreno@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, jcrouse@codeaurora.org, christian.koenig@amd.com, andrey.grodzovsky@amd.com, Sharat Masetty Subject: [PATCH 2/2] drm/scheduler: Add a start_timeout_notify() backend function Date: Fri, 2 Nov 2018 16:01:33 +0530 Message-Id: <1541154693-29623-2-git-send-email-smasetty@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1541154693-29623-1-git-send-email-smasetty@codeaurora.org> References: <1541154693-29623-1-git-send-email-smasetty@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add an optional backend function op which will let the scheduler clients know when the timeout got scheduled on the scheduler instance. 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 --- Here is an example of how I plan to use this new function callback. [1] https://patchwork.freedesktop.org/patch/254227/ drivers/gpu/drm/scheduler/sched_main.c | 7 ++++++- include/drm/gpu_scheduler.h | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index c993d10..afd461e 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -192,8 +192,13 @@ bool drm_sched_dependency_optimized(struct dma_fence* fence, static void drm_sched_start_timeout(struct drm_gpu_scheduler *sched) { if (sched->timeout != MAX_SCHEDULE_TIMEOUT && - !list_empty(&sched->ring_mirror_list)) + !list_empty(&sched->ring_mirror_list)) { + schedule_delayed_work(&sched->work_tdr, sched->timeout); + + if (sched->ops->start_timeout_notify) + sched->ops->start_timeout_notify(sched); + } } /* job_finish is called after hw fence signaled diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index d87b268..faf28b4 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -239,6 +239,12 @@ struct drm_sched_backend_ops { * and 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. + */ + void (*start_timeout_notify)(struct drm_gpu_scheduler *sched); }; /**