Skip to content

Conversation

@abonislawski
Copy link
Member

It will increase max size for ipc msg, needed for #2212

Signed-off-by: Adrian Bonislawski adrian.bonislawski@linux.intel.com

@lbetlej
Copy link
Collaborator

lbetlej commented Dec 17, 2019

@abonislawski I'd suggest to make more future proof solution by increasing max IPC size to 2 KB for example (depending on amount of space left unoccupied in a memory window in case of Intel HW), this way number of IPC operation for sending large payloads to DSP would be significantly reduced. A typical example is transport of a large parameter set for keyphrase detection algorithm.

@lgirdwood
Copy link
Member

@dbaluta any objections on your end to 2kB ?

@dbaluta
Copy link
Collaborator

dbaluta commented Dec 18, 2019

@lgirdwood fine for us. We actually don't have any hard limitation for messages passed through dsp box / host box as in our side we use a shared DRAM area which can host up to 8MB so far. We trimmed the memory windows to match the ones on Intel.

@jajanusz
Copy link
Contributor

jajanusz commented Jan 2, 2020

SOFCI TEST

@abonislawski
Copy link
Member Author

@abonislawski I'd suggest to make more future proof solution by increasing max IPC size to 2 KB for example (depending on amount of space left unoccupied in a memory window in case of Intel HW), this way number of IPC operation for sending large payloads to DSP would be significantly reduced. A typical example is transport of a large parameter set for keyphrase detection algorithm.

@lbetlej I tried 2000 and 2048 but both results in problem with FW load, not sure why
It is used only for static allocations so it will waste a lot of memory if set way more than needed

@lgirdwood
Copy link
Member

lgirdwood commented Jan 6, 2020

@abonislawski one thing to watch out for when changing section sizes is that we are also growing/shrinking other sections correctly (and updating their metadata for linker and allocator etc).
rimage and GNU ld have some built in checks to make sure no sections overlap, but it could be our linker sections are not aligned with some section macros ?

Increased ipc msg max size will allow to fit a bigger ipc, e.g. needed for mux channel map.
Because of that it is also needed to increase HEAP_SYSTEM_M_SIZE to fit in memory bigger ipc msg size.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
@abonislawski
Copy link
Member Author

@abonislawski one thing to watch out for when changing section sizes is that we are also growing/shrinking other sections correctly (and updating their metadata for linker and allocator etc).
rimage and GNU ld have some built in checks to make sure no sections overlap, but it could be our linker sections are not aligned with some section macros ?

@lgirdwood I think there should be no problem with sections, after recent changes for most of them we only provide size of sections and linker will put them where he thinks.
As discussed with @tlauda no need for more changes to allow 2kB size, but please comment @tlauda

@lgirdwood lgirdwood added the ABI ABI change involved label Jan 8, 2020
@lgirdwood lgirdwood added this to the v1.5 milestone Jan 8, 2020
@lgirdwood
Copy link
Member

Ok, looks good to me, is there a corresponding kernel PR ?

@jajanusz
Copy link
Contributor

jajanusz commented Jan 8, 2020

Please figure out if you want 768b or 2kb before merging this

@jajanusz
Copy link
Contributor

@abonislawski Please let us know what's your plan for this PR, you can mark it as WIP if you are working on some dependency

@abonislawski
Copy link
Member Author

@jajanusz it would be the best to merge this and #2212 because Emil is waiting so long with mux tests.
And later I will try to make this ipc allocations less static to allow full msg size, ok?

@lgirdwood
Copy link
Member

@jajanusz @abonislawski are we just waiting for a corresponding kernel PR now ?

@jajanusz
Copy link
Contributor

@abonislawski please fix CI issues and take care of kernel patch, then we can merge this

@abonislawski
Copy link
Member Author

@lgirdwood @jajanusz kernel PR:
thesofproject/linux#1738

@plbossart
Copy link
Member

@plbossart
So, if your question is do I have to add more ifs like those after merging this PR?, then answer is: NO.
Can we merge it then?

Well, 1 correction - these IPCs are not used AFAIK in driver, they exist in FW.
So if you use mux then, IPC for new FW will be bigger (beyond old limit), but if you don't use mux in driver yet (as we suspect) then it doesn't matter.

but we don't have a mux-specific IPC, do we? It should be the component ID and then the component-specific data. The IPC is only the transport - I hope.

@abonislawski
Copy link
Member Author

Well, 1 correction - these IPCs are not used AFAIK in driver, they exist in FW.
So if you use mux then, IPC for new FW will be bigger (beyond old limit), but if you don't use mux in driver yet (as we suspect) then it doesn't matter.

Yeap, exactly and anyway in both cases this is not about this PR

@abonislawski
Copy link
Member Author

but we don't have a mux-specific IPC, do we? It should be the component ID and then the component-specific data. The IPC is only the transport - I hope.

