From patchwork Thu Mar 22 10:23:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10301207 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 7DF6B60385 for ; Thu, 22 Mar 2018 10:25:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FB2429AA1 for ; Thu, 22 Mar 2018 10:25:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6411629AA4; Thu, 22 Mar 2018 10:25:21 +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=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, 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 E89C629AA1 for ; Thu, 22 Mar 2018 10:25:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6F406EBE6; Thu, 22 Mar 2018 10:25:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0042.outbound.protection.outlook.com [104.47.40.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id E37536EBD6 for ; Thu, 22 Mar 2018 10:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LTX+J7VlrfYIqucGAaRrHRZN66+V0N77aJDrkImKX0g=; b=b0bZYf5aqcU+AX5Z9SW7A0FlSDSguCSwMMhVtHR0egwV/+ar+CABfvOtX4l7So1hEv0KxMUI37CLKDoQcaDcxtmnuP3DF7FIXCGfBLEjrdEqBlp9RGoNyu/Ao7hajeX1RVkIx+8tjs2JiuZ4wuvL3P4SXLN0aGLfClmNMWjundc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; Received: from localhost.localdomain (155.4.205.56) by DM2PR05MB767.namprd05.prod.outlook.com (2a01:111:e400:244d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.6; Thu, 22 Mar 2018 10:24:46 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org, linux-graphics-maintainer@vmware.com Subject: [PATCH -next 10/11] drm/vmwgfx: use monotonic event timestamps Date: Thu, 22 Mar 2018 11:23:51 +0100 Message-Id: <20180322102352.2881-10-thellstrom@vmware.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180322102352.2881-1-thellstrom@vmware.com> References: <20180322102352.2881-1-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: HE1PR0502CA0021.eurprd05.prod.outlook.com (2603:10a6:3:e3::31) To DM2PR05MB767.namprd05.prod.outlook.com (2a01:111:e400:244d::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bae90f08-bbeb-44a1-6653-08d58fdf230c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR05MB767; X-Microsoft-Exchange-Diagnostics: 1; DM2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a9nzEQS4mKDFaU9m4ZvG4RezBbZw4pCpgIoufe/It109MgURyGXrj7bTm/UaB7uRm1jtllgNtfE2352gQboffK3hkvZ3em2wLUDXWvX98PR4S7bx+5Fuhg1tqKk9tU7QrdwwHMch9oVtQeqecR7ugjmHp2/loz2FJ5FQhFId98cRaFn9kPPOjWXG9cH3LNOxpQ1OGrcfGDM2XN6yHvZ1javnrcXDhUJuHkdVC+LIQUl2Y0PobC8t2M300dgKIEycPLXEbEUrjnFPUhCoiABQguUy08oM2HbZDwLOLhX+gi26Cgo59njPSYqzg8rm27IMOYCviHFLz7c+s6dgp4ZDioSxUHZBprNP9xsQYU3jCYhzweiptucKAGG8YIB/SJtKqqVpf8iVMs4S2ctii2sli6ivyTzCSa5Q4u78MWEM1j4; 4:yHoW1zfox8EeVeSpTKMUQNg79DFhimes3jwE3Ogcx6HGpcBpue7NhJSaTMB3B3SZL1ohxfQOwgESggkwyv4w3Zm5OdSbWcpL/wSwS54MsdvcWWIVbpdpDo7lx9he5vBTX412bC9ADTzL7YO6mVoEsmnK4WrUgQLtt10ZZ/NNyZHEeWSg/I48tU7jzWPgJjWGHwLCwluTMklz11rM7jlsGFzhAwx4xEnQVppINz4bL9nQ3ynX+ZbGkytY+RNp2qnuBY/uuV3o8TG4aMR5Uy/UjnlPEbd2SEV7O6PXx6xFGSIzynJiOfwpIe1KsA0zqn0t X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR05MB767; BCL:0; PCL:0; RULEID:; SRVR:DM2PR05MB767; X-Forefront-PRVS: 0619D53754 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(39380400002)(376002)(396003)(39860400002)(366004)(199004)(189003)(76176011)(59450400001)(8676002)(81156014)(316002)(68736007)(5660300001)(305945005)(8936002)(50226002)(16586007)(36756003)(81166006)(86362001)(50466002)(6486002)(48376002)(186003)(16526019)(6512007)(53936002)(6666003)(6636002)(6506007)(386003)(2950100002)(25786009)(6116002)(52116002)(106356001)(105586002)(51416003)(47776003)(3846002)(26005)(1076002)(2906002)(97736004)(7736002)(66066001)(478600001)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR05MB767; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR05MB767; 23:2TR6W8IaYfM4qHYUBDlPKp6F7jCraKLSMrQwPeTZg7?= =?us-ascii?Q?BH5fWjRbBSwaBPcvIwZ5B20HGevfFSew/aOlg6GexFq2PE5C3tTx8ob75wI4?= =?us-ascii?Q?3AAmiZAjma2MBewQ0+xzhl0+dyE10J0O+23WxLx92d05H/90x8rho4Bo3/dQ?= =?us-ascii?Q?SgvZZNjld8hbh0EtBrtrA6HkBtLb0WSDXeCSj37gX3iDzfrGUMMYkHAaMw8B?= =?us-ascii?Q?RJP03fVS040ydGBeAbyAqBFAFNBMcq6u+tRJzQwjWQhlIA5ggpV7mtGYCV3A?= =?us-ascii?Q?bGsn4vx4oeezt7jNdS9J1qxRQMxD+3zAz44oZHX28NidIkk5tRF5x1WkTbFq?= =?us-ascii?Q?Y0ZLEEgaqsB6vKe7J9ToO3MY4aTo8R/iz0icFNrLuaIv9wRyOrTo1h5PQXAZ?= =?us-ascii?Q?XtWYcVGbFCTELBXeklF3QOSXEusjs+dChfExmplrdZUJDd42GiVYFAUyEKi/?= =?us-ascii?Q?9jex3MRRYz9bAqqKt54uhikxkJmJJVgWR/nrI3BZz5bCQVgM2qA3P9ERWQyD?= =?us-ascii?Q?/exms+5p/cPI+U6UIleHWYEhPG4ejnNO+CBpnRL2oSV9k346v7r4dtG0a/DM?= =?us-ascii?Q?9HEl2BC/IIQVKgosgjNIcatvv7/ag/MTFzCyUECx2wkUei7WDVBXEcUbqJZj?= =?us-ascii?Q?I/xcm3l+VCAStanVoYVyWDGQidKfutYXnmXOmB3293xAB+lno9rdx7q1lc7i?= =?us-ascii?Q?R7fpYK+7s1EgBoy4DqrF+C01bMk2w8MtBAkgZL1IEkhj5UtDElDAyXdTOWLI?= =?us-ascii?Q?ol1pnoIvim/Cn9p9phl1QDm+z1jby7zWywH895S/yu8PdPz6bCpExvO9jAXW?= =?us-ascii?Q?KbEXFtUeCimqeYDKvf/xbNZWuzGqpNyIeJUNnF0ByJGuMUb7cU/M6G5g8G63?= =?us-ascii?Q?oCjIhR/jMXvBKUfRSJIKEUXWv7cIKf6zZalXFuiVIMf1WtROAK63DX6AEGJq?= =?us-ascii?Q?00rWxeacBAsXekNMi9Cp7gNVWciyi2h+WQDGzs3QJOd4pfSdTVS7J5bjuY/h?= =?us-ascii?Q?wqZp26qevaHE44EgnuDlemnxGa8u8Qx/t5Y5A/56C+0RPw6mFWmviei9orYH?= =?us-ascii?Q?aOeEstvue6xtKiIQc7GLakBpIX1m8p0fj+8LQOas3K+H4Fvsl+h4Szzg3FL1?= =?us-ascii?Q?yCEdj2BzCO7yX1C/wQlva8x8qCJkxD5OdOY7p98uRA4F2CYWJuSw=3D=3D?= X-Microsoft-Antispam-Message-Info: 4MuMXcOulbbQLXuhpw0fgcDGbp++gky7oI3XDggWlN1WKmxaOGaaRr4/UWlc3NtULYO8iL7t0ZI6yxwurYQeBAVzdE7NsE+vnjQLh247nWff5lxChDOOeUOJh0CaEyW6cy7OAS5frLayo+wlC1QWS4XuNhWlN92NxDG+j0/UhV/btvMV75dPpdF15QLMbRTr X-Microsoft-Exchange-Diagnostics: 1; DM2PR05MB767; 6:My19g73modmr2DYMi8rxNJWlaSsEiB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cGIcpmM5Ue/Fz2LgJQ6dwJLJk0IgPhNa0mnfWsUM2kB/icYSsC77PHTaogdIMnGhKjCyatYnEMOOQ1zJwilwndt7RjiAjNJJ3Fw7HU8d1jsqztjIpqN7LONZC93dd8EGZzdRKE1hilFtz3KgPFzd8NiLMp4gA2gh8pWlu0= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2018 10:24:46.4612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bae90f08-bbeb-44a1-6653-08d58fdf230c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR05MB767 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Arnd Bergmann DRM_VMW_EVENT_FENCE_SIGNALED (struct drm_vmw_event_fence) and DRM_EVENT_VBLANK (struct drm_event_vblank) pass timestamps in 32-bit seconds/microseconds format. As of commit c61eef726a78 ("drm: add support for monotonic vblank timestamps"), other DRM drivers use monotonic times for drm_event_vblank, but vmwgfx still uses CLOCK_REALTIME for both events, which suffers from the y2038/y2106 overflow as well as time jumps. For consistency, this changes vmwgfx to use ktime_get_ts64 as well, which solves those problems and avoids the deprecated do_gettimeofday() function. This should be transparent to to user space, as long as it doesn't compare the time against the result of gettimeofday(). Signed-off-by: Arnd Bergmann Signed-off-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c index 6c5c75cf5e6c..9ed544f8958f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c @@ -901,11 +901,12 @@ static void vmw_event_fence_action_seq_passed(struct vmw_fence_action *action) spin_lock_irq(&dev->event_lock); if (likely(eaction->tv_sec != NULL)) { - struct timeval tv; + struct timespec64 ts; - do_gettimeofday(&tv); - *eaction->tv_sec = tv.tv_sec; - *eaction->tv_usec = tv.tv_usec; + ktime_get_ts64(&ts); + /* monotonic time, so no y2038 overflow */ + *eaction->tv_sec = ts.tv_sec; + *eaction->tv_usec = ts.tv_nsec / NSEC_PER_USEC; } drm_send_event_locked(dev, eaction->event);