Skip to contentSkip to conversation

ASoC: lower "no backend DAIs enabled for ... Port" log severity

PATCH Superseded Hans de Goede 4 participants 10 messages Aug 4, 2023 – Aug 7, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: lower "no backend DAIs enabled for ... Port" log severity

If SNDRV_PCM_IOCTL_PREPARE is called when the mixer settings linking frontend and backend have not been setup yet this results in e.g. the following errors getting logged:

[   43.244549]  Baytrail Audio Port: ASoC: no backend DAIs enabled for Baytrail Audio Port
[   43.244744]  Baytrail Audio Port: ASoC: error at dpcm_fe_dai_prepare on Baytrail Audio Port: -22

pipewire triggers this leading to 96 repeats of this in the log after the user has logged into a GNOME session.

IMHO userspace should not be able to get the kernel to spam dmesg like this. Lower the severity of the "no backend DAIs enabled" log message for dai-s with the dynamic flag set to avoid this.

And also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix the other error. Userspace passing wrong parameters should not lead to dmesg messages.

---
 sound/soc/soc-pcm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/soc-pcm.c +6 -1
index 8896227e4fb7..fdc1a1c654d6 100644
@@ -38,6 +38,7 @@ static inline int _soc_pcm_ret(struct snd_soc_pcm_runtime *rtd,
 	switch (ret) {
 	case -EPROBE_DEFER:
 	case -ENOTSUPP:
+	case -EINVAL:
 		break;
 	default:
 		dev_err(rtd->dev,
@@ -2466,7 +2467,11 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
 
 	/* there is no point preparing this FE if there are no BEs */
 	if (list_empty(&fe->dpcm[stream].be_clients)) {
-		dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
+		if (fe->dai_link->dynamic)
+			dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
+				fe->dai_link->name);
+		else
+			dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
 				fe->dai_link->name);
 		ret = -EINVAL;
 		goto out;
Signature · 1 line
2.41.0
#1 lore raw
Quoted 10 lines · Hans de Goede

If SNDRV_PCM_IOCTL_PREPARE is called when the mixer settings linking frontend and backend have not been setup yet this results in e.g. the following errors getting logged:

[   43.244549]  Baytrail Audio Port: ASoC: no backend DAIs enabled for Baytrail Audio Port
[   43.244744]  Baytrail Audio Port: ASoC: error at dpcm_fe_dai_prepare on Baytrail Audio Port: -22

pipewire triggers this leading to 96 repeats of this in the log after the user has logged into a GNOME session.

Quoted 7 lines

IMHO userspace should not be able to get the kernel to spam dmesg like this. Lower the severity of the "no backend DAIs enabled" log message for dai-s with the dynamic flag set to avoid this.

And also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix the other error. Userspace passing wrong parameters should not lead to dmesg messages.

Maybe, but it's a questionable flow if pipewire tries to open stuff without the mixer values set-up. Is there something done about this?

The reason why I am pushing back is that we had a similar issue with HDaudio where HDMI/DP PCM devices were opened without checking if the jack was connected.

It really makes no sense for userspace to try and open devices that are known to be problematic. We can push kernel error logs below the rug, it doesn't make the programming flows better.

#2 lore raw
Quoted 18 lines · Pierre-Louis Bossart
Quoted 14 lines · Hans de Goede

If SNDRV_PCM_IOCTL_PREPARE is called when the mixer settings linking frontend and backend have not been setup yet this results in e.g. the following errors getting logged:

[   43.244549]  Baytrail Audio Port: ASoC: no backend DAIs enabled for Baytrail Audio Port
[   43.244744]  Baytrail Audio Port: ASoC: error at dpcm_fe_dai_prepare on Baytrail Audio Port: -22

pipewire triggers this leading to 96 repeats of this in the log after the user has logged into a GNOME session.

IMHO userspace should not be able to get the kernel to spam dmesg like this. Lower the severity of the "no backend DAIs enabled" log message for dai-s with the dynamic flag set to avoid this.

Quoted 6 lines
Quoted 3 lines

And also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix the other error. Userspace passing wrong parameters should not lead to dmesg messages.

Maybe, but it's a questionable flow if pipewire tries to open stuff without the mixer values set-up. Is there something done about this?

I think it's an oft-seen problem when user runs the system without installing a proper UCM profile.

Quoted 7 lines

The reason why I am pushing back is that we had a similar issue with HDaudio where HDMI/DP PCM devices were opened without checking if the jack was connected.

It really makes no sense for userspace to try and open devices that are known to be problematic. We can push kernel error logs below the rug, it doesn't make the programming flows better.

Downgrading the message also hides to show what's wrong there. Although the message doesn't indicate how to fix the problem, no message would make debug harder.

So in general I agree that it's annoying and it should be fixed, but hiding all as default can be bad, too. Maybe we can introduce a counter and shut out after three strikes?

Takashi

#3 lore raw

Hi,

Quoted 20 lines · Takashi Iwai
Quoted 18 lines · Pierre-Louis Bossart
Quoted 14 lines · Hans de Goede

If SNDRV_PCM_IOCTL_PREPARE is called when the mixer settings linking frontend and backend have not been setup yet this results in e.g. the following errors getting logged:

[   43.244549]  Baytrail Audio Port: ASoC: no backend DAIs enabled for Baytrail Audio Port
[   43.244744]  Baytrail Audio Port: ASoC: error at dpcm_fe_dai_prepare on Baytrail Audio Port: -22

pipewire triggers this leading to 96 repeats of this in the log after the user has logged into a GNOME session.

IMHO userspace should not be able to get the kernel to spam dmesg like this. Lower the severity of the "no backend DAIs enabled" log message for dai-s with the dynamic flag set to avoid this.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

And also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix the other error. Userspace passing wrong parameters should not lead to dmesg messages.

Maybe, but it's a questionable flow if pipewire tries to open stuff without the mixer values set-up. Is there something done about this?

I'm working with the pipewire folks to see if we can fix this on pipewire's side too:

Quoted 11 lines

I think it's an oft-seen problem when user runs the system without installing a proper UCM profile.

Quoted 7 lines

The reason why I am pushing back is that we had a similar issue with HDaudio where HDMI/DP PCM devices were opened without checking if the jack was connected.

It really makes no sense for userspace to try and open devices that are known to be problematic. We can push kernel error logs below the rug, it doesn't make the programming flows better.

Quoted 7 lines

Downgrading the message also hides to show what's wrong there. Although the message doesn't indicate how to fix the problem, no message would make debug harder.

So in general I agree that it's annoying and it should be fixed, but hiding all as default can be bad, too. Maybe we can introduce a counter and shut out after three strikes?

Right, this also happens with unsupported codecs (either unsupported in the kernel or no UCM profile available yet). So making this less "chatty" would be good.

I would prefer to just go for only log this once rather then three strikes though, then we can simply use 'dev_err_once()' for this.

Regards,

Hans

#4 lore raw
Quoted 28 lines
Quoted 3 lines
Quoted 3 lines

Maybe, but it's a questionable flow if pipewire tries to open stuff without the mixer values set-up. Is there something done about this?

I'm working with the pipewire folks to see if we can fix this on pipewire's side too:

Quoted 11 lines

I think it's an oft-seen problem when user runs the system without installing a proper UCM profile.

Quoted 7 lines

The reason why I am pushing back is that we had a similar issue with HDaudio where HDMI/DP PCM devices were opened without checking if the jack was connected.

It really makes no sense for userspace to try and open devices that are known to be problematic. We can push kernel error logs below the rug, it doesn't make the programming flows better.

Quoted 7 lines

Downgrading the message also hides to show what's wrong there. Although the message doesn't indicate how to fix the problem, no message would make debug harder.

So in general I agree that it's annoying and it should be fixed, but hiding all as default can be bad, too. Maybe we can introduce a counter and shut out after three strikes?

Quoted 5 lines

Right, this also happens with unsupported codecs (either unsupported in the kernel or no UCM profile available yet). So making this less "chatty" would be good.

I would prefer to just go for only log this once rather then three strikes though, then we can simply use 'dev_err_once()' for this.

I'd be fine with dev_err_once(). In general when you have this error it's a telltale sign that a configuration is missing. Repeating the message does not makes things better.

Maybe also add some information for the user, e.g. "ASoC: no backend DAIs enabled for Baytrail Audio Port, possibly missing ALSA mixer-based routing or UCM profile"

maintainer
#5 lore raw
In reply to Takashi Iwai
Quoted 11 lines · Takashi Iwai
Quoted 6 lines · Pierre-Louis Bossart
Quoted 3 lines

And also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix the other error. Userspace passing wrong parameters should not lead to dmesg messages.

Maybe, but it's a questionable flow if pipewire tries to open stuff without the mixer values set-up. Is there something done about this?

I think it's an oft-seen problem when user runs the system without installing a proper UCM profile.

Yeah, it's really easy to do.

Quoted 11 lines
Quoted 3 lines

It really makes no sense for userspace to try and open devices that are known to be problematic. We can push kernel error logs below the rug, it doesn't make the programming flows better.

Downgrading the message also hides to show what's wrong there. Although the message doesn't indicate how to fix the problem, no message would make debug harder.

So in general I agree that it's annoying and it should be fixed, but hiding all as default can be bad, too. Maybe we can introduce a counter and shut out after three strikes?

Hrm, do systems typically filter out debug logs? Most of the systems I work on do still log debug logs, they just only include them in dmesg by default. There are ratelimited printk APIs which we could use, though they're not quite ratelimited enough for this I think.

#6 lore raw
Quoted 24 lines · Mark Brown
Quoted 11 lines · Takashi Iwai
Quoted 6 lines · Pierre-Louis Bossart
Quoted 3 lines

And also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix the other error. Userspace passing wrong parameters should not lead to dmesg messages.

Maybe, but it's a questionable flow if pipewire tries to open stuff without the mixer values set-up. Is there something done about this?

I think it's an oft-seen problem when user runs the system without installing a proper UCM profile.

Yeah, it's really easy to do.

Quoted 7 lines
Quoted 3 lines

It really makes no sense for userspace to try and open devices that are known to be problematic. We can push kernel error logs below the rug, it doesn't make the programming flows better.

Downgrading the message also hides to show what's wrong there. Although the message doesn't indicate how to fix the problem, no message would make debug harder.

Quoted 7 lines
Quoted 3 lines

So in general I agree that it's annoying and it should be fixed, but hiding all as default can be bad, too. Maybe we can introduce a counter and shut out after three strikes?

Hrm, do systems typically filter out debug logs? Most of the systems I work on do still log debug logs, they just only include them in dmesg by default.

I thought flipping the dynamic debug flag needed for showing them up with dev_dbg() and co.

Quoted 2 lines

There are ratelimited printk APIs which we could use, though they're not quite ratelimited enough for this I think.

Yes, this is printed not too frequently but just repeatedly.

IMHO, dev_err_once() would be a good compromise.

thanks,

Takashi

maintainer
#7 lore raw
Quoted 8 lines · Takashi Iwai
Quoted 3 lines · Mark Brown

Hrm, do systems typically filter out debug logs? Most of the systems I work on do still log debug logs, they just only include them in dmesg by default.

I thought flipping the dynamic debug flag needed for showing them up with dev_dbg() and co.

That's an optional feature, I guess perhaps distro kernels will tend to turn it on but not the defconfigs I'm generally using so I've not been seeing it.

Quoted 6 lines
Quoted 2 lines

There are ratelimited printk APIs which we could use, though they're not quite ratelimited enough for this I think.

Yes, this is printed not too frequently but just repeatedly.

IMHO, dev_err_once() would be a good compromise.

I can imagine that being *super* frustrating when trying to actually develop configurations since you only get told once per boot that there's something missing. dev_dbg() did seem like a sensible choice here, even with dynamic debug you can at least turn it on. Perhaps both a dev_err_once() and a dev_dbg() so you get a hint that there's something wrong in the logs and can still get ongoing information when developing your configuration.

#8 lore raw
Quoted 8 lines · Mark Brown
Quoted 5 lines · Takashi Iwai
Quoted 3 lines · Mark Brown

Hrm, do systems typically filter out debug logs? Most of the systems I work on do still log debug logs, they just only include them in dmesg by default.

Quoted 6 lines
Quoted 2 lines

I thought flipping the dynamic debug flag needed for showing them up with dev_dbg() and co.

That's an optional feature, I guess perhaps distro kernels will tend to turn it on but not the defconfigs I'm generally using so I've not been seeing it.

Ah yes, most distros set CONFIG_DYNAMIC_DEBUG, but defconfig is a different set.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

There are ratelimited printk APIs which we could use, though they're not quite ratelimited enough for this I think.

Yes, this is printed not too frequently but just repeatedly.

IMHO, dev_err_once() would be a good compromise.

Quoted 7 lines

I can imagine that being *super* frustrating when trying to actually develop configurations since you only get told once per boot that there's something missing. dev_dbg() did seem like a sensible choice here, even with dynamic debug you can at least turn it on. Perhaps both a dev_err_once() and a dev_dbg() so you get a hint that there's something wrong in the logs and can still get ongoing information when developing your configuration.

+1, this sounds like a solution.

thanks,

Takashi

maintainer
#9 lore raw
In reply to Hans de Goede
Quoted 8 lines · Hans de Goede

If SNDRV_PCM_IOCTL_PREPARE is called when the mixer settings linking frontend and backend have not been setup yet this results in e.g. the following errors getting logged:

[   43.244549]  Baytrail Audio Port: ASoC: no backend DAIs enabled for Baytrail Audio Port
[   43.244744]  Baytrail Audio Port: ASoC: error at dpcm_fe_dai_prepare on Baytrail Audio Port: -22

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: lower "no backend DAIs enabled for ... Port" log severity

      commit: 1f566435141047ca7db26aa4b0b6647a25badaee

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark