Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3955436pxb; Mon, 4 Oct 2021 13:36:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxz3Y/kkZjI/hk7aZXegm4wSiS9eJwx/BbOXY7MIJiModILO0T2o7O2Y3yaYwfgPknH0YyX X-Received: by 2002:a17:906:b303:: with SMTP id n3mr6728719ejz.267.1633379802506; Mon, 04 Oct 2021 13:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633379802; cv=none; d=google.com; s=arc-20160816; b=cekAHlEA4Jmd+qypx3n/ixU+UvCDTYEaW1zfsiPV/PDf/ssoZHQ7nCgzdumN6FC2LN ZNcagB3NgR7y8h0K+7UHG5QypbyE7ZoL+DeW0d7UhD6e8Kwx+/T/Yx3W4z9fi3ZXbwSW 3l/S/wBDL6kBzJWKdkqTlSExaIZ2U3DKRqxUA+lvYw9qW4NYdKeQbPxcnkCGu2NWry+T aFDBbeAJ5WRLPXZGJloUTLIfyErmBd4Q7IyVRrsWIS7lQvfO+MLtOp/DaDeyCKUaKngq 6TlbkaIe2p8tImUhiq0Xs8WWBbWsA19IQFle4zlxe4EuL2YZo/T5vNVvXzEu71vU9ycS FM8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=35R+keR73J8sc27eT9Bx4CnF6lX5WOn1IoVz4jHfnT4=; b=k7wHLR5Hdrvt0iqXuXWIBHDNVFICQ+izvzo71FntqKYKjBACBhblDk1eF0zx84qyYR skbKEfmrYrBwCo3BFUEKbwqF7MOzseQsVjhQ2E8fSW4dL6uxEkXNdnqh+OiyIP6PMYkS jrPdrtYPQE+2w0bnNLvS+j57Ql7PkUlIBCqaLYO9dBTq8twsPficyiZ1+oxBFWelpFD6 bEsayrb0WBQ16BwZE9azkP5k1m+I5gFOjgQO9/ZUlbDWSy0fJSq8OmYBHMOCa2/MOrpB kxdPseiMNFUhChV5s2HusLIl1AZRV1++GPzhDai7XD7QOKb7JcFuMJPRyYezL+fwYkpC Kszg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wVZwS7s8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb11si17455006ejc.197.2021.10.04.13.36.18; Mon, 04 Oct 2021 13:36:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wVZwS7s8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237531AbhJDNed (ORCPT + 99 others); Mon, 4 Oct 2021 09:34:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:48040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237452AbhJDNc3 (ORCPT ); Mon, 4 Oct 2021 09:32:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 47A9361A03; Mon, 4 Oct 2021 13:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353276; bh=E/13+KPXCm4XKKMzY1Izeosv8/zVuxbrCSZTUN8fVsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wVZwS7s8penxCorTKHiMtSgS/vrBfNQRUWBjVU8bcpSsAAxc7Vwbfs76waOlW4ffc dYVOo831UatnN/wiIR844p8dltwnKaN2cSLv33QrKywNQEUvQ1B/xPN3Gm6El5b/G6 YDbnuiyXl8Qg+TgP72cg/0WV23i5v90wRjYttenM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Grodzovsky , =?UTF-8?q?Christian=20K=C3=B6nig?= , Guchun Chen , Alex Deucher , Sasha Levin Subject: [PATCH 5.14 032/172] drm/amdgpu: stop scheduler when calling hw_fini (v2) Date: Mon, 4 Oct 2021 14:51:22 +0200 Message-Id: <20211004125046.004589330@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guchun Chen [ Upstream commit f7d6779df642720e22bffd449e683bb8690bd3bf ] This gurantees no more work on the ring can be submitted to hardware in suspend/resume case, otherwise a potential race will occur and the ring will get no chance to stay empty before suspend. v2: Call drm_sched_resubmit_job before drm_sched_start to restart jobs from the pending list. Suggested-by: Andrey Grodzovsky Suggested-by: Christian König Signed-off-by: Guchun Chen Reviewed-by: Christian König Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index 7495911516c2..49884069226a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c @@ -532,6 +532,9 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev) if (!ring || !ring->fence_drv.initialized) continue; + if (!ring->no_scheduler) + drm_sched_stop(&ring->sched, NULL); + /* You can't wait for HW to signal if it's gone */ if (!drm_dev_is_unplugged(&adev->ddev)) r = amdgpu_fence_wait_empty(ring); @@ -591,6 +594,11 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev) if (!ring || !ring->fence_drv.initialized) continue; + if (!ring->no_scheduler) { + drm_sched_resubmit_jobs(&ring->sched); + drm_sched_start(&ring->sched, true); + } + /* enable the interrupt */ if (ring->fence_drv.irq_src) amdgpu_irq_get(adev, ring->fence_drv.irq_src, -- 2.33.0