Skip to content

[DO NOT MERGE] Ipc reply list fixes - #584

Closed
keyonjie wants to merge 2 commits into
thesofproject:topic/sof-devfrom
keyonjie:ipc_reply_list_fix
Closed

keyonjie wants to merge 2 commits into
thesofproject:topic/sof-devfrom
keyonjie:ipc_reply_list_fix

Conversation

@keyonjie

Copy link
Copy Markdown

This is aimed to fix #516, it is only RFC and I am not quite satisfied with the solution yet.

The issue is that sof_ipc_reply_find_msg() may find(logically only) wrong message from reply list in today's implementation.

As described in the 2nd commit, this is only an simple fix for this ipc message matching check but not
perfect, we may need to switch to use host_box to get the whole message for checking in future, which need changes together in FW side.

Any comments or follow up will be appreciated.

We should find message from reply_list with the whole message header(32
bits), not only the lowest 16 bits message id, otherwise, the searching
will always return either with the 1st message in the list(as all our
messages now are with 0x0 lowest 16 bits), or with no matched and show
error logs always to be "error: rx list empty but received 0x0".

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
As some of the highest IPC register bits are occupied for busy/done
interrupts, we can't use them for IPC message payload.

This is only an simple fix for this ipc message matching check but not
perfect, we may need to switch to use host_box to get the whole message
for checking in future, which need changes together in FW side.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really don't like the methodology here. We keep doing those incremental IPC fixes and it's still the weakest link in the chain. Seriously, all the problems i've encountered since I came back at the end of October are due to IPC issues.
We really need to uplevel things and have a design document (text only) that describes how the IPC is supposed to work, and second look at the implementation.
I will not merge any IPC-related fixes until we have such a document and a shared understanding of the end-goal.

@keyonjie

keyonjie commented Jan 24, 2019 •

Copy link
Copy Markdown
Author

I really don't like the methodology here. We keep doing those incremental IPC fixes and it's still the weakest link in the chain. Seriously, all the problems i've encountered since I came back at the end of October are due to IPC issues.
We really need to uplevel things and have a design document (text only) that describes how the IPC is supposed to work, and second look at the implementation.
I will not merge any IPC-related fixes until we have such a document and a shared understanding of the end-goal.

agreed, as I mentioned in the 2nd commit, I don't like this imperfect idea, I prefer we do this fix after SHIM register message cleanup first, and then we may only need the 1st commit here.

I submitted it with [RFC] to draw intention to the issue existed here, maybe I should change title to [DO NOT MERGE] now.

@keyonjie keyonjie changed the title [RFC] Ipc reply list fixes [DO NOT MERGE] Ipc reply list fixes Jan 24, 2019
@dbaluta

dbaluta commented Jan 24, 2019

Copy link
Copy Markdown
Collaborator

@plbossart @keyonjie agree. A design document would be excellent to understand how things works.

As far as I understand:

  1. host initiated IPC no longer uses SHIM for commands. We just have some leftovers which are cleaned up with:
    drivers: Remove unused unused host_msg field sof#877
    drivers: Remove unused unused host_msg field sof#877

  2. replies from FW to 1) still use cmd sent via SHIM registers.

  3. FW initiated IPC still uses cmd sent via SHIM registers.

I think we can now fix 1) by merging the two PR referenced there.

@mengdonglin mengdonglin added the upstream blocker Mandatory for upstream label Jan 31, 2019
Comment thread sound/soc/sof/ipc.c
header = SOF_IPC_MESSAGE_ID(header);

list_for_each_entry(msg, &ipc->reply_list, list) {
if (SOF_IPC_MESSAGE_ID(msg->header) == header)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@keyonjie could you explain where those low 16 bits of IPC commands, masked by SOF_IPC_MESSAGE_ID(), are actually set? I've searched through both the driver and the firmware IPC code and see a few locations, where those bits are read and checked, but I don't see them anywhere being set?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@lyakh they are actually not set(0s low 16 bits for all IPCs), so that's the problem I reported here: #516

Here my RFC PR try to remove comparing of this message ID(it is a wrong usage as all comparing were success here actually).

@plbossart

Copy link
Copy Markdown
Member

I still don't get what the issue is:

  1. if we deal with messages sequentially what is the point of having a list of received messages?
  2. if we want to deal with messages in an out-of-order manner shouldn't we keep the IDs and force firmware to deal with them?

What are we trying to accomplish here?

@keyonjie

Copy link
Copy Markdown
Author

I still don't get what the issue is:

  1. if we deal with messages sequentially what is the point of having a list of received messages?

Agree, if we can make sure dealing with replied messages sequentially, then we don't need the list. Today's problem is that we can't make sure about that as we are using a scheduled work to reading/handling the replied messages, so, if #581 is merged, the next step we can remove this list, that's the reason I prefix this PR "DO NOT MERGE" -- we don't necessarily need searching/matching replied message.

  1. if we want to deal with messages in an out-of-order manner shouldn't we keep the IDs and force firmware to deal with them?

This is a choice, if we decide to employ(the reality is that we haven't done that in both FW and driver) this ID(lowest 16 bits, 0~65535), we need implement it in both driver(increase ID for each Tx) and FW(make sure the new added ID content won't break any existed message comparing/checking logic) side simultaneously.

What are we trying to accomplish here?

@plbossart

Copy link
Copy Markdown
Member

closing since @lyakh is working on a better IPC

@plbossart plbossart closed this Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream blocker Mandatory for upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sof_ipc_reply_find_msg() may find wrong message from reply list

5 participants