From patchwork Thu Sep 3 16:48:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yukimasa Sugizaki X-Patchwork-Id: 11755971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0ED7791F for ; Fri, 4 Sep 2020 07:12:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DED56206D4 for ; Fri, 4 Sep 2020 07:12:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=idein-jp.20150623.gappssmtp.com header.i=@idein-jp.20150623.gappssmtp.com header.b="10qKDtDh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DED56206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=idein.jp Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 97DEE6EAAB; Fri, 4 Sep 2020 07:11:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BB0A6E202 for ; Thu, 3 Sep 2020 16:49:26 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id f18so2772432pfa.10 for ; Thu, 03 Sep 2020 09:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idein-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+yb8hoZtskHzNjveRfuAP0h+6punyflsDh2kuJbWG58=; b=10qKDtDhWG53ztWXB9FdVsqU1Cr/G4Ah6xK9585E49E37PtE8erHQztqfiAg4j8DNj 863AuV5ZGunrSM7SS4DDUmnE9VzMS2AM1fBF9efQq9GRujRFwUHKVZ+jChhBjWpEGCyK BscZPfPgGgVinrPsRBmHgp882hUVQJWnAZImJkWb2eaNB4XacQp/zTSmopGrr/mDHCyU kc/rQ0PRiKr2kyVD3QqcDYup3gdMUgf7IUlLX936VWSFR/HPpCd29KhiDu1UisrX5sKv QssRz8uF/YWHVLgKGk/8pXEdowgrnAi8k/Tm/Zcb99GYeGqgSnuLunobaZRUJBMkYKCb Bk4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+yb8hoZtskHzNjveRfuAP0h+6punyflsDh2kuJbWG58=; b=UrKSoJ1Zwl32YeAfntsXo1SSXLNqefu15CcZOEiN7Tab9izepkH5WgIt2G7CQJimhX uHHdyLi3z+DpyprManIO2pjXz7StTOmCSiTtI2vN7rfTlRefLIYr6sxk1g86LnnnJSBX 2I0KJqyFoCyz02xE9B7KTIbeijIuD8xgEKDir30sum+aO+gLK3FI6n+UW7QSb8XpaBdg NqDsVF2N2l+OwutsHcTQ19naqJf9MdEib6NoDDH2RU8bkEs+3oFBGaJGESyTIMcJDPgI 0V2mMQy9TN/8WOZW06uZhZ9Mf/OjxzhJrUPiL1wF0lprW5HQ6CrhWOHrDJABDD2EwGC6 zxHw== X-Gm-Message-State: AOAM5324i69qALeG+qX5t1cQQj0cSjs4yFJBa35S/H/trqiXpzJMsj5D jxGIRI+7F75zRBI0uo4y9ODa3yfTHKemvGs= X-Google-Smtp-Source: ABdhPJxcWynpg53+rkz8YHfacxSAefCvnxu58Ha9bQWNEGqtSJUJPWA5kTQulhi1awUeHqkqNDOGGw== X-Received: by 2002:a63:cc49:: with SMTP id q9mr3588094pgi.390.1599151765272; Thu, 03 Sep 2020 09:49:25 -0700 (PDT) Received: from localhost.localdomain (i220-221-200-167.s41.a008.ap.plala.or.jp. [220.221.200.167]) by smtp.googlemail.com with ESMTPSA id mw8sm2897411pjb.47.2020.09.03.09.49.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2020 09:49:24 -0700 (PDT) From: Yukimasa Sugizaki X-Google-Original-From: Yukimasa Sugizaki To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm/v3d: Don't resubmit guilty CSD jobs Date: Fri, 4 Sep 2020 01:48:19 +0900 Message-Id: <20200903164821.2879-2-i.can.speak.c.and.basic@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903164821.2879-1-i.can.speak.c.and.basic@gmail.com> References: <20200903164821.2879-1-i.can.speak.c.and.basic@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 04 Sep 2020 07:11:29 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Yukimasa Sugizaki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Yukimasa Sugizaki The previous code misses a check for the timeout error set by drm_sched_resubmit_jobs(), which results in an infinite GPU reset loop if once a timeout occurs: [ 178.799106] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* Resetting GPU for hang. [ 178.807836] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* V3D_ERR_STAT: 0x00001000 [ 179.839132] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* Resetting GPU for hang. [ 179.847865] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* V3D_ERR_STAT: 0x00001000 [ 180.879146] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* Resetting GPU for hang. [ 180.887925] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* V3D_ERR_STAT: 0x00001000 [ 181.919188] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* Resetting GPU for hang. [ 181.928002] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* V3D_ERR_STAT: 0x00001000 ... This commit adds the check for timeout as in v3d_{bin,render}_job_run(): [ 66.408962] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* Resetting GPU for hang. [ 66.417734] v3d fec00000.v3d: [drm:v3d_reset [v3d]] *ERROR* V3D_ERR_STAT: 0x00001000 [ 66.428296] [drm] Skipping CSD job resubmission due to previous error (-125) , where -125 is -ECANCELED, though users currently have no way other than inspecting the dmesg to check if the timeout has occurred. Signed-off-by: Yukimasa Sugizaki Reviewed-by: Jose Maria Casanova Crespo --- drivers/gpu/drm/v3d/v3d_sched.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.7.4 diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index 0747614a78f0..001216f22017 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -226,6 +226,17 @@ v3d_csd_job_run(struct drm_sched_job *sched_job) struct dma_fence *fence; int i; + /* This error is set to -ECANCELED by drm_sched_resubmit_jobs() if this + * job timed out more than sched_job->sched->hang_limit times. + */ + int error = sched_job->s_fence->finished.error; + + if (unlikely(error < 0)) { + DRM_WARN("Skipping CSD job resubmission due to previous error (%d)\n", + error); + return ERR_PTR(error); + } + v3d->csd_job = job; v3d_invalidate_caches(v3d); From patchwork Thu Sep 3 16:48:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yukimasa Sugizaki X-Patchwork-Id: 11756083 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CF13138C for ; Fri, 4 Sep 2020 07:13:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF137206D4 for ; Fri, 4 Sep 2020 07:13:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=idein-jp.20150623.gappssmtp.com header.i=@idein-jp.20150623.gappssmtp.com header.b="CcV8feBe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF137206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=idein.jp Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1E5D6EA95; Fri, 4 Sep 2020 07:11:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FBC56E202 for ; Thu, 3 Sep 2020 16:49:45 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id h12so2596861pgm.7 for ; Thu, 03 Sep 2020 09:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idein-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j+qOwJ3GIDW7GU1HM7VpyWshvkHIrsBue+nt2OB0v9Y=; b=CcV8feBeWvjB7Gm/Lhgf9B6W0O+Z13xkQJJXTD4mHviOHFrf4kz8jTSuXechD/8j8G sd92hdnriFJLbXTfVcBnQKDKSH1OnkB6or5gReIcC33midFFqDP5dliMb5/qMMPwzSJs fmDh/VZi0GSQwlNKO4EuxRu2IDoxywK1YMV96Gr94HSmLw9RA6eV4NYIh2isAvh6iLOA pgk+vhkXVPnwxwCw1WkITPcQVGNzn4Z9W+fCm4cIsykjMMm+NvI9PF1U2mi80oyUO6Fj e3GasYn+vzzXMXY4MHyOTBumK+zDzxdGE7aybX0/U8oLKvDsZa1g1VswZCubXuUl710b s63w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j+qOwJ3GIDW7GU1HM7VpyWshvkHIrsBue+nt2OB0v9Y=; b=FLtThX5watI4VpWnrTkEVTsxEoQwZipDhLORwVHk6pVIsJSAhqIeJKOjR7ana852PO l/OiixQue5LbeiqOJlhO82w4o7NBE+g4IwJg15SR4QTYt+lheRLdtpL4LCAvRqfd3wJB MHTwUQKsd609ynaxa4rF/tIuFCE4BsHgB46F4pyF+MMVCu84ydpBI8uXjX1RiOBmJC66 5vlWvYWhef9rsnm7pdut6xbZAsqENu+o/yXYsLQKh5sbEsotU99HOIvrK/A6FHH2mjuQ 7U3vRVDdY5xREO5Ltye2bGvWwmcNG9NVVWqQad2hBND4Z1Gyj8k0E7L4omF0ie5yk4H7 wrcg== X-Gm-Message-State: AOAM530/5CrKqSlWloQtq9nvuLGuCYjP3tLmIbcLa3WRNF2yEKMA4p8u x+bGUh913m10XtT1MqHJsPZSyyeqP/iIlUc= X-Google-Smtp-Source: ABdhPJxSVYX8DeiruArBlM7H2GTf9xhDRx7ANZN2VRI6PLfUB4c/cqXhkhot4RO/BeuPWZygw1R3BQ== X-Received: by 2002:a63:110c:: with SMTP id g12mr3535069pgl.91.1599151784521; Thu, 03 Sep 2020 09:49:44 -0700 (PDT) Received: from localhost.localdomain (i220-221-200-167.s41.a008.ap.plala.or.jp. [220.221.200.167]) by smtp.googlemail.com with ESMTPSA id mw8sm2897411pjb.47.2020.09.03.09.49.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2020 09:49:43 -0700 (PDT) From: Yukimasa Sugizaki X-Google-Original-From: Yukimasa Sugizaki To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm/v3d: Correctly restart the timer when progress is made Date: Fri, 4 Sep 2020 01:48:20 +0900 Message-Id: <20200903164821.2879-3-i.can.speak.c.and.basic@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903164821.2879-1-i.can.speak.c.and.basic@gmail.com> References: <20200903164821.2879-1-i.can.speak.c.and.basic@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 04 Sep 2020 07:11:34 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emily Deng , David Airlie , =?utf-8?q?Christian_K=C3=B6nig?= , Yukimasa Sugizaki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Yukimasa Sugizaki The V3D scheduler wants a timed-out job to continue running if it made progress. However, the current DRM scheduler removes the timed-out job from ring_mirror_list and thus the timer is not restarted automatically, resulting in an infinite timeout. We need stop and restart the DRM scheduler to rearm the timer. Fixes: 135517d3565b ("drm/scheduler: Avoid accessing freed bad job.") Signed-off-by: Yukimasa Sugizaki --- drivers/gpu/drm/v3d/v3d_sched.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.7.4 diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index 001216f22017..feef0c749e68 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -312,9 +312,24 @@ v3d_cl_job_timedout(struct drm_sched_job *sched_job, enum v3d_queue q, u32 ctca = V3D_CORE_READ(0, V3D_CLE_CTNCA(q)); u32 ctra = V3D_CORE_READ(0, V3D_CLE_CTNRA(q)); + /* If we've made progress, skip reset and let the timer get + * rearmed. + */ if (*timedout_ctca != ctca || *timedout_ctra != ctra) { *timedout_ctca = ctca; *timedout_ctra = ctra; + + /* Because the timed-out job has been removed from + * ring_mirror_list in drm_sched_job_timedout(), we need to + * stop and restart the scheduler to rearm the timer. + * Holding the reset_lock is necessary for concurrent + * v3d_gpu_reset_for_timeout(). + */ + mutex_lock(&v3d->reset_lock); + drm_sched_stop(sched_job->sched, sched_job); + drm_sched_start(sched_job->sched, sched_job); + mutex_unlock(&v3d->reset_lock); + return; } @@ -359,6 +374,18 @@ v3d_csd_job_timedout(struct drm_sched_job *sched_job) */ if (job->timedout_batches != batches) { job->timedout_batches = batches; + + /* Because the timed-out job has been removed from + * ring_mirror_list in drm_sched_job_timedout(), we need to + * stop and restart the scheduler to rearm the timer. + * Holding the reset_lock is necessary for concurrent + * v3d_gpu_reset_for_timeout(). + */ + mutex_lock(&v3d->reset_lock); + drm_sched_stop(sched_job->sched, sched_job); + drm_sched_start(sched_job->sched, sched_job); + mutex_unlock(&v3d->reset_lock); + return; } From patchwork Thu Sep 3 16:48:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yukimasa Sugizaki X-Patchwork-Id: 11756119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73B2B91F for ; Fri, 4 Sep 2020 07:14:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5249820722 for ; Fri, 4 Sep 2020 07:14:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=idein-jp.20150623.gappssmtp.com header.i=@idein-jp.20150623.gappssmtp.com header.b="uaA7KtPH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5249820722 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=idein.jp Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8D426EB1C; Fri, 4 Sep 2020 07:12:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 32F866EA12 for ; Thu, 3 Sep 2020 16:49:58 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id l191so2600434pgd.5 for ; Thu, 03 Sep 2020 09:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idein-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9bodQ/ib1T+7rn6F/WtSC31J9eedNDc9gub5rD/BQcA=; b=uaA7KtPH9XozSkDO7Detxw+nSg7r37JfL2uNhwhRuG//YOtbbYYiAq6TxWfnnvpcPX w8hMn+SWt8BqsaXo21SXawEz612b1YfbQby8WYdNl2t2+fuAi1o4a7Eh6qxV4pzWg/y+ HnySZmyFyENqAC2/EHAXDI5Vf/Zr2skZnU89I1QCe+nDa8+l6GCeNQz7KlYJJyE6jyxB ueg6YMUCkrK6H21ZNPbG7whyjD1RuDYZVI7GVzQ/okQaVvuKEBLxuXrdmAb5umihOBtR hY7lp08cKgbrTIntqPrrN2jBboEjk8E5Mnqgzh4P1YU7daDvE4wy2H1jmSJ4cXBa9OiY WsPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9bodQ/ib1T+7rn6F/WtSC31J9eedNDc9gub5rD/BQcA=; b=mId6kOnjyM5IZuOo7ftRWf9ln769vvYN508RY6W48CGAAGxFLUcrPYPlFoh9r6ik17 fjIxgAFrd19dT2bz0C/SX6iaIXchXA4MVUp/gyW1qb/xhRTDIl77pXBlkh3K8ykslrI+ Pls3OUz1qhV4T9ZHDdQ1I8O15n0eqIUYTRmbMdD4mfX1+7bOCDRNx1d3jIMYGD5uyjHH 9ag5jVbTnKP44yXGjux2GwABDST2GTmLF1CMdOU2IrehvrXju7EgV90v9EcITAAkgeAs KmATcLKZmF8mHvz9iynFJfkbtU7bKGBiHPGGdNfY6yUYwq6QV9gc5pX+Kt04qJk2dCdc aKZg== X-Gm-Message-State: AOAM532PKtIGk4fGwV/eD5LYwJyAYHKX2b0AMTRq8rE48536iMdPoWOv 67Vmrh5h27tg7SIQGKa/v5gfDz7E55M9Odw= X-Google-Smtp-Source: ABdhPJyr0GJs3TAFGieMJ4wzRpc0i6YyDf9aFyn7Ouxd9GMatQjU2RflnmkMHLH2Vx+yfGt9QN4xdw== X-Received: by 2002:a63:31d2:: with SMTP id x201mr3841752pgx.263.1599151797348; Thu, 03 Sep 2020 09:49:57 -0700 (PDT) Received: from localhost.localdomain (i220-221-200-167.s41.a008.ap.plala.or.jp. [220.221.200.167]) by smtp.googlemail.com with ESMTPSA id mw8sm2897411pjb.47.2020.09.03.09.49.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2020 09:49:56 -0700 (PDT) From: Yukimasa Sugizaki X-Google-Original-From: Yukimasa Sugizaki To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/v3d: Add job timeout module param Date: Fri, 4 Sep 2020 01:48:21 +0900 Message-Id: <20200903164821.2879-4-i.can.speak.c.and.basic@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903164821.2879-1-i.can.speak.c.and.basic@gmail.com> References: <20200903164821.2879-1-i.can.speak.c.and.basic@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 04 Sep 2020 07:11:34 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Yukimasa Sugizaki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Yukimasa Sugizaki The default timeout is 500 ms which is too short for some workloads including Piglit. Adding this parameter will help users to run heavier tasks. Signed-off-by: Yukimasa Sugizaki --- drivers/gpu/drm/v3d/v3d_sched.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index feef0c749e68..983efb018560 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -19,11 +19,17 @@ */ #include +#include #include "v3d_drv.h" #include "v3d_regs.h" #include "v3d_trace.h" +static uint timeout = 500; +module_param(timeout, uint, 0444); +MODULE_PARM_DESC(timeout, + "Timeout for a job in ms (0 means infinity and default is 500 ms)"); + static struct v3d_job * to_v3d_job(struct drm_sched_job *sched_job) { @@ -432,13 +438,13 @@ v3d_sched_init(struct v3d_dev *v3d) { int hw_jobs_limit = 1; int job_hang_limit = 0; - int hang_limit_ms = 500; + long timeout_jiffies = timeout ? + msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; int ret; ret = drm_sched_init(&v3d->queue[V3D_BIN].sched, &v3d_bin_sched_ops, - hw_jobs_limit, job_hang_limit, - msecs_to_jiffies(hang_limit_ms), + hw_jobs_limit, job_hang_limit, timeout_jiffies, "v3d_bin"); if (ret) { dev_err(v3d->drm.dev, "Failed to create bin scheduler: %d.", ret); @@ -447,8 +453,7 @@ v3d_sched_init(struct v3d_dev *v3d) ret = drm_sched_init(&v3d->queue[V3D_RENDER].sched, &v3d_render_sched_ops, - hw_jobs_limit, job_hang_limit, - msecs_to_jiffies(hang_limit_ms), + hw_jobs_limit, job_hang_limit, timeout_jiffies, "v3d_render"); if (ret) { dev_err(v3d->drm.dev, "Failed to create render scheduler: %d.", @@ -459,8 +464,7 @@ v3d_sched_init(struct v3d_dev *v3d) ret = drm_sched_init(&v3d->queue[V3D_TFU].sched, &v3d_tfu_sched_ops, - hw_jobs_limit, job_hang_limit, - msecs_to_jiffies(hang_limit_ms), + hw_jobs_limit, job_hang_limit, timeout_jiffies, "v3d_tfu"); if (ret) { dev_err(v3d->drm.dev, "Failed to create TFU scheduler: %d.", @@ -472,8 +476,7 @@ v3d_sched_init(struct v3d_dev *v3d) if (v3d_has_csd(v3d)) { ret = drm_sched_init(&v3d->queue[V3D_CSD].sched, &v3d_csd_sched_ops, - hw_jobs_limit, job_hang_limit, - msecs_to_jiffies(hang_limit_ms), + hw_jobs_limit, job_hang_limit, timeout_jiffies, "v3d_csd"); if (ret) { dev_err(v3d->drm.dev, "Failed to create CSD scheduler: %d.", @@ -484,8 +487,7 @@ v3d_sched_init(struct v3d_dev *v3d) ret = drm_sched_init(&v3d->queue[V3D_CACHE_CLEAN].sched, &v3d_cache_clean_sched_ops, - hw_jobs_limit, job_hang_limit, - msecs_to_jiffies(hang_limit_ms), + hw_jobs_limit, job_hang_limit, timeout_jiffies, "v3d_cache_clean"); if (ret) { dev_err(v3d->drm.dev, "Failed to create CACHE_CLEAN scheduler: %d.",