Skip to content

[RFC][DO NOT MERGE][TESTS NEEDED] MSI/legacy PCI IPC improvements - #1109

Closed
plbossart wants to merge 2 commits into
thesofproject:topic/sof-devfrom
plbossart:fix/ipc-interrupts
Closed

[RFC][DO NOT MERGE][TESTS NEEDED] MSI/legacy PCI IPC improvements#1109
plbossart wants to merge 2 commits into
thesofproject:topic/sof-devfrom
plbossart:fix/ipc-interrupts

Conversation

@plbossart

Copy link
Copy Markdown
Member

This is a proof-of-concept compile-tested only suggestion, based on the slew of comments in
#1042 (stuck for 6+ weeks).

This is my interpretation of the discussion, only provided here to try and make progress. I may perfectly be completely wrong, I am way beyond my comfort zone here...

Comments and tests welcome, this is an important topic.

The addition of a kernel module parameter to optionally disable MSI
had the side effect of permanently disabling it.
The return value of pci_alloc_irq_vectors() is the number of allocated
vectors or a negative number on error, so testing with the ! operator
is not quite right. It was one optimization too far.
Restore previous behavior to use MSI by default, unless the user
selects not to do so or the allocation of irq_vectors fails.
Fixes: 672ff5e ('ASoC: SOF: Intel: hda: add a parameter to disable MSI')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
…ts in MSI mode
This patch is a POC to test Guennadi's comments in PR 1042.
The solution suggested in this patch keeps the existing code flow for
the PCI legacy mode, and avoids losing interrupts for the MSI mode.
MSI interrupt handling is currently conceptually broken. By
re-enabling the interrupt at the end of the thread, we may lost some
interrupts. We could modify the flow to re-enable the interrupt before
reading status registers, however this would be sub-optimial if we
used the PCI legacy mode since it would cause two calls to both the
IRQ handler and thread.
Another simpler solution would be to keep the interrupt enabled. This
would not be a problem for MSI, but would create an interrupt rain in
legacy mode. Having a conditional disabling/re-enabling of the
interrupt in the legacy mode solves that problem.
Let's test and see how this works.
Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

@keyonjiekeyonjie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Change the first commit to:
if (hda_use_msi && !pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI)) {

For the second commit, it looks good if we are aligned that we should disable/re-enable IPC interrupts for legacy IRQs and keep IPC interrupts on for MSI IRQs.

@plbossart

Copy link
Copy Markdown
MemberAuthor

@keyonjie Can you take a look at the errors flagged by CI on Up2?
I don't quite get why we have an issue on PCM period elapsed and preload.

this is the reported warning:

voidsnd_pcm_period_elapsed(structsnd_pcm_substream*substream)
{
structsnd_pcm_runtime*runtime;
unsigned longflags;
if (PCM_RUNTIME_CHECK(substream))
return;

And the firmware has a lot of errors as well:

0 2 DAI 2.14 263090498.385417 3.697917 src/audio/dai.c:494 dai_comp_trigger(), START
0 2 HOST 263091373.437500 875.052063 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263092372.916667 999.479187 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263093372.916667 1000.000000 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263094372.916667 1000.000000 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263095372.916667 1000.000000 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263096372.916667 1000.000000 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263097372.968750 1000.052063 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263098372.968750 1000.000000 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263099372.968750 1000.000000 src/audio/host.c:719 host_copy(), preload not yet finished
0 2 HOST 263100373.020833 1000.052063 src/audio/host.c:719 host_copy(), preload not yet finished

@plbossart

Copy link
Copy Markdown
MemberAuthor

no one seems to care so closing. If IPC bugs show up again don't blame me.

Sign up for freeto 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.

2 participants

@plbossart@keyonjie