ASoC: SOF: reshuffle and optimize structures
Subsystems (3)
cover 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(-)
Signature · 1 line
2.43.0
PATCH 1/4 ASoC: SOF: sof-priv.h: optimize snd_sof_platform_stream_params
reshuffle members to remove hole.
--- sound/soc/sof/sof-priv.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sof/sof-priv.h +4 -3
@@ -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; };
Signature · 1 line
2.43.0
PATCH 2/4 ASoC: SOF: sof-priv.h: optimize snd_sof_mailbox
In reply to Pierre-Louis BossartReverse the two members to remove a hole.
--- sound/soc/sof/sof-priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/sof-priv.h +1 -1
@@ -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 */
Signature · 1 line
2.43.0
PATCH 3/4 ASoC: SOF: sof-priv.h: optimize snd_sof_ipc_msg
In reply to Pierre-Louis BossartMove 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 */ };
--- sound/soc/sof/sof-priv.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sof/sof-priv.h +4 -3
@@ -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; };/**
Signature · 1 line
2.43.0
PATCH 4/4 ASoC: SOF: sof-audio.h: optimize snd_sof_pcm_stream_pipeline_list
In reply to Pierre-Louis BossartInvert members to remove hole.
--- sound/soc/sof/sof-audio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/sof-audio.h +2 -2
@@ -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 */
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 6 lines · Pierre-Louis Bossart
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.
Quoted 7 lines
Pierre-Louis Bossart (4):
ASoC: SOF:sof-priv.h: optimizesnd_sof_platform_stream_params
ASoC: SOF:sof-priv.h: optimizesnd_sof_mailbox
ASoC: SOF:sof-priv.h: optimizesnd_sof_ipc_msg
ASoC: SOF:sof-audio.h: optimizesnd_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: 5821d7b4981f4915ab353f538be38defe9656f81All 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