Skip to content

Conversation

@ujfalusi
Copy link
Collaborator

@ujfalusi ujfalusi commented Dec 8, 2022

Hi,

the recently merged thesofproject/sof#6637 added support for specifying the target core_id for the pipeline to be created by carving out 4 bits from the reserved section of the message extension.

The core_id can be specified in topology with SOF_TKN_SCHED_CORE token and the kernel will set it to the message.
The core_id will remain 0 (as it is now) when the token is not present and since these bits were ignored, old firmware should with new topology (which is unsupported combination) should not cause regressions, issues either.

replaces PR#4047

Added one new patch to fix a NULL pointer dereference if I force the core_id of the pipelines to 1 which will fail in firmware and the pipeline list allocated, but we have not stored any pipeline in the array, so on stop we are hitting a NULL pointer on the first spipe.

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4_pipeline_core_id_02 branch 2 times, most recently from b579303 to 505f946 Compare December 9, 2022 09:47
@ujfalusi
Copy link
Collaborator Author

ujfalusi commented Dec 9, 2022

Changes since v1:

  • typo fixed in the first patch's commit message
  • check added to validate the core_id consistency along the path:
  • checking each connection core_id for pipelines and widgets which will eventually going to find out if any component uses different core_id.

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

I don't think the protection rules are correct.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this rule is correct. It's perfectly fine to have a route between components that are handled by separate pipelines on separate cores. This would only allow for connected pipelines to be on the same core, and that's a short-term limitation we absolutely don't want to upstream.

Copy link
Member

Choose a reason for hiding this comment

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

same on the source side.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right, so no limitation on the connected pipelines and widgets.
The only limitation is that a widget's core must match with the pipeline's core that it is part of?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

iow, this is not valid:

if (src_pipeline->core_id != src_widget->core) {
...
}

if (sink_pipeline->core_id != sink_widget->core) {
...
}

Copy link
Member

Choose a reason for hiding this comment

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

The only limitation is that a widget's core must match with the pipeline's core that it is part of?

Even that part is not clear. When we have DP modules, we will be able to have chained modules on the same pipeline use different cores. So I don't know what the pipeline core would mean, it's an irrelevant notion when DP is used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right, so if all combinations are fine then what to check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

and most importantly, how the DP is going to be used? Is it going to have some mark in tplg?
Without DP we do have limitation, no? We should have the limitation checked now (we don't have DP support afaik) and make it conditional when DP is available?

Copy link
Member

Choose a reason for hiding this comment

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

IIRC there is nothing advertized anywhere in kernel-accessible manifests or topology that a module is LL or DP, so it could even be the case that only firmware can check for invalid configurations. @lgirdwood can we have the firmware folks confirm what errors cases we could/need to handled in the driver?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fwiw, if you send the CREATE_PIPELINE message with core_id=1, the firmware will reply with "invalid core id"

@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4_pipeline_core_id_02 branch from 505f946 to eb1ddfd Compare December 13, 2022 12:14
@ujfalusi
Copy link
Collaborator Author

Changes since v2:

  • Drop the core id verification from sof_ipc4_route_setup()
  • the check is going to happen in the firmware and in case of error it is going to be communicated to the kernel which we handle gracefully. This will allow policy and changes in firmware without a need for a synchronized kernel change.

plbossart
plbossart previously approved these changes Dec 13, 2022
Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

I would add a comment in the commit message to reflect the direction on error check

Firmware will double-check all information retrieved by topology and report errors if required. This will allow policy and changes in topologies without a need for a synchronized kernel change.

ranj063
ranj063 previously approved these changes Dec 13, 2022
…stored

If the pipeline setup fails at the first widget/pipeline then we will have
no spipe stored under the pipeline_list->pipelines, the
pipeline_list->count is 0.

If this is the case we would have a NULL pointer dereference if the
execution is allowed to proceed.

Check for this condition along with the pipeline_list->pipelines check

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The create pipeline message can carry the target code_id which is set to
0 at the moment.

Add macros to set the core_id in the message extension.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Token SOF_TKN_SCHED_CORE in topology file can specify the target core for
the pipeline, if it is missing it is going to be 0 (as it is right now).

Firmware will double-check all information retrieved by topology and
report errors if required. This will allow policy and changes in
topologies without a need for a synchronized kernel change.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ujfalusi ujfalusi dismissed stale reviews from ranj063 and plbossart via 3a1a741 December 14, 2022 09:44
@ujfalusi ujfalusi force-pushed the peter/sof/pr/ipc4_pipeline_core_id_02 branch from eb1ddfd to 3a1a741 Compare December 14, 2022 09:44
@ujfalusi
Copy link
Collaborator Author

Changes since v3:

  • Commit message updated for the last (core_id support) patch.

@plbossart plbossart requested a review from ranj063 December 14, 2022 15:08
@plbossart plbossart merged commit 7b2f58e into thesofproject:topic/sof-dev Dec 14, 2022
@ujfalusi ujfalusi deleted the peter/sof/pr/ipc4_pipeline_core_id_02 branch February 21, 2023 08:45
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.

3 participants