Message ID | 20230713-mfd-cirrus-maple-v1-8-16dacae402a8@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1516568vqm; Wed, 12 Jul 2023 18:06:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWz1pN7SP9Dygb/qLMh+UyWbrABywaZW4hUxok0z+yfZcGuhXpCqn5QHbo8umHzE6x1Xa3 X-Received: by 2002:a05:6870:180f:b0:1b0:57f8:dab4 with SMTP id t15-20020a056870180f00b001b057f8dab4mr549995oaf.24.1689210386789; Wed, 12 Jul 2023 18:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689210386; cv=none; d=google.com; s=arc-20160816; b=ndWaRHJz22+nXA9MkLheBqWr3ypxusJJiWRMoFG9+dJURsiTxOLgnQYar8vE6ocs+x HJqKPKg1CUCn3njB4B+JwzXJRdBzKutV9bV9xRwUTF+Jo0pjJ+btjdkWCZZwWeIjNF+X r+I6bi+cWAdEzYMIA5e/K8m9DL76eUfgjoYUvnNRN64El6g3SWbRJ1BoYu5wtPqSR+RX 6BOvqMLmKyni0Bg6c3bL1S1/a7cbW/Hrh8ovF/wmuFtURQLSvNh17w5KJwAR7ljNCWDe bId8t4v0MAeILKK0kcA76oar8NML0Su7FVklUo3zVA1SHnjzOeHx7RvFjO3kuSuYT+lR HQug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=8tOYmLnExLuLlIn3AyS5/h++68LCPDVY+DWWig+o6vk=; fh=dOxFUzZCNbe5xMYraRYkMHf2W14njpUxK2j3f3I+S7c=; b=yB1P2TYCDrH4+TLozYkR21Tcss19+iOJFi1jtbZMokvTplHsl2uS6D3SV2Lpl4g75w 9/CQseynSnuwUeHzHbc3FowsvRH5KhutNrPi3riSSIoba5btLP00s2MlPaCu6lAo1/Dp IHzMpSlQ3N/wEfdc7cRM0EwC4HplPT65NO+xmYpHiSXIZ7LkWOIYGv1pGc8A1VB+vpSK ce6LIxfwJeuEfDNUjFYwXi4NA53FERbNEHMgid7ux6nfRz42uALKtll0TOJhu7aI8xIn m5amVmxfj7H5w0Djm/nPEeYYrlmDxUNwbjUAQ18j23LWgEn+Xylz7eCnf2HmTJFGCwTY xRAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pSkjhgIm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nm14-20020a17090b19ce00b00263f5f3b890si4138734pjb.69.2023.07.12.18.06.13; Wed, 12 Jul 2023 18:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pSkjhgIm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233393AbjGMAyX (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Wed, 12 Jul 2023 20:54:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233273AbjGMAyO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 12 Jul 2023 20:54:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2F852709 for <linux-kernel@vger.kernel.org>; Wed, 12 Jul 2023 17:54:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A8484619EC for <linux-kernel@vger.kernel.org>; Thu, 13 Jul 2023 00:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67001C433C8; Thu, 13 Jul 2023 00:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689209639; bh=4xCyosK5hPNwehtDaNrTf/Y8gMcOBjAwl62LZXcJO2k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pSkjhgImx+SaRhrDL82JHZ6UnXod1X3YmYRn45w9oGQgn9Extnkav5IsHqNWbSzy7 ScwQSFhloyQRWAlIykv073UWQQqwVF6MLtRvUA+xKdyj9jMfd4aAq+eGCBh/EohZsP Dk3PksxGem3QhDZzxVXBgyNFpK1TSiOAKJADaiKhOk4q/QUr4z40RmLIlqxRJtUWe/ Mo51nn7fpeWlg/IxQEQYbxMVRMQrC3lpq9t9JMe+jT6ihfQus1a0RwrOj7YRiDPmEF jN6wpw30eMKaL79A6s9+fk8QAieP2PGlfEzajy9UbyRzBxowQBbfpV2CsW7dw0clMT HA0ILUy3wlZbg== From: Mark Brown <broonie@kernel.org> Date: Thu, 13 Jul 2023 01:49:26 +0100 Subject: [PATCH 08/11] mfd: wm5110: Update to use maple tree register cache MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230713-mfd-cirrus-maple-v1-8-16dacae402a8@kernel.org> References: <20230713-mfd-cirrus-maple-v1-0-16dacae402a8@kernel.org> In-Reply-To: <20230713-mfd-cirrus-maple-v1-0-16dacae402a8@kernel.org> To: Charles Keepax <ckeepax@opensource.cirrus.com>, Richard Fitzgerald <rf@opensource.cirrus.com>, Lee Jones <lee@kernel.org> Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org> X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=1123; i=broonie@kernel.org; h=from:subject:message-id; bh=4xCyosK5hPNwehtDaNrTf/Y8gMcOBjAwl62LZXcJO2k=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkr0sQ6b19gj1t3pk+IspVD63ACwUKmce+gW+3J fVQOh697P+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZK9LEAAKCRAk1otyXVSH 0FoECACGXALSQaWFQAnJ0GizEuUj7FSKDd7D6pHsgjYAqoKb7eaoSlzGKd5EgQcCwrFup4UB2St MDE2EPWQfIRPszMNUzZHPqVZI52AedurNdmwu1olUyR+QMHJXKYqBgScjgMZIguDv8195eJCZnp Ril2f8nSFPL5sgFaDLjvIPSJhDhKRD97w/lTTOPuylJ4oVzo8BHDACN13jPFtoxGVChmWLftrBa NExSO5w5VkWIND6zBvpiGM18YU6pbjWOJJg+eWUmXN5QFonj+qlRgmpmSYXf/Uh38py14OZObxd otVyxuRLhmraYFSZrS2Mnkh/s8/ryhqsLmFiq94WRrUB6X+2 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771265470452862648 X-GMAIL-MSGID: 1771265470452862648 |
Series |
mfd:: Update Cirrus Logic drivers to use maple tree register caches
|
|
Commit Message
Mark Brown
July 13, 2023, 12:49 a.m. UTC
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache. In
v6.5 it has also acquired the ability to generate multi-register writes in
sync operations, bringing performance up to parity with the rbtree cache
there.
Update the wm5110 driver to use the more modern data structure.
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/mfd/wm5110-tables.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Jul 13, 2023 at 01:49:26AM +0100, Mark Brown wrote: > The maple tree register cache is based on a much more modern data structure > than the rbtree cache and makes optimisation choices which are probably > more appropriate for modern systems than those made by the rbtree cache. In > v6.5 it has also acquired the ability to generate multi-register writes in > sync operations, bringing performance up to parity with the rbtree cache > there. > > Update the wm5110 driver to use the more modern data structure. > > Signed-off-by: Mark Brown <broonie@kernel.org> > --- > drivers/mfd/wm5110-tables.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c > index 65b9b1d6daec..eba324875afd 100644 > --- a/drivers/mfd/wm5110-tables.c > +++ b/drivers/mfd/wm5110-tables.c > @@ -3218,7 +3218,7 @@ const struct regmap_config wm5110_i2c_regmap = { > .readable_reg = wm5110_readable_register, > .volatile_reg = wm5110_volatile_register, > > - .cache_type = REGCACHE_RBTREE, > + .cache_type = REGCACHE_MAPLE, > .reg_defaults = wm5110_reg_default, > .num_reg_defaults = ARRAY_SIZE(wm5110_reg_default), > }; > > -- > 2.39.2 > This one appears to cause me some issues, seems to get the IRQs into a weird state when doing compressed stream stuff. The issue seems to also require commit bfa0b38c1483 ("regmap: maple: Implement block sync for the maple tree cache") to be present. So it definitely seems to relate to the cache sync, but not sure if it is something todo with the device itself, or the maple tree stuff yet. Thanks, Charles
On Tue, Jul 18, 2023 at 03:42:00PM +0000, Charles Keepax wrote: > On Thu, Jul 13, 2023 at 01:49:26AM +0100, Mark Brown wrote: > > The maple tree register cache is based on a much more modern data structure > > than the rbtree cache and makes optimisation choices which are probably > > more appropriate for modern systems than those made by the rbtree cache. In > > v6.5 it has also acquired the ability to generate multi-register writes in > > sync operations, bringing performance up to parity with the rbtree cache > > there. > > > > Update the wm5110 driver to use the more modern data structure. > > > > Signed-off-by: Mark Brown <broonie@kernel.org> > > --- > > drivers/mfd/wm5110-tables.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c > > index 65b9b1d6daec..eba324875afd 100644 > > --- a/drivers/mfd/wm5110-tables.c > > +++ b/drivers/mfd/wm5110-tables.c > > @@ -3218,7 +3218,7 @@ const struct regmap_config wm5110_i2c_regmap = { > > .readable_reg = wm5110_readable_register, > > .volatile_reg = wm5110_volatile_register, > > > > - .cache_type = REGCACHE_RBTREE, > > + .cache_type = REGCACHE_MAPLE, > > .reg_defaults = wm5110_reg_default, > > .num_reg_defaults = ARRAY_SIZE(wm5110_reg_default), > > }; > > > > -- > > 2.39.2 > > > > This one appears to cause me some issues, seems to get the IRQs > into a weird state when doing compressed stream stuff. The > issue seems to also require commit bfa0b38c1483 ("regmap: > maple: Implement block sync for the maple tree cache") to be > present. So it definitely seems to relate to the cache sync, > but not sure if it is something todo with the device itself, > or the maple tree stuff yet. > Ah... I think I see the regcache_sync sets async=true, but then the maple tree code immediately deletes the buffer after calling _regmap_raw_write. So its a racy use after free. How would we feel about having the maple tree code, clear async again? Thanks, Charles
On Tue, Jul 18, 2023 at 05:00:35PM +0000, Charles Keepax wrote: > On Tue, Jul 18, 2023 at 03:42:00PM +0000, Charles Keepax wrote: > > This one appears to cause me some issues, seems to get the IRQs > > into a weird state when doing compressed stream stuff. The > > issue seems to also require commit bfa0b38c1483 ("regmap: > > maple: Implement block sync for the maple tree cache") to be > > present. So it definitely seems to relate to the cache sync, > > but not sure if it is something todo with the device itself, > > or the maple tree stuff yet. > Ah... I think I see the regcache_sync sets async=true, but then > the maple tree code immediately deletes the buffer after calling > _regmap_raw_write. So its a racy use after free. > How would we feel about having the maple tree code, clear async > again? I was going to say, it must be a maple tree issue. I think we should push that async down into the rbtree code, that's probably also broken for other cache types if used in conjunction with slow buses...
diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c index 65b9b1d6daec..eba324875afd 100644 --- a/drivers/mfd/wm5110-tables.c +++ b/drivers/mfd/wm5110-tables.c @@ -3218,7 +3218,7 @@ const struct regmap_config wm5110_i2c_regmap = { .readable_reg = wm5110_readable_register, .volatile_reg = wm5110_volatile_register, - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_MAPLE, .reg_defaults = wm5110_reg_default, .num_reg_defaults = ARRAY_SIZE(wm5110_reg_default), };