Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: Print the dbg_dump and ipc_dump once to reduce kernel log noise

Do not print the dump more than once to keep the kernel log cleaner in case
of a firmware failure.

When the DSP is rebooted due to suspend or runtime_suspend reset the flags
to re-enable the dump prints.

Add also a debug flag to print all dumps to get more coverage if needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Peter Ujfalusi and committed by
Mark Brown
9ff90859 3f7561f7

+16 -3
+3 -1
sound/soc/sof/debug.c
··· 827 827 if (IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT) || 828 828 (sof_core_debug & SOF_DBG_RETAIN_CTX)) { 829 829 /* should we prevent DSP entering D3 ? */ 830 - dev_info(sdev->dev, "info: preventing DSP entering D3 state to preserve context\n"); 830 + if (!sdev->ipc_dump_printed) 831 + dev_info(sdev->dev, 832 + "preventing DSP entering D3 state to preserve context\n"); 831 833 pm_runtime_get_noresume(sdev->dev); 832 834 } 833 835
+4
sound/soc/sof/loader.c
··· 791 791 792 792 init_waitqueue_head(&sdev->boot_wait); 793 793 794 + /* (re-)enable dsp dump */ 795 + sdev->dbg_dump_printed = false; 796 + sdev->ipc_dump_printed = false; 797 + 794 798 /* create read-only fw_version debugfs to store boot version info */ 795 799 if (sdev->first_boot) { 796 800 ret = snd_sof_debugfs_buf_item(sdev, &sdev->fw_version,
+6 -2
sound/soc/sof/ops.h
··· 243 243 /* debug */ 244 244 static inline void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, u32 flags) 245 245 { 246 - if (sof_ops(sdev)->dbg_dump) { 246 + if (sof_ops(sdev)->dbg_dump && !sdev->dbg_dump_printed) { 247 247 dev_err(sdev->dev, "------------[ DSP dump start ]------------\n"); 248 248 sof_ops(sdev)->dbg_dump(sdev, flags); 249 249 dev_err(sdev->dev, "------------[ DSP dump end ]------------\n"); 250 + if (!(sof_core_debug & SOF_DBG_PRINT_ALL_DUMPS)) 251 + sdev->dbg_dump_printed = true; 250 252 } 251 253 } 252 254 253 255 static inline void snd_sof_ipc_dump(struct snd_sof_dev *sdev) 254 256 { 255 - if (sof_ops(sdev)->ipc_dump) { 257 + if (sof_ops(sdev)->ipc_dump && !sdev->ipc_dump_printed) { 256 258 dev_err(sdev->dev, "------------[ IPC dump start ]------------\n"); 257 259 sof_ops(sdev)->ipc_dump(sdev); 258 260 dev_err(sdev->dev, "------------[ IPC dump end ]------------\n"); 261 + if (!(sof_core_debug & SOF_DBG_PRINT_ALL_DUMPS)) 262 + sdev->ipc_dump_printed = true; 259 263 } 260 264 } 261 265
+3
sound/soc/sof/sof-priv.h
··· 33 33 #define SOF_DBG_DISABLE_MULTICORE BIT(5) /* schedule all pipelines/widgets 34 34 * on primary core 35 35 */ 36 + #define SOF_DBG_PRINT_ALL_DUMPS BIT(6) /* Print all ipc and dsp dumps */ 36 37 37 38 #define SOF_DBG_DUMP_REGS BIT(0) 38 39 #define SOF_DBG_DUMP_MBOX BIT(1) ··· 422 421 /* debug */ 423 422 struct dentry *debugfs_root; 424 423 struct list_head dfsentry_list; 424 + bool dbg_dump_printed; 425 + bool ipc_dump_printed; 425 426 426 427 /* firmware loader */ 427 428 struct snd_dma_buffer dmab;