* RE: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response [not found] ` <b7e0b822a9deea506acaa40e0e31cc9f488bb446.camel@linux.intel.com> @ 2020-06-11 17:09 ` Lu, Brent 2020-06-11 17:59 ` Takashi Iwai 2020-06-11 18:01 ` Pierre-Louis Bossart 0 siblings, 2 replies; 8+ messages in thread From: Lu, Brent @ 2020-06-11 17:09 UTC (permalink / raw) To: Ranjani Sridharan, alsa-devel Cc: Pierre-Louis Bossart DRIVERS, authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel > Hi Brent, > > Thanks for the patch. Is this fix for a specific issue you're seeing? > If so, could you please give us some details about it? > > Thanks, > Ranjani Hi Ranjani, It's reported to happen on GLK Chromebook 'Fleex' that sometimes it cannot output the audio stream to external display. The kernel is Chrome v4.14 branch. Following is the reproduce step provided by ODM but I could reproduce it simply running aplay or cras_test_client so I think it's not about the cable plug/unplug handling. What steps will reproduce the problem? 1. Play YouTube video on Chromebook and connect it to external monitor with Type C to DP dongle 2. Press monitor power button to turn off the monitor 3. Press monitor power button again to turn on the monitor 4. Continue to play YouTube video and check audio playback 5. No sound comes out from built-in speaker of external monitor when turn on external monitor I added debug messages to print the RIRBWP register and realize that response could come between the read of RIRBWP in the snd_hdac_bus_update_rirb() function and the interrupt clear in the hda_dsp_stream_interrupt() function. The response is not handled but the interrupt is already cleared. It will cause timeout unless more responses coming to RIRB. [ 69.173507] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_get_response: addr 0x2 [ 69.173567] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_update_rirb: cmds 1 res 0 rp 21 wp 21 => handle the response in slot 21 [ 69.173570] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_update_rirb: updated wp 22 => new response in slot 22 but not handled [ 70.174089] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_get_response: timeout, wp 22 [ 70.174106] HDMI HDA Codec ehdaudio0D2: codec_read: fail to read codec I found there is a commit addressing this issue and cherry-pick it to the Chrome v4.14 but the issue is still there. I think more loop does not help because eventually there will be response coming in the snd_hdac_bus_update_rirb() function and become unhandled response in the last loop. commit 6297a0dc4c14a62bea5a9137ceef280cb7a80665 Author: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Date: Wed Jun 12 12:23:40 2019 -0500 ASoC: SOF: Intel: hda: modify stream interrupt handler Modify the stream interrupt handler to always wake up the IRQ thread if the status register is valid. The IRQ thread performs the check for stream interrupts and RIRB interrupts in a loop to handle the case of missed interrupts when an unsolicited response from the codec is received just before the stream interrupt handler is completed. Regards, Brent ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response 2020-06-11 17:09 ` [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response Lu, Brent @ 2020-06-11 17:59 ` Takashi Iwai 2020-06-11 18:12 ` Ranjani Sridharan 2020-06-12 6:15 ` Lu, Brent 2020-06-11 18:01 ` Pierre-Louis Bossart 1 sibling, 2 replies; 8+ messages in thread From: Takashi Iwai @ 2020-06-11 17:59 UTC (permalink / raw) To: Lu, Brent Cc: Ranjani Sridharan, alsa-devel, Pierre-Louis Bossart DRIVERS, authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel On Thu, 11 Jun 2020 19:09:08 +0200, Lu, Brent wrote: > > > Hi Brent, > > > > Thanks for the patch. Is this fix for a specific issue you're seeing? > > If so, could you please give us some details about it? > > > > Thanks, > > Ranjani > > Hi Ranjani, > > It's reported to happen on GLK Chromebook 'Fleex' that sometimes it > cannot output the audio stream to external display. The kernel is > Chrome v4.14 branch. Following is the reproduce step provided by > ODM but I could reproduce it simply running aplay or cras_test_client > so I think it's not about the cable plug/unplug handling. > > What steps will reproduce the problem? > 1. Play YouTube video on Chromebook and connect it to external monitor with Type C to DP dongle > 2. Press monitor power button to turn off the monitor > 3. Press monitor power button again to turn on the monitor > 4. Continue to play YouTube video and check audio playback > 5. No sound comes out from built-in speaker of external monitor when turn on external monitor > > I added debug messages to print the RIRBWP register and realize that > response could come between the read of RIRBWP in the > snd_hdac_bus_update_rirb() function and the interrupt clear in the > hda_dsp_stream_interrupt() function. The response is not handled but > the interrupt is already cleared. It will cause timeout unless more > responses coming to RIRB. Now I noticed that the legacy driver already addressed it recently via commit 6d011d5057ff ALSA: hda: Clear RIRB status before reading WP We should have checked SOF at the same time, too... thanks, Takashi ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response 2020-06-11 17:59 ` Takashi Iwai @ 2020-06-11 18:12 ` Ranjani Sridharan 2020-06-11 20:14 ` Takashi Iwai 2020-06-12 6:15 ` Lu, Brent 1 sibling, 1 reply; 8+ messages in thread From: Ranjani Sridharan @ 2020-06-11 18:12 UTC (permalink / raw) To: Takashi Iwai, Lu, Brent Cc: alsa-devel, Pierre-Louis Bossart DRIVERS, authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel On Thu, 2020-06-11 at 19:59 +0200, Takashi Iwai wrote: > On Thu, 11 Jun 2020 19:09:08 +0200, > Lu, Brent wrote: > > > > > Hi Brent, > > > > > > Thanks for the patch. Is this fix for a specific issue you're > > > seeing? > > > If so, could you please give us some details about it? > > > > > > Thanks, > > > Ranjani > > > > Hi Ranjani, > > > > It's reported to happen on GLK Chromebook 'Fleex' that sometimes it > > cannot output the audio stream to external display. The kernel is > > Chrome v4.14 branch. Following is the reproduce step provided by > > ODM but I could reproduce it simply running aplay or > > cras_test_client > > so I think it's not about the cable plug/unplug handling. > > > > What steps will reproduce the problem? > > 1. Play YouTube video on Chromebook and connect it to external > > monitor with Type C to DP dongle > > 2. Press monitor power button to turn off the monitor > > 3. Press monitor power button again to turn on the monitor > > 4. Continue to play YouTube video and check audio playback > > 5. No sound comes out from built-in speaker of external > > monitor when turn on external monitor > > > > I added debug messages to print the RIRBWP register and realize > > that > > response could come between the read of RIRBWP in the > > snd_hdac_bus_update_rirb() function and the interrupt clear in the > > hda_dsp_stream_interrupt() function. The response is not handled > > but > > the interrupt is already cleared. It will cause timeout unless more > > responses coming to RIRB. > > Now I noticed that the legacy driver already addressed it recently > via > commit 6d011d5057ff > ALSA: hda: Clear RIRB status before reading WP > > We should have checked SOF at the same time, too... Thanks, Takashi. But the legacy driver but doesnt remove the loop. The loop added in the SOF driver was based on the legacy driver and specifically to handle missed stream interrupts. Is there any harm in keeping the loop? Thanks, Ranjani ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response 2020-06-11 18:12 ` Ranjani Sridharan @ 2020-06-11 20:14 ` Takashi Iwai 2020-06-11 20:36 ` Pierre-Louis Bossart 0 siblings, 1 reply; 8+ messages in thread From: Takashi Iwai @ 2020-06-11 20:14 UTC (permalink / raw) To: Ranjani Sridharan Cc: Lu, Brent, alsa-devel, Pierre-Louis Bossart DRIVERS, authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel On Thu, 11 Jun 2020 20:12:53 +0200, Ranjani Sridharan wrote: > > On Thu, 2020-06-11 at 19:59 +0200, Takashi Iwai wrote: > > On Thu, 11 Jun 2020 19:09:08 +0200, > > Lu, Brent wrote: > > > > > > > Hi Brent, > > > > > > > > Thanks for the patch. Is this fix for a specific issue you're > > > > seeing? > > > > If so, could you please give us some details about it? > > > > > > > > Thanks, > > > > Ranjani > > > > > > Hi Ranjani, > > > > > > It's reported to happen on GLK Chromebook 'Fleex' that sometimes it > > > cannot output the audio stream to external display. The kernel is > > > Chrome v4.14 branch. Following is the reproduce step provided by > > > ODM but I could reproduce it simply running aplay or > > > cras_test_client > > > so I think it's not about the cable plug/unplug handling. > > > > > > What steps will reproduce the problem? > > > 1. Play YouTube video on Chromebook and connect it to external > > > monitor with Type C to DP dongle > > > 2. Press monitor power button to turn off the monitor > > > 3. Press monitor power button again to turn on the monitor > > > 4. Continue to play YouTube video and check audio playback > > > 5. No sound comes out from built-in speaker of external > > > monitor when turn on external monitor > > > > > > I added debug messages to print the RIRBWP register and realize > > > that > > > response could come between the read of RIRBWP in the > > > snd_hdac_bus_update_rirb() function and the interrupt clear in the > > > hda_dsp_stream_interrupt() function. The response is not handled > > > but > > > the interrupt is already cleared. It will cause timeout unless more > > > responses coming to RIRB. > > > > Now I noticed that the legacy driver already addressed it recently > > via > > commit 6d011d5057ff > > ALSA: hda: Clear RIRB status before reading WP > > > > We should have checked SOF at the same time, too... > > Thanks, Takashi. But the legacy driver but doesnt remove the loop. The > loop added in the SOF driver was based on the legacy driver and > specifically to handle missed stream interrupts. Is there any harm in > keeping the loop? A loop there might be safer to keep, indeed. That's basically for a difference kind of race, and it can still happen theoretically. Though, SOF is with the threaded interrupt, and it's interesting how the behavior differs. I can imagine that, if a thread irq is running while a new IRQ is re-triggered, the hard irq handler won't queue it again. But I might be wrong here, need some checks. Takashi ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response 2020-06-11 20:14 ` Takashi Iwai @ 2020-06-11 20:36 ` Pierre-Louis Bossart 2020-06-11 23:33 ` Lu, Brent 0 siblings, 1 reply; 8+ messages in thread From: Pierre-Louis Bossart @ 2020-06-11 20:36 UTC (permalink / raw) To: Takashi Iwai, Ranjani Sridharan Cc: Lu, Brent, alsa-devel, authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel >>>> I added debug messages to print the RIRBWP register and realize >>>> that >>>> response could come between the read of RIRBWP in the >>>> snd_hdac_bus_update_rirb() function and the interrupt clear in the >>>> hda_dsp_stream_interrupt() function. The response is not handled >>>> but >>>> the interrupt is already cleared. It will cause timeout unless more >>>> responses coming to RIRB. >>> >>> Now I noticed that the legacy driver already addressed it recently >>> via >>> commit 6d011d5057ff >>> ALSA: hda: Clear RIRB status before reading WP >>> >>> We should have checked SOF at the same time, too... >> >> Thanks, Takashi. But the legacy driver but doesnt remove the loop. The >> loop added in the SOF driver was based on the legacy driver and >> specifically to handle missed stream interrupts. Is there any harm in >> keeping the loop? > > A loop there might be safer to keep, indeed. That's basically for a > difference kind of race, and it can still happen theoretically. > > Though, SOF is with the threaded interrupt, and it's interesting how > the behavior differs. I can imagine that, if a thread irq is running > while a new IRQ is re-triggered, the hard irq handler won't queue it > again. But I might be wrong here, need some checks. IIRC we added this loop before merging all interrupt handling in one thread, somehow the MSI mode never worked reliably without this change, so maybe we don't need this loop any longer. I'd really prefer it if we didn't tie the RIRB handing change to this loop change, removing the loop should only be done with *a lot of testing*. ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response 2020-06-11 20:36 ` Pierre-Louis Bossart @ 2020-06-11 23:33 ` Lu, Brent 0 siblings, 0 replies; 8+ messages in thread From: Lu, Brent @ 2020-06-11 23:33 UTC (permalink / raw) To: Pierre-Louis Bossart, Takashi Iwai, Ranjani Sridharan Cc: alsa-devel, authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel > > IIRC we added this loop before merging all interrupt handling in one thread, > somehow the MSI mode never worked reliably without this change, so > maybe we don't need this loop any longer. > > I'd really prefer it if we didn't tie the RIRB handing change to this loop change, > removing the loop should only be done with *a lot of testing*. The reason I removed the loop because I thought it's for the unsolicited response, apparently it's not. I'd like to port the commit 6d011d5057ff ALSA: hda: Clear RIRB status before reading WP to SOF driver and upload a version 2. Thanks. Regards, Brent ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response 2020-06-11 17:59 ` Takashi Iwai 2020-06-11 18:12 ` Ranjani Sridharan @ 2020-06-12 6:15 ` Lu, Brent 1 sibling, 0 replies; 8+ messages in thread From: Lu, Brent @ 2020-06-12 6:15 UTC (permalink / raw) To: Takashi Iwai Cc: Ranjani Sridharan, alsa-devel, Pierre-Louis Bossart DRIVERS, authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel > > Now I noticed that the legacy driver already addressed it recently via commit > 6d011d5057ff > ALSA: hda: Clear RIRB status before reading WP > > We should have checked SOF at the same time, too... > > > thanks, > > Takashi Hi Takashi-san, Yes you are correct. I tested Chrome v5.4 on a CML Chromebook 'hatch' and realize the SOF does no suffer from this issue because the 'sync write' feature is enabled in hda_init. Soon I can reproduce the issue after turning it off. So I think it's still worthy to have this fix in case we need to disable 'sync write' someday. Regards, Brent ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response 2020-06-11 17:09 ` [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response Lu, Brent 2020-06-11 17:59 ` Takashi Iwai @ 2020-06-11 18:01 ` Pierre-Louis Bossart 1 sibling, 0 replies; 8+ messages in thread From: Pierre-Louis Bossart @ 2020-06-11 18:01 UTC (permalink / raw) To: Lu, Brent, Ranjani Sridharan, alsa-devel Cc: authored:2/16=12%,added_lines:21/248=8%,removed_lines:5/84=6%,),Liam Girdwood DRIVERS ), commit_signer:6/16=38%,authored:6/16=38%,added_lines:123/248=50% ,removed_lines:36/84=43%,Kai Vehmanen DRIVERS ), Daniel Baluta DRIVERS ), Mark Brown, Jaroslav Kysela, Takashi Iwai, Rojewski, Cezary, Zhu Yingjiang, Keyon Jie, Bard Liao, sound-open-firmware, linux-kernel On 6/11/20 12:09 PM, Lu, Brent wrote: >> Hi Brent, >> >> Thanks for the patch. Is this fix for a specific issue you're seeing? >> If so, could you please give us some details about it? >> >> Thanks, >> Ranjani > > Hi Ranjani, > > It's reported to happen on GLK Chromebook 'Fleex' that sometimes it > cannot output the audio stream to external display. The kernel is > Chrome v4.14 branch. Following is the reproduce step provided by > ODM but I could reproduce it simply running aplay or cras_test_client > so I think it's not about the cable plug/unplug handling. > > What steps will reproduce the problem? > 1. Play YouTube video on Chromebook and connect it to external monitor with Type C to DP dongle > 2. Press monitor power button to turn off the monitor > 3. Press monitor power button again to turn on the monitor > 4. Continue to play YouTube video and check audio playback > 5. No sound comes out from built-in speaker of external monitor when turn on external monitor > > I added debug messages to print the RIRBWP register and realize that > response could come between the read of RIRBWP in the > snd_hdac_bus_update_rirb() function and the interrupt clear in the > hda_dsp_stream_interrupt() function. The response is not handled but > the interrupt is already cleared. It will cause timeout unless more > responses coming to RIRB. > > [ 69.173507] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_get_response: addr 0x2 > [ 69.173567] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_update_rirb: cmds 1 res 0 rp 21 wp 21 > => handle the response in slot 21 > [ 69.173570] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_update_rirb: updated wp 22 > => new response in slot 22 but not handled > [ 70.174089] sof-audio-pci 0000:00:0e.0: snd_hdac_bus_get_response: timeout, wp 22 > [ 70.174106] HDMI HDA Codec ehdaudio0D2: codec_read: fail to read codec > > I found there is a commit addressing this issue and cherry-pick it to the > Chrome v4.14 but the issue is still there. I think more loop does not help > because eventually there will be response coming in the > snd_hdac_bus_update_rirb() function and become unhandled response > in the last loop. IIRC the loop was added because on some versions of the hardware we seem to miss stream interrupts - and I believe this was inspired by the same solution with the legacy HDaudio driver. Maybe we need to do something better for unsolicited responses but I'd be surprised if we can remove this loop - this sounds like asking for trouble. > > commit 6297a0dc4c14a62bea5a9137ceef280cb7a80665 > Author: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> > Date: Wed Jun 12 12:23:40 2019 -0500 > > ASoC: SOF: Intel: hda: modify stream interrupt handler > > Modify the stream interrupt handler to always wake up the > IRQ thread if the status register is valid. The IRQ thread > performs the check for stream interrupts and RIRB interrupts > in a loop to handle the case of missed interrupts when an > unsolicited response from the codec is received just before the > stream interrupt handler is completed. > > > Regards, > Brent > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-06-12 6:16 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1591883073-17190-1-git-send-email-brent.lu@intel.com> [not found] ` <b7e0b822a9deea506acaa40e0e31cc9f488bb446.camel@linux.intel.com> 2020-06-11 17:09 ` [PATCH] ASoC: SOF: Intel: hda: unsolicited RIRB response Lu, Brent 2020-06-11 17:59 ` Takashi Iwai 2020-06-11 18:12 ` Ranjani Sridharan 2020-06-11 20:14 ` Takashi Iwai 2020-06-11 20:36 ` Pierre-Louis Bossart 2020-06-11 23:33 ` Lu, Brent 2020-06-12 6:15 ` Lu, Brent 2020-06-11 18:01 ` Pierre-Louis Bossart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).