Repository navigation
IPC and keyword detection fixes - #4869
Conversation
kv2019i
left a comment
There was a problem hiding this comment.
Hmm, sensible problems to fix, but I'm left with many questions about the how the fixes work. Please see questions inline.
There was a problem hiding this comment.
I get the commit message description of the problem, but I've having hard time how moving the cpu-is-me check form one place to another actually fixes the problem as describe in commit message. Can you somehow clarify how this is supposed to work?
There was a problem hiding this comment.
I can. Look at the .delayed_response flag below. As I describe in the commit message, ipc_complete_cmd() can be entered 3 times: first on the primary core, then on the secondary core from the IDC / IPC, then on the secondary core from the pipeline task. Before this patch the first call on the primary core would set .delayed_response to false, so that the second call to this function would already find .delayed_response set to false and send a response. Then the third call would again find it as false and send it again. After this patch the primary core won't set false, only the secondary core will.
There was a problem hiding this comment.
@lyakh it is true the function is entered 3 times but the delayed_response flag is actually set only on the core that the IPC gets executed on right? So what the primary core does is sort of immaterial right?
There was a problem hiding this comment.
ipc is a global object. So, can something like this happen?
core 0 core 1
IPC IRQ
IPC EDF task
ipc_cmd()
IDC to core 1
IDC IRQ
timer IRQ
pipeline tasks
ipc_cmd()
ipc->delayed_response = 1
resume IPC
ipc->delayed_response = 0
?
There was a problem hiding this comment.
IDC is non-blocking isnt it? And timer IRQ can preempt the IPC task?
There was a problem hiding this comment.
@ranj063 It depends on the mode parameter. E.g. for STREAM_TRIGGER it's non-blocking:
static int ipc_stream_trigger(uint32_t header)
{
...
if (!cpu_is_me(pcm_dev->core))
return ipc_process_on_core(pcm_dev->core, false);
false means non-blocking
There was a problem hiding this comment.
Commit not matching code. Commit says ignore, code says "-EINVAL".
There was a problem hiding this comment.
and -EINVAL is not a a success code either ;-)
ipc: ipc3: return error on PCM_PARAMS request for active pipelines
If a PCM_PARAMS IPC arrives on an active pipeline, log and return an error immediately.
There was a problem hiding this comment.
but why should it be an error? can we not ignore the IPC and return succes?
There was a problem hiding this comment.
we should also be a bit more verbose with the trace context, i.e. "ipc: pipe X is active but client requested PCM params change"
There was a problem hiding this comment.
@lgirdwood could you please reply to @ranj063 's question, I'm not sure I asked for an explanation from you when you requested me to do this :-)
There was a problem hiding this comment.
Sending PCM params during a running pipeline means the driver and FW are out of sync. Now that's an obvious eror, but IIUC an IPC4 use case, so we should return 0 and have a big comment about this in teh code.
There was a problem hiding this comment.
@lgirdwood you want it back to returning zero?..
There was a problem hiding this comment.
yes please, with a comment too :)
There was a problem hiding this comment.
@lyakh ping - only this change is needed I think (and the commit message to align with return value).
|
CI failures: |
|
@wszypelt can the sample width be fixed in KD tests? |
There was a problem hiding this comment.
we should also be a bit more verbose with the trace context, i.e. "ipc: pipe X is active but client requested PCM params change"
|
@lyakh @lgirdwood we'll take a look at it together with Filip |
9fc69b3 to
e8a9015
Compare
It is possible, that ipc_complete_cmd() is entered 3 times while processing a single IPC message in multicore configurations: once by the primary core, then by the IDC IPC processing context, and finally by the pipeline thread, actually executing the IPC. To make sure that the response is only sent once by the core, that actually processes the IPC, we must not clear the .delayed_response flag on the primary core in such cases, it should only be done by the IDC IPC context before the pipeline task actually sends the response. Fixes: 82857a7 ("ipc: fix a IPC completion race") Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
IPCs from the host aren't very frequent during normal operation, and having all their codes in firmware trace output is extremely useful for debugging. Add a trace print for arriving IPCs. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
test_keyword_get_threshold() can return errors, make sure to check its return value before using it. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
With IPC3 it is an error to send a PCM_PARAMS IPC on an active pipeline, but it is a valid use-case with IPC4, ignore such IPCs. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
cpu_is_primary() can be easier to parse than !cpu_is_secondary(), make the swap. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
e8a9015 to
b2ef980
Compare
kv2019i
left a comment
There was a problem hiding this comment.
Looks fine. I did leave a comment/question to the last patch, but not a blocker.
|
|
||
| /* flush for secondary core */ | ||
| if (cpu_is_secondary(task->core)) | ||
| if (!cpu_is_primary(task->core)) |
There was a problem hiding this comment.
Why this change @lyakh ? Isn't cpu_is_secondary() the easier to parse in this case?
There was a problem hiding this comment.
@kv2019i sorry, I might not have the best taste for "simple" vs. "complex" :-) This is the only use of cpu_is_secondary() and I decided that !cpu_is_primary() is easy enough to understand to justify the removal of cpu_is_secondary() in one place...
|
CI showing known suspend timeouts. |
No description provided.