diff options
author | Cezary Rojewski <cezary.rojewski@intel.com> | 2022-12-02 18:28:39 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-12-05 17:05:31 +0300 |
commit | 34d27c71707c4ed615105376e0f3907d99b1b271 (patch) | |
tree | f5520ed8e6953a63fed7a5ca6a98d23910faa16a /sound | |
parent | 5a565ba23abe478f3d4c3b0c8798bcb5215b82f5 (diff) | |
download | linux-34d27c71707c4ed615105376e0f3907d99b1b271.tar.xz |
ASoC: Intel: avs: Gather remaining logs on strace_release()
When user closes the tracer, some logs may still remain in the tail of
the buffer as firmware sends LOG_BUFFER_STATUS notification only when
certain threshold of data is reached. Add whatever is left to already
gathered logs so no information is lost.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221202152841.672536-15-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/intel/avs/debugfs.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c index 678572ee6b9d..e7b0b99824aa 100644 --- a/sound/soc/intel/avs/debugfs.c +++ b/sound/soc/intel/avs/debugfs.c @@ -201,11 +201,25 @@ static int strace_open(struct inode *inode, struct file *file) static int strace_release(struct inode *inode, struct file *file) { + union avs_notify_msg msg = AVS_NOTIFICATION(LOG_BUFFER_STATUS); struct avs_dev *adev = file->private_data; - unsigned long flags; + unsigned long resource_mask; + unsigned long flags, i; + u32 num_cores; + + resource_mask = adev->logged_resources; + num_cores = adev->hw_cfg.dsp_cores; spin_lock_irqsave(&adev->trace_lock, flags); + + /* Gather any remaining logs. */ + for_each_set_bit(i, &resource_mask, num_cores) { + msg.log.core = i; + avs_dsp_op(adev, log_buffer_status, &msg); + } + kfifo_free(&adev->trace_fifo); + spin_unlock_irqrestore(&adev->trace_lock, flags); return 0; |