-
Notifications
You must be signed in to change notification settings - Fork 48
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
tools: sof_perf_analyzer: fix widget ID parsing error #1122
Conversation
1a41d4c
to
64ad709
Compare
Long before we search the info in a different place, could we have a "quicker fix" where the entire script does not crash but replaces the missing ID with some "Unknown" category or something? |
tools/sof_perf_analyzer.py
Outdated
comp_peak_max_cycles = perf_info.groupby('COMP_ID')['CPU_PEAK'].max() | ||
perf_stats['MODULE_CPC'] = comp_peak_max_cycles |
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.
perf_stats['MODULE_CPC'] = perf_info.groupby('COMP_ID')['CPU_PEAK'].max()
single line is good.
Let's make this commit a standalone PR, because
- it has nothing to do with widget id issue
- it can be merged quickly
commit message:
Previously, module CPC is calculated by multiplying the mean
value of cpu_peak with a margin scalar, after internal technical
discussion, change module CPC to the maximum value of module's
cpu_peak as aligned.
@btian1 For the widget id issue, I am afraid we have to refine code and comments according Marc's review comments. Let's sync tomorrow. |
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.
no idea what this is about
"When there is no widget ID in kernel logs, try to find the widget ID in bind related logs." Has anyone tried to change the kernel logs to make the problem go away? |
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.
in both create widget and bind message parsing, two lines are involved. we cannot assume it is atomic. because the concurrent nature of the linux kernel.
[...]
there is still probability a component in the topology is missing in our comp_name dict, but the probability is low as we parse more and more information
I just had a quick chat with @plbossart and he told me that there has been zero attempt to simplify the kernel logs... is this real?
f3104d3
to
19a0efc
Compare
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.
It's rather disappointing that after multiple asks I still get this sort of raw dump of information without clarity on the problem statement. This is starting to be a waste of everyone's time if I am honest. - @plbossart
About two weeks ago, 4 days after this PR was first submitted, I asked this:
#1122 (comment)
Which cases? And what exactly is missing in these cases and why? An entire line and if yes which one? A part of a line and if yes which part? You must be much more specific, otherwise it's impossible to review the code without knowing what it is trying to parse.
That question was marked as "resolved" without an answer.
At the same time I asked basically the same question in #1108. No answer either.
It's pointless to submit a fix to a problem that has not been analyzed, understood and explained. It's called "programming by coincidence".
- Why are the kernel logs incomplete, how and when?
- Why can't the kernel logs be fixed instead? Or at least made somewhat better.
Don't answer in this PR here, answer in the bug 1108
19a0efc
to
5076036
Compare
5076036
to
63e6317
Compare
Create pipeline pipeline.3 (pipe 3) - instance 3, core 0 | ||
|
||
[ 59.622645] snd_sof:sof_ipc4_widget_setup: sof-audio-pci-intel-mtl 0000:00:1f.3: | ||
Create widget host-copier.0.capture (pipe 3) - ID 4, instance 3, core 0 | ||
|
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.
'''Process the dmesg to get component ID to component name mapping,
they are acquired from the line that contains 'Create widget':
EXAMPLE_OF_CREATE_WIDGWT_LINE
By design in the kernel, pipeline ID is the instance ID of pipeline
widget, so it is acquired from the line that contains 'Create pipeline':
EXAMPLE_OF_CREATE_PIPELINE_LINE
'''
tools/sof_perf_analyzer.py
Outdated
# with sof kernel PR: https://github.com/thesofproject/linux/pull/4709 | ||
# pipeline and module creation are using separate print in kernle log. | ||
# So, for pipeline case, pipeline instance ID will be extracted from pipeline | ||
# logs. For module creation, module instance ID and module ID will be | ||
# extracted accordingly. | ||
# ppln_id, widget_id and widget instance ID will be combined together to | ||
# column COMP_ID as the unique ID for each module inside pipelines. |
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.
keep my original comments, it explains why instance id of pipeline widget is the widget pipeline id for the widgets of the pineline
tools/sof_perf_analyzer.py
Outdated
module_instance_id = int(line_split[7][:-1]) | ||
widget_id = int(line_split[5][:-1]) |
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.
explain [:-1]
with a simple comment.
widget_id = next_line.split('|')[0].split(':')[-1].strip() | ||
# convert to the same ID format in mtrace | ||
widget_id = int('0x' + widget_id[-6:], 16) | ||
ppln_id = int(line_split[5][:-1]) |
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.
explain [:-1]
, no one know why if you don't explain.
# remove ending comma(,) with [:-1]
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.
Commit title and body:
tools: sof_perf_analyzer: fix widget ID parsing error
In existing code, we parse component name from the line
that contains 'Create widget', and component ID from the
next line, which normally is the ipc tx message:
Create widget host-copier.0.playback instance 0 - pipe 1 - core 0
ipc tx : 0x40000004|0x15: MOD_INIT_INSTANCE [data size: 84]
However, due to the concurrent nature of linux kernel, the
assumption that `Create widget` message and `ipc tx` message
are always adjacent is wrong. An exception will be raised
if the next line is not the 'ipc tx' message.
The first step to fix the issue is to make a kernel PR to print
all the information we need in a single 'Create widget' line,
thus to avoid the requirement for multiple lines of kernel message,
see https://github.com/thesofproject/linux/pull/4709.
And next,this patch will parse the new 'Create widget' line to
get component name and ID.
Fixes: https://github.com/thesofproject/sof-test/issues/1108
Always describe the issue (what), root cause of the issue (why), and how it is fixed(how).
63e6317
to
d581c89
Compare
d581c89
to
9d2f437
Compare
9d2f437
to
6720c04
Compare
In existing code, we parse component name from the line that contains 'Create widget', and component ID from the next line, which normally is the ipc tx message: Create widget host-copier.0.playback instance 0 - pipe 1 - core 0 ipc tx : 0x40000004|0x15: MOD_INIT_INSTANCE [data size: 84] However, due to the concurrent nature of linux kernel, the assumption that `Create widget` message and `ipc tx` message are always adjacent is wrong. An exception will be raised if the next line is not the 'ipc tx' message. The first step to fix the issue is to make a kernel PR to print all the information we need in a single 'Create widget' line, thus to avoid the requirement for multiple lines of kernel message, see thesofproject/linux#4709. And next,this patch will parse the new 'Create widget' line to get component name and ID. Fixes: thesofproject#1108 Signed-off-by: Baofeng Tian <[email protected]> Signed-off-by: Chao Song <[email protected]>
see internal test report 35019, test result is good. |
dismiss as resolved
In existing code, we parse component name from the line
that contains 'Create widget', and component ID from the
next line, which normally is the ipc tx message:
Create widget host-copier.0.playback instance 0 - pipe 1 - core 0
ipc tx : 0x40000004|0x15: MOD_INIT_INSTANCE [data size: 84]
However, due to the concurrent nature of linux kernel, the
assumption that
Create widget
message andipc tx
messageare always adjacent is wrong. An exception will be raised
if the next line is not the 'ipc tx' message.
The first step to fix the issue is to make a kernel PR to print
all the information we need in a single 'Create widget' line,
thus to avoid the requirement for multiple lines of kernel message,
see thesofproject/linux#4709.
And next,this patch will parse the new 'Create widget' line to
get component name and ID.