From patchwork Tue Dec 11 10:34:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10723429 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 4D1DD1751 for ; Tue, 11 Dec 2018 10:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A5922A0AA for ; Tue, 11 Dec 2018 10:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E7AF2A0DC; Tue, 11 Dec 2018 10:35:16 +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 9E4B22A0AA for ; Tue, 11 Dec 2018 10:35:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C26C86E08D; Tue, 11 Dec 2018 10:35:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790044.outbound.protection.outlook.com [40.107.79.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id DABF089F45; Tue, 11 Dec 2018 10:35:12 +0000 (UTC) Received: from SN1PR12CA0096.namprd12.prod.outlook.com (2603:10b6:802:21::31) by CY1PR12MB0839.namprd12.prod.outlook.com (2a01:111:e400:59d2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Tue, 11 Dec 2018 10:35:11 +0000 Received: from BY2NAM03FT023.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::208) by SN1PR12CA0096.outlook.office365.com (2603:10b6:802:21::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1404.23 via Frontend Transport; Tue, 11 Dec 2018 10:35:10 +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 BY2NAM03FT023.mail.protection.outlook.com (10.152.84.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.16 via Frontend Transport; Tue, 11 Dec 2018 10:35:10 +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; Tue, 11 Dec 2018 04:35:08 -0600 From: Chunming Zhou To: , , , Date: Tue, 11 Dec 2018 18:34:41 +0800 Message-ID: <20181211103449.25899-2-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181211103449.25899-1-david1.zhou@amd.com> References: <20181211103449.25899-1-david1.zhou@amd.com> 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)(396003)(39860400002)(376002)(136003)(346002)(2980300002)(428003)(199004)(189003)(478600001)(486006)(1076002)(53936002)(105586002)(2201001)(186003)(81166006)(476003)(5660300001)(39060400002)(81156014)(23676004)(106466001)(14444005)(6666004)(5820100001)(76176011)(446003)(356004)(126002)(97736004)(575784001)(11346002)(50466002)(8676002)(26005)(2616005)(86362001)(426003)(8936002)(77096007)(50226002)(110136005)(54906003)(4326008)(66574011)(36756003)(2870700001)(336012)(2906002)(316002)(47776003)(104016004)(53416004)(305945005)(7696005)(72206003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0839; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT023; 1:6PeHA/K0vcNtj3CU8VG3BdmSCSF0ysctw9jI1TWGU3F+sY+oKcpPim6yzzdTHQP0kePOeVW3P0HIdcP1SEBQMUTFEb9bfgaFSsFyP9bYnBMfKvezjH/DDuguzynzGU+4 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f805b5af-4ac7-4d02-269d-08d65f5453c8 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:CY1PR12MB0839; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 3:N+g7Ou0+qwj3Uj+VheCOlPVDpWl/bjh+Wg7GsvMNhZ/M2XPK1IB7MMEwb752jVgLIF5Zqo/tPb1wggkJW4MQWzHjHVOsIFULsEbPIGEeXt0+DIEqUYUpeJoX/YPJt0hfnLWEQqgHgkEur4CZlAZIUfpzXVFptQeR6ZhPbj9iblhqHitBPtM0bV4iLJqK39hcR9jkD5beftfYgXNMtHTILelq5BGo9YZwsvzGdO+xWSd0TO0MdYT7+aBSDJsD8A07AjM+8J8Wq9JpDg0UgcccQ8FgAFZ2pyjCufrVyYOGvImvdm5u6cdbW0leVRniEdELlv+SxgqYY8kfvPGHCCilh6VLqhsN6Z7ghizl/basXWk=; 25:GMJhO191/rLx6QUDzUf4jSKIsBUvs9ehvIhVGOKlzj0T15P76uYKbvb1YIdauiotN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PV6AsofTBdTyc1uh5PSjnFxwkT9dz8NJrbY0jROHTHd6PaqOW X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3231472)(944501520)(52105112)(3002001)(10201501046)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:CY1PR12MB0839; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0839; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 4:W2I3TxU4lZirYkaVzRuBxw7t+TsBSxGO1KTuKHddv5T6upSHQqdiLMsuS6YtQ9HfHY2MP9sgmxjjswRhnp3bvjitFlOm/1C+vox+Xeg2Lgn8vw2HBxANVOOj9xLdlsq7O2oOiz6dOrsXc38uiY7Bgf0R2HgECsrZkAMNQ8COIlxQ/63nVDQl/rZDIBxcSgb5h5pCqRptdsVMPpelrnnxFr9l8HV+XeuAgIP+uNkQ5B/jMkqUwHSyqTrVfh3X6PFYiwnXV92kax7gR8lXb4aV4Q== X-Forefront-PRVS: 08831F51DC X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BCY1PR12MB0839=3B23=3AL0ObFgH?= =?utf-8?q?ir2sK38FVX7TIeEDVXjuXwUbRJ7+bSTvyP+hk3Mf8144u717DafkVR+7uUpLb9Dk5?= =?utf-8?q?ZE/NX9eMSJqlJObjdcsNkFONbueXzZQq1ZpEGCRtEkr6B0LM0Go8DF+rEBo66znv2?= =?utf-8?q?zxRE1ooz++RkKOcUhINnhTtk6f0/hkP+BRMOBC5LzoopNg1D861iBbejkgiHnI74+?= =?utf-8?q?EdXrAv9GRv3hxwOnT9hmTrbw14WZRbsU5u9uOev3XRrqJHa1kHK1V8M42tRZDthLA?= =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IheYLNep3rO/htdmcVzMTwRUYXzIMwTnlXXJwp26zlk7uFe4GEM2Ta9oHz93Sa1My1gdknU5w50phEtYsCURB9B0IRIkkvsiamn5D+lRR08HGXTCUr5KB9M=; 7:bJYPXHIOgg2lWjEjs4E/lqMBHRsABdMMlCrb6dot9gmaNweFoHFyn078Ha0jC3qbbpUgQkXHJgclblEpsSv4UyYFGQQBUM3bHPk0/+947+R+VwKensl4thZhPEpBgamJsdyeVrmyM5IAw+Ddruqe4A== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0839; 20:o/aFvDwscqWjhipwIk/hsxtvkaJycWeVN6cuwimDUWgW2nbOAjWwY5cBY9vrmpbIsshXYKz1F4FO8C1qx9xuJW8SSlDAYgmnsvQbY411Qpz6+hWc8p+1Phu41KrQx3f63JUA7W1zfIXqYrZU9yIlwHXsgJv1HmVfksU9s0FKMrV61ogjqZO3zt7cHLcUcXQMMrU5Pp8RVI9DKHAdHcF4KcpzinqGwkcqElrAodLr9K5jc2cn2/0uskgRNsEZ6CZj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2018 10:35:10.4990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f805b5af-4ac7-4d02-269d-08d65f5453c8 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: CY1PR12MB0839 Subject: [Intel-gfx] [PATCH 02/10] drm/syncobj: remove drm_syncobj_cb and cleanup 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?= , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König This completes "drm/syncobj: Drop add/remove_callback from driver interface" and cleans up the implementation a bit. Signed-off-by: Christian König --- drivers/gpu/drm/drm_syncobj.c | 91 ++++++++++++----------------------- include/drm/drm_syncobj.h | 21 -------- 2 files changed, 30 insertions(+), 82 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index db30a0e89db8..e19525af0cce 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -56,6 +56,16 @@ #include "drm_internal.h" #include +struct syncobj_wait_entry { + struct list_head node; + struct task_struct *task; + struct dma_fence *fence; + struct dma_fence_cb fence_cb; +}; + +static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, + struct syncobj_wait_entry *wait); + /** * drm_syncobj_find - lookup and reference a sync object. * @file_private: drm file private pointer @@ -82,58 +92,33 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, } EXPORT_SYMBOL(drm_syncobj_find); -static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb, - drm_syncobj_func_t func) +static void drm_syncobj_fence_add_wait(struct drm_syncobj *syncobj, + struct syncobj_wait_entry *wait) { - cb->func = func; - list_add_tail(&cb->node, &syncobj->cb_list); -} - -static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj, - struct dma_fence **fence, - struct drm_syncobj_cb *cb, - drm_syncobj_func_t func) -{ - int ret; - - *fence = drm_syncobj_fence_get(syncobj); - if (*fence) - return 1; + if (wait->fence) + return; spin_lock(&syncobj->lock); /* We've already tried once to get a fence and failed. Now that we * have the lock, try one more time just to be sure we don't add a * callback when a fence has already been set. */ - if (syncobj->fence) { - *fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, - lockdep_is_held(&syncobj->lock))); - ret = 1; - } else { - *fence = NULL; - drm_syncobj_add_callback_locked(syncobj, cb, func); - ret = 0; - } + if (syncobj->fence) + wait->fence = dma_fence_get( + rcu_dereference_protected(syncobj->fence, 1)); + else + list_add_tail(&wait->node, &syncobj->cb_list); spin_unlock(&syncobj->lock); - - return ret; } -void drm_syncobj_add_callback(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb, - drm_syncobj_func_t func) +static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj, + struct syncobj_wait_entry *wait) { - spin_lock(&syncobj->lock); - drm_syncobj_add_callback_locked(syncobj, cb, func); - spin_unlock(&syncobj->lock); -} + if (!wait->node.next) + return; -void drm_syncobj_remove_callback(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb) -{ spin_lock(&syncobj->lock); - list_del_init(&cb->node); + list_del_init(&wait->node); spin_unlock(&syncobj->lock); } @@ -148,7 +133,7 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence) { struct dma_fence *old_fence; - struct drm_syncobj_cb *cur, *tmp; + struct syncobj_wait_entry *cur, *tmp; if (fence) dma_fence_get(fence); @@ -162,7 +147,7 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, if (fence != old_fence) { list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { list_del_init(&cur->node); - cur->func(syncobj, cur); + syncobj_wait_syncobj_func(syncobj, cur); } } @@ -608,13 +593,6 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, &args->handle); } -struct syncobj_wait_entry { - struct task_struct *task; - struct dma_fence *fence; - struct dma_fence_cb fence_cb; - struct drm_syncobj_cb syncobj_cb; -}; - static void syncobj_wait_fence_func(struct dma_fence *fence, struct dma_fence_cb *cb) { @@ -625,11 +603,8 @@ static void syncobj_wait_fence_func(struct dma_fence *fence, } static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb) + struct syncobj_wait_entry *wait) { - struct syncobj_wait_entry *wait = - container_of(cb, struct syncobj_wait_entry, syncobj_cb); - /* This happens inside the syncobj lock */ wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, lockdep_is_held(&syncobj->lock))); @@ -688,12 +663,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, */ if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { - for (i = 0; i < count; ++i) { - drm_syncobj_fence_get_or_add_callback(syncobjs[i], - &entries[i].fence, - &entries[i].syncobj_cb, - syncobj_wait_syncobj_func); - } + for (i = 0; i < count; ++i) + drm_syncobj_fence_add_wait(syncobjs[i], &entries[i]); } do { @@ -742,9 +713,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, cleanup_entries: for (i = 0; i < count; ++i) { - if (entries[i].syncobj_cb.func) - drm_syncobj_remove_callback(syncobjs[i], - &entries[i].syncobj_cb); + drm_syncobj_remove_wait(syncobjs[i], &entries[i]); if (entries[i].fence_cb.func) dma_fence_remove_callback(entries[i].fence, &entries[i].fence_cb); diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index b1fe921f8e8f..7c6ed845c70d 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h @@ -28,8 +28,6 @@ #include "linux/dma-fence.h" -struct drm_syncobj_cb; - /** * struct drm_syncobj - sync object. * @@ -62,25 +60,6 @@ struct drm_syncobj { struct file *file; }; -typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj, - struct drm_syncobj_cb *cb); - -/** - * struct drm_syncobj_cb - callback for drm_syncobj_add_callback - * @node: used by drm_syncob_add_callback to append this struct to - * &drm_syncobj.cb_list - * @func: drm_syncobj_func_t to call - * - * This struct will be initialized by drm_syncobj_add_callback, additional - * data can be passed along by embedding drm_syncobj_cb in another struct. - * The callback will get called the next time drm_syncobj_replace_fence is - * called. - */ -struct drm_syncobj_cb { - struct list_head node; - drm_syncobj_func_t func; -}; - void drm_syncobj_free(struct kref *kref); /**