From patchwork Tue Mar 28 08:43:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 9648379 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 D5B7F60349 for ; Tue, 28 Mar 2017 08:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA7B220855 for ; Tue, 28 Mar 2017 08:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF00626247; Tue, 28 Mar 2017 08:44:10 +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 C266E20855 for ; Tue, 28 Mar 2017 08:44:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37A566E51F; Tue, 28 Mar 2017 08:44:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 87123 seconds by postgrey-1.35 at gabe; Tue, 28 Mar 2017 08:44:06 UTC Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0064.outbound.protection.outlook.com [104.47.34.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9B5526E51F for ; Tue, 28 Mar 2017 08:44:06 +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=ZEjSkA5+R70ZN3aSVTPk6CYz2yXZIEtkvnjzuJlgAyw=; b=Uyv2k4kCBpFJ9nXcWQNadUpI9YO1uwqH1pCGIdA2oGD+364A+sxLA/fP5EN9A6ss9MJ5Yy4Qo1p5FThrWvOMEtsB+dbnR6iHAGSHCW8A9My0YCZeDjWbhqq7zAC6EJo+VjFkLGva9Qik0y5G7oZg7xHl0fA/lS6NA9Djk4lv3xc= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=vmware.com; Received: from linvm2.localdomain (155.4.205.56) by BY2PR05MB759.namprd05.prod.outlook.com (10.141.224.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.4; Tue, 28 Mar 2017 08:44:04 +0000 From: Thomas Hellstrom To: Subject: [PATCH] drm/ttm: Avoid calling drm_ht_remove from atomic context Date: Tue, 28 Mar 2017 10:43:14 +0200 Message-ID: <1490690594-4195-1-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: AM4PR05CA0002.eurprd05.prod.outlook.com (10.171.184.143) To BY2PR05MB759.namprd05.prod.outlook.com (10.141.224.23) X-MS-Office365-Filtering-Correlation-Id: 8377f53f-ccd2-4f7e-a588-08d475b6973d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423058)(201703031133064); SRVR:BY2PR05MB759; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB759; 3:nZK8H1YFpHUVswcSVeorq14K7H3KQLXtHuVxZ/yd1HD5c/YVTlcdQsTXlnxVg5Upqyn/pQW3VKfSYX6hocPRIo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TLs2u9zJOAMJPXxtYtRXrGcJ16Isy4Ul6S660AmWneHMndhuKsQOdbFiY1DLKgWjd8HcTAyT0WwY/bjnF5QI7oeLiEsn1h11DFqBa0BP76r/WJkm7UxmsxFJK59mNePv5PLjxBP0PKkHU9A9cloW5rEJdAJYzRNRtk0y1gfZFSyNDquzljEAngbuS8BT8nvDlQtX+gvMn3bQFVDf5raNe8A+1aYBQGPdAVKz03twB8rMf9kj7dIw+1XjvGF406JuUDB2D48LW9/2pc85HnS5vCHNZd50AXFUYRQPs5OEjYdl60J1SFwV/V+tXpMF9IZoBrcvNtckBZODtNAowiMZ+o2HyqZkcvH+DO/vzVaXVso59/E3Gw8Gn464ZH7wNCUGQ46PSS/r+C0uuQEYOBMOlGMkEosn30QEwFBhR7MNz7vPKLtVi4vaA5kqoXbGBO5pmudbFhmObfO1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040432)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123564025)(20161123558025)(20161123560025)(20161123562025)(20161123555025)(201703131423057)(201702281528057)(201703061421057)(201703061406057)(6072148); SRVR:BY2PR05MB759; BCL:0; PCL:0; RULEID:; SRVR:BY2PR05MB759; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB759; 4:aUWaPut7LsefDl/JIjPlZ+s0wO8h/aNyszwCCql32WpbANw6ssgsGLZ3qLMiZod/AL1bww3+3RRsM3EsuiOLPW/AWVNXtd+2/xarnsFeeyE9ii7Mv8Km0RtVeGxC/k0T1FR0rgCYe1Lx6W7rPckI+X0g/PX4nSnRQV2RAhwUQbDUYjQRpnW/etUomCAASv221HpRDxazNpwR1MlO6DaxWB2ZN0vRQcEQ1TRQyf6DSNorP/3xCV3gYAckhUUjsEzjt2iwmin0Vb2bUU+768MZVQYvzJDIhErY6CZmyh8zH8tW1aErdhX9csV/zWXsqlqxbexA0iH/zXnmyo/OU8/xpv1uchXd1YKrzRtt3zVS1zYSnrgEo2gdZ43kjNu5b6XUrMprgYDL1UzUvEeYrFIe07+fKuGX8FH67zdNl1jSPi1j7zVX0fRSMAqLB/bJ6y5QoJYFsiWAeLlj5o7RpfQsU7hsvYKq6KXj0O59bto2bkPjMf73YgaBN7DjwoXByokfu7RyIhqW9K+Kv/4m6x8vthKpwGCPff5sM38ZEVK5z+I8sJWjT0o3ITKwawtDcsnUTR99xTVwSmVjcmSQmMiUXlPqLFEgL5A9MMt+nEnK73uspTJQEbNe0vgdVQWpVLyuz3Fu/jo4ACj0rSsI+3tpPbV2UC13cKUlPAlwW1EEspRLUI2wiycLWHp8WZedpbCd7b4MNZ1XPQwQzQvgrQEZBkMj7G1DdHBp5XSxr2LK/Jv1ME9/tuG1EZ4J7dvM8H/S/vMJTodmGLbjvDhh/II74At43GkWVJMaF+R2+qarVrE= X-Forefront-PRVS: 0260457E99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39850400002)(39840400002)(39410400002)(39400400002)(5003940100001)(2351001)(6666003)(6916009)(8676002)(305945005)(7736002)(4326008)(50466002)(107886003)(38730400002)(110136004)(53936002)(33646002)(6116002)(3846002)(36756003)(6506006)(66066001)(42186005)(6486002)(6512007)(50226002)(81166006)(86362001)(50986999)(189998001)(5660300001)(2906002)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR05MB759; H:linvm2.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB759; 23:WhwM4SEsLWB+f3dBeKPa+Nsd+D1dl9IkjhVA1mywU0Ukp1ofJJZQfK78eZVWvObITQaHtxvIoCn7747ykZXgJGDwdULQ7ezVV5L4T8EWVLZ0c7RqraGcfxfyZiLnIts62yN45sLpECqk9ftt2Tmwwh6WKNJmCAazMcbESge7rNu5Is2134snAMA/0k/+QbAcAycTcuPV6LM9bOZ+/pglRXQuIS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P+KTViip0ds4qmYwIf4eXT6bgWdELOZz7lIvzCGXea/Cg43zIS0WXYyaIQ9RH/Grwwa1qF/cv+Q6x2028lE3QFCmWHv9fnQdw1c9B17YU33JKA==; 5:ZW0evIx/aJeApdOOyvMsoi7ediSsELaepNPLO9wekY+/X2VZqJx+xiz8BMUG0ns7k7Jiz6oG8WpDMIuB6yr99uknLQ9jxEAGws/Kk1PEaHgLuqKP6vq/YdbH/rvZKqQBjESbI3taSTe1g6iTFZA85A==; 24:yA55Dndhqm9dzhPireF5lh24jsj2PNDrWN9HOzK9PVbyt1V7c+lPWQZwfi1HXEUHihVBKzReHLUnH0LZFesw0811DWc7D1QNmTCEu6KNQVs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB759; 7:4+fcPRMiPvKC9R1VJjfBMs+yy7t9WPYcfJegce1rtYUIRq5r3CSEiL0oXeX9NsP58idUma4T4Hq8Pesr9SdkyCdcVzl1v9zvApiUIHVBDqWKOxQqZtBEnc6YVEDHDj2h3OdVSt4GCUvFJmFpzJp9JdFrVZpviJPZSjjWFfFAnxHsgK/GEXDlIup8O5TwpXkGmhS//qdlnadYEerhVKYV6rp5zwKFFRfaaHuwvwJJLNXNuTmBIqngp4nzic7WxDwF12vNbfEx45qtdmUVOJhKmdrj2FKetw8v+H83Iye3WWYiVGnZ2QgqHJsr8vFz3zOk6uOvfP4KF6U6DcEQFQj6gA==; 20:xAc716JiqFIJhqGPHgUFVrdiG+TSQ/tZKSFQl20fnpne61cANenKx1ttMIOWinCJPQN19aSW3IUrTwwSURNxGNO4wBvohs7UUCBKAb/RZY0TEL6TDsLreDS/Mzvgzu0fTX7Xtge0b1HprNEpGOh7vRqzyR5dcvjo9lnpkw1noPo= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2017 08:44:04.1254 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR05MB759 Cc: Thomas Hellstrom 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On recent kernels, calling drm_ht_remove triggers a might_sleep() warning from within vfree(). So avoid calling it from atomic context. The use-cases we fix here are both from destructors so there should be no concurrent use of the hash tables. Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/ttm/ttm_object.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c index d750140..26a7ad0 100644 --- a/drivers/gpu/drm/ttm/ttm_object.c +++ b/drivers/gpu/drm/ttm/ttm_object.c @@ -453,10 +453,10 @@ void ttm_object_file_release(struct ttm_object_file **p_tfile) ttm_ref_object_release(&ref->kref); } + spin_unlock(&tfile->lock); for (i = 0; i < TTM_REF_NUM; ++i) drm_ht_remove(&tfile->ref_hash[i]); - spin_unlock(&tfile->lock); ttm_object_file_unref(&tfile); } EXPORT_SYMBOL(ttm_object_file_release); @@ -533,9 +533,7 @@ void ttm_object_device_release(struct ttm_object_device **p_tdev) *p_tdev = NULL; - spin_lock(&tdev->object_lock); drm_ht_remove(&tdev->object_hash); - spin_unlock(&tdev->object_lock); kfree(tdev); }