-
Notifications
You must be signed in to change notification settings - Fork 349
ipc: notifications refactor #2454
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
ipc: notifications refactor #2454
Conversation
src/drivers/imx/ipc.c
Outdated
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.
@tlauda do we have a real usecase where checking IPC bits is not enough?
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.
@dbaluta Yes, during specific power flows on cAVS DSP.
aa70f91 to
3192c4d
Compare
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.
Looks good, but my only thought is that an allocation failure may prevent an IPC message ? Should we pre-allocate the IPC messages (i.e embed into component private data). That way we are always guaranteed to succeed, I would also pre-alloc 8 messages on IPC core too so that we always copy client messages into IPC core messages (meaning we wont have collisions between host/IPC core and clients).
IPCs are allocated along with notification owner. There are no other allocations during the owner's lifetime. I think I don't get the second part. What is your definition of host/IPC core/client? |
|
@lgirdwood Pre-allocation on the IPC core would consume a lot of memory when max ipc size is aligned with the mailbox size since the core would need to alloc max for each one in the pool. While an originator can do precise allocation. |
3192c4d to
e0e16e1
Compare
src/ipc/handler.c
Outdated
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.
I am not sure why there is a dedicated function needed for each specific message. Looks like some generic ipc_prepare(...) called by a client could do the work?
src/ipc/handler.c
Outdated
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 should not be part of ipc code I believe. How about:
position_update(...)
{
mailbox_stream_write(...)
ipc_send(...)
}|
@lgirdwood With these set of patches we're totally changing the approach to owning and sending notifications. The idea was proposed by @mmaka1 as a potential solution for optimizing memory usage. Just to sum up:
|
I have one issue: should there be support for canceling a notification that is in the queue whenever the data structures for a component are freed? We 100% don't want to send invalid notifications via a use-after-free do we? |
There is such support in ipc_msg_free(). |
2f9ca73 to
caae55b
Compare
|
Jenkins CI is known issue, but we have UT failure in the internal CI. |
Adds additional parameter to control whether upstream IPC channel is currently free or not. It's helpful in case for some reason checking IPC bits is not enough. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Returns status -EBUSY, when IPC upstream channel is currently busy and notification cannot be sent. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds improved implementation for sending IPC notifications to host. New function takes ipc_msg directly and adds it to message queue if message is not already there. Also critical notifications will be sent right away or added to the beginning of the queue if sending fails. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds helper methods for initial building of IPC notifications. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds helper methods for IPC notifications allocation and free. This way we can allocate only the size we need without preallocating the maximum size. Free operation automatically handles synchronization. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Changes implementation of notifications allocation. Instead of using common empty list of messages let's switch to allocating message per source of notification. This way we won't have problem with memory and lack of empty messages and also we will be able to optimize memory. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
caae55b to
ecdc7e6
Compare
|
SOFCI TEST |
|
Rerunning CI now that WHL DUT has been rebooted. |
This set of patches changes the way notifications are allocated and sent. More details in commit descriptions.