Received: by 10.213.65.68 with SMTP id h4csp269673imn; Fri, 23 Mar 2018 04:22:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELuEDAQ1iSsodsKo8gvh9beV4RCh5V4+Jo7xYTxim5Id62/uKG3qp1oDrBJrviaFqqBV/erq X-Received: by 2002:a17:902:64cf:: with SMTP id y15-v6mr5693926pli.49.1521804163348; Fri, 23 Mar 2018 04:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521804163; cv=none; d=google.com; s=arc-20160816; b=FqYqF/f8lVUmejSGoxLW/bNx72ix/jMMYulSCrMnlSat8kgD+FwXihaA/sPZx40w2c jCiT82/+AeRJopZtfH14y7TlqvAqta77g5hWRk5AyO607pr/T8SFVZO9W20moTlZZOm4 Npy049bMLMUsGMZ11Mi7Ngajamv9b5zv49z0kAQJUDaADqGcNNyU//D1dh0s95sMYmaZ pKcA+papfhblKfDNS2klx7JS4EP+EUpnaVsCfpQZE6btTJh8othGPRUEnzlWW6S7KflK sNRH2DX3HPtaCTV48H2Br+nRhcpziCW/zl5sBifQbma8CsFP11wu4PVyjJqMtUOvOrU7 QJhg== 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=zeQuApFWPZrOzWf8VzZQNVPExQw7IDiokfJtjl4AiWM=; b=FgunKXUa6EXAuAY40o5fMFO3APqjb7olbY/TlJBKk0TQ9ZPMVJAWCmy3MCexWp0IJW d66hJUcB6KILBxHCmWV7RGvMY4mZg+sXL7dGcJtUYVYVc/kPTk7TDYdEeLQHDdDPo/Mu 13olaueHChAmwXylDi6jALf8s24BhX3kntx2HvYM9FebIfw6hbI4UZmjDCe1lKB8ZWJ0 QHF84Xe6W0hRxy3vX/Dykxy6AlkFha2wTrsH0UKYAtjjZ7qGSBR2BtZg01AE1cW05Sjr ujFiQK5fNN4IzdT/VV4W5YewS0gGHcIaJKh9ayhkLFdtK6hHrWZQ52Ms6nOJkieuD2lQ eSYA== 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 t9si5894774pgq.271.2018.03.23.04.22.28; Fri, 23 Mar 2018 04:22:43 -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 S1752674AbeCWLUa (ORCPT + 99 others); Fri, 23 Mar 2018 07:20:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41768 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755588AbeCWKIj (ORCPT ); Fri, 23 Mar 2018 06:08:39 -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 B4E8CEBC; Fri, 23 Mar 2018 10:08:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Kleiner , Ben Skeggs , Sasha Levin Subject: [PATCH 4.9 101/177] drm/nouveau/kms: Increase max retries in scanout position queries. Date: Fri, 23 Mar 2018 10:53:49 +0100 Message-Id: <20180323094209.745952203@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094205.090519271@linuxfoundation.org> References: <20180323094205.090519271@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mario Kleiner [ Upstream commit 60b95d709525e3ce1c51e1fc93175dcd1755d345 ] So far we only allowed for 1 retry and just failed the query - and thereby high precision vblank timestamping - if we did not get a reasonable result, as such a failure wasn't considered all too horrible. There are a few NVidia gpu models out there which may need a bit more than 1 retry to get a successful query result under some conditions. Since Linux 4.4 the update code for vblank counter and timestamp in drm_update_vblank_count() changed so that the implementation assumes that high precision vblank timestamping of a kms driver either consistently succeeds or consistently fails for a given video mode and encoder/connector combo. Iow. switching from success to fail or vice versa on a modeset or connector change is ok, but spurious temporary failure for a given setup can confuse the core code and potentially cause bad miscounting of vblanks and confusion or hangs in userspace clients which rely on vblank stuff, e.g., desktop compositors. Therefore change the max retry count to a larger number - more than any gpu so far is known to need to succeed, but still low enough so that these queries which do also happen in vblank interrupt are still fast enough to be not disastrously long if something would go badly wrong with them. As such sporadic retries only happen seldom even on affected gpu's, this could mean a vblank irq could take a few dozen microseconds longer every few hours of uptime -- better than a desktop compositor randomly hanging every couple of hours or days of uptime in a hard to reproduce manner. Signed-off-by: Mario Kleiner Signed-off-by: Ben Skeggs Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -106,7 +106,7 @@ nouveau_display_scanoutpos_head(struct d }; struct nouveau_display *disp = nouveau_display(crtc->dev); struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index(crtc)]; - int ret, retry = 1; + int ret, retry = 20; do { ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args));