Received: by 10.213.65.68 with SMTP id h4csp224616imn; Fri, 23 Mar 2018 03:17:50 -0700 (PDT) X-Google-Smtp-Source: AG47ELuuh/DtwYHUPbG1H0n3bwKOTHmU7OVSStS5VW1AF5iIXAK0n6+o/lk70u29Yd8klTIyjZNV X-Received: by 2002:a17:902:526:: with SMTP id 35-v6mr29612014plf.276.1521800269969; Fri, 23 Mar 2018 03:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521800269; cv=none; d=google.com; s=arc-20160816; b=H3iMxKtIVoN8wuvvWoer32hJEEyxRJexYWL2zfruLmq6wg8mtJFnW6GVscz90wjTgP VcTwYc2dauJxHgorhW/n/wclZyhPwk+aAfOkaipv/uN60GPt6GWtyvgZr08X1C8wDhhx 2XbwktwSmpo6eaIqYo3LOWWH5ppIIxNQSyYjyt0FRbgHfVVfF3afpFVVyRQ0pFjCLea4 CJJSvV0RQ21N2BCk+LcLifq7JYD3Xvtmnhy6qCdKv/obLtCz5cogAv+m4p33O9o6VFNn wjCTLJ0dJYTYvvPDRtGTm8x3ocCCEy8MVgX/GstUSezmy3USf85zVc0jbGK0mPTnYVbZ cs7w== 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=1rHRyxPUByzwxFwiT9qNDHYsZs5WB4w5caYlPGFyvJg=; b=sY+xytftaJmhe68Mi4sJJRbO2bB6aCk6B8YfAMbJ4Ply19AxUEOc70NcKdxijtEUo3 SMQoqNnt6KOS7zI6bxn55+DPgDv7XGICykwdYRBMVf9LgzNRD7lRJy46JxAh2ATwsnHM QIM9daI29bhqA+WnvGcy22dBoDTv4OJ9dJrwdkjXC9IqxGwvDKKp6OMO9O9GMLbErar5 /LUEUOUT/bmKMmufSsEn0SMhanz6jne+D3yXFGC6zFzVPgVnA4vSTHtl2eJMXrJU1KJ8 sE6x1A9tUVqbjkhXXsyJfgkXjHHLubMBO9Lu1zVMAzycFWWphYHTtxwkV1vYvqCd9hRc JvOw== 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 b64si4412872pfa.328.2018.03.23.03.17.35; Fri, 23 Mar 2018 03:17:49 -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 S933487AbeCWKPc (ORCPT + 99 others); Fri, 23 Mar 2018 06:15:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45674 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933400AbeCWKP3 (ORCPT ); Fri, 23 Mar 2018 06:15:29 -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 F17A51279; Fri, 23 Mar 2018 10:15:28 +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.4 59/97] drm/nouveau/kms: Increase max retries in scanout position queries. Date: Fri, 23 Mar 2018 10:54:46 +0100 Message-Id: <20180323094200.937228128@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@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.4-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 @@ -104,7 +104,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));