From patchwork Thu Oct 25 08:53:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10655615 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 7ECFA17DE for ; Thu, 25 Oct 2018 08:53:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A90527E5A for ; Thu, 25 Oct 2018 08:53:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58FA7283D9; Thu, 25 Oct 2018 08:53:24 +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=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 DB55F27E5A for ; Thu, 25 Oct 2018 08:53:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9815A89308; Thu, 25 Oct 2018 08:53:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0077.outbound.protection.outlook.com [104.47.41.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 954A1892FD; Thu, 25 Oct 2018 08:53:21 +0000 (UTC) Received: from CY4PR1201CA0020.namprd12.prod.outlook.com (2603:10b6:910:16::30) by BLUPR12MB0419.namprd12.prod.outlook.com (2a01:111:e400:516c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Thu, 25 Oct 2018 08:53:18 +0000 Received: from DM3NAM03FT039.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::206) by CY4PR1201CA0020.outlook.office365.com (2603:10b6:910:16::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1273.19 via Frontend Transport; Thu, 25 Oct 2018 08:53:18 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT039.mail.protection.outlook.com (10.152.83.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1273.13 via Frontend Transport; Thu, 25 Oct 2018 08:53:18 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Thu, 25 Oct 2018 03:53:06 -0500 From: Chunming Zhou To: Date: Thu, 25 Oct 2018 16:53:01 +0800 Message-ID: <20181025085301.8217-1-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(376002)(396003)(346002)(39860400002)(136003)(2980300002)(428003)(199004)(189003)(426003)(5660300001)(8676002)(97736004)(81156014)(23676004)(1857600001)(50226002)(336012)(77096007)(86362001)(316002)(14444005)(2870700001)(8936002)(50466002)(66574009)(6916009)(53936002)(186003)(47776003)(81166006)(68736007)(53416004)(2906002)(2351001)(6666004)(105586002)(356004)(478600001)(104016004)(126002)(305945005)(5820100001)(106466001)(7696005)(486006)(2616005)(476003)(26005)(54906003)(36756003)(72206003)(1076002)(4326008)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0419; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT039; 1:kez5TneWCmSY0hkoTJjU9NS6eMmQkyNNkEao20kJ+eg8T/i1ijt79FYJBxgmp5wyN1gckYqOZyFATLY+AKJjxLuodjx+pbzyiOreCGcvM1xc+1lx8+yLWsokmUlSyXT+ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a58e780f-b525-405a-d4bd-08d63a574f42 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060); SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 3:xI7JQQ3FBtEBtviIrgnj7UaQQWsqANdCch1aORW2dRctI+EZUJhypw3ITB7c1AGDsri/oQvMYxvymzSbMTU/Ni0j3R3l5GhTBLX5kR8Iu/FTYkimty35pjnJNNwk4CYQgsMXiSs/R+or63ytiSLbbskjSNL/IpnYtVXr3azPZ4ubjcx7hj/sPvLxGfVZmZERAKBnnnoc0vDRX0Cmk+spGWrLnWnehzI4XHa0VAVO5ehZOOGXeX1+ozEj9InSHT2lPIdHvLm7EiPdrooyXfy7kwbGWbC5ckRsikXhHgxALHPDDYDA4obGi+vhLRIqnZw1zO30vQuPVPKASmwLt41Xo4WfWQ9o1vLAKS41JiNG8rc=; 25:b2HkoStjlVXreR1hYL2uFLJp2lGa0la/1JtgBaQXXrcDC8Lrj05SOmny9iv3gvLHVUBMrkapMUwZwJIhsgfpJJmCvfPW7QuzTDAV/8Z0sbHXyvR8o7iUeWnBOC8/Dkikw2X8zK8N5yKOpSZoWAkM9kKcsBar5t+v4ebR+bPRbGkn9aVCkOrXi9uNSn3tTv4JyeNScPLnAqHUuQtogaMxhu7O8OFERszBWN0ZLK2lRLITJKHMEio66ykaJhVPknMEJ5IoG+H2qBF08beouUiXVwNlBdJpUrK+iyhak4O5mC3rysboQhZHe9wLzlSSdvtPhV3A9o721j/2zQu7npTS49QQmJ50wOLDc+avUgZxNBc= X-MS-TrafficTypeDiagnostic: BLUPR12MB0419: X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 31:mv0RBwmGQma7tagXuq8onckLYm3nfQSRpEsYwBc/SwpCsdYbFJtzZNuauukEfjjNa9vAdx4F08xy8Sr1oLP+FsDmqp4nWxIUliEQghKX+WUGmn7FZ9wxbgQ9jz8MHWyes4LFVWh7p85V9okyUeWX8JIg/mD4ENxIZDhtbugXf1XhdOF7Z34wZtgCsbWb7VYszq2IuYWzLAEPRTfOQ27xFL0p5Hs44WOytei8JHvUZuU=; 20:nkJ3OZ/vW0ZOzu6kr4Ch1cPCfcXKW+2mML842sQrVz/Hh1zCvQVML36YRruJvDrkRqk6T+c2LrtfBPwDW627xg0+3hzWU4w0dY9rAdag4Lpp6taDKc8svewi7I4scKizk7J7D80WGfH75yVBNLxAV9e08uAgPT9jp+Q1RmtM+NoVFz0gTrO6s0U9CB4TQNWeENSFkLET9LHFboDpjFB8WRCl5mFrRpfovWW75vyQPP5omX7Wbtle3HXO94dqWQevVBvRlKgmkAMK2+1OTTMPGJKD7L17ZUoeQ9g6ZY7RQ99w6X+07GpY36iyn9t1tAuIZ6ImoDGt++h91TMuY39YOf4KGI86zVR2aNax2fZFAAterJkXZgXyKxTED7KOiapZYfl44N5RRo/3mpojujUEj5mRej3rz4G90WUWk+xRvG0lWBJspiKqrUsXSBBtUTPYO1YeHWmzBlUoDhD09qJoannU/4hUhNQKXvVafgLVqCzfZU5wWBYQuntgwX+lx7AR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193)(767451399110)(228905959029699)(217544274631240)(8415204561270); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(3002001)(93006095)(93003095)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:BLUPR12MB0419; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 4:HkogjAVzfWAAed4TMC09EVP3W2fbYjqifwuaPgK5r1VcPdP0gdyzMqgsEJ8mUzvJVM8auPom62FOdVvdSqS6LYJuX4bKdY0tGPL/+1ZwVPyvoVlkY3XvKYvI0f+HExEOCwbkecLQCvqU/qMsHaohrzBL7SlM7Rt52Sy6Xg8Z9sqGTcTrjxVZ3LEdteLKMMtqvI83U8twZJb5DpjC3v/bQpEp/v5cLRho6/CzF+mhS7H/TMjHVxLsJd+emhkvwtirJreGNMpqFWO9ZjX13LBwd67EUJL7CF1a+x9ANSNVvOJIKdAW57dwaFsha9Vou6UJT0xZ2IMOkEWDECNEaq8/5V0mjrXaGF0facbaiM4ppCeZ/NtaFyklVUVnBKFc/1ufMj7NvXzShMQrXG873p3KFMWxxmi4L4r+DXkBK0EdmpAz+6xmcNIeUv72fT9FfBDL X-Forefront-PRVS: 083691450C X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBLUPR12MB0419=3B23=3AdOIX6EC?= =?utf-8?q?MtUAtBxjUz3lvAiSHelQ8ZRYFkleyf1tA8G8AvK0vcmkdqK7Za19X9Wylzo0DR1hM?= =?utf-8?q?+mZaDC0vuVZk+Gz3xR4I5X/Clr6vxIQGLMEQa2cxg8eza8GnwPyML46sMzJwFMCQF?= =?utf-8?q?ZgQwgO40ns90B0Q43/ZO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grvh6U0Rynml/OhDFujusNaP99KTyG2a4sHilP3bgr1Jx30cl6N/RNhJHXsEk62pbXNePNzaswzmYYhPUR9e+XB++LjIp+O8TC9IkL5Qx9c4tw==; 5:3IuNf/939KIPJh44NuI3REbhje269pWP8anmtiPVXKtXCCc7S3lftrXFM2RZre2w8Oh9cnYsdeeuAMr4m+6NqMPsXyrhe+QWMDkw2QDoh3aJaledlI1ZU1gdFZL48LL4gX8Givel0L3jZljSB4krgAlqfbgxibvbIHrVw/YI0cc=; 7:9y2ZKYoESpemo20qtmLCBFyA+oyM4sG7Kyl/Lj9VY6OYlNZNgNvAwHNWv8d+V3luvqTbSBZxyenKftvVAhmOA3cC0sdS+Nf4X1Utfz+3d5EBKNKUMdDCaosWbq7EQkk680u8efUFocPWVR6WXn/b089J+DYUaC/uWCSDshOIi1pyQ11EVfH+5NeKtcH7gikufl4jwKbRFgXtti1uB+Efmum2SJOJVZJmZC3pWBBFEDLO064zXC15AlAm9YzV9KUT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 20:RHFdT7HsBomUakCRhN8VCgqSC99tpD0paFo3xUvy7sDxUqChuNMoO0z+MORcV3/5TGk4xqaPq9n3dpokm1RNHk3Kd/gcwBtMs5aqATw46piKZqeq+UeqbMHJ8gJjuZClLX7nB+LquGwDKu5Hl4qyZnvu9a16gXS+Knbz1A2T+OcSKt4SaRaEYvJF4ZZ1xrkysUODKuHQq4OCX42Rtj7YkCFwcUH+JUQjtwsJJSs8Y000hT6RpHgKACuIzqH5svc3 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2018 08:53:18.3349 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a58e780f-b525-405a-d4bd-08d63a574f42 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0419 Subject: [Intel-gfx] [PATCH] drm: fix call_kern.cocci warnings v2 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= , Chunming Zhou , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP drivers/gpu/drm/drm_syncobj.c:202:4-14: ERROR: function drm_syncobj_find_signal_pt_for_point called on line 390 inside lock on line 389 but uses GFP_KERNEL Find functions that refer to GFP_KERNEL but are called with locks held. Semantic patch information: The proposed change of converting the GFP_KERNEL is not necessarily the correct one. It may be desired to unlock the lock, or to not call the function under the lock in the first place. Generated by: scripts/coccinelle/locks/call_kern.cocci v2: syncobj->timeline still needs protect. Signed-off-by: Chunming Zhou Cc: Maarten Lankhorst Cc: intel-gfx@lists.freedesktop.org Cc: Christian König --- drivers/gpu/drm/drm_syncobj.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index b7eaa603f368..b843d4c2778c 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -111,15 +111,16 @@ static struct dma_fence uint64_t point) { struct drm_syncobj_signal_pt *signal_pt; + struct dma_fence *f = NULL; + struct drm_syncobj_stub_fence *fence = + kzalloc(sizeof(struct drm_syncobj_stub_fence), + GFP_KERNEL); + if (!fence) + return NULL; + spin_lock(&syncobj->pt_lock); if ((syncobj->type == DRM_SYNCOBJ_TYPE_TIMELINE) && (point <= syncobj->timeline)) { - struct drm_syncobj_stub_fence *fence = - kzalloc(sizeof(struct drm_syncobj_stub_fence), - GFP_KERNEL); - - if (!fence) - return NULL; spin_lock_init(&fence->lock); dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops, @@ -128,6 +129,7 @@ static struct dma_fence point); dma_fence_signal(&fence->base); + spin_unlock(&syncobj->pt_lock); return &fence->base; } @@ -137,9 +139,12 @@ static struct dma_fence if ((syncobj->type == DRM_SYNCOBJ_TYPE_BINARY) && (point != signal_pt->value)) continue; - return dma_fence_get(&signal_pt->fence_array->base); + f = dma_fence_get(&signal_pt->fence_array->base); + break; } - return NULL; + spin_unlock(&syncobj->pt_lock); + kfree(fence); + return f; } static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj, @@ -166,9 +171,7 @@ static void drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj, } mutex_lock(&syncobj->cb_mutex); - spin_lock(&syncobj->pt_lock); *fence = drm_syncobj_find_signal_pt_for_point(syncobj, pt_value); - spin_unlock(&syncobj->pt_lock); if (!*fence) drm_syncobj_add_callback_locked(syncobj, cb, func); mutex_unlock(&syncobj->cb_mutex); @@ -379,11 +382,9 @@ drm_syncobj_point_get(struct drm_syncobj *syncobj, u64 point, u64 flags, if (ret < 0) return ret; } - spin_lock(&syncobj->pt_lock); *fence = drm_syncobj_find_signal_pt_for_point(syncobj, point); if (!*fence) ret = -EINVAL; - spin_unlock(&syncobj->pt_lock); return ret; }