Skip to content

ASoC: SOF: ipc4-topology: Add module parameter to ignore the CPC value - #4531

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ipc4_topology_ignore_cpc_module_param_01
Aug 21, 2023
Merged

plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ipc4_topology_ignore_cpc_module_param_01

Conversation

@ujfalusi

Copy link
Copy Markdown
Collaborator

Add a new module parameter ipc4_force_cpc_to_zero which can be used to force the kernel to ignore the queried CPC value for the given module and send 0 instead.

The CPC lookup is still done to report missing configurations and the debug print is going to be different to be explicit that the CPC is ignored and what was the value we would have used.

The flag is intended to be used only when there is a need to validate the firmware behavior regarding to clock scaling since the 0 CPC value will force the DSP to run in full speed.

kv2019i
kv2019i previously approved these changes Aug 17, 2023

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

Naming is hard, so I have one alternative in the comment. Let's see what others think. I'm good with the original name (end-users will anyways need some context to use this option).

Comment thread sound/soc/sof/ipc4-topology.c Outdated
static bool force_cpc_to_zero;
module_param_named(ipc4_force_cpc_to_zero, force_cpc_to_zero, bool, 0444);
MODULE_PARM_DESC(ipc4_force_cpc_to_zero,
"Ignore CPC value for modules and force it to be 0.");

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.

This is a bit hard for outsiders as you'd have to know that zero has special meaning to make any sense of this. Additionally CPC should be explains somehow.

But, but, I don't really have very good alternatives. One solution:

MODULE_PARM_DESC(ipc4_ignore_fw_cpc,
    "Ignore the cycle budget (CPC) data for modules" 

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a bit hard for outsiders as you'd have to know that zero has special meaning to make any sense of this. Additionally CPC should be explains somehow.

Are we going to document IPC4, clock scaling, clock sources and all of the stuff around CPC?

But, but, I don't really have very good alternatives. One solution:

MODULE_PARM_DESC(ipc4_ignore_fw_cpc,
    "Ignore the cycle budget (CPC) data for modules" 

CPC == Cycle Budget?

Initially I had this: ipc4_ignore_cpc
My problem was and still is (after I thought about it) that the 'ignore' implies that we would do, use, rely on a 'cpc' value, but we are just reading it from manifest (at the moment, but we might have topology override and in multiple levels).
So we should have 'ipc4_ignore_queried_cpc_value', but ignoring does not tell that we are going to send 0 or cpc_max or 42.
I'm not sure if the added 'fw' helps in this.

Sure, let's roll a dice, I'm fine with whatever name ;)

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.

inline comments are free here, so we can be a little more verbose and say "... in other words forces DSP clock to max frequency"

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.

"force_cpc_to_zero" can only be understood if the reviewer knows that this zero value disables clock scaling.

If we want to avoid a description, 'ignore' is better IMHO. ipc4_ignore_fw_manifest_cpc ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it is going to ignore any CPC regardless of source and it might include in the future CPC from topology.
Should we go with a really generic ipc4_ignore_cpc.
I don't think we can expect any user to know what CPC is and what it does by the name of the parameter.

lgirdwood
lgirdwood previously approved these changes Aug 17, 2023

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

LGTM. Approving.

Comment thread sound/soc/sof/ipc4-topology.c Outdated
static bool force_cpc_to_zero;
module_param_named(ipc4_force_cpc_to_zero, force_cpc_to_zero, bool, 0444);
MODULE_PARM_DESC(ipc4_force_cpc_to_zero,
"Ignore CPC value for modules and force it to be 0.");

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.

inline comments are free here, so we can be a little more verbose and say "... in other words forces DSP clock to max frequency"

Comment thread sound/soc/sof/ipc4-topology.c Outdated
#include "ipc4-topology.h"
#include "ops.h"

static bool force_cpc_to_zero;

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.

Commit messsage:

Add a new module parameter ipc4_force_cpc_to_zero which can be used to
force the kernel to ignore the queried CPC value for the given module
and send 0 instead.

"module" has two meanings in this sentence, we are talking about kernel module and firmware module, not the same thing.

Also this ignores ALL values for ALL firmware modules, there is no selectivity or granularity as hinted by "the given module".

The flag is intended to be used only when there is a need to validate the
firmware behavior regarding to clock scaling since the 0 CPC value will
force the DSP to run in full speed.

this patch does the exact opposite, it prevents the DSP from using clock scaling, it does not validate anything related to clock scaling.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@plbossart, let me reword. It provides validation for clock scaling by disabling to provide additional data point to rule out clock scaling caused failure.

Comment thread sound/soc/sof/ipc4-topology.c Outdated
static bool force_cpc_to_zero;
module_param_named(ipc4_force_cpc_to_zero, force_cpc_to_zero, bool, 0444);
MODULE_PARM_DESC(ipc4_force_cpc_to_zero,
"Ignore CPC value for modules and force it to be 0.");

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.

"force_cpc_to_zero" can only be understood if the reviewer knows that this zero value disables clock scaling.

If we want to avoid a description, 'ignore' is better IMHO. ipc4_ignore_fw_manifest_cpc ?

@ujfalusi
ujfalusi dismissed stale reviews from lgirdwood and kv2019i via 54a1cc6 August 17, 2023 12:52
@ujfalusi
ujfalusi force-pushed the peter/sof/pr/ipc4_topology_ignore_cpc_module_param_01 branch from 83ec534 to 54a1cc6 Compare August 17, 2023 12:52
@ujfalusi

Copy link
Copy Markdown
Collaborator Author

Changes since v1:

  • flag renamed to ipc4_ignore_cpc
  • comment block added fort he flag
  • commit message updated

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

nicely worded commit message, thanks @ujfalusi

@plbossart
plbossart requested review from kv2019i and lgirdwood August 17, 2023 17:38

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

Commit and code don't match. Commit has "Add a new module parameter ipc4_force_cpc_to_zero " but code has "module_param_named(ipc4_ignore_cpc, ignore_cpc, bool, 0444);".

Otherwise looks good.

Add a new module parameter ipc4_ignore_cpc which can be used to force the
kernel to ignore the queried CPC value for all firmware modules and use 0
instead.

The CPC lookup is still done to report missing configurations and the
debug print is going to be different to be explicit that the CPC is ignored
and what was the value we would have used.

The CPC value is sent to the firmware with the MOD_INIT_INSTANCE message
and it is used by the firmware as a parameter for clock scaling.

The flag is intended to be used only when there is a need to validate the
firmware behavior regarding to clock scaling since the 0 CPC value will
force the DSP to run in full speed, disabling the scaling and provides
additional counter point to rule out clock management related issues.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ujfalusi
ujfalusi force-pushed the peter/sof/pr/ipc4_topology_ignore_cpc_module_param_01 branch from 54a1cc6 to 823ee45 Compare August 21, 2023 07:36
@ujfalusi

Copy link
Copy Markdown
Collaborator Author

Changes since v2:

  • commit message updated with s/ipc4_force_cpc_to_zero/ipc4_ignore_cpc

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

Thanks @ujfalusi , looks good now!

@plbossart
plbossart merged commit e6a152c into thesofproject:topic/sof-dev Aug 21, 2023
@ujfalusi
ujfalusi deleted the peter/sof/pr/ipc4_topology_ignore_cpc_module_param_01 branch November 30, 2023 06:51
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