Commit Graph

8 Commits

Author SHA1 Message Date
Marc Herbert 327a26bf8a logger: make "global_config" truly global
Finish the job that commit 5b29dae9c8 ("logger: Create global
convert_config variable to avoid spaghetti code.") started but did not
finish, leaving behind a supposedly "global" variable that is actually a
confusing global pointer to a struct local to the main() function.

This confuses some static analyzer complaining that stack values are
being returned, see #6858 and #6738. This is a false positive
because the main()'s stack lifespan is the same as a global but let's
simplify things anyway.

Also stop using 'extern' in .c files, use a proper .h file instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-12-21 09:36:27 +00:00
Marc Herbert 158089ceb6 Add and fix many logger and dma-related comments. No code change.
Learned the hard way.  Will help refactoring or duplicated
"reverse-engineering" effort.

Zero code change, pure comments: no functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-28 15:52:44 +01:00
Marc Herbert 53bda51b99 logger: fix uninitialized FILE *out_fd in filter_update_firmware()
Reported by VERBOSE=1 CMAKE_BUILD_TYPE=Release ./scripts/build-tools.sh -l
and gcc version 9.3.0-10ubuntu2.

out_fd is not initialized on the first "goto err:" and this can result in
trying to close a random file descriptor.

Fixes commit 126060ae63 ("logger: Send parsed runtime log levels to FW
via debugFS")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-15 10:03:04 +01:00
Artur Kloniecki 5b29dae9c8 logger: Create global convert_config variable to avoid spaghetti code.
Most functions in logger depend on values stored in conver_config struct
which are passed to almost all function calls. This patch moves pointer
to the config to global context and allows each function to derive
necessary values from there. This reduces needless parameters passed
to function calls and allows for more flexible access to data in nested
functions.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
2020-09-01 10:11:55 +01:00
Karol Trzcinski 31a3aacc1a logger: Terminate parsed log levels with new line
Text saved to FILTER_KERNEL_PATH should be terminated with
new line, to indicate end of input and mark it redy to send
to FW in IPC message.

Fixes: 126060ae (logger: Send parsed runtime log levels to FW via debugFS)

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 14:25:14 +01:00
Karol Trzcinski 60141f2074 logger: Fix log level parsing
Usage of strstr for short version of logs level definitions
(for example 'e') leads to invalid level parsing, because first
log level with defined string (or letter) will be returned
(in this example 'verbose').
After change, log level will be returned only when name is
exactly as given one.

Fixes: b1fc9220 (logger: Parse runtime filter levels)

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-27 14:25:14 +01:00
Karol Trzcinski 126060ae63 logger: Send parsed runtime log levels to FW via debugFS
"/sys/kernel/debug/sof/filter" file is responsible for updating
trace log levels. IPC message contain list of new trace threshold,
it is represented as single line in file where entries are separated
with ";". Single entry has form of:
"<uuid_id> <pipe_id> <comp_id> <log_level>"

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski b1fc922079 logger: Parse runtime filter levels
Parse arguments given in -F flag, in form where each -F argument
is given as separate line. Format of single -F entry is
`<log_level>=<component_list>`. <log_level> must corresponds with
.name field from log_level_dict. List of component are build from
elements separated with `,` and single element may have one of the
following forms:
"<name> <pipe_id>.<comp_id>" - single component instance
"<name> <pipe_id>.*" - components with given name on piepeline with pipe_id
"<name>*" - each component instance with given name or global component
"<name>" - as above
"* <pipe_id>.<comp_id>" - component on selected pipe_id with given comp_id
"* <pipe_id>.*" - each component on pipeline with pipe_id
"*" - each component in firmware
<name> must correspond values of uuid entries from ldc file.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00