-
Notifications
You must be signed in to change notification settings - Fork 139
Runtime trace filtration #2377
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
Runtime trace filtration #2377
Conversation
plbossart
left a comment
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.
Sounds like a good idea but needs a bit of cleanup, e.g. memory allocation doesn't seem quite right
|
@plbossart @lgirdwood I'm not sure I fully appreciate the usefulness of this. We're adding a new user ABI that we'll have to maintain, version, secure against abuse etc. Besides we'll start getting partial logs, which will have us wonder where messages X and Y are gone. Wouldn't it be better to have simple 2-3 verbosity levels and otherwise use grep for any further filtering? |
kv2019i
left a comment
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.
Mostly covered by other reviewers but a few more comments.
I wonder if we'd need to document the interface given this is more than just a readonly debugfs node. OTOH, sof-logger is open-source, so maybe that is sufficient in this case.
d90b3a1 to
a9677a7
Compare
@lyakh while I understand your concern, I think this will be quite a useful feature, at least for developers. In the past, I've struggled while trying to debug one particular component and enabling verbose trace for just that one component was not possible. |
Agree with @ranj063. See e.g. how graphics and ACPI added 2 sets of flags for debug_layer and debug_level. if you really want verbose stuff on a specific component and squelch other issues, there's no real alternative. https://www.kernel.org/doc/html/latest/firmware-guide/acpi/method-tracing.html |
@ranj063 @plbossart if it is for developers, wouldn't compile-time configuration flags be enough? Do we need it at run-time? |
de79e81 to
c73b03f
Compare
You're forgetting about devices with the Intel production key, we don't necessarily have the freedom to recompile firmware in all cases. |
c73b03f to
f6b5a16
Compare
kv2019i
left a comment
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.
Good discussion in the review so far. Most issues are already covered, but I did have a few points that I think still need attention.
include/sound/sof/trace.h
Outdated
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.
@ktrzcinx Hmm, I think declaring "FIN" in the same enumeration and same style name is confusing many people (including me). You are essential defining bitfields within the 32bit key, with 7bit for element type and 1bit for the FIN end marker, and rest of the 24bits reserved.
There is some unavoidable abstraction overload, but how about:
bit6..0:
SOF_IPC_TRACE_FILTER_ELEM_TYPE_LEVEL
SOF_IPC_TRACE_FILTER_ELEM_TYPE_UUID
SOF_IPC_TRACE_FILTER_ELEM_TYPE_COMP
SOF_IPC_TRACE_FILTER_ELEM_TYPE_PIPE
SOF_IPC_TRACE_FILTER_ELEM_TYPE_MASK
bit7:
SOF_IPC_TRACE_FILTER_ELEM_FIN
This seems easier to follow for at least me. The TYPE is still a bit confusing as this is "type of filter action" and not type of a DSP element, but yeah, best I could come up.
cd246d7 to
a8dc3c6
Compare
plbossart
left a comment
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.
LGTM now, thanks @ktrzcinx
sound/soc/sof/trace.c
Outdated
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.
if we return an error code from trace_debugfs_create(), snd_sof_init_trace() will fail too and leave the system with no SOF tracing. This isn't fatal for SOF probing / functionality, but maybe it's better to fail filter initialisation "silently." In fact I'd rather change snd_sof_init_trace() to not fail if trace_debugfs_create() fails, but that's something for a different PR. And anyway, if the system fails such functions, which in this case means it's really low on memory, many other things will fail too...
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.
@lyakh as you have spotted, possibility of failure trace_debugfs_filter_create() in fully functional system in quite low, and even if it will be 'silent failure', then following line is going to fail too (dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL)), so system will be without SOF tracing at all. In my opinion it's not an argument to drop return code check and relay on other things fails. I can replace return ret with dev_err, but because of low fail probability, it shouldn't change much for end-user.
a8dc3c6 to
e9a4f3c
Compare
|
@ktrzcinx Two checkpatch warnings (u32 usage is ok), can you look at these: WARNING: line length of 103 exceeds 100 columns WARNING: Prefer using '"%s...", func' to using 'sof_dfsentry_trace_filter_write', this function's name, in a string
|
e9a4f3c to
fd5bf7d
Compare
3751cd1 to
cd621b1
Compare
cd621b1 to
f5fd93c
Compare
The "filter" debugfs file defines the log levels used by the firmware and reported by sof-logger. The file contains the formatted entry list, where each entry follows the following syntax in plain text: log_level uuid_id pipe_id comp_id; This file may be updated by userspace applications such sof-logger, or directly by the user during debugging process. An unused (wildcard) pipe_id or comp_id value should be set to -1, uuid_id is hexadecimal value, so when unused then should be set to 0. When the file is modified, an IPC command is sent to FW with new trace levels for selected components in filter elements list. Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
f5fd93c to
9541329
Compare
|
ping, FW part is already merged |
kv2019i
left a comment
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.
Thanks @ktrzcinx , looks good now.
Add possibility to filter received trace messages (from sof-logger) in runtime. It improve debugging experience, allow to easily skip uninteresting messages.
Kernel part is to receive new trace settings in strictly formatted text from sof-logger and send it to firmware in IPC message.
This feature will need component alignment between shown topology representation and logger output, but it may be done separately.
FW part: thesofproject/sof#3329
logger part: thesofproject/sof#2965
issue: thesofproject/sof#2172