From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36AC719D07E for ; Sun, 24 Aug 2025 20:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756066614; cv=none; b=AQ03/jNdTqHax6329X1md4UGHQRlRRSmCiSN+Fk7Zq/fjxxABib2LZi69suJB8O1AV31t+ZSkRuUKoBIxnyXJRRCg/SnAnldRzfT8bgms+ldH7A2u+DXSrtzSam8HKqg7czdIJ3UQ6ODCDeutZdAkgNTPayvNSoGW1m2ObXRTFI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756066614; c=relaxed/simple; bh=brgqjqPdkymYwpxzprU5bp5+t5tdiecqn0pw7qpUigw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jUmVIng0e9UQ5EAF5MgU8E56WBdA0PlEoF6fsSCcEonTCIQNLWHXJYXfBSvv2Dmzkm1hfB5qoJ3o2kFj/LVs+HhC0hWYjbjhVsg9memyDfWvgXkRGmSa1D94SnD5bOWdzYt9krBbxp2ra5yEAhQeacB4SQIG447AVPBfbdn2Kwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CcWwceon; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CcWwceon" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD05AC4CEEB; Sun, 24 Aug 2025 20:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756066613; bh=brgqjqPdkymYwpxzprU5bp5+t5tdiecqn0pw7qpUigw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=CcWwceonoipEmlzT938DSWR3TqgImWZJ/CcohfHGL6ZTcksO/HtJD/KmWpTPyhq+H EZHkQh2gIH+xQX9RV+yqPfjPa2zPrcqP1BN0nU0f2p/TnQ0hFXcFyusrVfYS9eu/dP B1eRLXf/HTWHCONxhtCUnzlFU8CG6c+J5c5yDr9Ri4r1pQpaA0nAQ7NVlt0/r9zGFq Xd2QaZiuWslYu64/viSlTMwcTLtD93/PTnE9DYrHyNacd4Ggdi/3VSEkGt0tissMtm nEs+kHpfiWY2W36WL5mXVq+bgBMs4Sm5o4A9Hq+hEuXRgPjl5rX4jN5xCbDQmMIBMm k8Dsn8DGlAcWw== Message-ID: Date: Sun, 24 Aug 2025 15:16:51 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/2] drm/amdgpu/vpe: increase VPE_IDLE_TIMEOUT to fix hang on Strix Halo To: Antheas Kapenekakis , amd-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , Harry Wentland , Rodrigo Siqueira , Mario Limonciello , Peyton Lee , Lang Yu References: <20250824085351.454619-1-lkml@antheas.dev> Content-Language: en-US From: Mario Limonciello Autocrypt: addr=superm1@gmail.com; keydata= xsFNBFfXIYYBEADlBpwn46Os2kqQK7xm12wq3dTQBBjV0/MNTYzuhcKMXXTSco0SGJTaeNCd 3YVNxkzcJpNvpRGfjpVSRJkgXB0kdUEf7M+XET9p9jJwVXJKB+IIRhcKxnqujLdWIr6ZDPb4 HkTp186cfSfqUZcwpCHQnmYLrdwP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p1e+zkYDZotGSymJHcCdq5JD/0dX7zNy15ypllaglQwzQ26y9HqS1PVAcnSaY+T+UJvW6rf ORy234R3C3fwNySfnNPIu6JzaFhRKukZHMH00xnf+BmEM/I+b+vf/ylbC9P1jXpLT07z24jc yDVqFf+kMXujLUW9OWmdOC4o3z2bNHK/CV8Xkyjy1ZTBb9fuDKv/XqCci82oaFtQX87bbW9s /DEUl/QM8yDkB6AKgldaVUyKZTkDdrzh7O6+tFDCyLqoOT2aV4z9nSqRs2ICScq1EtqsVthQ fELqAFu8a7lKerErqxs5mFhMY6C1Nto3G8mJ2z6OaH3L8PiUmV4+kmmKgdpAmsJwgByyFeKY W/gq4L21cEQhYatUAL3H4HtYRork65mZfozhInDTFrd7fD2urr0wMqVooM4YuUSkRJAFzt8Q gYiizU7DfJCHGzARQc7X6yhzw9aZY/JAU0m+eruF1pEJic2A5GYbNo4WHsB6b8B1p8vVEMvX 3XwsNt2vh2ITDGJhmeU/zEbjPTUPIK8dxOskFouBMNjN/Ja67/c9nfBTEr4a/8hzFcjxhfD0 Vvvs8b8qJjVxel7u3Ro2VKr+LOKcqnQdPsSGORvw/Drv9eNtVhSlkibKvlZERJ5LG6Y7vtMj REqplPe2LceRhA/5bvevhGJ3UxsrU4i/gOecHUf1vaXSfrVdK50Nvx/aJvZtmQ== In-Reply-To: <20250824085351.454619-1-lkml@antheas.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 8/24/25 3:53 AM, Antheas Kapenekakis wrote: > On the Asus Z13 2025, which uses a Strix Halo platform, around 8% of the > suspend resumes result in a soft lock around 1 second after the screen > turns on (it freezes). This happens due to power gating VPE when it is > not used, which happens 1 second after inactivity. > > Specifically, the VPE gating after resume is as follows: an initial > ungate, followed by a gate in the resume process. Then, > amdgpu_device_delayed_init_work_handler with a delay of 2s is scheduled > to run tests, one of which is testing VPE in vpe_ring_test_ib. This > causes an ungate, After that test, vpe_idle_work_handler is scheduled > with VPE_IDLE_TIMEOUT (1s). > > When vpe_idle_work_handler runs and tries to gate VPE, it causes the > SMU to hang and partially freezes half of the GPU IPs, with the thread > that called the command being stuck processing it. > > Specifically, after that SMU command tries to run, we get the following: > > snd_hda_intel 0000:c4:00.1: Refused to change power state from D0 to D3hot > ... > xhci_hcd 0000:c4:00.4: Refused to change power state from D0 to D3hot > ... > amdgpu 0000:c4:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x00000032 SMN_C2PMSG_82:0x00000000 > amdgpu 0000:c4:00.0: amdgpu: Failed to power gate VPE! > [drm:vpe_set_powergating_state [amdgpu]] *ERROR* Dpm disable vpe failed, ret = -62. > amdgpu 0000:c4:00.0: [drm] *ERROR* [CRTC:93:crtc-0] flip_done timed out > amdgpu 0000:c4:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x00000032 SMN_C2PMSG_82:0x00000000 > amdgpu 0000:c4:00.0: amdgpu: Failed to power gate JPEG! > [drm:jpeg_v4_0_5_set_powergating_state [amdgpu]] *ERROR* Dpm disable jpeg failed, ret = -62. > amdgpu 0000:c4:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x00000032 SMN_C2PMSG_82:0x00000000 > amdgpu 0000:c4:00.0: amdgpu: Failed to power gate VCN instance 0! > [drm:vcn_v4_0_5_stop [amdgpu]] *ERROR* Dpm disable uvd failed, ret = -62. > thunderbolt 0000:c6:00.5: 0: timeout reading config space 1 from 0xd3 > thunderbolt 0000:c6:00.5: 0: timeout reading config space 2 from 0x5 > thunderbolt 0000:c6:00.5: Refused to change power state from D0 to D3hot > amdgpu 0000:c4:00.0: [drm] *ERROR* [CRTC:97:crtc-1] flip_done timed out > amdgpu 0000:c4:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x00000032 SMN_C2PMSG_82:0x00000000 > amdgpu 0000:c4:00.0: amdgpu: Failed to power gate VCN instance 1! > > In addition to e.g., kwin errors in journalctl. 0000:c4.00.0 is the GPU. > Interestingly, 0000:c4.00.6, which is another HDA block, 0000:c4.00.5, > a PCI controller, and 0000:c4.00.2, resume normally. 0x00000032 is the > PowerDownVpe(50) command which is the common failure point in all > failed resumes. > > On a normal resume, we should get the following power gates: > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerDownVpe(50) param: 0x00000000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerDownJpeg0(33) param: 0x00000000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerDownJpeg1(38) param: 0x00010000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerDownVcn1(4) param: 0x00010000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerDownVcn0(6) param: 0x00000000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerUpVcn0(7) param: 0x00000000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerUpVcn1(5) param: 0x00010000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerUpJpeg0(34) param: 0x00000000, resp: 0x00000001 > amdgpu 0000:c4:00.0: amdgpu: smu send message: PowerUpJpeg1(39) param: 0x00010000, resp: 0x00000001 > > To fix this, increase VPE_IDLE_TIMEOUT to 2 seconds. This increases > reliability from 4-25 suspends to 200+ (tested) suspends with a cycle > time of 12s sleep, 8s resume. When you say you reproduced with 12s sleep and 8s resume, was that 'amd-s2idle --duration 12 --wait 8'? > The suspected reason here is that 1s that > when VPE is used, it needs a bit of time before it can be gated and > there was a borderline delay before, which is not enough for Strix Halo. > When the VPE is not used, such as on resume, gating it instantly does > not seem to cause issues. > > Fixes: 5f82a0c90cca ("drm/amdgpu/vpe: enable vpe dpm") > Signed-off-by: Antheas Kapenekakis > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c > index 121ee17b522b..24f09e457352 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c > @@ -34,8 +34,8 @@ > /* VPE CSA resides in the 4th page of CSA */ > #define AMDGPU_CSA_VPE_OFFSET (4096 * 3) > > -/* 1 second timeout */ > -#define VPE_IDLE_TIMEOUT msecs_to_jiffies(1000) > +/* 2 second timeout */ > +#define VPE_IDLE_TIMEOUT msecs_to_jiffies(2000) > > #define VPE_MAX_DPM_LEVEL 4 > #define FIXED1_8_BITS_PER_FRACTIONAL_PART 8 > > base-commit: c17b750b3ad9f45f2b6f7e6f7f4679844244f0b9 1s idle timeout has been used by other IPs for a long time. For example JPEG, UVD, VCN all use 1s. Can you please confirm both your AGESA and your SMU firmware version? In case you're not aware; you can get AGESA version from SMBIOS string (DMI type 40). ❯ sudo dmidecode | grep AGESA You can get SMU firmware version from this: ❯ grep . /sys/bus/platform/drivers/amd_pmc/*/smu_* Are you on the most up to date firmware for your system from the manufacturer? We haven't seen anything like this reported on Strix Halo thus far and we do internal stress testing on s0i3 on reference hardware. To me this seems likely to be a platform firmware bug; but I would like to understand the timing of the gate vs ungate on good vs bad. IE is it possible the delayed work handler amdgpu_device_delayed_init_work_handler() is causing a race with vpe_ring_begin_use()? This should be possible to check without extra instrumentation by using ftrace and looking at the timing of the 2 ring functions and the init work handler and checking good vs bad cycles.