From patchwork Mon Jan 18 21:01:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12028243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 736F1C433E6 for ; Mon, 18 Jan 2021 21:02:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 344DF22CAD for ; Mon, 18 Jan 2021 21:02:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 344DF22CAD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0930B6E5A3; Mon, 18 Jan 2021 21:02:32 +0000 (UTC) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750052.outbound.protection.outlook.com [40.107.75.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 188E26E5A2; Mon, 18 Jan 2021 21:02:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qdhq6+T8nA0nqrU5YHxIZI3hZ+h0eIpGEVx9KHf6FM+sg6Rxdab4CayRf2vHcllBmH0ik76yIktUJhNnKrFxsTItjpiqhDu8NJjrlGlDJJrIW0LAtQyatzzN/8ReMKhinMOaA84P7uazeXgGzIU9CYUrOHFizZpGUdB01Sz514Yf62DvVWdsh33hJJO8S51IKlBF7vctNSqyuQKdpE8PnfLun9Yt3JVyNjKxiono6Btrq8IHasIooEp/kkU+ZMief1cB74ctEN3LwkmJ1SpTbJDpMUKuAH132vHQr+XwL6tSi1z+uSB+GPiUD6c855ZEllFNXFmVG0BNMJDdonWxpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8vLdzE+IJs46N8vQKS6qBAcqDAEa3YfT3MnnF6Zcy0Y=; b=m7L2Weeu1nAC2j+op5xtimQ1E/4IU5jDqBMuRLup2XkblxfRlfIc/pfbdg06JDStJssr0YIa32AkfwZsia/L6DSHUx0jN37bLeXdAj49BCexLqe73FnHyen4oq/cajwwh4hzAWVLqx5EFTwKsl97ogLrO6mYV+utmbxV2+yEbsyCM2Qu7fIGzhIXsX0vc/WoC4jdcHPLxEMlEgWkg5ZXUqFXv9ansG6WxRNyDmTDK813N1sN3ufbdeeQvbU6mb8MxplBLK8srrTMxc81O9yLwWcydlRCtqm30vPHkyCz8ux5lHaOnD0QWFt65McaYFi9ZlJtLHTR4++jYUUvVo0BEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8vLdzE+IJs46N8vQKS6qBAcqDAEa3YfT3MnnF6Zcy0Y=; b=BH6FX0k0AOf9Hqv8bB1+Hc85jF4daVHd3ZMgEBicAuzYgi1qNWRQMZA+CpVrNGUjMblMCvu/UXvTU7FH6VbRL6TPwsHiD2+RoSdSUcUg+78IKa1WYtjEuymdRxr1A1yrqPNmG0QLL70LdWuR6is3+WoLZ12wQnL6qYPOm2D8hek= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB4623.namprd12.prod.outlook.com (2603:10b6:805:e9::17) by SN6PR12MB4767.namprd12.prod.outlook.com (2603:10b6:805:e5::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Mon, 18 Jan 2021 21:02:27 +0000 Received: from SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::5d30:b29d:5f5b:6921]) by SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::5d30:b29d:5f5b:6921%5]) with mapi id 15.20.3763.014; Mon, 18 Jan 2021 21:02:27 +0000 From: Andrey Grodzovsky To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, ckoenig.leichtzumerken@gmail.com, daniel.vetter@ffwll.ch, robh@kernel.org, l.stach@pengutronix.de, yuq825@gmail.com, eric@anholt.net Subject: [PATCH v4 04/14] drm/sched: Cancel and flush all oustatdning jobs before finish. Date: Mon, 18 Jan 2021 16:01:13 -0500 Message-Id: <1611003683-3534-5-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1611003683-3534-1-git-send-email-andrey.grodzovsky@amd.com> References: <1611003683-3534-1-git-send-email-andrey.grodzovsky@amd.com> X-Originating-IP: [2607:fea8:3edf:49b0:84d3:21cc:478c:efa7] X-ClientProxiedBy: YTXPR0101CA0020.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00::33) To SN6PR12MB4623.namprd12.prod.outlook.com (2603:10b6:805:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ubuntu-1604-test.hitronhub.home (2607:fea8:3edf:49b0:84d3:21cc:478c:efa7) by YTXPR0101CA0020.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3763.9 via Frontend Transport; Mon, 18 Jan 2021 21:02:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b0535b1a-2401-4ac1-db6e-08d8bbf45c87 X-MS-TrafficTypeDiagnostic: SN6PR12MB4767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:318; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rt0G0pYTcdm19yrYE2/xUpIzQTeKlcGNZ5pP+sb646ZF7NR1gCU9IuIKcawVNKfOsqyS9JGZAztHWWrt5T9+8JQNmwTRYFqQFQevOgFlWhqPNqj85USyMm7iQJKq8w0I8ExD4lUjv4loTjN5u+KVcZ3iiLmffo/sCOKFWdJtCgMi4pUohJhYMu0jM4zlmPYoEl9mKKrUWA9XLdqen00M2E4SNBk5qB4i7MKFhid2DA2/KCSC4Jd0ChxdGNZYBHH7IzoRMPjRqwlFjowjA9LwCIdQq+eMlft0tGnzM8FTPJTh+BX57VlpTB+G2L94C+3DQUP0UbO3p0jVUpSYco/pEqiFy2/aQAgzEkdL0tFl2haic9ME8f8nd28qoj6LDcBJdeg+vKW+Hr5uJTXWJwVb5g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR12MB4623.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(346002)(39860400002)(366004)(136003)(86362001)(66946007)(66574015)(6666004)(83380400001)(44832011)(8936002)(66556008)(316002)(6512007)(6486002)(36756003)(2616005)(66476007)(6506007)(4326008)(478600001)(5660300002)(7416002)(2906002)(52116002)(16526019)(4744005)(8676002)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?/FKLo+HrNXFiTWvsn4X8BkbZhadWVi?= =?utf-8?q?B70wWU7tPlrsCUpBw8iBUubbHVhbTTOr3kR8qjFHD4dFZvWuzwreAmvBEPdDR4e5p?= =?utf-8?q?oBD3u+qO7UQRlp/xygGT8xItw1sXR1NSJ+QGaqN80ahNJfgyrU6ylJjRwkDbL0GT7?= =?utf-8?q?BKEAdrvIfl/w+kHWzsv3AXkZAiq9BxwCsh1PuUCcu228pwVe7MJhvp2kSDMSGPTpJ?= =?utf-8?q?RjwXUMNTu7uNc8iBa6HZQSyVQXV40lUy8o69cY/bCzsPGcsi/IkIZmdkwWBaT7e8E?= =?utf-8?q?w7chstGT4akeR+2l9GmJakhd7vJI+hJ02+RsRU6oD8+aAOpuSzWwJOhrkqse5B7bM?= =?utf-8?q?APiLuNZPF0PfhtYoFT/p6xDff0G0LSqR2OgTrgbtYnFDsnYU/bxSwcahcB0Sc4QIw?= =?utf-8?q?sK/o2pOsazFzcCLZvP7JOCZr1rgB4KHNN7C12+g275btjf6N2ZXuGUpJpNKanG09u?= =?utf-8?q?ARpVsCseAGr4Jotxmm3/XDts6pjzLtf9F247O+9Y4Xf7yIKXMw4XMubuCk8x6NTQj?= =?utf-8?q?Lyk+k9QStdskQ927x7ve68NLtWKC7SEdSON6v0OY3kIqmy66/EwTsNqU/MbQ0dp3r?= =?utf-8?q?3sztgDF3RbZGG4QTHU6O0yQQzNmnZVgeSjB0ZZHc+MJCSPm73r7+KN1NTbDvotMnH?= =?utf-8?q?Vu1O50lvTsUWLHgnmpztTnxEIPM6YSUCClzImt+TVNVa/O7gfvXwFog0vdXyRLtNf?= =?utf-8?q?xDR5uYP/skdYPWrCSWRb7J72i8JyI/SFuPvARcXuy+5kn6a6qkFf6yZxlwkr9qbMJ?= =?utf-8?q?VnH/CcgFRIlHI1Qs4AxdJHjg/Gl267yHz9RWVK9SBHaQ56AkjJ3our/hBx4Y0HDvM?= =?utf-8?q?31hPu13uVnbnL2sbOCgwdE7+Zw1rV2Ev6qNv5/9ZKg0fuDgitjZvgEuix84AlbVU3?= =?utf-8?q?/tgg42IqaKgkZ/l99o3b7An3h5KQgHMukb79ztwoqxgmhmgP/ZqBm1ZgTEvj8LnHT?= =?utf-8?q?+AJD3ddzDNi/AmxVQTEge216DiD1bhhkEimOVJrWjsKcU54LTaa+l4+Ovi1Cpi1vZ?= =?utf-8?q?dI7J4NyFQxxfDwsiwSQ97ocDz0U6IsbQ2/WDNHlzp607Y3zh3+hkyjt2bEBHE3p/P?= =?utf-8?q?13W2kD9ie3dQTaGMe?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0535b1a-2401-4ac1-db6e-08d8bbf45c87 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4623.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2021 21:02:27.3965 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dLTK5EarHXw1Lct1o/bmZCpW+OTmkckEuJ9Qz/BKMjCJ0IIyfWcAiFvl1TTqdg7nnmAX/Cun/ll/g0Tf3XWQcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4767 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander.Deucher@amd.com, gregkh@linuxfoundation.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To avoid any possible use after free. Signed-off-by: Andrey Grodzovsky Reviewed-by: Christian König --- drivers/gpu/drm/scheduler/sched_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 997aa15..92637b7 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -899,6 +899,9 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched) if (sched->thread) kthread_stop(sched->thread); + /* Confirm no work left behind accessing device structures */ + cancel_delayed_work_sync(&sched->work_tdr); + sched->ready = false; } EXPORT_SYMBOL(drm_sched_fini);