I think "component-specific-data" is what we are thinking about. Only this will change

@plbossart
Copy link
Member

just for fun I looked up all the usages of this value in the kernel:

include/sound/sof/header.h:#define SOF_IPC_MSG_MAX_SIZE                 384
sound/soc/sof/ipc.c:    if (msg_bytes > SOF_IPC_MSG_MAX_SIZE ||
sound/soc/sof/ipc.c:        reply_bytes > SOF_IPC_MSG_MAX_SIZE)
sound/soc/sof/ipc.c:    sparams->pl_size = SOF_IPC_MSG_MAX_SIZE - sparams->hdr_bytes;
sound/soc/sof/ipc.c:    partdata = kzalloc(SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL);
sound/soc/sof/ipc.c:    if (cdata->rhdr.hdr.size <= SOF_IPC_MSG_MAX_SIZE) {
sound/soc/sof/ipc.c:    msg->msg_data = devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE,
sound/soc/sof/ipc.c:    msg->reply_data = devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE,
sound/soc/sof/topology.c:       if (ipc_size > SOF_IPC_MSG_MAX_SIZE) {

It seems we are going to need to make this a variable that depends on the ABI level?

@jajanusz
Copy link
Contributor

just for fun I looked up all the usages of this value in the kernel:

include/sound/sof/header.h:#define SOF_IPC_MSG_MAX_SIZE                 384
sound/soc/sof/ipc.c:    if (msg_bytes > SOF_IPC_MSG_MAX_SIZE ||
sound/soc/sof/ipc.c:        reply_bytes > SOF_IPC_MSG_MAX_SIZE)
sound/soc/sof/ipc.c:    sparams->pl_size = SOF_IPC_MSG_MAX_SIZE - sparams->hdr_bytes;
sound/soc/sof/ipc.c:    partdata = kzalloc(SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL);
sound/soc/sof/ipc.c:    if (cdata->rhdr.hdr.size <= SOF_IPC_MSG_MAX_SIZE) {
sound/soc/sof/ipc.c:    msg->msg_data = devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE,
sound/soc/sof/ipc.c:    msg->reply_data = devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE,
sound/soc/sof/topology.c:       if (ipc_size > SOF_IPC_MSG_MAX_SIZE) {

It seems we are going to need to make this a variable that depends on the ABI level?

Do you want to add this conditional macro first? You can assume that it has higher size since MINOR 13

@plbossart
Copy link
Member

just for fun I looked up all the usages of this value in the kernel:

include/sound/sof/header.h:#define SOF_IPC_MSG_MAX_SIZE                 384
sound/soc/sof/ipc.c:    if (msg_bytes > SOF_IPC_MSG_MAX_SIZE ||
sound/soc/sof/ipc.c:        reply_bytes > SOF_IPC_MSG_MAX_SIZE)
sound/soc/sof/ipc.c:    sparams->pl_size = SOF_IPC_MSG_MAX_SIZE - sparams->hdr_bytes;
sound/soc/sof/ipc.c:    partdata = kzalloc(SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL);
sound/soc/sof/ipc.c:    if (cdata->rhdr.hdr.size <= SOF_IPC_MSG_MAX_SIZE) {
sound/soc/sof/ipc.c:    msg->msg_data = devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE,
sound/soc/sof/ipc.c:    msg->reply_data = devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE,
sound/soc/sof/topology.c:       if (ipc_size > SOF_IPC_MSG_MAX_SIZE) {

It seems we are going to need to make this a variable that depends on the ABI level?

Do you want to add this conditional macro first? You can assume that it has higher size since MINOR 13

I was thinking of a variable field in a structure, not sure if we need a complicated macro.

But one question: we've used 'large IPCs' before, where information is sent for 'process' in multiple smaller IPCs. @juimonen worked on this. Doesn't this apply to the MUX case?

Put differently, are we really going to need to update the IPC size everytime we've got a structure that doesn't fit in the current size? or should we break this in pieces and transport it in multiple passes?

@abonislawski
Copy link
Member Author

abonislawski commented Jan 22, 2020

Put differently, are we really going to need to update the IPC size everytime we've got a structure that doesn't fit in the current size? or should we break this in pieces and transport it in multiple passes?

No, as discussed in the first comments: in the near future 'ipc msg size' will be changed to maximum available along with ipc msg allocation changes in fw.

But one question: we've used 'large IPCs' before, where information is sent for 'process' in multiple smaller IPCs. @juimonen worked on this. Doesn't this apply to the MUX case?

I dont remember details but we decided to stay with the current approach.
@akloniex do you remember the reasons?

But anyway, ipc msg size is going to be increased to maximum available size to not waste resources and splitting mux configuration will not be needed

@juimonen
Copy link

If I recall correctly, mux config was then fitting the 1 payload. The config was then in topology as byte control data and If I recall correctly we had some issues of setting the default data. As I see we are only missing the firmware side support in demux for large data. You can see how it is done in the eq's. @singalsu can also comment as he was just hacking around the eq's.

I you want to have large data blob or just large number of parameters as part of basic widget (not its related control), I think we don't support that atm.

@singalsu
Copy link
Collaborator

@singalsu can also comment as he was just hacking around the eq's.

Yep, it works perfectly. Please see eq_fir.c code.

@juimonen
Copy link

and just my 2 cents to this:

  1. If we are still using the binary blob for mux, we should honestly get rid of it and specify real visible values in topology/kernel/firmware for it. The binary blob was done as we we're in horribly hurry and understood that specifying it then would take ages. Anyway we should do it and only use binary blobs where they are proper, like eq transfer function for example (or if something needs to be hidden for some reason).

  2. I don't think increasing the msg size really makes a big difference in ipc traffic, we are talking about 1-10-100 messages (with widget parameter setting) and our ipc should handle that without issues? Otherwise it is very crappy ipc...

@jajanusz
Copy link
Contributor

We should keep logic as simple as possible. Multi-part IPCs require additional logic in components and should be used when there is no alternative. Increasing IPC msg size limit is good.

@abonislawski
Copy link
Member Author

abonislawski commented Jan 23, 2020

@juimonen @singalsu thanks for comments but regardless of mux we want to increase the ipc msg limit to maximum, 384 is a limit without any reasons.

Multi part IPC is a way to go if we will reach real hard limits


/** Maximum message size for mailbox Tx/Rx */
#define SOF_IPC_MSG_MAX_SIZE 384
#define SOF_IPC_MSG_MAX_SIZE 768
Copy link
Member

Choose a reason for hiding this comment

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

@abonislawski my understanding after recent discussions is that we are moving to 2kB.

Copy link
Contributor

Choose a reason for hiding this comment

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

@lgirdwood To move to 2kB we have to rework how msgs are allocated. @abonislawski will work on that, but for now we would like to use as much as we can without these changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

@lgirdwood just like @jajanusz said, please merge

Copy link
Member

Choose a reason for hiding this comment

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

@lgirdwood To move to 2kB we have to rework how msgs are allocated. @abonislawski will work on that, but for now we would like to use as much as we can without these changes.

can we quantify the work needed to support 2KB IPC messages? If we can have ONE ABI change it's less work for me, and less confusion for everyone.

Copy link
Member Author

Choose a reason for hiding this comment

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

@plbossart hardly to say but atm Im busy with other tasks

Copy link
Contributor

Choose a reason for hiding this comment

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

@plbossart It's not 5-minutes-task. Msg allocation and handling code would need to be reworked and we have more urgent tasks now. We want to increase it to 768 atm, cos without it we stall another feature. I know it's inconvenient for you, but we can't help much with that now. We would greatly appreciate your help with approving this one.

Copy link
Member

Choose a reason for hiding this comment

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

Humm, what happens if I don't? The mux would be stalled, but what is the impact? Put differently, who needs the mux support from the kernel level in the coming weeks?

@juimonen
Copy link

@jajanusz @abonislawski yes thanks from my side no objection to increase the max size.

Copy link
Collaborator

@lbetlej lbetlej left a comment

Choose a reason for hiding this comment

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

@abonislawski we have a combined @mmaka1 @plbossart @lbetlej proposal to make change that is scalable for the future:

  1. Set IPC max size in FW to 4KB (cavs hw memory window size)
  2. Report IPC max max size via FW ready to a driver
  3. Driver uses value reported by FW

@lgirdwood lgirdwood modified the milestones: v1.5, v1.6 Feb 20, 2020
@abonislawski
Copy link
Member Author

@plbossart @lbetlej @mmaka1 I will add reporting capability of IPC msg max size to extended manifest when #2427 merged

@lgirdwood
Copy link
Member

@abonislawski I assume we will be changing to 4kB ?

@abonislawski
Copy link
Member Author

@lgirdwood not now but it will not require another kernel change

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

Can we resubmit with the larger size and let CI do it's thing.

@kv2019i
Copy link
Collaborator

kv2019i commented Sep 4, 2020

@abonislawski ping? what's the status of this?

@abonislawski
Copy link
Member Author

@kv2019i ipc size added to ext_manifest and merged in FW but still not used in kernel

@lgirdwood
Copy link
Member

@abonislawski ping. Will move to v1.7

@lgirdwood lgirdwood modified the milestones: v1.6, v1.7 Sep 17, 2020
@lgirdwood lgirdwood modified the milestones: v1.7, v1.8 Jan 25, 2021
@mwasko
Copy link
Contributor

mwasko commented Jan 25, 2021

Closing this PR as the related 2212 (closed - cancelled)

@mwasko mwasko closed this Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ABI ABI change involved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants