[PATCH 0/4] ASoC: SOF: reshuffle and optimize structures
pahole reports a number of sub-optimal structure definitions with holes and cache-line alignment problems, this patchset optimizes a couple of structure frequently used.
No functionality change, only re-ordering of structure members.
Pierre-Louis Bossart (4): ASoC: SOF: sof-priv.h: optimize snd_sof_platform_stream_params ASoC: SOF: sof-priv.h: optimize snd_sof_mailbox ASoC: SOF: sof-priv.h: optimize snd_sof_ipc_msg ASoC: SOF: sof-audio.h: optimize snd_sof_pcm_stream_pipeline_list
sound/soc/sof/sof-audio.h | 4 ++-- sound/soc/sof/sof-priv.h | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-)
reshuffle members to remove hole.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/sof-priv.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 4d6a1517f9b3..28179a573762 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -132,16 +132,17 @@ struct snd_sof_pdata;
/** * struct snd_sof_platform_stream_params - platform dependent stream parameters - * @stream_tag: Stream tag to use - * @use_phy_addr: Use the provided @phy_addr for configuration * @phy_addr: Platform dependent address to be used, if @use_phy_addr * is true + * @stream_tag: Stream tag to use + * @use_phy_addr: Use the provided @phy_addr for configuration * @no_ipc_position: Disable position update IPC from firmware + * @cont_update_posn: Continuous position update. */ struct snd_sof_platform_stream_params { + u32 phy_addr; u16 stream_tag; bool use_phy_address; - u32 phy_addr; bool no_ipc_position; bool cont_update_posn; };
Reverse the two members to remove a hole.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/sof-priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 28179a573762..6ecc58e11592 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -412,8 +412,8 @@ struct snd_sof_debugfs_map {
/* mailbox descriptor, used for host <-> DSP IPC */ struct snd_sof_mailbox { - u32 offset; size_t size; + u32 offset; };
/* IPC message descriptor for host <-> DSP IO */
Move waitq to make sure it's entirely in the same cache line, and move ipc_complete to reduce padding.
struct snd_sof_ipc_msg { void * msg_data; /* 0 8 */ void * reply_data; /* 8 8 */ size_t msg_size; /* 16 8 */ size_t reply_size; /* 24 8 */ int reply_error; /* 32 4 */ bool ipc_complete; /* 36 1 */
/* XXX 3 bytes hole, try to pack */
wait_queue_head_t waitq; /* 40 88 */ /* --- cacheline 2 boundary (128 bytes) --- */ void * rx_data; /* 128 8 */
/* size: 136, cachelines: 3, members: 8 */ /* sum members: 133, holes: 1, sum holes: 3 */ /* last cacheline: 8 bytes */ };
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/sof-priv.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 6ecc58e11592..843be3b6415d 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -425,11 +425,12 @@ struct snd_sof_ipc_msg { size_t reply_size; int reply_error;
+ bool ipc_complete; + + wait_queue_head_t waitq; + /* notification, firmware initiated messages */ void *rx_data; - - wait_queue_head_t waitq; - bool ipc_complete; };
/**
Invert members to remove hole.
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Péter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/sof-audio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 49be02234fc3..b9b8b64768b9 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -314,12 +314,12 @@ struct sof_token_info {
/** * struct snd_sof_pcm_stream_pipeline_list - List of pipelines associated with a PCM stream - * @count: number of pipeline widgets in the @pipe_widgets array * @pipelines: array of pipelines + * @count: number of pipeline widgets in the @pipe_widgets array */ struct snd_sof_pcm_stream_pipeline_list { - u32 count; struct snd_sof_pipeline **pipelines; + u32 count; };
/* PCM stream, mapped to FW component */
On Fri, 02 Aug 2024 14:46:05 +0200, Pierre-Louis Bossart wrote:
pahole reports a number of sub-optimal structure definitions with holes and cache-line alignment problems, this patchset optimizes a couple of structure frequently used.
No functionality change, only re-ordering of structure members.
Pierre-Louis Bossart (4): ASoC: SOF: sof-priv.h: optimize snd_sof_platform_stream_params ASoC: SOF: sof-priv.h: optimize snd_sof_mailbox ASoC: SOF: sof-priv.h: optimize snd_sof_ipc_msg ASoC: SOF: sof-audio.h: optimize snd_sof_pcm_stream_pipeline_list
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: SOF: sof-priv.h: optimize snd_sof_platform_stream_params commit: cac88e96ba0961921b8068326579b26094f37ba4 [2/4] ASoC: SOF: sof-priv.h: optimize snd_sof_mailbox commit: e9e7eeaf199c7961d634235dbedeb7b682b1dd32 [3/4] ASoC: SOF: sof-priv.h: optimize snd_sof_ipc_msg commit: 5a4413d0fa8d0a438246acaf81637d71aab1b6a0 [4/4] ASoC: SOF: sof-audio.h: optimize snd_sof_pcm_stream_pipeline_list commit: 5821d7b4981f4915ab353f538be38defe9656f81
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
participants (2)
-
Mark Brown
-
Pierre-Louis Bossart