Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2037270imm; Mon, 16 Jul 2018 00:37:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfcY9OL/V2ZtrxpkQjhvHYFS6xHV23Q5PFdrvGHNm8I4159BaXjslmzBXk4E2YecMQEcXpf X-Received: by 2002:a63:b91c:: with SMTP id z28-v6mr14623984pge.22.1531726630059; Mon, 16 Jul 2018 00:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531726630; cv=none; d=google.com; s=arc-20160816; b=FPjtSZDUoysq1CJa29OxY52EM/bNF3YQSx/lfSLkXGvoaVWzfNTTh6BwodW+RTojz9 EMwNzitu2QoXvZ8p3YRwTbg0T+N7nV3trR/ML5S4eYGcHnwtZ59t0CpVYW3TitHEJJFl MruljHYkEpffPy8vPQS+jFaET/eRAx3AP4/c6N/d2RQUx7GGbBC9KEa7hBk9ekYyW2wM Ck6w6nHVoeGdk8zNeEosCfStfbCeDulz7ZjMAUE6CnTraXOlqnTpU2yt81uFj0N2x4Xr FCZ/KaOAc7Ar62ilFPVX0GdoVVufeUF7vK7bB61N83L3U9e4OcfLCSkGNYOi1W/s59Bk chIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=0TwZGBxdxx6rApUj1PhTrLCkGxp+KCBym+zabr0SxTI=; b=mStY+CCebx20GCORkJkrGjnTw0e7h1izUkTu6T2FCAQuW5JIYwJl6LsunH7QwRXkJ7 g2pTJYA5kJdZYt9o6EZXbUjt7jbvqbNCELGpFpSFM3G8hCix6DegCVNGW56EQnXBI/um K4jSdFOtgYaA3JNjFocau0orZEh2dDCVj28srzEGiQc6y2rAYMXxrdkeg/Z0+KXlKe+9 uj4smNN7dpF2j1zGOzUfTOAn+De/4bwgpOtIpOnu9/C+/Th8pnEuc7K5MMsMixWIZ+yn YSfLp3t1ppIqswmbQ2mUK6Tziu35IckH6UEKOIisPsyCzj4LElq8axYxd/t/Q11HH150 VlUg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37-v6si22536798pgy.118.2018.07.16.00.36.52; Mon, 16 Jul 2018 00:37:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731066AbeGPICF (ORCPT + 99 others); Mon, 16 Jul 2018 04:02:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46596 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728470AbeGPICE (ORCPT ); Mon, 16 Jul 2018 04:02:04 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 052E5CA4; Mon, 16 Jul 2018 07:36:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Lucas Stach , Eric Anholt Subject: [PATCH 4.17 07/67] drm/etnaviv: bring back progress check in job timeout handler Date: Mon, 16 Jul 2018 09:34:36 +0200 Message-Id: <20180716073444.276938236@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073443.294323458@linuxfoundation.org> References: <20180716073443.294323458@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lucas Stach commit 2c83a726d6fbb5d130d8f2edd82a258adb675ac3 upstream. When the hangcheck handler was replaced by the DRM scheduler timeout handling we dropped the forward progress check, as this might allow clients to hog the GPU for a long time with a big job. It turns out that even reasonably well behaved clients like the Armada Xorg driver occasionally trip over the 500ms timeout. Bring back the forward progress check to get rid of the userspace regression. We would still like to fix userspace to submit smaller batches if possible, but that is for another day. Cc: Fixes: 6d7a20c07760 (drm/etnaviv: replace hangcheck with scheduler timeout) Reported-by: Russell King Signed-off-by: Lucas Stach Reviewed-by: Eric Anholt Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 3 +++ drivers/gpu/drm/etnaviv/etnaviv_sched.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -142,6 +142,9 @@ struct etnaviv_gpu { struct work_struct sync_point_work; int sync_point_event; + /* hang detection */ + u32 hangcheck_dma_addr; + void __iomem *mmio; int irq; --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c @@ -21,6 +21,7 @@ #include "etnaviv_gem.h" #include "etnaviv_gpu.h" #include "etnaviv_sched.h" +#include "state.xml.h" static int etnaviv_job_hang_limit = 0; module_param_named(job_hang_limit, etnaviv_job_hang_limit, int , 0444); @@ -96,6 +97,29 @@ static void etnaviv_sched_timedout_job(s { struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job); struct etnaviv_gpu *gpu = submit->gpu; + u32 dma_addr; + int change; + + /* + * If the GPU managed to complete this jobs fence, the timout is + * spurious. Bail out. + */ + if (fence_completed(gpu, submit->out_fence->seqno)) + return; + + /* + * If the GPU is still making forward progress on the front-end (which + * should never loop) we shift out the timeout to give it a chance to + * finish the job. + */ + dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS); + change = dma_addr - gpu->hangcheck_dma_addr; + if (change < 0 || change > 16) { + gpu->hangcheck_dma_addr = dma_addr; + schedule_delayed_work(&sched_job->work_tdr, + sched_job->sched->timeout); + return; + } /* block scheduler */ kthread_park(gpu->sched.thread);