mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
firmware: cs_dsp: rate-limit log messages in KUnit builds
Use the dev_*_ratelimit() macros if the cs_dsp KUnit tests are enabled
in the build, and allow the KUnit tests to disable message output.
Some of the KUnit tests cause a very large number of log messages from
cs_dsp, because the tests perform many different test cases. This could
cause some lines to be dropped from the kernel log. Dropped lines can
prevent the KUnit wrappers from parsing the ktap output in the dmesg log.
The KUnit builds of cs_dsp export three bools that the KUnit tests can
use to entirely disable log output of err, warn and info messages. Some
tests have been updated to use this, replacing the previous fudge of a
usleep() in the exit handler of each test. We don't necessarily want to
disable all log messages if they aren't expected to be excessive,
so the rate-limiting allows leaving some logging enabled.
The rate-limited macros are not used in normal builds because it is not
appropriate to rate-limit every message. That could cause important
messages to be dropped, and there wouldn't be such a high rate of
messages in normal operation.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/linux-sound/af393f08-facb-4c44-a054-1f61254803ec@opensource.cirrus.com/T/#t
Fixes: cd8c058499 ("firmware: cs_dsp: Add KUnit testing of bin error cases")
Link: https://patch.msgid.link/20260130171256.863152-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
611c7d2262
commit
10db9f6899
@@ -17,6 +17,8 @@
|
||||
#include <linux/random.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include "../cs_dsp.h"
|
||||
|
||||
/*
|
||||
* Test method is:
|
||||
*
|
||||
@@ -2224,7 +2226,22 @@ static int cs_dsp_bin_test_common_init(struct kunit *test, struct cs_dsp *dsp)
|
||||
return ret;
|
||||
|
||||
/* Automatically call cs_dsp_remove() when test case ends */
|
||||
return kunit_add_action_or_reset(priv->test, _cs_dsp_remove_wrapper, dsp);
|
||||
ret = kunit_add_action_or_reset(priv->test, _cs_dsp_remove_wrapper, dsp);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* The large number of test cases will cause an unusually large amount
|
||||
* of dev_info() messages from cs_dsp, so suppress these.
|
||||
*/
|
||||
cs_dsp_suppress_info_messages = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cs_dsp_bin_test_exit(struct kunit *test)
|
||||
{
|
||||
cs_dsp_suppress_info_messages = false;
|
||||
}
|
||||
|
||||
static int cs_dsp_bin_test_halo_init(struct kunit *test)
|
||||
@@ -2536,18 +2553,21 @@ static struct kunit_case cs_dsp_bin_test_cases_adsp2[] = {
|
||||
static struct kunit_suite cs_dsp_bin_test_halo = {
|
||||
.name = "cs_dsp_bin_halo",
|
||||
.init = cs_dsp_bin_test_halo_init,
|
||||
.exit = cs_dsp_bin_test_exit,
|
||||
.test_cases = cs_dsp_bin_test_cases_halo,
|
||||
};
|
||||
|
||||
static struct kunit_suite cs_dsp_bin_test_adsp2_32bit = {
|
||||
.name = "cs_dsp_bin_adsp2_32bit",
|
||||
.init = cs_dsp_bin_test_adsp2_32bit_init,
|
||||
.exit = cs_dsp_bin_test_exit,
|
||||
.test_cases = cs_dsp_bin_test_cases_adsp2,
|
||||
};
|
||||
|
||||
static struct kunit_suite cs_dsp_bin_test_adsp2_16bit = {
|
||||
.name = "cs_dsp_bin_adsp2_16bit",
|
||||
.init = cs_dsp_bin_test_adsp2_16bit_init,
|
||||
.exit = cs_dsp_bin_test_exit,
|
||||
.test_cases = cs_dsp_bin_test_cases_adsp2,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user