From patchwork Sun Apr 23 23:54:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9695341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51A60602A7 for ; Sun, 23 Apr 2017 23:55:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2739F262AE for ; Sun, 23 Apr 2017 23:55:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 186EF26538; Sun, 23 Apr 2017 23:55:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B7ADA262AE for ; Sun, 23 Apr 2017 23:55:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BED8989FFD; Sun, 23 Apr 2017 23:55:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6966E89FFD for ; Sun, 23 Apr 2017 23:55:00 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id w50so14221270wrc.0; Sun, 23 Apr 2017 16:55:00 -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=L6tOwBC91asTd+Zi79Cx3tS0qatwIh9u/sYX2R0C9Wo=; b=UG0HBHI9ia5dzxxnKXDVqUNfAZp1wMxpnL1QMZxRjrqLn19byVNVHz/NCF+/RzHU5R zHg1dvWM36iCYYQ/LPOD2eC/g17STstQ5OitlM9ew7aWg0IZL0UoYG06xQQdStafgqiv dz/9zs0cXQCY11rrQVQwPN3Q8zZV2H7YzntZw356VtmSUpj4iyPo8Rlg5hATuuofBFYt LolX20ZDkYPngSJvYf9Uijz6sMSRFmKCZXagyaOpKSplbQL1H/UeU8Jx8T8Bz2LWVJPX 2WgndCgifM4LUrMTTJwzschs5xAkqDi6Tfgt3qkW6Cy7n1HTmCA0BxlPjDm0LTrAxR2C XgdQ== 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=L6tOwBC91asTd+Zi79Cx3tS0qatwIh9u/sYX2R0C9Wo=; b=eVy6e7K6fqU6iMtkkOerxfgFLzoXSDxtNIBD3wLFrWOE9Ccy1p9KwdOSps0Yz8h++k Yo0n0gOpSOf7J/lCyoDp6c++IJGY7+YjFKakeWxO1pqBCY5soGKLM0vKl2VIHfc89elY OrBqV8+uGbGMVK4vUhN9DYsm7cyQvHWF/TFrdThESm78d7/PcOs1hEdeb3axK/tnmDyN MCLfuYixsMmSqtd6nPPkX8QYdV7eNZ8l6LDRa+QLjAeFvCDed1CteHUD31l9ZC8g8GPp eVzalVuchCSM5QxzOIiCC9hJuNxFACr8o6Mb8YDf8Do/QIreooOWZlZl5hDT/HgOUZ2+ fUWg== X-Gm-Message-State: AN3rC/6DDOBCWKngzRqFCxAZPBgyyze3Y5UiHgs4QEfvVuZxd4lLA00j TADklLvD6z6qyg== X-Received: by 10.223.176.194 with SMTP id j2mr3379287wra.81.1492991699020; Sun, 23 Apr 2017 16:54:59 -0700 (PDT) Received: from twisty.cin.medizin.uni-tuebingen.de (cin-11.medizin.uni-tuebingen.de. [134.2.118.242]) by smtp.gmail.com with ESMTPSA id n193sm10930491wmg.30.2017.04.23.16.54.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 16:54:57 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/nouveau/kms: Increase max retries in scanout position queries. Date: Mon, 24 Apr 2017 01:54:44 +0200 Message-Id: <1492991684-10377-1-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.7.0 Cc: Ben Skeggs , nouveau-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Ben Skeggs --- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 6104f61..21b10f9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -111,7 +111,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, }; 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));