Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2700550imm; Sun, 5 Aug 2018 10:03:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeYloJGq6pgZlzH+HgLDICkhy629/ZEhevLbaYDydohDL59XFsntjlZt+pGbzoWePHGN2R1 X-Received: by 2002:a62:11c4:: with SMTP id 65-v6mr13677937pfr.54.1533488625488; Sun, 05 Aug 2018 10:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533488625; cv=none; d=google.com; s=arc-20160816; b=RHcyaf7I4PQ4xr5xBiLfcXrMFyv6TGFwWqd577B/sfDOwEW34RsCTv7veuvZyY7U2J 8cjbc/912vRFiYPkclcAb5czNw4xQweuRQbmqWVsB5h04cc9nkmHfN7uSplCgRbTzup4 k5MyCGr3NIrt3HSItJWoTL+DGbSLHulEhYb/pMc3H7RvbZpIS8HSbaEvngSvrIEcDgUi /mLbsWjNU+wQgETcnSd6EJVxTOxfEyA8irrM62QhlseqUfHB3DG2iZVSnrANmrKV7Z/Q Fos9UdjCab52fyeQ8UuG3IWet4LYD6ohXI4i2GF9+kW1eEWbcDyNcFV7VQV5SFqkgDWF 60bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Ldr0yoQdF1fCKHSkU/tHvNfIAixV328NcFTPZDoFZ4w=; b=jOSZwqr4hzbd5wCe6nBSKoBwdBDG/hli1pAkBjHcF/g8fSJqqtUGxNdvL/M9QAHZOe mKt5LLY2q9cxX1H75D/N0OJ3Ndutj9OBkGKdsjpDG1s5jA+9qV3MhnZH4mbKkOH0958p of18vVRrv50yTD7w7MtLgzQBGRIvAmw9e+5xGgdBBB64RXQZWSFhX3ToNvs/L5q3zKRb mxESx6ulMJOIc4e8gjgWhg44X2wUxJBYgA2rHKz4HLF5z3iVRwRiw8La01w3o1uKXGEs KjxMruLnBZcyZAx6lhxQcBxYrSLOIoUzDkj5mWrzc+9dqhcjAHq1u5uqOFUmWz5Ycuo9 j8Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U0CI1Ujn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t24-v6si8854400pgk.632.2018.08.05.10.03.18; Sun, 05 Aug 2018 10:03:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U0CI1Ujn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbeHETHI (ORCPT + 99 others); Sun, 5 Aug 2018 15:07:08 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:41066 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbeHETHI (ORCPT ); Sun, 5 Aug 2018 15:07:08 -0400 Received: by mail-lj1-f194.google.com with SMTP id y17-v6so8674073ljy.8; Sun, 05 Aug 2018 10:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Ldr0yoQdF1fCKHSkU/tHvNfIAixV328NcFTPZDoFZ4w=; b=U0CI1Ujnpd1mIRLTtfytGCJYEvyfYapDCOaCcHB95pDv5wj0OcPF+1d4ZYGOQT3cbM DOwrQb23FNgO+wc2AY0VWae2TAbSpbTX+ZdzwO29Jck1TYjq18v+QBVKY83dWSlLZN1B V6F98JpYLZYYDKCcysrOYz+NzGEMOiiRkxNy2yuSHA6SPRssHLhP4wf2yyP1Aohcxjf3 TwqqqpdMqeIXqic6cWgJDiVyqzs3majswi9YyZh8HTKWyHKh/b69XaaLCYTGRQpg7MwW VeoPnznlWUqYaI7k96SB610CN0aYjdZP740Zg9j5H171KphS86GXi8TEACJopEmdrxgQ Og8Q== 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; bh=Ldr0yoQdF1fCKHSkU/tHvNfIAixV328NcFTPZDoFZ4w=; b=Me3DIcVQGxHcxYP14ZZTkCt2ZiIqO05f4R+3pYIVgyGrHl4GkqfSA4w4srvdDDHwCR PG0koWow50Rn+bnZNH8q/ypjJwGWCNMvDLCn+rrsPKYl06GsB/W2Uqrt2fjSj0z5WDUB FulPXnve6FbIRXxR6oG0XLslzHSvCtXzueeTzcnj9tJZQ5AIGFzAvW0Rj3DyjFFCCu8f rL+m7ancyXVL46/bQvucFzG2a6n2MO/k52ze97uEdloZ4vtcIEY3oYnlDNO4gQZgJDx8 eVapFcDsc2pq/eqyjn7mry4dmmwBSIeUHplwbrmv8P6j9wFypAOB24ZHMWTRi3Z2NVoL OAxg== X-Gm-Message-State: AOUpUlFE1tePLjAB8SOFxJVOkZBqNjgbYBr0+blHQUClb159ZEqRbPDe 44FE+HozJQaMtqWXnxLBeIs= X-Received: by 2002:a2e:2bd7:: with SMTP id r84-v6mr10978430ljr.40.1533488513888; Sun, 05 Aug 2018 10:01:53 -0700 (PDT) Received: from localhost.localdomain ([109.252.90.13]) by smtp.gmail.com with ESMTPSA id g11-v6sm1844609ljk.45.2018.08.05.10.01.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Aug 2018 10:01:53 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen Cc: linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] gpu: host1x: Cancel only job that actually got stuck Date: Sun, 5 Aug 2018 20:01:31 +0300 Message-Id: <20180805170131.29263-1-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Host1x doesn't have information about jobs inter-dependency, that is something that will become available once host1x will get a proper jobs scheduler implementation. Currently a hang job causes other unrelated jobs to be canceled, that is a relic from downstream driver which is irrelevant to upstream. Let's cancel only the hanging job and not to touch other jobs in queue. Signed-off-by: Dmitry Osipenko --- drivers/gpu/host1x/cdma.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 91df51e631b2..4d94af4a315f 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -348,13 +348,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, } /* - * Walk the sync_queue, first incrementing with the CPU syncpts that - * are partially executed (the first buffer) or fully skipped while - * still in the current context (slots are also NOP-ed). + * Increment with CPU the remaining syncpts of a partially executed job. * - * At the point contexts are interleaved, syncpt increments must be - * done inline with the pushbuffer from a GATHER buffer to maintain - * the order (slots are modified to be a GATHER of syncpt incrs). + * Syncpt increments must be done inline with the pushbuffer from a + * GATHER buffer to maintain the order (slots are modified to be a + * GATHER of syncpt incrs). * * Note: save in restart_addr the location where the timed out buffer * started in the PB, so we can start the refetch from there (with the @@ -370,12 +368,8 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, else restart_addr = cdma->last_pos; - /* do CPU increments as long as this context continues */ - list_for_each_entry_from(job, &cdma->sync_queue, list) { - /* different context, gets us out of this loop */ - if (job->client != cdma->timeout.client) - break; - + /* do CPU increments for the remaining syncpts */ + if (job) { /* won't need a timeout when replayed */ job->timeout = 0; @@ -388,20 +382,8 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, syncpt_incrs, job->syncpt_end, job->num_slots); - - syncpt_val += syncpt_incrs; } - /* - * The following sumbits from the same client may be dependent on the - * failed submit and therefore they may fail. Force a small timeout - * to make the queue cleanup faster. - */ - - list_for_each_entry_from(job, &cdma->sync_queue, list) - if (job->client == cdma->timeout.client) - job->timeout = min_t(unsigned int, job->timeout, 500); - dev_dbg(dev, "%s: finished sync_queue modification\n", __func__); /* roll back DMAGET and start up channel again */ -- 2.18.0