[PATCH 0/8] ASoC: Use the maple tree register cache for RealTek SoundWire CODECs
The RealTek SoundWire CODECs don't support bulk register operations so they gain no advantage from using the rbtree cache, convert them to use the maple tree cache instead - it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- Mark Brown (8): ASoC: rt700: Use maple tree register cache ASoC: rt711: Use maple tree register cache ASoC: rt712: Use maple tree register cache ASoC: rt715: Use maple tree register cache ASoC: rt722: Use maple tree register cache ASoC: rt1308: Use maple tree register cache ASoC: rt1316: Use maple tree register cache ASoC: rt1318: Use maple tree register cache
sound/soc/codecs/rt1308-sdw.c | 2 +- sound/soc/codecs/rt1316-sdw.c | 2 +- sound/soc/codecs/rt1318-sdw.c | 2 +- sound/soc/codecs/rt700-sdw.c | 2 +- sound/soc/codecs/rt711-sdca-sdw.c | 4 ++-- sound/soc/codecs/rt711-sdw.c | 2 +- sound/soc/codecs/rt712-sdca-dmic.c | 4 ++-- sound/soc/codecs/rt712-sdca-sdw.c | 4 ++-- sound/soc/codecs/rt715-sdca-sdw.c | 4 ++-- sound/soc/codecs/rt722-sdca-sdw.c | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) --- base-commit: 08e6c4bb17087584261c4aff555d32fc1c620b81 change-id: 20230609-asoc-rt-sdw-maple-fa6714ac4318
Best regards,
The rt700 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt700-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c index ba7767bee07c..8b28e47775cc 100644 --- a/sound/soc/codecs/rt700-sdw.c +++ b/sound/soc/codecs/rt700-sdw.c @@ -292,7 +292,7 @@ static const struct regmap_config rt700_regmap = { .max_register = 0x755800, .reg_defaults = rt700_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt700_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, .reg_read = rt700_sdw_read,
The rt711 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt711-sdca-sdw.c | 4 ++-- sound/soc/codecs/rt711-sdw.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c index 2c5eb28259dc..119e1f9605d7 100644 --- a/sound/soc/codecs/rt711-sdca-sdw.c +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -119,7 +119,7 @@ static const struct regmap_config rt711_sdca_regmap = { .max_register = 0x44ffffff, .reg_defaults = rt711_sdca_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt711_sdca_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, }; @@ -133,7 +133,7 @@ static const struct regmap_config rt711_sdca_mbq_regmap = { .max_register = 0x40800f12, .reg_defaults = rt711_sdca_mbq_defaults, .num_reg_defaults = ARRAY_SIZE(rt711_sdca_mbq_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, }; diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c index b8ed3c6236d8..87dafcb4545d 100644 --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -296,7 +296,7 @@ static const struct regmap_config rt711_regmap = { .max_register = 0x755800, .reg_defaults = rt711_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt711_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, .reg_read = rt711_sdw_read,
The rt712 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt712-sdca-dmic.c | 4 ++-- sound/soc/codecs/rt712-sdca-sdw.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/rt712-sdca-dmic.c b/sound/soc/codecs/rt712-sdca-dmic.c index 847198e6c07e..869cc7bfd178 100644 --- a/sound/soc/codecs/rt712-sdca-dmic.c +++ b/sound/soc/codecs/rt712-sdca-dmic.c @@ -110,7 +110,7 @@ static const struct regmap_config rt712_sdca_dmic_regmap = { .max_register = 0x40981300, .reg_defaults = rt712_sdca_dmic_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt712_sdca_dmic_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, }; @@ -124,7 +124,7 @@ static const struct regmap_config rt712_sdca_dmic_mbq_regmap = { .max_register = 0x40800f14, .reg_defaults = rt712_sdca_dmic_mbq_defaults, .num_reg_defaults = ARRAY_SIZE(rt712_sdca_dmic_mbq_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, }; diff --git a/sound/soc/codecs/rt712-sdca-sdw.c b/sound/soc/codecs/rt712-sdca-sdw.c index 8f65516e7562..ad06267b0ea0 100644 --- a/sound/soc/codecs/rt712-sdca-sdw.c +++ b/sound/soc/codecs/rt712-sdca-sdw.c @@ -116,7 +116,7 @@ static const struct regmap_config rt712_sdca_regmap = { .max_register = 0x44ffffff, .reg_defaults = rt712_sdca_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt712_sdca_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, }; @@ -130,7 +130,7 @@ static const struct regmap_config rt712_sdca_mbq_regmap = { .max_register = 0x41000312, .reg_defaults = rt712_sdca_mbq_defaults, .num_reg_defaults = ARRAY_SIZE(rt712_sdca_mbq_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, };
The rt715 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt715-sdca-sdw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c index 7e5ddce8097d..df10916bab46 100644 --- a/sound/soc/codecs/rt715-sdca-sdw.c +++ b/sound/soc/codecs/rt715-sdca-sdw.c @@ -97,7 +97,7 @@ static const struct regmap_config rt715_sdca_regmap = { .max_register = 0x43ffffff, .reg_defaults = rt715_reg_defaults_sdca, .num_reg_defaults = ARRAY_SIZE(rt715_reg_defaults_sdca), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, }; @@ -111,7 +111,7 @@ static const struct regmap_config rt715_sdca_mbq_regmap = { .max_register = 0x43ffffff, .reg_defaults = rt715_mbq_reg_defaults_sdca, .num_reg_defaults = ARRAY_SIZE(rt715_mbq_reg_defaults_sdca), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, };
The rt722 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt722-sdca-sdw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c index bfb2dac6bfee..cc57e4e27805 100644 --- a/sound/soc/codecs/rt722-sdca-sdw.c +++ b/sound/soc/codecs/rt722-sdca-sdw.c @@ -139,7 +139,7 @@ static const struct regmap_config rt722_sdca_regmap = { .max_register = 0x44ffffff, .reg_defaults = rt722_sdca_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt722_sdca_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, }; @@ -153,7 +153,7 @@ static const struct regmap_config rt722_sdca_mbq_regmap = { .max_register = 0x41000312, .reg_defaults = rt722_sdca_mbq_defaults, .num_reg_defaults = ARRAY_SIZE(rt722_sdca_mbq_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, };
The rt1308 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt1308-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c index 313e97c94532..f43520ca3187 100644 --- a/sound/soc/codecs/rt1308-sdw.c +++ b/sound/soc/codecs/rt1308-sdw.c @@ -68,7 +68,7 @@ static const struct regmap_config rt1308_sdw_regmap = { .max_register = 0xcfff, .reg_defaults = rt1308_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt1308_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, };
The rt1316 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt1316-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c index 601b76320124..721821d9e9af 100644 --- a/sound/soc/codecs/rt1316-sdw.c +++ b/sound/soc/codecs/rt1316-sdw.c @@ -188,7 +188,7 @@ static const struct regmap_config rt1316_sdw_regmap = { .max_register = 0x4108ffff, .reg_defaults = rt1316_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt1316_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, };
The rt1318 can only support single register read and write operations so does not benefit from block writes. This means it gets no benefit from using the rbtree register cache over the maple tree register cache so convert it to use maple trees instead, it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt1318-sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt1318-sdw.c b/sound/soc/codecs/rt1318-sdw.c index 3751d923611c..16d750102c8c 100644 --- a/sound/soc/codecs/rt1318-sdw.c +++ b/sound/soc/codecs/rt1318-sdw.c @@ -337,7 +337,7 @@ static const struct regmap_config rt1318_sdw_regmap = { .max_register = 0x41081488, .reg_defaults = rt1318_reg_defaults, .num_reg_defaults = ARRAY_SIZE(rt1318_reg_defaults), - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .use_single_read = true, .use_single_write = true, };
On 6/10/2023 10:27 PM, Mark Brown wrote:
The RealTek SoundWire CODECs don't support bulk register operations so they gain no advantage from using the rbtree cache, convert them to use the maple tree cache instead - it is more modern.
Signed-off-by: Mark Brown broonie@kernel.org
Tested on a Dell laptop with rt1316, rt711-sdca, and rt715-sdca.
Tested-by: Bard Liao yung-chuan.liao@linux.intel.com
Mark Brown (8): ASoC: rt700: Use maple tree register cache ASoC: rt711: Use maple tree register cache ASoC: rt712: Use maple tree register cache ASoC: rt715: Use maple tree register cache ASoC: rt722: Use maple tree register cache ASoC: rt1308: Use maple tree register cache ASoC: rt1316: Use maple tree register cache ASoC: rt1318: Use maple tree register cache
sound/soc/codecs/rt1308-sdw.c | 2 +- sound/soc/codecs/rt1316-sdw.c | 2 +- sound/soc/codecs/rt1318-sdw.c | 2 +- sound/soc/codecs/rt700-sdw.c | 2 +- sound/soc/codecs/rt711-sdca-sdw.c | 4 ++-- sound/soc/codecs/rt711-sdw.c | 2 +- sound/soc/codecs/rt712-sdca-dmic.c | 4 ++-- sound/soc/codecs/rt712-sdca-sdw.c | 4 ++-- sound/soc/codecs/rt715-sdca-sdw.c | 4 ++-- sound/soc/codecs/rt722-sdca-sdw.c | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-)
base-commit: 08e6c4bb17087584261c4aff555d32fc1c620b81 change-id: 20230609-asoc-rt-sdw-maple-fa6714ac4318
Best regards,
On Sat, 10 Jun 2023 15:27:11 +0100, Mark Brown wrote:
The RealTek SoundWire CODECs don't support bulk register operations so they gain no advantage from using the rbtree cache, convert them to use the maple tree cache instead - it is more modern.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/8] ASoC: rt700: Use maple tree register cache commit: 049a78048e15ab276052d846c9692ea272699644 [2/8] ASoC: rt711: Use maple tree register cache commit: 0a5757293339fbbbb627baa7d2da65fd083c7cce [3/8] ASoC: rt712: Use maple tree register cache commit: f438c799aa934fcd9b956083043b6f691bcc8492 [4/8] ASoC: rt715: Use maple tree register cache commit: dd08b6ddcb319375b4ee69cd02ce3298ca7608aa [5/8] ASoC: rt722: Use maple tree register cache commit: 799457a3200b0451ca9859c77dd4e863f70ba608 [6/8] ASoC: rt1308: Use maple tree register cache commit: 4f69e29ace9dce5f8226bfc99b77b8497d3d3d79 [7/8] ASoC: rt1316: Use maple tree register cache commit: 6179a2e84f0b0b353079fe965d321ed25251c996 [8/8] ASoC: rt1318: Use maple tree register cache commit: 22691a051377763e6a4e149b7362944253fb434a
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
Hello,
With cache type changing to maple tree for SoundWire Codec patch series, we are observing rcu warnings with AMD SoundWire stack.
Below are the pastebin links for rcu warnings dmesg logs.
https://pastebin.com/6sadwNCw https://pastebin.com/6sadwNCw
https://pastebin.com/zwhfUKGf https://pastebin.com/zwhfUKGf
Acquiring rcu lock in between register read/writes causes context switch.
In AMD SoundWire manager xfer_msg() callback, we are using read_poll_timeout logic. Below is the link. https://elixir.bootlin.com/linux/v6.4-rc7/source/drivers/soundwire/amd_manag...
As per our understanding, we need to go with busy wait rather than using usleep_range() which will be invoked by read_poll_timeout() logic.
Could you please suggest us how to fix this issue?
Thanks, Vijendar
On Mon, Jun 26, 2023 at 07:00:31PM +0530, Mukunda,Vijendar wrote:
With cache type changing to maple tree for SoundWire Codec patch series, we are observing rcu warnings with AMD SoundWire stack.
Do you you have 0cc6578048e0980 ("regmap: maple: Drop the RCU read lock while syncing registers") in your tree when testing?
Below are the pastebin links for rcu warnings dmesg logs.
Please include at least some of the actual warning in your emails so they are directly readable.
On 26/06/23 18:59, Mark Brown wrote:
On Mon, Jun 26, 2023 at 07:00:31PM +0530, Mukunda,Vijendar wrote:
With cache type changing to maple tree for SoundWire Codec patch series, we are observing rcu warnings with AMD SoundWire stack.
Do you you have 0cc6578048e0980 ("regmap: maple: Drop the RCU read lock while syncing registers") in your tree when testing?
We have tested with ASoC tree for-next branch code. This patch is not included in our tree while testing.
We will verify with the patch and let you know our findings.
Below are the pastebin links for rcu warnings dmesg logs. https://pastebin.com/6sadwNCw https://pastebin.com/6sadwNCw
Please include at least some of the actual warning in your emails so they are directly readable.
On 26/06/23 20:09, Mukunda,Vijendar wrote:
On 26/06/23 18:59, Mark Brown wrote:
On Mon, Jun 26, 2023 at 07:00:31PM +0530, Mukunda,Vijendar wrote:
With cache type changing to maple tree for SoundWire Codec patch series, we are observing rcu warnings with AMD SoundWire stack.
Do you you have 0cc6578048e0980 ("regmap: maple: Drop the RCU read lock while syncing registers") in your tree when testing?
We have tested with ASoC tree for-next branch code. This patch is not included in our tree while testing.
We will verify with the patch and let you know our findings.
After inclusion of above-mentioned patch, we are no longer observing rcu warnings.
Thanks, Vijendar
Below are the pastebin links for rcu warnings dmesg logs. https://pastebin.com/6sadwNCw https://pastebin.com/6sadwNCw
Please include at least some of the actual warning in your emails so they are directly readable.
participants (3)
-
Liao, Bard
-
Mark Brown
-
Mukunda,Vijendar