From patchwork Fri Apr 7 11:17:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9669293 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 8010F60364 for ; Fri, 7 Apr 2017 11:17:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66B51285B2 for ; Fri, 7 Apr 2017 11:17:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5919B285F9; Fri, 7 Apr 2017 11:17:20 +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_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 EBC4C285B2 for ; Fri, 7 Apr 2017 11:17:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71CC46EAD9; Fri, 7 Apr 2017 11:17:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D2806EAD9 for ; Fri, 7 Apr 2017 11:17:16 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id u18so11108123wrc.1 for ; Fri, 07 Apr 2017 04:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=AZYYPxHnDstcM1lyEasSvmAuPqxPe/tjxjpGMZXwkkY=; b=g0BOnR/PzHz+jE5n2Mod159CVU/4lgTi5jE0PGEqk0GZ6TgxiO5/+DLeBBZ+2bTQKJ hL9wb4v1ya5IXlJAs828PBPVg7zcMDCkQCI8TE9VYlb185QymE5sb2Ik0pCbb7IQsijM n36GKpX3TRqmQi+jKgXvqbopNndpIGH6cUAuEHNZSZwUao1TBymUqp3zXpdDvgJQK1rI HQ2Gl24njkvgZUvdDADJRnN46kiRKzwmmwAb1QI+Ky/GIG3SvSW32OJhM0sS/dCPHA8d m8XwCeZUzRH0vIQXCZBd4D9fOP+IRGZ2FxcNTZNBQY4m5hy2Ld2YzCbw1qjds3iTclmV NPYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=AZYYPxHnDstcM1lyEasSvmAuPqxPe/tjxjpGMZXwkkY=; b=j/5ua89xN6cszsr9sDMflSr/OLi3ftmvEdEMhgcy6uplLHULyNB8HcX9oyBYZZtnzh lBs/q5Zs8lEMK6zHF70kwwRpcorqmupUlxJGbxLHSgjlqvGYXPO/BJduYU6gMFL00hKA Bh1CjLZexrWUnxERGU4Xkexe2SfpXAdQCA7pdg5cuRFjLr9X4hL3dQGNLp2+enMHVsuC BSpKga+/7YbbiFOwA1uCuRLzlaOuXv5MsOB27DCswrldPfQ34OZXuB2oWgdOLCfxU/yy azqvlyGoEYneJ5D/2KNjG2cOSEyP/kX0RM8VyFUiRH0I3JBSUk0MXCxEUo2jgh0yzXWI FU/w== X-Gm-Message-State: AFeK/H2tWDPmZ7t9zt5ECJ2elNGZEGrenNqT+5DgOW60tycYlYnxOXto/IyFSHq0xbl8dA== X-Received: by 10.28.208.7 with SMTP id h7mr28247696wmg.79.1491563834960; Fri, 07 Apr 2017 04:17:14 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id 100sm5629184wrb.33.2017.04.07.04.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Apr 2017 04:17:14 -0700 (PDT) From: Chris Wilson To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: Don't allow interruptions when opening debugfs/crc Date: Fri, 7 Apr 2017 12:17:12 +0100 Message-Id: <20170407111712.13962-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 Cc: Daniel Vetter , Tomeu Vizoso 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 The code does not like to be interrupted when waiting for the first vblank after opening a debugfs/crc channel, so don't. [66285.716870] WARNING: CPU: 1 PID: 16615 at drivers/gpu/drm/drm_debugfs_crc.c:185 crtc_crc_open+0x1d0/0x1f0 [drm] [66285.716877] Modules linked in: i915 intel_powerclamp crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel cryptd intel_gtt i2c_algo_bit lpc_ich mfd_core drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops prime_numbers drm video button autofs4 sd_mod ahci libahci libata i2c_i801 scsi_mod i2c_designware_platform i2c_designware_core i2c_core [66285.716929] CPU: 1 PID: 16615 Comm: kms_frontbuffer Not tainted 4.11.0-rc5+ #7 [66285.716935] Hardware name: GIGABYTE GB-BXBT-1900/MZBAYAB-00, BIOS F8 03/02/2016 [66285.716941] Call Trace: [66285.716955] dump_stack+0x4d/0x6f [66285.716966] __warn+0xc1/0xe0 [66285.716975] warn_slowpath_null+0x18/0x20 [66285.717004] crtc_crc_open+0x1d0/0x1f0 [drm] [66285.717014] ? wake_atomic_t_function+0x50/0x50 [66285.717024] full_proxy_open+0xf0/0x1b0 [66285.717032] ? full_proxy_release+0x80/0x80 [66285.717042] do_dentry_open.isra.17+0x14b/0x2d0 [66285.717051] vfs_open+0x42/0x60 [66285.717064] path_openat+0x5e7/0x13d0 [66285.717074] ? refcount_dec_and_test+0x11/0x20 [66285.717081] ? down_read+0xd/0x30 [66285.717087] do_filp_open+0x85/0xf0 [66285.717093] ? __vfs_write+0x23/0x120 [66285.717100] ? __alloc_fd+0x3a/0x170 [66285.717107] do_sys_open+0x11e/0x1f0 [66285.717113] ? do_sys_open+0x11e/0x1f0 [66285.717119] SyS_openat+0xf/0x20 [66285.717125] entry_SYSCALL_64_fastpath+0x17/0x98 [66285.717131] RIP: 0033:0x7f5f2235146a [66285.717135] RSP: 002b:00007ffd892e6bc0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 [66285.717142] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5f2235146a [66285.717147] RDX: 0000000000000000 RSI: 00007ffd892e6c40 RDI: 0000000000000006 [66285.717151] RBP: 00007ffd892e6b20 R08: 0000000000000000 R09: 000000000000000f [66285.717156] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 [66285.717161] R13: 00007ffd892e6b10 R14: 0000000000000004 R15: 00000000007e61f4 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100610 Fixes: e8fa5671183c ("drm: crc: Wait for a frame before returning from open()") Signed-off-by: Chris Wilson Cc: Tomeu Vizoso Cc: Daniel Vetter Reviewed-by: Tomeu Vizoso --- drivers/gpu/drm/drm_debugfs_crc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 1722d8f21449..aa13e734c9e5 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -177,13 +177,9 @@ static int crtc_crc_open(struct inode *inode, struct file *filep) * guess when this particular piece of HW will be ready to start * generating CRCs. */ - ret = wait_event_interruptible_lock_irq(crc->wq, - crtc_crc_data_count(crc), - crc->lock); + wait_event_lock_irq(crc->wq, crtc_crc_data_count(crc), crc->lock); spin_unlock_irq(&crc->lock); - WARN_ON(ret); - return 0; err_disable: