Skip to content

Conversation

@ranj063
Copy link
Collaborator

@ranj063 ranj063 commented Jun 6, 2019

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.

@ranj063
Copy link
Collaborator Author

ranj063 commented Jun 6, 2019

@plbossart @kv2019i this is a extended/modifed version of #1011 and more in line with what the legacy driver does. In the few tests that I have run so far I have not met an IPC timeout yet.

Also Rander's PR #983 on top of this works well to fix #909

Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly nitpicking

@RanderWang
Copy link

@ranj063 I first tested on UP2 with CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC enabled.(Actually, you have to enable this config to enable hda_generic_machine driver on Up2).
Without my IPC fix in PR938, there are a lot of error message with WAKEEN feature.

Now I test your PR with WAKEEN feature, there are still many error messages. But I think your PR is not for this issue ?

[ 36.441640] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at 00000044
[ 36.441650] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000040 at 00000048
[ 36.441655] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000000 at 00000048
[ 36.444603] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at 00000048
[ 36.444612] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000040 at 00000048
[ 36.444621] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000040 at 00000048
[ 36.444626] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000000 at 00000048
[ 36.444631] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at 00000048
[ 36.444636] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000040 at 00000048
[ 36.444663] sof-audio-pci 0000:00:0e.0: error: nothing to do in IRQ thread
[ 36.444668] sof-audio-pci 0000:00:0e.0: loading firmware
[ 36.445007] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000002 at 00000048
[ 36.445011] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000000 at 00000048
[ 36.445017] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at 00000044
[ 36.445022] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000004 at 00000044
[ 36.445024] sof-audio-pci 0000:00:0e.0: booting DSP firmware
[ 36.445275] sof-audio-pci 0000:00:0e.0: error: timeout waiting for stream reset
[ 36.445636] sof-audio-pci 0000:00:0e.0: error: hdac prepare failed: ffffff92
[ 36.445977] sof-audio-pci 0000:00:0e.0: error: dma prepare for fw loading err: ffffff92
[ 36.446370] sof-audio-pci 0000:00:0e.0: error: failed to reset DSP
[ 36.446663] sof-audio-pci 0000:00:0e.0: error: failed to boot DSP firmware after resume -110
[ 36.447078] sof-audio-pci 0000:00:0e.0: pcm: open stream 1 dir 0
[ 36.447082] sof-audio-pci 0000:00:0e.0: period min 192 max 16384 bytes
[ 36.447085] sof-audio-pci 0000:00:0e.0: period count 2 max 16
[ 36.447088] sof-audio-pci 0000:00:0e.0: buffer max 65536 bytes
[ 36.448923] sof-audio-pci 0000:00:0e.0: ipc tx: 0x80010000
[ 36.756503] sof-audio-pci 0000:00:0e.0: error: ipc timed out for 0x80010000 size 120
[ 36.756795] sof-audio-pci 0000:00:0e.0: unknown ROM status value ffffffff
[ 36.756799] sof-audio-pci 0000:00:0e.0: error: status = 0xffffffff panic = 0xffffffff
[ 36.756961] sof-audio-pci 0000:00:0e.0: unknown ROM status value ffffffff

@RanderWang
Copy link

@ranj063 to reproduce it on UP2, just play a music after boot-up.


if (!pm_runtime_active(bus->dev))
return IRQ_NONE;
int ret = IRQ_WAKE_THREAD;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 Waking the thread is a big change. I had a draft addition to PR1011 that only wakes stream thread if CIS or SIS bits are set, but then one needs to use a mask. Maybe this is better, I'll give it a test.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work very well, no IPC timeouts when testing with WHL and CFL, and sanity check with UP2 works as well.

Waking up the stream threaded handled always is a bit fishy, but it does seem to do the trick.

@ranj063 ranj063 force-pushed the fix/hda-stream-irq branch from 35feec9 to b557c53 Compare June 6, 2019 16:43
@ranj063
Copy link
Collaborator Author

ranj063 commented Jun 6, 2019

@lyakh @kv2019i all comments addressed now

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.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063 ranj063 force-pushed the fix/hda-stream-irq branch from b557c53 to 408b7ab Compare June 6, 2019 16:57
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this look good. We can do the thread-wake-up optimization later if masking proves a stable solution. Plus the locking needs some work still, but this patch is not adding anything new and e.g. reg_lock usage looks good here.

@lyakh
Copy link
Collaborator

lyakh commented Jun 11, 2019

@ranj063 to reproduce it on UP2, just play a music after boot-up.

@RanderWang Sorry, I still cannot reproduce this problem. Does it occur for you every time or only sometimes? On analog or HDMI or both? PCM512X? Any other special conditions?

@lyakh
Copy link
Collaborator

lyakh commented Jun 11, 2019

@ranj063 to reproduce it on UP2, just play a music after boot-up.

@RanderWang Sorry, I still cannot reproduce this problem. Does it occur for you every time or only sometimes? On analog or HDMI or both? PCM512X? Any other special conditions?

I managed to reproduce it. The reason I wasn't getting it before is, that I also had #977 in my tree, which also happens to fix or at least to hide this problem.

@plbossart
Copy link
Member

(posting in correct PR this time)
@ranj063 I can't get HDaudio to work reliably without this PR, is there a reason to delay the merge further?

@plbossart
Copy link
Member

let's merge.

@plbossart plbossart merged commit dec1616 into thesofproject:topic/sof-dev Jun 11, 2019
@ranj063 ranj063 deleted the fix/hda-stream-irq branch July 18, 2019 01:18
plbossart pushed a commit that referenced this pull request May 29, 2024
timerlat top does some background/font color formatting. While useful
on terminal, it breaks the output on other formats. For example, when
piping the output for pastebin tools, the format strings are printed
as characters. For instance:

  [2;37;40m                                     Timer Latency                                              [0;0;0m
    0 00:00:01   |          IRQ Timer Latency (us)        |         Thread Timer Latency (us)
  [2;30;47mCPU COUNT      |      cur       min       avg       max |      cur       min       avg       max[0;0;0m
    0 #1013      |        1         0         1        54 |        5         2         4        57
    1 #1013      |        3         0         1        10 |        6         2         4        15

To avoid this problem, do the formatting only if running on a tty,
and in !quiet mode.

Link: https://lkml.kernel.org/r/8288e1544ceab21557d5dda93a0f00339497c649.1713968967.git.bristot@kernel.org

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants