Skip to content

Conversation

@marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Sep 20, 2023

Preparation for backporting #8216 release fixes.

Zero conflict, fully automated backport with just:

git log --oneline --format=%h  2c1f089d3965..origin/main -- tools/logger/*.c  |
  tac | git cherry-pick -x --stdin

marc-hb and others added 10 commits September 20, 2023 05:23
Open /sys/kernel/debug/sof/fw_version _after_
/sys/kernel/debug/sof/[e]trace because reading the former is optional
and the latter is not.

So when the driver is not loaded, we get the same (missing trace) error
trace message whether we use the -n option or not.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
(cherry picked from commit af6bd41)
Don't fail immediately when the driver is not loaded. Use inotify
instead to wait for /sys/kernel/debug/sof/[e]trace to appear.

This makes it possible to start before the driver is loaded which
reduces considerably the chances of missing early logs.

Fixes a small part of thesofproject/linux#3275

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
(cherry picked from commit dcf0577)
Restores ability to compile on Windows with MSYS.

Fixes commit dcf0577 ("logger: allow starting before the driver is
loaded")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
(cherry picked from commit 92d828b)
In user-space tools, memory allocations can reasonably be expected to
always succeed. Make this assumption explicit by adding error handling
after malloc.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
(cherry picked from commit 4d64893)
In user-space tools, memory allocations can reasonably be expected to
always succeed. Make this assumption explicit by adding error handling
after calloc.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
(cherry picked from commit 4bec5b2)
sof-logger -u 115200 -d /lib/firmware/sof-foo.ldc

Leads to silent failure as a NULL is passed to open(). Add
explicit error handling for this case.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
(cherry picked from commit 80adcdf)
Finish the job that commit 5b29dae ("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 thesofproject#6858 and thesofproject#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>
(cherry picked from commit 327a26b)
Finish the job that commit 5b29dae ("logger: Create global
convert_config variable to avoid spaghetti code.") started but did not
complete, leaving a confusing mix of globals and locals.

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

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
(cherry picked from commit 2dfaee6)
localtime() can return NULL in error cases. Check the return value
before dereferencing it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
(cherry picked from commit 84b2dd2)
Due to allocation failures, or invalid content in dictionary,
"params" entries in "struct proc_ldc_entry" may be NULL.

In print_entry_params(), the NULL entries may be passed
as arguments to fprintf(). While e.g. glibc handles these without
error, this is not guaranteed behaviour and may result in segfault
on some platforms.

Fix the issue by aborting program if allocation fails and
explicitly handling the cases when asprintf_entry_text returns
NULL.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
(cherry picked from commit 1a7a36a)
@marc-hb marc-hb changed the title [stable-v2.2] backport all sof-logger from main [stable-v2.2] backport all sof-logger updates from main Sep 20, 2023
@marc-hb marc-hb requested a review from kv2019i September 20, 2023 05:30
@marc-hb marc-hb mentioned this pull request Sep 20, 2023
@marc-hb marc-hb marked this pull request as ready for review September 20, 2023 05:42
@marc-hb
Copy link
Collaborator Author

marc-hb commented Sep 20, 2023

Not going to modify cherry-picked code to fix one parenthesis alignment warning in checkpatch
https://github.com/thesofproject/sof/actions/runs/6244395176/job/16951233287?pr=8233

Quickbuild is not compatible with stable-v2.2, nothing new.

Everything else and especially https://sof-ci.01.org/sofpr/PR8233/build13226/devicetest is green. sof-logger output looks good there.

Ready to merge.

@lgirdwood lgirdwood merged commit ffe468b into thesofproject:stable-v2.2 Sep 25, 2023
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.

4 participants