From patchwork Wed Nov 6 17:51:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 11230791 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C98831709 for ; Wed, 6 Nov 2019 17:51:24 +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 B0B3B214D8 for ; Wed, 6 Nov 2019 17:51:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0B3B214D8 Authentication-Results: mail.kernel.org; dmarc=none (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 F2F3E6EE20; Wed, 6 Nov 2019 17:51:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740050.outbound.protection.outlook.com [40.107.74.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id B176E6EE1D; Wed, 6 Nov 2019 17:51:20 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FFKzbDXvrbol1ENv6mT1+Zg/ij4Vkf+8oZ2dTEXSkv8hFt6i/m7+qJiQJBpRh1tqvb81UBktNaTLw6j/9bfpSuUWm9U8YMUWi5X6/rVWNvUOPlIIr/e+e0jJ5rr9/n/U1z0sm/WlhQBYomtekH+y9uNWhMkz3vHgXJk2mExSaxDxQK+qzmJrH4qyfVbueR3r09+EMXc21OSimF7wExoXJNuVyN2z1lVwGJH8eQa4VDtsng5HlG2yKXGtTwJ9LMN1CWoCPIklplN3fnfujD7XGwQ0ZxH+ltm3nhh7vWVXpUxv9O1xqh/C58VZWVDQge/ArJypnl13qv7s/rpXFBFalg== 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=HXsS7olscigu00RrXleAvpAEkQeW5Z7RIeWrzLszzrE=; b=Xi1PAKw8rT3p2JxSuuC6f/4DZINJ4gwg2nmxrV6CQWMU5Ae3sK0PegSRAp7n9dV7sVngpzBaVF0yKkhu9LVYEfBytequYaAuvVkjzQfRcgf42VoWZnfZuhD6GMU8rfWCUpUIMkY0wDRLktNeTRtsoN6haWZUh0bsFTLh8kxKb451vP/O4COt8inSFT+d0pp3pYfCDxQaYy4bRkGGlIga4bXPcdnzO/zbTNTRG50dmCx9con8FGnl46rOJEjxiiUTsjLTbo78b/W2FD18vIpHrSXmjnjILdWO81AtflXlbHBda1ZLI49PxUwR4iq0n3tePGcFECiZGBdRCuE1eqZPlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from DM5PR12CA0055.namprd12.prod.outlook.com (2603:10b6:3:103::17) by DM5PR1201MB0202.namprd12.prod.outlook.com (2603:10b6:4:4d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Wed, 6 Nov 2019 17:51:19 +0000 Received: from CO1NAM03FT061.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by DM5PR12CA0055.outlook.office365.com (2603:10b6:3:103::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2430.22 via Frontend Transport; Wed, 6 Nov 2019 17:51:18 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by CO1NAM03FT061.mail.protection.outlook.com (10.152.81.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2430.20 via Frontend Transport; Wed, 6 Nov 2019 17:51:18 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Nov 2019 11:51:17 -0600 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Nov 2019 11:51:17 -0600 Received: from agrodzovsky-All-Series.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 6 Nov 2019 11:51:17 -0600 From: Andrey Grodzovsky To: Subject: [PATCH 1/4] Revert "drm/amdgpu: dont schedule jobs while in reset" Date: Wed, 6 Nov 2019 12:51:09 -0500 Message-ID: <1573062672-23698-1-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 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)(4636009)(39860400002)(346002)(136003)(376002)(396003)(428003)(189003)(199004)(48376002)(305945005)(8936002)(4326008)(478600001)(186003)(336012)(44832011)(2616005)(86362001)(476003)(126002)(51416003)(7696005)(26005)(54906003)(50226002)(14444005)(109986005)(70586007)(70206006)(47776003)(8676002)(53416004)(81156014)(81166006)(36756003)(16586007)(426003)(316002)(486006)(5660300002)(356004)(1671002)(50466002)(450100002)(4744005)(6666004)(2906002)(266003)(192303002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0202; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1073ee82-3fae-4acb-a67d-08d762e1ed7a X-MS-TrafficTypeDiagnostic: DM5PR1201MB0202: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:125; X-Forefront-PRVS: 02135EB356 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z6NPD7MvtzVl5ZNI/CTEKf/2Wj9/DR93CCtk4diyf+rQ3hHZIMpFg0SmsIxHA5SW4cYH3pJku0R4oojK+tJLcSo+JHET6d2OxLH3buVsHD7+e5Lu0uMCcyO/sJpQyMjDczqtXvQujXrHuHwLxVQSmAPDYg56piWE3am/3ieDD1KBz5EyASqsTnZLf5IJZ6gJxtUvEQLIY6qfZ6hekMHn9+I7nkvWr/gs8E6VRloC2da0zZTRTDb2j/o19hH6yidrPczWSINzRZ31BJTic9FFMaqZk+ImhMFR8pZhuKea3z7LSW+ly14HYzbrLBoU6B0mmKsQRN2hskfGQn38y85nKmOnd7auvgopIkhlRy/s+q4qd5hKpzeOXyVcMofZmggFzhtFFmOeovcq/9ez38iVMe2TdpiEX1eRsWIOHVhqHe8XCnZkOF8lf7+7iGp5MoAY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2019 17:51:18.6005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1073ee82-3fae-4acb-a67d-08d762e1ed7a 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0202 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HXsS7olscigu00RrXleAvpAEkQeW5Z7RIeWrzLszzrE=; b=0dWesmXupckDwg/061Vivmtbe2NSs+roJa9B3UDUk2VWhikAXfsFqgfPj1HDB2OXbRXOE7Q8ZIvg9pzMgoaZ86mRyg6wk+evE3sZ+CqsA9hv9Pp1kIJR2IMSGhnZrIRTswv2ZhshuPppB0vLAdgvxEULsOD+BR4EIrKh7EflRa0= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shirish.S@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Christian.Koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This reverts commit 3cdf9bd0089723c468d5f6240e54d1afa52e9a04. We will do a proper fix in next patch. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 2cdaf3b..6614d8a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -604,11 +604,8 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) continue; } - for (i = 0; i < num_entities; i++) { - mutex_lock(&ctx->adev->lock_reset); + for (i = 0; i < num_entities; i++) drm_sched_entity_fini(&ctx->entities[0][i].entity); - mutex_unlock(&ctx->adev->lock_reset); - } } } From patchwork Wed Nov 6 17:51:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 11230795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0B161709 for ; Wed, 6 Nov 2019 17:51:29 +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 B828C214D8 for ; Wed, 6 Nov 2019 17:51:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B828C214D8 Authentication-Results: mail.kernel.org; dmarc=none (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 3A9666EE1F; Wed, 6 Nov 2019 17:51:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720053.outbound.protection.outlook.com [40.107.72.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 225526EE1F; Wed, 6 Nov 2019 17:51:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c719iaRK1GH/MSwFvxCyDpiTsLC20dgyHNG+JmIRa4j6vJjVMil+171PMVo5HRg8+mZ3CrCwtFeAfvz28d8nG2NrTCLbBFmcpFbbg4MFre1E3UjVzY7cWjPv+cRbhygMleekbs0IOPZ2Oh9nn0PhNARKbnKc5zb2JbAnycU++lpcVocq8XORsCLW6ZqFli1ov9jBB4fdzTLmFjHRP4bvW9L2JAyNxJYACpkFkqhNlS3oM8i5gRjoqgiYjP4MVgsyfBnkzGDaNDTnXZuV9c0zl/NgAxyzMw8O7ne/jvIBcCkVFGIeUvkNjiPCS61acp8rO9ejMoaVJnem9ELhyHbBvA== 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=qN6DK+9nA7jgfoJ6aBZVsikV50p3nwbBfPIs1xM8cHs=; b=SvI9TGy407CoAORwfh74I/mOrJ5py0WsqEtBqLls1Cj1Akcsn9Z/39G559LzilVOdbCIoqv8QcEYJ3Q1lAGPQWtBVV52k45zRNpdbG/eiPer4aSBrwN6t5O8CPeK9nguQW8mUv6Y2yy/4xDQTlV8/VCMxIiZ908rGCDLi4KZ0fZvnq6x0mZLms5tCo93qK5lJ2YCPtTxNY8M3QX5lBUqNMcih91hqHM76tgg6zMR0adRNYVRBWM8ZZcFvjnl1+TzxOJAnQCPTJtGxtlq6wbcAtVA7LPVgnXJJHFNzkE2HeFH1r2B90w/5fOUg6+KBkN0OCSI3TKjk3kuJF7dT1klHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from DM3PR12CA0077.namprd12.prod.outlook.com (2603:10b6:0:57::21) by BYAPR12MB3621.namprd12.prod.outlook.com (2603:10b6:a03:db::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Wed, 6 Nov 2019 17:51:19 +0000 Received: from DM3NAM03FT007.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::200) by DM3PR12CA0077.outlook.office365.com (2603:10b6:0:57::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22 via Frontend Transport; Wed, 6 Nov 2019 17:51:19 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by DM3NAM03FT007.mail.protection.outlook.com (10.152.82.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2430.20 via Frontend Transport; Wed, 6 Nov 2019 17:51:19 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Nov 2019 11:51:18 -0600 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Nov 2019 11:51:18 -0600 Received: from agrodzovsky-All-Series.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 6 Nov 2019 11:51:18 -0600 From: Andrey Grodzovsky To: Subject: [PATCH 2/4] drm/sched: Use completion to wait for entity idle Date: Wed, 6 Nov 2019 12:51:10 -0500 Message-ID: <1573062672-23698-2-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1573062672-23698-1-git-send-email-andrey.grodzovsky@amd.com> References: <1573062672-23698-1-git-send-email-andrey.grodzovsky@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)(4636009)(396003)(39860400002)(376002)(136003)(346002)(428003)(189003)(199004)(476003)(47776003)(70206006)(2906002)(23676004)(53416004)(7696005)(5660300002)(5820100001)(2870700001)(50226002)(44832011)(478600001)(70586007)(66574012)(4326008)(109986005)(305945005)(86362001)(446003)(11346002)(126002)(2616005)(81166006)(14444005)(81156014)(8676002)(8936002)(356004)(6666004)(336012)(186003)(54906003)(76176011)(316002)(50466002)(426003)(486006)(36756003)(26005)(1671002)(450100002)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3621; H:SATLEXMB02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f059255-51af-48f8-3c4e-08d762e1eddf X-MS-TrafficTypeDiagnostic: BYAPR12MB3621: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 02135EB356 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R38ZRiTVfq4y84jErvE4g5yQS6WnKYAp/CZ50bKWkwyZY9bC2CrqMgh8xh2ck9eIy3LwZpqUuQllu10rX7CxLOJ6uwf/HruV+qt7v3UOq8SgSJZzWm3sdIDQeCCxLn0AFQ4M60eeeuqpwu0vF1fZF5PEjlRunsD7/BXyONeLEsQVc/uTqQm3MV1LUeYkNBWdPi4RE5PaRdQfFhCkBtZOtET+2vIsK5wlXo0qIJTXHNkSIyyD0vm7rNLxfsvQLH668YAInvN/lvBKhU2keHIOEQy0eNFq2KqUYTvvlgJlP+Z84t1oRkbpEc1dwnZI5ClitdFeYOeoyGTIIp6A8aUCvGoJcWY4sziSL1F3u/+XJz/BBAka6rjvs13dh1Q0Mu9pN2Rkxc+raaR0Js4kgaAoxN9o9HSbYxYM8mqOsoI9ybsQNxTWHl8kWNaRdOmDWy8I X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2019 17:51:19.3357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f059255-51af-48f8-3c4e-08d762e1eddf 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=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3621 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qN6DK+9nA7jgfoJ6aBZVsikV50p3nwbBfPIs1xM8cHs=; b=Ur5KyELO+TkbSdzIlorMKZwbIMhczNaeiJtqRApnB0lrFWCIKh+7kLTpiSplIRiH5BoNet/qQTg5Pfta5UpyVkLT8LTiUwgux24Dccxiw6smpD5GHmlld3pcR/h6MsQLOYyqhlP+i8AGE8QrXCEJ8nyFQWIDpzQWV5hm9qb/ODE= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shirish.S@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Christian.Koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Removes thread park/unpark hack from drm_sched_entity_fini and by this fixes reactivation of scheduler thread while the thread is supposed to be stopped. Signed-off-by: Andrey Grodzovsky Suggested-by: Christian König --- drivers/gpu/drm/scheduler/sched_entity.c | 12 ++++++++---- drivers/gpu/drm/scheduler/sched_main.c | 6 ++++++ include/drm/gpu_scheduler.h | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index 1a51531..461a7a8 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -68,6 +69,8 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, if (!entity->rq_list) return -ENOMEM; + init_completion(&entity->entity_idle); + for (i = 0; i < num_rq_list; ++i) entity->rq_list[i] = rq_list[i]; @@ -286,11 +289,12 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity) */ if (spsc_queue_count(&entity->job_queue)) { if (sched) { - /* Park the kernel for a moment to make sure it isn't processing - * our enity. + /* + * Wait for thread to idle to make sure it isn't processing + * this entity. */ - kthread_park(sched->thread); - kthread_unpark(sched->thread); + wait_for_completion(&entity->entity_idle); + } if (entity->dependency) { dma_fence_remove_callback(entity->dependency, diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index dba4390..38bbad7 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -134,6 +135,7 @@ drm_sched_rq_select_entity(struct drm_sched_rq *rq) list_for_each_entry_continue(entity, &rq->entities, list) { if (drm_sched_entity_is_ready(entity)) { rq->current_entity = entity; + reinit_completion(&entity->entity_idle); spin_unlock(&rq->lock); return entity; } @@ -144,6 +146,7 @@ drm_sched_rq_select_entity(struct drm_sched_rq *rq) if (drm_sched_entity_is_ready(entity)) { rq->current_entity = entity; + reinit_completion(&entity->entity_idle); spin_unlock(&rq->lock); return entity; } @@ -721,6 +724,9 @@ static int drm_sched_main(void *param) continue; sched_job = drm_sched_entity_pop_job(entity); + + complete(&entity->entity_idle); + if (!sched_job) continue; diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 57b4121..6619d2a 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -71,6 +71,7 @@ enum drm_sched_priority { * @last_scheduled: points to the finished fence of the last scheduled job. * @last_user: last group leader pushing a job into the entity. * @stopped: Marks the enity as removed from rq and destined for termination. + * @entity_idle: Signals when enityt is not in use * * Entities will emit jobs in order to their corresponding hardware * ring, and the scheduler will alternate between entities based on @@ -94,6 +95,7 @@ struct drm_sched_entity { struct dma_fence *last_scheduled; struct task_struct *last_user; bool stopped; + struct completion entity_idle; }; /** From patchwork Wed Nov 6 17:51:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 11230793 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF3F21709 for ; Wed, 6 Nov 2019 17:51:27 +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 D6835214D8 for ; Wed, 6 Nov 2019 17:51:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6835214D8 Authentication-Results: mail.kernel.org; dmarc=none (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 F0E466EE23; Wed, 6 Nov 2019 17:51:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on061e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::61e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 603BE6EE1D; Wed, 6 Nov 2019 17:51:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=afKWtsz6/1rGbw4R5TraapYyeJ6uN5GGS1n06cXatcNJerVX9+6JVXYZ7S7sPEJENHRaRj0j5uDTmcTCW7rC4f61TbZufmpV9Ei41QSSWXRnwdtWupxs/UEDA7j5rn9z8fmM2k28VMmFiDcEcnFMWCn+W6TaT533EoTveMtE1DnD3kONEvMilAuywV//8CsDg14ygQlIlENFrCRNH7iIP9ckdD9RzfXp7I83M8GkYlnChLgJ23NMro5QOfpRAXkZfHrVnxU4iwJlQZnWfHanbYjy5eJ1Ug/2y5p4SdsKsu2nsuPmPnMWy/zk//Dn7g8j+rlIyVGBTYu+6VUZMqNqcw== 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=6fRaMFMMXIG5vfsrhB70NWUa/7t/tshIzlvO8b15v/Q=; b=Z9mVLmHEvI/WxEUa6ZzqyRvof43iNb3xeqS7k8Crgc6ecFx6HkImrx00/+M+iwz1o0tXS/PlrvXZmATT3G/aW4MvPOefWXkTgwQk3D/lHJEjmbyt7UBX1Rf+15igyr3sBTKYzEyusGfMMiml/Ylt5U/sginPIKLeXWPWqVKJPo4RM/xBggsXrsDZfbRikNntrjj9pYdItsdy/gUjh5iJyPGw9GarwPp9EolpfziNy5G+N/g/tlWaYmXSCPG0bZFZZCQ1NIbVnGSve947+hb8kqVpWrQYJKAcT++NDNBgEpIX7vrglQpfFD5VbK/yK2t0bf6/gkDrpJ2QuPR909NRKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from CY4PR1201CA0012.namprd12.prod.outlook.com (2603:10b6:910:16::22) by DM6PR12MB2683.namprd12.prod.outlook.com (2603:10b6:5:52::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 6 Nov 2019 17:51:21 +0000 Received: from CO1NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::206) by CY4PR1201CA0012.outlook.office365.com (2603:10b6:910:16::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2430.22 via Frontend Transport; Wed, 6 Nov 2019 17:51:21 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by CO1NAM03FT011.mail.protection.outlook.com (10.152.80.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2430.20 via Frontend Transport; Wed, 6 Nov 2019 17:51:20 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Nov 2019 11:51:19 -0600 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Nov 2019 11:51:19 -0600 Received: from agrodzovsky-All-Series.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 6 Nov 2019 11:51:19 -0600 From: Andrey Grodzovsky To: Subject: [PATCH 3/4] drm/sched: Avoid job cleanup if sched thread is parked. Date: Wed, 6 Nov 2019 12:51:11 -0500 Message-ID: <1573062672-23698-3-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1573062672-23698-1-git-send-email-andrey.grodzovsky@amd.com> References: <1573062672-23698-1-git-send-email-andrey.grodzovsky@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)(4636009)(136003)(376002)(346002)(39860400002)(396003)(428003)(199004)(189003)(426003)(86362001)(336012)(446003)(70586007)(11346002)(70206006)(50466002)(4326008)(2616005)(476003)(126002)(316002)(16586007)(5660300002)(109986005)(26005)(51416003)(7696005)(186003)(53416004)(76176011)(48376002)(54906003)(44832011)(486006)(8936002)(1671002)(81166006)(478600001)(81156014)(2906002)(8676002)(50226002)(47776003)(36756003)(6666004)(356004)(450100002)(305945005)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2683; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1a147cb-f4d0-421b-d931-08d762e1eea8 X-MS-TrafficTypeDiagnostic: DM6PR12MB2683: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:792; X-Forefront-PRVS: 02135EB356 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XpMDDfE/cle5BqZ+3yF4QbRrjzBxDqO8IT+dwLnnjS7ra6GN4LMTVKpDlWbE+uG+SY4g0oWpSixDJiEn5dvdzjLW9NAR5bwr1NxTmeA754AvqBY0vFA+Bs03+S6lZBcU7KZYYpZXpjUUubAb/UmcIRjYlriKqAQxG7+FGpH5M5WW5ZbkWD6bB8+gieQ66EklInb49tqesXr63ob6PvAuW2R20HxSRHVZ8uHMrBXT3TOM3upAS1+Bufy/hr8JhfwtcRvcxROErOUKMg6HvCE17WrenjE5bT6LhPRlTSZ6l2F1fgVypSiR48evZU0Rp4qeJ43oXAh9Eukrh3Rag/aVFPGROfuhI47HHmpbOuVwX+FOHlcujGzUvjzr83prBfGH1+m+koO0jZymAGMIO1Z5e7LO3q7sgi0heTlXQdmnPnjYMT0sMneK6PKQ4PEwwLsJ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2019 17:51:20.5669 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1a147cb-f4d0-421b-d931-08d762e1eea8 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2683 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6fRaMFMMXIG5vfsrhB70NWUa/7t/tshIzlvO8b15v/Q=; b=x8stlZFMFmz5ZZc9xBaFB2fkiLvGXrbQ95sqpxnhmhG7zUHwMjqHg4RqXzqiSo/GF5yTtg3p+jG5ZHP8lVahaqtPr6s7i7DoePUTex2mB0EKnl6aHwoSJ+cmKIGKW5EW2QqWWmZgYL0PvUAIhmDzhK5MaOEodYYISTaaKsr/aqE= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shirish.S@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Christian.Koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When the sched thread is parked we assume ring_mirror_list is not accessed from here. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/scheduler/sched_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 38bbad7..80ddbdf 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -647,9 +647,13 @@ static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched) { unsigned long flags; - /* Don't destroy jobs while the timeout worker is running */ - if (sched->timeout != MAX_SCHEDULE_TIMEOUT && - !cancel_delayed_work(&sched->work_tdr)) + /* + * Don't destroy jobs while the timeout worker is running OR thread + * is being parked and hence assumed to not touch ring_mirror_list + */ + if ((sched->timeout != MAX_SCHEDULE_TIMEOUT && + !cancel_delayed_work(&sched->work_tdr)) || + __kthread_should_park(sched->thread)) return; From patchwork Wed Nov 6 17:51:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 11230797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 942AA1709 for ; Wed, 6 Nov 2019 17:51:32 +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 7AD75214D8 for ; Wed, 6 Nov 2019 17:51:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AD75214D8 Authentication-Results: mail.kernel.org; dmarc=none (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 8441D6EE28; Wed, 6 Nov 2019 17:51:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750088.outbound.protection.outlook.com [40.107.75.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3BFE86EE29; Wed, 6 Nov 2019 17:51:28 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LaIGxyn+IWp3JrFN/Te/gPKT1PTAi4ubB4hlyHAwN+aJeOpsdFbdQq8NOGyMLddEySUBjBtrnNIQPsSxH1J4f3O3tSJ6h13/7VAIINnaaeybQWzHh5aV+I/WU3N0HLHDoANedUQUbJdG5bxL4Q3xvfeTlzBmotdw9LGUg44miO6scfaicN5+OhL+uGg6x/Z3tSDxOIZeqMHZtA5EieDFuHt6hbQWXAX7scI6MNkx/Qp2JOwkNxMw9Fo6SYaSQoSALju7eZPzSEsDjkCPb+i6d6nclgsrZe1DRpot+mhp/aE4kpontE9IXYCMtCoj8jKEDKCbNd1fll9bsH4DWCR07w== 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=b7ZtcNlS+NzFNgMGtng8wt8sCwvmbpnonp+ZQ2rEn+s=; b=J4huJ4AWeLi0mKylaSUv5fLP5orWMzfUAGsV3a2jdeWABCjsfHllL65PTMVST/fg3shPvYK4eSXxieSBFvoLga2SQAgNWJCpzulP2fw41IQYpfHU0KDwRoeF58B3vVmkGNKmrtPgC/FdDtGYN5iKneOpmdaGpvVU9a8VsRe4B4XROZ3Vao2pzW6c5u1BhGcmcLRzssdV+W9u7SkPW/MNXlgl1vQA2oJLmrbo/1LRpoMsgVcgvRadmaKbT/qWwCFDCRTsfowBUN5efWibt2Eax0BHWuPZgHGkuGv1NXTZ+hIFNw+rmr5tp17NNVpszF6zKlVzYXQ90kBZEAyq3v2bog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from CY4PR1201CA0023.namprd12.prod.outlook.com (2603:10b6:910:16::33) by BN8PR12MB3489.namprd12.prod.outlook.com (2603:10b6:408:44::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.24; Wed, 6 Nov 2019 17:51:22 +0000 Received: from CO1NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::206) by CY4PR1201CA0023.outlook.office365.com (2603:10b6:910:16::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2430.20 via Frontend Transport; Wed, 6 Nov 2019 17:51:21 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by CO1NAM03FT011.mail.protection.outlook.com (10.152.80.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2430.20 via Frontend Transport; Wed, 6 Nov 2019 17:51:21 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Nov 2019 11:51:20 -0600 Received: from agrodzovsky-All-Series.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 6 Nov 2019 11:51:20 -0600 From: Andrey Grodzovsky To: Subject: [PATCH 4/4] drm/amdgpu: Avoid accidental thread thread reactivation. Date: Wed, 6 Nov 2019 12:51:12 -0500 Message-ID: <1573062672-23698-4-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1573062672-23698-1-git-send-email-andrey.grodzovsky@amd.com> References: <1573062672-23698-1-git-send-email-andrey.grodzovsky@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)(4636009)(346002)(396003)(376002)(136003)(39860400002)(428003)(189003)(199004)(2616005)(47776003)(450100002)(8676002)(426003)(81166006)(50466002)(316002)(76176011)(8936002)(486006)(51416003)(305945005)(446003)(81156014)(6666004)(16586007)(2906002)(11346002)(86362001)(186003)(476003)(126002)(478600001)(5660300002)(53416004)(14444005)(36756003)(54906003)(109986005)(70586007)(336012)(26005)(70206006)(1671002)(356004)(48376002)(44832011)(7696005)(4326008)(50226002)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR12MB3489; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 763fe8f7-96ae-4551-5f9b-08d762e1ef3a X-MS-TrafficTypeDiagnostic: BN8PR12MB3489: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 02135EB356 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mal7CvrlOrw+5myhE+W/dsXjhdgeIdGUARMbfffr0QJsdd0YpqZaZx4JdSKlS42o9QbHtIEo6sgUSHdRcfRZ9nZC4akmfdN57ls3Kb/d3UyjT0UJ+8BkLLPiYWRnjGRVBMz8AB/cmZQeigJg3OPQVJc50vrdb25yp8H/ReBHttyy9i7aHYTJQSpEoERJGg7prHYOZ5IL4QZrpFs1Z/ZQzgQg0NogUAmLgvKZ4FRKzgN/N+5kpzR4nFMnf+TK7i6A5hthqlzJIHYoPSTejztvdsyGlPkTsV6RFh84s7IjG/gC9/iL0QjUL2xIg0h9+ZUoLiHo4Wg/dqfmMd6RaLVIu/j6sqyGyKGu6gO8UHbSEKJ22V8vmXOAE3R/4arpY0W+g4Alu7UoUHTOOnlrUcyxqRcXIi0U+ZNWmn+ahuU3WSrC4l2yr3un593hxeYgwN9n X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2019 17:51:21.5347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 763fe8f7-96ae-4551-5f9b-08d762e1ef3a 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3489 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b7ZtcNlS+NzFNgMGtng8wt8sCwvmbpnonp+ZQ2rEn+s=; b=a2gr1QRx0FicAP4hZ/+Rv4VnaW6NXAyz+lIR6hrdDW8mSljWV4aixD1aWLDfsoxoLdI0R7WtZsaR5ChmiHh6zmlcKa1MHTS4NHRUR7yiJCAxdK6USK3GXlTAHEVVjNc29SB/SkcT4iPuuvy6YEo2Q0zjUv2Ma75dsRivL+shmRw= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shirish.S@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Christian.Koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Problem: During GPU reset we call the GPU scheduler to suspend it's thread, those two functions in amdgpu also suspend and resume the sceduler for their needs but this can collide with GPU reset in progress and accidently restart a suspended thread before time. Fix: Serialize with GPU reset. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index 693f17e..8e6726e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -859,6 +859,9 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data) struct amdgpu_device *adev = dev->dev_private; int r = 0, i; + /* Avoid accidently unparking the sched thread during GPU reset */ + mutex_lock(&adev->lock_reset); + /* hold on the scheduler */ for (i = 0; i < AMDGPU_MAX_RINGS; i++) { struct amdgpu_ring *ring = adev->rings[i]; @@ -884,6 +887,8 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data) kthread_unpark(ring->sched.thread); } + mutex_unlock(&adev->lock_reset); + return 0; } @@ -1036,6 +1041,9 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) if (!fences) return -ENOMEM; + /* Avoid accidently unparking the sched thread during GPU reset */ + mutex_lock(&adev->lock_reset); + /* stop the scheduler */ kthread_park(ring->sched.thread); @@ -1075,6 +1083,8 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) /* restart the scheduler */ kthread_unpark(ring->sched.thread); + mutex_unlock(&adev->lock_reset); + ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched); kfree(fences);