Skip to content

volume: fix cache invalidation in volume_set_config() - #6274

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
lyakh:ipc4volume
Sep 9, 2022
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
lyakh:ipc4volume

Conversation

@lyakh

@lyakh lyakh commented Sep 8, 2022

Copy link
Copy Markdown
Collaborator

With IPC4 volume_set_config() is called from module_set_large_config() with the host mailbox used as a configuration source. Data there is written by the host, therefore any DSP cache contents for that area is invalid. volume_set_config() does invalidate local cache for that area but it's doing it too late - after calling module_set_configuration() which already reads the data. This leads to sporadic wrong configuration readings. Move cache invalidation before module_set_configuration() to fix that.

With IPC4 volume_set_config() is called from
module_set_large_config() with the host mailbox used as a
configuration source. Data there is written by the host, therefore
any DSP cache contents for that area is invalid. volume_set_config()
does invalidate local cache for that area but it's doing it too late
- after calling module_set_configuration() which already reads the
data. This leads to sporadic wrong configuration readings. Move cache
invalidation before module_set_configuration() to fix that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

@lgirdwood lgirdwood 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.

Can we do all set/get large config cache mgmt in the IPC layer ?

@lyakh

lyakh commented Sep 9, 2022

Copy link
Copy Markdown
Collaborator Author

CI: licencing server connection failed in https://sof-ci.01.org/sofpr/PR6274/build1517/build/cnl_xcc_error.txt

@lyakh

lyakh commented Sep 9, 2022

Copy link
Copy Markdown
Collaborator Author

Can we do all set/get large config cache mgmt in the IPC layer ?

@lgirdwood that was also my preference and I tried to do that, I really did. But it turned out to be more complicated than I expected and potentially more risky. To move this cache management up into the caller would be a larger change because of code reuse. Just to explain a bit - volume_set_config() now is called from volume_cmd() (IPC3 / LEGACY_INTERFACE) and is used as the .set_configuration hook for two non-legacy modules (volume and gain). The .set_configuration hook is called from module_set_large_config() (IPC4) and module_adapter_set_params() for SET_DATA and module_adapter_cmd() for SET_VALUE (IPC3). So currently that cache flushing is performed for generic modules on all those paths. So should we move it to all the callers? Which would then affect all modules of course, not just volume. That probably would be correct and wouldn't break anything, but is a larger change. This PR is fixing a bug that I hit in my local tests. So, I'd rather get it in now and see if we can make it generic in the future.

@juimonen juimonen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

so I vote to merge this now and do bigger changes in later pr.

@kv2019i kv2019i left a comment

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.

Fair enough, +1

@lgirdwood

Copy link
Copy Markdown
Member

@juimonen @kv2019i @lyakh ok - I will merge now, but this does need fixed to be managed by IPC core. @lyakh can you create a feature as a reminder.

@lgirdwood

Copy link
Copy Markdown
Member

@marc-hb @keqiaozhang fyi - we are still building for older platforms with xcc and gcc. See https://sof-ci.01.org/sofpr/PR6274/build1517/build/

@lgirdwood
lgirdwood merged commit 4e0f0de into thesofproject:main Sep 9, 2022
@lyakh
lyakh deleted the ipc4volume branch September 9, 2022 14:34
@lyakh

lyakh commented Sep 12, 2022

Copy link
Copy Markdown
Collaborator Author

@lyakh can you create a feature as a reminder.

@lgirdwood #6285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants