From patchwork Wed May 12 14:26:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12253887 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 1F024C43462 for ; Wed, 12 May 2021 14:27:39 +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 C453561417 for ; Wed, 12 May 2021 14:27:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C453561417 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 AE4D06EC05; Wed, 12 May 2021 14:27:37 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2060.outbound.protection.outlook.com [40.107.223.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id BE6446EC18; Wed, 12 May 2021 14:27:36 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ktk1Bp3p2ZH/zwOCuurfcUnlFQXMAhj06P29c3MCZU6ArpsKIMpWPtvVH8M44Gh4Cj2Zzp3o15F5Y9HQohsH/sx6VDS4VyeVsXPdi251qkMDPDHTbazYE7gtj+YAK+Gr1N4gO049iT5IwnvCb+TMSox4BBNyjPJ5OnDiF+bH48Ujkq44nOfMffqlKF/ZWZSq8i8N+oe1X0BZyoWWM3tQYIoFq+Eps4EicMYHO6Vj57ORfMnNDVusvzG2jZ6LLKwNJVVjicbMFGeSSkYFhzlOOzik+Icto8qTbtLp7OgGBluBkEa7llHXivl6zxQ0kOEojWK5XhF6mPqZW56FzVtnxQ== 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=PsuHwoXxG2GPArc939kNaSlXDwLw+Fkof8ti3WmEEZA=; b=TNZ2FXE9QjUl1Xe4Ck/f4obAOyFv8MUe54VDvOY5qAyVn4+ifQq8jby1giUNrNFeXg86AF02TrT6acWB3QE0fRVpGo7WSafTDW7qQLWSxvktV54MG6BcHiOmo+VM+l6sCoP2qFxY9IdA5qz7QTgp6+018MIwsgjYxoX56bO8jum6+5zct4bEQZ5QDCkU/H8nsHVm6qVzqFuB/WRKExGjTQuzGQV8mVlrrKRfBbo7E+8CcqoYuQi/g2g5QV8aD0s1OFPX4GWNtuAFALHvIcuDpG1Yn+7ctU1kzt+yeIznTt7WDacxIu+wLkCInggbYWtn4vtBTwaVLSlPEclNNCQjXg== 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=PsuHwoXxG2GPArc939kNaSlXDwLw+Fkof8ti3WmEEZA=; b=z2Z8DPhzF4Ztx63weg4NF1yA/a0sSiYhQPMy8ULpPIiCqcl3t59QbWPyDoojpMeBjkSlAZ2aIfm5zi7I7UhAPszzVDz+b5gn32eibXPX/5ZJdoLuQ2lLME/mSljYGWQ7sv7Nrm6JSAZZITKyBSxmqFpX1Y6WkjZovApyYs+6a14= 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 SN6PR12MB2845.namprd12.prod.outlook.com (2603:10b6:805:75::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Wed, 12 May 2021 14:27:35 +0000 Received: from SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::ad51:8c49:b171:856c]) by SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::ad51:8c49:b171:856c%7]) with mapi id 15.20.4129.026; Wed, 12 May 2021 14:27:35 +0000 From: Andrey Grodzovsky To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-pci@vger.kernel.org, ckoenig.leichtzumerken@gmail.com, daniel.vetter@ffwll.ch, Harry.Wentland@amd.com Subject: [PATCH v7 11/16] drm/amdgpu: Prevent any job recoveries after device is unplugged. Date: Wed, 12 May 2021 10:26:43 -0400 Message-Id: <20210512142648.666476-12-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210512142648.666476-1-andrey.grodzovsky@amd.com> References: <20210512142648.666476-1-andrey.grodzovsky@amd.com> X-Originating-IP: [2607:fea8:3edf:49b0:7576:4f76:97d8:1487] X-ClientProxiedBy: YTOPR0101CA0032.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:15::45) To SN6PR12MB4623.namprd12.prod.outlook.com (2603:10b6:805:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from agrodzovsky-All-Series.hitronhub.home (2607:fea8:3edf:49b0:7576:4f76:97d8:1487) by YTOPR0101CA0032.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:15::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.30 via Frontend Transport; Wed, 12 May 2021 14:27:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bec6a8e7-d976-4c93-9d8e-08d9155215ee X-MS-TrafficTypeDiagnostic: SN6PR12MB2845: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aOnQuY4GtXVhAzs2cVIDlW15ErGYjE9IiIOxxvp9z3jvdEctnikmIYr3Wy3jdWv0n6zUUscxqbUViOO4hCMCX8TL2VaWMzhu7FXEIvt8C6hbRQ/Za4LntQGGWEozvyhGYEuFNUTbr6zjMOlMvuo4Zeu86OZmMhhqsVro1EUX45uGIXVJvSIM4pUnMKUCbQR99NgpTupY72AW+Qsr3YUjpe6X5A7FJaezPT210MWl+MqffgZu5PD8fhR76O5APoHO9dhrgOEpWmvsWnyOGWvevLgj2SPUy70/BSsLuEJcchbGqFgVgAIfgnedG6NNf+EBBzYy9Bwn7dCp9nTJY9VFtNebdH3PewFyBilgcyskZkcAPP3IAMZGYEuyaN8kS5kYoqA//6gTNXi6IMyjWHOiRZ1pn7cdTtEVqL/zaDYU1gl1GL8kOtnmmBbG1y0HoJ3Gj7IynnQf+6CZ5NduuNz4vMEyaiiSQYqdslXUc6HIbwjkHyBADTidUNkhtwmxfGkoc6uJGLEAPPhStsyWcXIhNGOOMmqkcL8fi2+slM2KtS/OzaVpBwffKPAK8IDJIOVRFBGrTOkEk+0GO/5dVWkESmtQN93IHGSLUqrYaX3jryY= 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)(376002)(39860400002)(396003)(346002)(136003)(366004)(6486002)(8676002)(54906003)(316002)(6512007)(16526019)(6636002)(478600001)(1076003)(186003)(4326008)(44832011)(2906002)(6506007)(8936002)(5660300002)(2616005)(38100700002)(66574015)(36756003)(86362001)(6666004)(66476007)(66946007)(66556008)(83380400001)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?1PoivChCVqO6Juez1W4546bV6ZINHM?= =?utf-8?q?HiFIuJlYpF7+/1baYrwFLavtPXTUp5d/TjS/4NkaZsismEzbCM1MImFlsYbtzmc1J?= =?utf-8?q?kM3YiAAzdEK2fjfsCa7xk/GbP9ji1dKNoogfEDVXo5Had1DdOHNXobrCEjSMRoLp1?= =?utf-8?q?N+UPGehF2vnWqXCOeZ80W9tK1jNpybI+L+s3HLUfEBhO2TrYJEcgB+9qYTdJSSbKC?= =?utf-8?q?VSdxFTXmrtbhu3MMSYxPPNRNdyvtO/azGTxT4jS2Ky2InRSKA9b9NKoAHk6hqY/5B?= =?utf-8?q?0guO9BZea6cljB4RUjPTjauzP3JkDisl2VpG6mDWRrNbi1u5NJ3jLJVaJ5xtr4Dix?= =?utf-8?q?F5+Cw4AEWr3HiGwkz6izf7DCC/XEoQz3Q1LmLZGVHHcKoiF4RekbRxw7KnC21C2lK?= =?utf-8?q?M1/UAT5ha12VoagF+NIjpYgFQB9ZhZ3l4T5AVIlhpcyLyYQaeD1VbggyKw3MUa3Qh?= =?utf-8?q?DgAD3Dp92bnnMLZ49CJdp5OpBCQSpg1g0khQBZyFlCXjxRzNQrGLGobFuV/BYVQ2N?= =?utf-8?q?yWyYojpmHjlfrkRCChnOsanxT6qtaWzxJRcNY72ROpnoXPMvY6Td1j0cb53q84zk+?= =?utf-8?q?MkO/mRnYTrumkiE3foaHui00TsF4oM2Y2LMpkL1GH2KEJIboA+xSFpQjGBHXDFkCX?= =?utf-8?q?pu80nCMno4hcD2cg9kWI7kF9PD9LvzrmHTUwx1+NcfBx+ADlS5fqPb/FS6jv0nDfn?= =?utf-8?q?zdFSC/tabqgpK6bnDl0xAxLGxCAH71B4z8cQA+IYSUe5mAdHXNrJbHPjD/cAi28CW?= =?utf-8?q?auyiHQyADXWfqLbg0Nqb1d7oUCM5T+L4yPEbgo9Cwo7R0GP789ZBjsNwRXfgweb5v?= =?utf-8?q?kGmJ0eSDlokziw40DVwc7/DYodFwOk0ITDUk9s+swALIZx+Ndit+PHBKmjgZYB7oA?= =?utf-8?q?43M5UoS8WZfmfkHNXiK/YQXaMd5MBKj8Zb3JiDe0f6gR3uSw5Z4yupdaGqr9c2h3T?= =?utf-8?q?uSATUkhmgY26uZZvx/WY4A03s5iaX2i5HRoh1JumHAVze+xLM1NfzwghQW6YcXV4W?= =?utf-8?q?SV7guhwsPkTjrPDmcq9ESTweV03zHxxBkoRI19EVBsMBuFyRFt6+/n5KLZPiqlFrM?= =?utf-8?q?Hz2ZLKNJadrgu9XrJdYdFoHulxupkqLhinDhAOsz/MH+zi9XAmvHsc51SgUtr4L3n?= =?utf-8?q?kVdrQIPPE1NbQzzf5oOyFwHMEgGeV3T9TUlUJoC49zz+BAcEFkcBFufgc0ldR+DAj?= =?utf-8?q?jT1V4MJww9BFnXX7DTTQdeE6Mo4EuncYkFxp2C6VjewmwKVcUjDqMF9J7HkVkYDmY?= =?utf-8?q?IdQnsNQhzK+pTGaCx9ERqFo0SZHAZ4OBBc+PqCawjvYMzQFKrozPRsB2fsovzIeKe?= =?utf-8?q?9IJ19RJfPzUM0?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bec6a8e7-d976-4c93-9d8e-08d9155215ee X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4623.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 14:27:35.1045 (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: oOrrNCm3WrW2wSyBewI0vkE/bro2UGoAG67AedeQw7YjH0exhdt5Sbj2FNTAONp6UcR2niWdvgsBp0dP2jnOWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2845 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: gregkh@linuxfoundation.org, Felix.Kuehling@amd.com, helgaas@kernel.org, Alexander.Deucher@amd.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Return DRM_TASK_STATUS_ENODEV back to the scheduler when device is not present so they timeout timer will not be rearmed. v5: Update to match updated return values in enum drm_gpu_sched_stat Signed-off-by: Andrey Grodzovsky Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 759b34799221..d33e6d97cc89 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -25,6 +25,8 @@ #include #include +#include + #include "amdgpu.h" #include "amdgpu_trace.h" @@ -34,6 +36,15 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) struct amdgpu_job *job = to_amdgpu_job(s_job); struct amdgpu_task_info ti; struct amdgpu_device *adev = ring->adev; + int idx; + + if (!drm_dev_enter(&adev->ddev, &idx)) { + DRM_INFO("%s - device unplugged skipping recovery on scheduler:%s", + __func__, s_job->sched->name); + + /* Effectively the job is aborted as the device is gone */ + return DRM_GPU_SCHED_STAT_ENODEV; + } memset(&ti, 0, sizeof(struct amdgpu_task_info)); @@ -41,7 +52,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) { DRM_ERROR("ring %s timeout, but soft recovered\n", s_job->sched->name); - return DRM_GPU_SCHED_STAT_NOMINAL; + goto exit; } amdgpu_vm_get_task_info(ring->adev, job->pasid, &ti); @@ -53,13 +64,15 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) if (amdgpu_device_should_recover_gpu(ring->adev)) { amdgpu_device_gpu_recover(ring->adev, job); - return DRM_GPU_SCHED_STAT_NOMINAL; } else { drm_sched_suspend_timeout(&ring->sched); if (amdgpu_sriov_vf(adev)) adev->virt.tdr_debug = true; - return DRM_GPU_SCHED_STAT_NOMINAL; } + +exit: + drm_dev_exit(idx); + return DRM_GPU_SCHED_STAT_NOMINAL; } int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,