Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp758304ybz; Wed, 29 Apr 2020 08:52:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLL3+a6RDIVk3vIA3lhWrH0amip7xMRQyPga0iFZrjP9riUHJL36rzwZq9B6AatsUjAKGf6 X-Received: by 2002:a17:906:d143:: with SMTP id br3mr3274328ejb.348.1588175552642; Wed, 29 Apr 2020 08:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588175552; cv=none; d=google.com; s=arc-20160816; b=MqgFOKf5BpIZGZMkYUZdvncP2lDuVf11P/rjDZp354PjCo5dqII4zu1afdH+hiSi+t M6dpDlh62+WFjAj+79jNSaACCPX5fm+fQef07c1xPyT1WpXTnYDziz/UfX50EWfihlDM AVl7ll+Obm5g7eoURgAW3SFl3V2xQkZrzAhOLqjMRaFqeWp27I12KBFK6HlRi+WL7vhY zyT8pJ0aV6TYT7lsNkeIxSCqtBynqk1BvvgSb1Au2lLrceTZcDSIrYyWZ/XAEHujlTtc Sc76ryzeEyTeyqQCTFuluYKVo25TeJKJT6o73MjexCAxyzLJIzKB4NIphsJJEPWDEcqd 6+hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Nl5AzzUzfTdhg1mHlIElmuD4Tx4QKCT7uS5quGgMP68=; b=u/dc8ksCGE2or1gOMxetnU6Ho2Tm0AA3ER2q09H0uD3jKnbVkf405/WUZdUbqsPZ3T g1aejDGj/iU/IG5wS6ygzzzb3p6EeH7DcW/4mfjnX3uS70LgkaTlajtiVWBHEjTyTxKx AmwfHEO2Zm11E+rIEPySHX1SmHAfbc1SuNPANvIOGK+creDR+iV4X5KvxQQO1DRdFLMA krELaqTlhMYAl+gFYJbGSwmDTvj8qbvUFRldX9/C0ol+DCMcj0gYZU9E9Vppxjc+6YD2 WaNXYK4dhTPfm9fn5lz8/qS36wSAf5k+rvFU6gX7frX0tMWWuSV7UWQRjp2UqbeSYZQe ExiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Y/22yGEw"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x5si4010676edr.583.2020.04.29.08.52.07; Wed, 29 Apr 2020 08:52:32 -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=@gmail.com header.s=20161025 header.b="Y/22yGEw"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbgD2PsB (ORCPT + 99 others); Wed, 29 Apr 2020 11:48:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726456AbgD2PsB (ORCPT ); Wed, 29 Apr 2020 11:48:01 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88539C03C1AD for ; Wed, 29 Apr 2020 08:47:59 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id j1so3167506wrt.1 for ; Wed, 29 Apr 2020 08:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Nl5AzzUzfTdhg1mHlIElmuD4Tx4QKCT7uS5quGgMP68=; b=Y/22yGEwCTktzDgBxYn4qiD69fwdOl1JK2oztbwNpwouFrM2Yd8JVCy1CfcMHvA94L SxElDT2In37M2PgIe/7oZU7CP0zHUQtFrUSHfwm0Kw9j0XMWzy6tsGQOPvQSAPJGXkqs /GdeNrMHVOOQIMYR2bLsUKz14hVdvwOlIscuJEoT0cwjrXAcf7uCV408YbBjLSOuu7QP EKM3ifJTCwcltb5OXm/KaZeVXBAV65MppVSAXgT6o06qtPURLq8UD84S/ngH9EKRwMug wrxROl/OW+68Bf1lFEKSQVj0EbLdExYjAMlJCmw3HhEEht6EoI3tKz2+4nSjuXRf1mqI Nk7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Nl5AzzUzfTdhg1mHlIElmuD4Tx4QKCT7uS5quGgMP68=; b=afSHkY7e+tXF8ui5fx66O3RQCH7iXdqqAvf1S2Aqq6bLNsMY7w9KU5Vv4McEY/Hqlw GaAAoFEVEe/Gh40qAJjiCJN2KKM+wjWd+7NjveA5JCIC2ssEWbNhQFbsuuTBkOTkKfwi GJVOTmsuBuIj0QMhqJjFlbgY41NEceWi/bmNrRLK4yLVjNQ9wbVdc1OJMfXunEjzucCL gzjHbgwdwnaggBSnGxWL+VJu3y9BvFX9ibQr8C0TOyJpey/9zhR+uFjwTwY+E5Rd92qG V5WNd4qE8VrDkFaDtAVFZK239/23fFyyJ0BSiiJKVz+rBDOo5MKyOhy9FZwvgmf/mWbV tsaQ== X-Gm-Message-State: AGi0PuYV4iD1UgP3dygQ/hKU43Tgv+eRIehUG5jlyt01xBR9whKcbXL9 fpigXCsVtEiv72qKV0gpnqjeDd3I8kPxIKQIJJI= X-Received: by 2002:adf:f844:: with SMTP id d4mr39213645wrq.362.1588175278191; Wed, 29 Apr 2020 08:47:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alex Deucher Date: Wed, 29 Apr 2020 11:47:47 -0400 Message-ID: Subject: Re: [PATCH 0/1] Fiji GPU audio register timeout when in BACO state To: Nicholas Johnson Cc: Takashi Iwai , "Zhou, David(ChunMing)" , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , "amd-gfx@lists.freedesktop.org" , Takashi Iwai , Lukas Wunner , "Deucher, Alexander" , "Koenig, Christian" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 11:27 AM Nicholas Johnson wrote: > > On Wed, Apr 29, 2020 at 09:37:41AM +0200, Takashi Iwai wrote: > > On Tue, 28 Apr 2020 16:48:45 +0200, > > Nicholas Johnson wrote: > > > > > > > > > > > > > > > > > FWIW, I have a fiji board in a desktop system and it worked fine when > > > > > > > this code was enabled. > > > > > > > > > > > > Is the new DC code used for Fiji boards? IIRC, the audio component > > > > > > binding from amdgpu is enabled only for DC, and without the audio > > > > > > component binding the runtime PM won't be linked up, hence you can't > > > > > > power up GPU from the audio side access automatically. > > > > > > > > > > > > > > > > Yes, DC is enabled by default for all cards with runtime pm enabled. > > > > > > > > OK, thanks, I found that amdgpu got bound via component in the dmesg > > > > output, too: > > > > > > > > [ 21.294927] snd_hda_intel 0000:08:00.1: bound 0000:08:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu]) > > > > > > > > This is the place soon after amdgpu driver gets initialized. > > > > Then we see later another initialization phase: > > > > > > > > [ 26.904127] rfkill: input handler enabled > > > > [ 37.264152] [drm] PCIE GART of 1024M enabled (table at 0x000000F400000000). > > > > > > > > here shows 10 seconds between them. Then, it complained something: > > > > > > > > > > > > [ 37.363287] [drm] UVD initialized successfully. > > > > [ 37.473340] [drm] VCE initialized successfully. > > > > [ 37.477942] amdgpu 0000:08:00.0: [drm] Cannot find any crtc or sizes > > > > > > The above would be me hitting WindowsKey+P to change screens, but with > > > no DisplayPort attached to Fiji, hence it unable to find crtc. > > > > > > > > > > > ... and go further, and hitting HD-audio error: > > > > > > > That would be me having attached the DisplayPort and done WindowsKey+P > > > again. > > > > > > > [ 38.936624] [drm] fb mappable at 0x4B0696000 > > > > [ 38.936626] [drm] vram apper at 0x4B0000000 > > > > [ 38.936626] [drm] size 33177600 > > > > [ 38.936627] [drm] fb depth is 24 > > > > [ 38.936627] [drm] pitch is 15360 > > > > [ 38.936673] amdgpu 0000:08:00.0: fb1: amdgpudrmfb frame buffer device > > > > [ 40.092223] snd_hda_intel 0000:08:00.1: azx_get_response timeout, switching to polling mode: last cmd=0x00170500 > > > > > > > > After this point, HD-audio communication was screwed up. > > > > > > > > This lastcmd in the above message is AC_SET_POWER_STATE verb for the > > > > root node to D0, so the very first command to power up the codec. > > > > The rest commands are also about the power up of each node, so the > > > > whole error indicate that the power up at runtime resume failed. > > > > > > > > So, this looks to me as if the device gets runtime-resumed at the bad > > > > moment? > > > It does. However, this is not going to be easy to pin down. > > > > > > I moved from Arch to Ubuntu, and it behaves differently. I cannot > > > trigger the bug in Ubuntu. Plus, it puts the GPUs asleep, even if > > > attached at boot, unlike Arch. I will continue to try to trigger it. But > > > even if this is a problem with the Linux distribution, it should not be > > > able to trigger a kernel mode bug, so we should persist with finding it. > > > > Sure, that's a bug to be fixed. > > > > This made me thinking what happens if we load the HD-audio driver very > > late. Could you try to blacklist snd-hda-intel module, then load it > > manually after plugging the DP monitor and activating it? > Attached dmesg-blacklist-* > > It is interesting. If I enable the monitor with the module unloaded, and > then load the module, I cannot trigger the bug, even if disabling the > monitor, waiting for GPU to sleep, and then waking again. > > Even if I wake monitor up, put to sleep again, and then insmod when > sleeping, it does not cause bug when waking again. > > Is there anything special about the first time the monitor is used? > What do you mean by used? Do you mean plugged in to the GPU or used in the GUI? It might be easier to debug this without a GUI involved. Can you try this at runlevel 3 or something equivalent for your distro? When the GPU is powered up, the driver gets an interrupt when a display is hotplugged and generates an event and userspace applications can listen for these events. When the GPU is powered down, there's no interrupt. I think most GUIs poll GPUs periodically to handle this case so they can detect a new display even when the GPU is off. Maybe we are getting some sort of race here. GUI queries GPU driver, causes GPU to wake up, checks attached displays, GPU driver resets runtime pm timer. GPU goes back to sleep. The detection updates the ELD data which causes the HDA driver to wake up. It assumes the hw is on and tries to query it. In the meantime, the GPU has already powered everything down again. Alex > > > > Also, could you track who called the problematic power-up sequence, > > e.g. by adding WARN_ON_ONCE()? > Attached dmesg-warning > > > > > Last but not least, please check /proc/asound/card1/eld#* files (there > > are both card0 and card1 or such that contain eld#* files, and one is > > for i915 and another for amdgpu) before and after plugging. This > > shows whether the audio connection was recognized or not. > Before plugging: card not yet attached, so the sysfs for that card not > yet created > > After plugging (and insmod snd-hda-intel.ko): > codec#0 codec#2 eld#2.0 eld#2.1 eld#2.2 eld#2.3 eld#2.4 eld#2.5 eld#2.6 eld#2.7 eld#2.8 id pcm0c pcm0p pcm10p pcm3p pcm7p pcm8p pcm9p > > Regards, > Nicholas > > > > > > > thanks, > > > > Takashi > > > > --- a/sound/hda/hdac_controller.c > > +++ b/sound/hda/hdac_controller.c > > @@ -224,6 +224,7 @@ void snd_hdac_bus_update_rirb(struct hdac_bus *bus) > > dev_err_ratelimited(bus->dev, > > "spurious response %#x:%#x, last cmd=%#08x\n", > > res, res_ex, bus->last_cmd[addr]); > > + WARN_ON_ONCE(1); > > } > > } > > }