From patchwork Wed Sep 26 16:18:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10616147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B60B3913 for ; Wed, 26 Sep 2018 16:19:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA2D12B3D5 for ; Wed, 26 Sep 2018 16:19:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E9BA2B3D9; Wed, 26 Sep 2018 16:19:43 +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=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 354472B3DA for ; Wed, 26 Sep 2018 16:19:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EED76E4A2; Wed, 26 Sep 2018 16:19:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-bn3nam04on061e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4e::61e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 245816E499 for ; Wed, 26 Sep 2018 16:19:16 +0000 (UTC) Received: from localhost.localdomain (155.4.205.56) by DM6PR05MB4588.namprd05.prod.outlook.com (2603:10b6:5:9f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.14; Wed, 26 Sep 2018 16:19:12 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH -next 07/18] drm/vmwgfx: Replace unconditional mutex unlocked warnings with lockdep counterpart Date: Wed, 26 Sep 2018 18:18:28 +0200 Message-Id: <20180926161839.4549-7-thellstrom@vmware.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180926161839.4549-1-thellstrom@vmware.com> References: <20180926161839.4549-1-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: VI1PR0601CA0020.eurprd06.prod.outlook.com (2603:10a6:800:1e::30) To DM6PR05MB4588.namprd05.prod.outlook.com (2603:10b6:5:9f::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 70b74172-3b02-4946-9305-08d623cbcca3 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:DM6PR05MB4588; X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4588; 3:aYxwYoy7IUH2j3M8cMCdYVsRA9xZEkYQukF7IKWzktQVL67YQUOf3G0NumsJ46ihvQk70MNcDVE7rTIgz2xqbazPX5Wm1Wc1E/JdPU4sbSMunxr+5x+4djryRbU4C07NP6sU8MxmMJEiIOA5ApjpV1Rfe76Gf21S68B4qQDf47x2TsMYn05s72aFiigV10lx+p+kKLRNhTSCBAq6ReYmOrSk1JcUCTykJ0fbIF4U5RWTT7EBxjcFfT3bA3J9q3Nw; 25:fKcYUYennh+nkB9EAmqG9CcXT51OpDKrJqCksUgNq2wJdL0Z8QD9X/XShYCcmXf6hA9LGlhV7np8qoNeoTXY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sRF2GIWfYuAmX57e5sGb61AL0iEu6qmJvuZ5c29xbyjhaylZvG97xbMmoxDaszOEd/tbW65g2r9p8HPL4rIlqAAf4HtcnDTGKc5LIhKF+m2tAwhK97WyfMyUAccAPv8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(61668805478150); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(3002001)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991041); SRVR:DM6PR05MB4588; BCL:0; PCL:0; RULEID:; SRVR:DM6PR05MB4588; X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4588; 4:UMz+PGel16WM94EsRsmaPS0MAH4BCXN2bqLBUH7s61L6Aa8DgqBtQEo9xjuHXhsh/eOO+f7mUlgBjzHJu87KMUIr/Ib69SOMkq2oXh0NCi+2CPkqe0yMWMeUvD2YpSDXm9xOJHbKyUpdGrRseIGfy+OL7aCV1rfHPaHhQPds+fkexaTM+jb/jC1Wo8b+nAquKfcVmsqydrUYTJjflpJHFG4ZjhxlpPRV8HIu/ZRQXTzdyR8o2QQCZzy9nK4vxc/F3/TOdB6JQwsldtj0ldZcxqZ/KNT+/v0xVR2ITyKGZmdtukLikI6fOugK/GrbzK6JbxXJEdcD4arSu57r4Gzyv/ShkbFS3u6BLiimCbXxUS8= X-Forefront-PRVS: 08076ABC99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(376002)(366004)(396003)(136003)(39860400002)(199004)(189003)(11346002)(186003)(105586002)(36756003)(47776003)(26005)(66066001)(6512007)(2351001)(305945005)(14444005)(446003)(2361001)(486006)(16526019)(106356001)(7736002)(5660300001)(476003)(6666003)(53936002)(86362001)(6486002)(97736004)(69590400006)(478600001)(68736007)(50466002)(25786009)(8936002)(316002)(16586007)(48376002)(956004)(2616005)(386003)(76176011)(6506007)(3846002)(6916009)(51416003)(1076002)(4326008)(8676002)(81166006)(50226002)(6116002)(107886003)(2906002)(81156014)(52116002)(34290500001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR05MB4588; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR05MB4588; 23:nS94tAym8bPLcnfEt+05DD/VghF/bOfxgf13nyvTC?= Fmg9AQ/GnhXz9AzAEbI3smGQmK2HeL0NSH9/ESyJIRFu6+nmQCyHSvW42DNNxypVa2MquOCCwAXi3SYz2ieTiPI1CuvG9DqwGLeqA5H9W0IZ0rPCxF9TnqtUOFSbjWfsMPZkzerF201uDqOUifxg9xJCaJfpH5y7XN3HexqqBmB3UdWLHdTT/+G72yV3s/hJz549YQfOiwKFJ0nQlYrFR7nyt2bXI+CwOKElBNXl5VV9AL/t0iOXjUBRf34tER9YD8YIQnzEuMWjvYzc96thjzHT+7iZd/7ztfUfeJyIPqMGEfI4fy0+Xz2GzdDuQVevnHc9wswCWlUwP690xcG9eYJUmc8CXqn7NrYmNq+tRcgfH4FzGdw4+OET24QFRcnC1apw0m8Qo8Njcc/m5XSohsZd5aBjzoTNfXgKQL37cCYV6wZtF8tm9p6jQCFxOkxTJZ+17Hf7cUdwnc5MevwQ/Y62TMRAx1fgB86XSk1xpu1cchh41HbBCjAjIPBb/8BwaZ1PfnKjnRRW89Z1zy+cjZBy3YXZWIdjVYLqZC5jD3v7ZhJu2WrD76wAd1EofOHU361QpC5WATOdazdyrdimktaJMiDJEjM7evyKXte169jqtxdDeXqSDDHl8IZbK/ErwqGQhBGfEGq1KTg9B9kUSZuKBxaqHxdQw29/lVDgH3r5f0IzcJqLJAVjd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fjnceoEVIr/PSVZRAzeRn3aHllqgqovVpiFu38oWwk/WvLRCA= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 16:19:12.9743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70b74172-3b02-4946-9305-08d623cbcca3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4588 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: , Cc: Thomas Hellstrom , linux-graphics-maintainer@vmware.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Replace instances of WARN_ON[_ONCE](!mutex_is_held()) with lockdep_assert_held(). This makes sure the checking process actually holds the mutex and also removes the checks from release builds Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh Reviewed-by: Deepak Rawat --- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_so.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c index e7e4655d3f36..48d1380a952e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c @@ -660,7 +660,7 @@ static void __vmw_cmdbuf_cur_flush(struct vmw_cmdbuf_man *man) { struct vmw_cmdbuf_header *cur = man->cur; - WARN_ON(!mutex_is_locked(&man->cur_mutex)); + lockdep_assert_held_once(&man->cur_mutex); if (!cur) return; @@ -1045,7 +1045,7 @@ static void vmw_cmdbuf_commit_cur(struct vmw_cmdbuf_man *man, { struct vmw_cmdbuf_header *cur = man->cur; - WARN_ON(!mutex_is_locked(&man->cur_mutex)); + lockdep_assert_held_once(&man->cur_mutex); WARN_ON(size > cur->reserved); man->cur_pos += size; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c index fe4842ca3b6e..e03431aef3d0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c @@ -562,7 +562,7 @@ void vmw_dx_shader_cotable_list_scrub(struct vmw_private *dev_priv, { struct vmw_dx_shader *entry, *next; - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); + lockdep_assert_held_once(&dev_priv->binding_mutex); list_for_each_entry_safe(entry, next, list, cotable_head) { WARN_ON(vmw_dx_shader_scrub(&entry->res)); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c index e9b6b7baa009..a01de4845eb7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c @@ -208,7 +208,7 @@ static int vmw_view_destroy(struct vmw_resource *res) union vmw_view_destroy body; } *cmd; - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); + lockdep_assert_held_once(&dev_priv->binding_mutex); vmw_binding_res_list_scrub(&res->binding_head); if (!view->committed || res->id == -1) @@ -439,7 +439,7 @@ void vmw_view_cotable_list_destroy(struct vmw_private *dev_priv, { struct vmw_view *entry, *next; - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); + lockdep_assert_held_once(&dev_priv->binding_mutex); list_for_each_entry_safe(entry, next, list, cotable_head) WARN_ON(vmw_view_destroy(&entry->res)); @@ -459,7 +459,7 @@ void vmw_view_surface_list_destroy(struct vmw_private *dev_priv, { struct vmw_view *entry, *next; - WARN_ON_ONCE(!mutex_is_locked(&dev_priv->binding_mutex)); + lockdep_assert_held_once(&dev_priv->binding_mutex); list_for_each_entry_safe(entry, next, list, srf_head) WARN_ON(vmw_view_destroy(&entry->res));