From patchwork Thu Oct 25 08:36:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10655603 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 39C3E13A9 for ; Thu, 25 Oct 2018 08:36:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2839F2B023 for ; Thu, 25 Oct 2018 08:36:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18E612B12E; Thu, 25 Oct 2018 08:36:48 +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=unavailable 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 C14032B023 for ; Thu, 25 Oct 2018 08:36:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 317366E391; Thu, 25 Oct 2018 08:36:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700058.outbound.protection.outlook.com [40.107.70.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id E33396E337; Thu, 25 Oct 2018 08:36:42 +0000 (UTC) Received: from CY4PR12CA0039.namprd12.prod.outlook.com (2603:10b6:903:129::25) by SN1PR12MB0624.namprd12.prod.outlook.com (2a01:111:e400:c428::18) 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:36:40 +0000 Received: from CO1NAM03FT055.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by CY4PR12CA0039.outlook.office365.com (2603:10b6:903:129::25) 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:36:40 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT055.mail.protection.outlook.com (10.152.81.162) 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:36:39 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Thu, 25 Oct 2018 03:36:38 -0500 From: Chunming Zhou To: Date: Thu, 25 Oct 2018 16:36:34 +0800 Message-ID: <20181025083634.7178-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)(346002)(376002)(39860400002)(136003)(396003)(2980300002)(428003)(189003)(199004)(5820100001)(54906003)(53936002)(97736004)(6916009)(53416004)(14444005)(4326008)(26005)(8676002)(106466001)(305945005)(1076002)(105586002)(36756003)(81166006)(77096007)(50226002)(81156014)(68736007)(7696005)(23676004)(8936002)(50466002)(478600001)(2906002)(126002)(1857600001)(2351001)(2616005)(2870700001)(72206003)(426003)(476003)(336012)(356004)(5660300001)(316002)(86362001)(186003)(6666004)(47776003)(66574009)(486006)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0624; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT055; 1:CiyC7JEJsujLoZl0VqruHPQjc5p+niD5WSIgyk2v6RcFRpj+yvdn+602hVMpUSwQZ0dbA1lvA5NZ1QpuSooWEikcOT/LQ5ArFO7pKFLUDXQQSobGfKzlalECpdKILVku X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d00da18-ba7a-4388-4edf-08d63a54fc28 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060); SRVR:SN1PR12MB0624; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0624; 3:Rte2gT6GvQ7QcNPW9T2R4fGQU1gFYDUpaM3+CkxFgdvQjuiWdXexBiPleFFdPphqvQW8GrmPDXmjlGD7+e8cgsF8jAoNowJwFE64Lvz/CMZ/VLFoiW+GnNMjywPtEWchP56wZegBiRck9d8qzlFmbFMyXVcJKjpxGCHShj09u5UeC3Wn5JQEn5fLfjg0a5rL10WCwamP64lkn/6I/IVn02iftl7RVWYDw2MUZlOJQEyZIJ+Di20Y/TPlWn+zLYXOjQsv0/Tl7zEhjcpVksN7TWOCTabja6QyCpwppisxjsJxGL5hx3aiAWg2o5ToLZTYp7v+Gj3R/6z7vINXYclthZIV8gWH/RyZ6uV4OMkIznw=; 25:TpKx60by+p1ByjWgQi8HzRxlRNWFKP9PaErLxke9BAR0ydC+pNvvaww1LAEn3cJZ4QraZUjBqUXmD0LRaCNKsWjlbIdfzTc8RrYRtukXv5C7p5j2KQkD8O0klhEaPAYUtwLRNjjRTORRTh/oRyXxbsmHgJcu4Ky3SUqRllYBM3H6938xuYdZcazjgGplEP8l73hcu7aH3X0KV5X6WhiyR85tzSOxdX4uBoheiRKKl+YOTyKbIsz2Jpw7EmPmFgwl3ll09ZuD/c99PeU53MO1+REWReuGj3PPV0rV6cu8h/dFPs0z0tBh9iM2Ttp9RHt4wFiEWT4d+k54UyOrfg0Eyc2UGx6q2U7FvlZLV5ZS7gQ= X-MS-TrafficTypeDiagnostic: SN1PR12MB0624: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0624; 31:GtMU8rXBIYR30YYVlrHDKTOisfQ3DPPJEpG4rkUHMg7Y5VyhPmtewDxPfuayeE7fp2OGKhKIePAI79pqs5Tiv9f/GfJWUHInfWmEbwEx/DRe1vNNy+cT160ZGFRWe7jlZnPcXYb51jHFbPY+zQV/g1ypRrwKoeEsfuneOOG2G7i4xE+Fespb7nM3Z6HRCozYMaLmivVFyUaXSl1yUa7kbanx+qqzUyg9FBHgfJ0uzTs=; 20:qR+SSpoDpuqXl2+XWyG9qeiPisnVMla0/wjbg4uNCuAEem4BwM1LP8tNgVRQQvAEqSkbJsXiZCl8xSElyCvsOhCWmE7X/WQThX6/kwO3+4Ln+a/RDFVJsoiT/AgDaXN2FC8EGbAbA6DJREjyRriItqdDIvnuak6kttoeRkKB9KFNDW1r3ZTNt/5OYJ60B7XImR1+/TCz/RBXBEsLXIhYnDlaFKNZL0I0fGgEsJb6zKq7dcCbJyRO+SooQkfOlNa4MoE3kuaXGcxEoNeZlRZSXhq6j1fEV5PIxqnefMHIozVOciMxUeiwwOO81rXSZEOZIGM9NMlrid1R8DghemefBgUHDnsfad/SeKL1dRxGqHljj36Mz6JcxagvqwDI8DaykDAj5uThvfERb9yvVBJUQTDHo0XMHRD2/WcZCC+lqy8IyjGpIbQenucPpIak7PO5ppU5zgfX+fc00IixuNp/rziKQq0FRDSBYNfk3maSnk7haYW6il1qNXkCvZCDzWSa 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)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:SN1PR12MB0624; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0624; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0624; 4:u627H33sK5ff3es4vzGZ3WSTUb+H2OF1Xzm5qKS5p4h7D4dPB0SrCa2toRDZgSVKZdUhWZ0lUKZ/QzJ6r0oUuTHaK12zhqZp5s5KpjaUYRlnAoAyQB7x/4I/U22AOZvjbOsGTroPb7nCG+XN4WbZYFFdpnyAjsU97AZlDF2y1DMyDE2kqCRaRVokv9nsIykU2WaOMBoqUKy9KXb+CJanpRhuGCSjVGFiKJZCrAMNRKykqSXR4jv1RDQJ1M2CMk6rDIAUjHXptos9ch1o0q9ue/aJik/dH6X1iCq71tH6vdS2Z37+zC6Rv0S8IV2dm5uXHqK+bkpAcx8binJKM8T1ejlRCQaPndOxkcp0Za93LPkKEhbI//01Bcj+oNJTl/RARrt3pi1CYmvTF9QLCNbGfXaGZnqfH8eFvrXjufcEo+1SnOlFSOfWPxIOx3wDy6lU X-Forefront-PRVS: 083691450C X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN1PR12MB0624=3B23=3AdqtY8HD?= =?utf-8?q?scSbvB0BGNNGb36GPYSRTVx+ORARHzI3kNeMhNW2GBTWgy4sK3COmjApym8I/t3wZ?= =?utf-8?q?lC8SdRFmyOO+9h7plwc6gUrqe9JMF/3p8zEcitMS82fTAfd+qajWDEz9AyGIFO1Zb?= =?utf-8?q?aC+esXNARaBTn7bmGgp465rZBun+NpOKhuZ0r7CWh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vuZdEkVobfLzQnZSHXKv/ngOOYiw5qcCzNqq+5zGSNnEijEhD4/VDYvkUSg7GqaLDa0YnEas4ddkuzzOjEKot4ErTEU+Z9ED/WTtItoof/2O4thME6c/ANcmAK5xTzPQG+aJFHvY/A5sJQ6MSFN830=; 7:wrZh69CnFilpnXh1tBwTcAAApdTbJ0s1FVuF5FW13+5KS1szCRD+ONQLqcExW8azxYQS5kBN9j0/ci+Gf2wsnmVZBpYbpYngzqqpdYpZHJPdZ+jOkCinTtkvT/gVZyAmRGa47h0UpUbfPcf8Q9//AB8NV0wunu3Vyw0illy6xjEy9eixwtopQECL7ZgUEG8vpwHEierSwuEM/uDZbQ1yhfklMRCMhjlUft/s+EfIEJat4Y557MTsxPUZEa/LDGE6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0624; 20:ElcoXn9LtlpRLCH1zEX2nD+uNPgrWkxAObScNet7VTEvVvPA6T/85TtxmLZH2HfAiyZrlzx9nU17Tq7pAwydZA7WLuVrjycGRWs+oFHQkd40CYwcmTRuI/J9/TMmUbK16ifrEfH9rMiQ/yazxchUhNQMBoK+BY2KftyN8NIUceuSIA+9ElTLUarLwe07ywUAD1zKJG6MLbNx78AIZebv3xDihFVIwBgl9cBPD3NdcO7rxi4FQwjoIGDHkrMmUZAp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2018 08:36:39.9636 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d00da18-ba7a-4388-4edf-08d63a54fc28 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0624 Subject: [Intel-gfx] [PATCH] drm: fix call_kern.cocci warnings 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 Signed-off-by: Chunming Zhou Cc: Maarten Lankhorst Cc: intel-gfx@lists.freedesktop.org Cc: Christian König --- drivers/gpu/drm/drm_syncobj.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index b7eaa603f368..c9099549ddcb 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -111,6 +111,7 @@ static struct dma_fence uint64_t point) { struct drm_syncobj_signal_pt *signal_pt; + struct dma_fence *fence = NULL; if ((syncobj->type == DRM_SYNCOBJ_TYPE_TIMELINE) && (point <= syncobj->timeline)) { @@ -131,15 +132,18 @@ static struct dma_fence return &fence->base; } + spin_lock(&syncobj->pt_lock); list_for_each_entry(signal_pt, &syncobj->signal_pt_list, list) { if (point > signal_pt->value) continue; if ((syncobj->type == DRM_SYNCOBJ_TYPE_BINARY) && (point != signal_pt->value)) continue; - return dma_fence_get(&signal_pt->fence_array->base); + fence = dma_fence_get(&signal_pt->fence_array->base); + break; } - return NULL; + spin_unlock(&syncobj->pt_lock); + return fence; } static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj, @@ -166,9 +170,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 +381,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; }