-
Notifications
You must be signed in to change notification settings - Fork 349
IPC4 error handling #5276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPC4 error handling #5276
Conversation
This is primarily needed to store IPC4 error codes to be returned in IPC replies. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
IPC4-specific error codes are only relevant for the IPC ABI, internally SOF is using POSIX error codes throughout its code base. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
lgirdwood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client API looks simple and will allow compatibility. Have you tried with Zephyr ?
@mwasko @marcinszkudlinski any comments ?
| ((ipc)->private) | ||
|
|
||
| struct ipc_core_ctx { | ||
| int error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may not always be an error, but its more of a reply with context. maybe call it ipc4_reply.
| { | ||
| struct core_context *ctx = (struct core_context *)cpu_read_threadptr(); | ||
|
|
||
| return &ctx->ipc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need for xtos ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is currently possible to build IPC4 with XTOS, right? And I think that configuration is or was also used for the initial development / testing? So I thought I shouldn't break that functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use Zephyr for this work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood well, sure, I wouldn't mind that, but what exactly does that mean? Does that mean that it should only be possible to build SOF with IPC4 with Zephyr? So we should disable building IPC4 with XTOS? If we don't do that and keep the possibility to build SOF with IPC4, then how would error handling work there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyakh IPC4 with XTOS is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood I just learned from @ujfalusi that work is ongoing for IPC4 with XTOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyakh, to clarify: testing is done with both xtos and zephyr, but I personally build SOF with XTOS for my local development needs. The parts that I'm working with are way above anything xtos/zephyr and makes no difference for the end result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ujfalusi ok, got it, but IIUC it might happen that IPC4 will not even build with XTOS beginning from some point. In fact maybe we should add a Kconfig dependency for that.
| return icd->cd; | ||
| } | ||
|
|
||
| int ipc4_add_comp_dev(struct comp_dev *dev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this removed? doesnt seem related to the change in this patch or I am not able to connect immediately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That function isn't called anywhere outside the file where it's defined, so I made it static
|
@lyakh can you explain what we gain in changing internal error codes into POSIX? I currently only see increased complexity and memory consumption. The POSIX is generic but we can make a great use of audio FW specific error codes (aligned with IPC error codes) that with proper granularity can help us in issue debugging and identifying potential root cause of the problem using only single error code. |
|
@mwasko sorry, this is not about changing IPC4 codes to posix, but about preserving the IPC4 reply within a POSIX environment so it can be sent correctly to the host drivers for every IPC. The PR naming probably does not help. |
I understand the idea, but this PR is a great example how cumbersome can be aligning with POSIX environment. Since we are moving to Zephyr and we are no longer going to maintain generic kernel code (where POSIX makes sense), but instead of that SOF is going to be Audio application layer, then maybe we should consider to switch to application specific error codes within SOF audio domain. |
|
@mwasko I agree in principle, that we don't have to use POSIX error codes or any other APIs. But what I do think we have to do is use consistent APIs throughout our code. Yes, we have to interface to other systems: to Zephyr, to the Linux kernel, etc. There we have to define interfaces well and - if needed - convert between them. That's what we do e.g. with IPC3 triggers - we have IPC3 trigger commands, that we exchange with the user, in this case with the Linux kernel. And internally SOF defines its own trigger codes, and it cleanly converts between the two sets at the interface. |
I am okay with the error status conversion at IPC process level but to do that we need something better then POSIX error codes. The only reason you had to add context for ipc error is because POSIX is too generic and we are unable to translate it into IPC status code. Additionally the specific application error codes can significantly speed up the debug and issue root causing.
I agree that IPC4 specific status as a return of generic functions like set_pipeline_state is not a way to go, but I would expect a meaningful set_pipeline_state error code that can be consumed both by IPC3 and IPC4 handlers (or any other caller). My recommendation is to define of SOF application error code enum and apply it incrementally with new code implementation/refactors, starting with IPC handlers. |
|
Can one of the admins verify this patch? |
|
@lyakh I think we can probably close now ? Can always reopen if things get difficult. |
@lgirdwood This PR is fixing real bugs and as a result of the discussion herein it was agreed to try to fix those bugs differently. However, those bugs still haven't been fixed. We can close this PR and I can add a high priority bug report instead if you prefer. |
|
Lets close now - we can always reopen if circumstances change. |
switch IPC4 internal error codes to POSIX, also fix several apparent bugs