From patchwork Fri Aug 7 10:31:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 6967521 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E2E1FC05AC for ; Fri, 7 Aug 2015 10:31:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BA892068C for ; Fri, 7 Aug 2015 10:31:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1CDB02062C for ; Fri, 7 Aug 2015 10:31:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F200D6ECF7; Fri, 7 Aug 2015 03:31:25 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id C39026ECF6 for ; Fri, 7 Aug 2015 03:31:24 -0700 (PDT) Received: by wibhh20 with SMTP id hh20so59976237wib.0 for ; Fri, 07 Aug 2015 03:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=UqFkx1p4Vnnpoqpm7yul4eRAjq85WVzWtfCG/Ir9N9Y=; b=PNApWFmj4P0cRPsqZoIO4pDqs/8Ekgs54T/L/Z1KCfZ39RGG4X3TVKR/uKC7tRblVP QTgF8/6OTPLUgonW0N1rGJ+MeKV3+vWtT/tECN3y4i9C5Y2ZlMfSqLzKYbm2m0+xyWzB h4XoBiRJhrKc2mH7y/+8UrbfUiAxJST5kn4Yc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=UqFkx1p4Vnnpoqpm7yul4eRAjq85WVzWtfCG/Ir9N9Y=; b=UQFS8W6MuOBj1lo20JEesIMY+r8fnKC9qIh+mxbhoQ1H2r54q4YR2DiYdqdImHQMEd ERI9Pfp8w0yKCYo7nI+hW+l1Xi5YNtG3t48uAcpMTWH6udWv3tSf4YY1AZJ5G0Nin6si PSV9ypgADyYUo22VjUPNcNbmv3eMjldS5adJfBuZMEjIg0CV5FIumD5cmyofvPrnPjB1 b60cwUgydcgsW5nHisy1yxV8jUm4yMxI/LSrdS3LWe9hoTekBq6le6RbwSDqmAblMrDP 6TC1jC7HFRF/XO2yKBnt5G3uLuynvcqqcf7sLciMErnw5h+NQ+u9I7KO+Zj5bWf9tKRF ZKvg== X-Gm-Message-State: ALoCoQmUo5ZcIO1yFrWlIke3CHDamZJ8PNy+uGFw/API2CAEloM+mEPiPMTaainczqtP9sSjuyni X-Received: by 10.194.81.137 with SMTP id a9mr14225185wjy.155.1438943483148; Fri, 07 Aug 2015 03:31:23 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id d17sm13970207wjs.32.2015.08.07.03.31.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Aug 2015 03:31:22 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development , DRI Development Date: Fri, 7 Aug 2015 12:31:17 +0200 Message-Id: <1438943477-23537-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 Cc: Daniel Vetter , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Daniel Vetter Subject: [Intel-gfx] [PATCH] drm/vblank: Use u32 consistently for vblank counters X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In commit 99264a61dfcda41d86d0960cf2d4c0fc2758a773 Author: Daniel Vetter Date: Wed Apr 15 19:34:43 2015 +0200 drm/vblank: Fixup and document timestamp update/read barriers I've switched vblank->count from atomic_t to unsigned long and accidentally created an integer comparison bug in drm_vblank_count_and_time since vblanke->count might overflow the u32 local copy and hence the retry loop never succeed. Fix this by consistently using u32. Cc: Michel Dänzer Reported-by: Michel Dänzer Signed-off-by: Daniel Vetter Reviewed-by: Thierry Reding --- drivers/gpu/drm/drm_irq.c | 2 +- include/drm/drmP.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index a7311c6e6f30..a2cfd2cc8c39 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -75,7 +75,7 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600) module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600); static void store_vblank(struct drm_device *dev, int crtc, - unsigned vblank_count_inc, + u32 vblank_count_inc, struct timeval *t_vblank) { struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index fdf8a501cb44..38e0e77d7277 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -691,7 +691,7 @@ struct drm_vblank_crtc { struct timer_list disable_timer; /* delayed disable timer */ /* vblank counter, protected by dev->vblank_time_lock for writes */ - unsigned long count; + u32 count; /* vblank timestamps, protected by dev->vblank_time_lock for writes */ struct timeval time[DRM_VBLANKTIME_RBSIZE];