linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: Aisheng Dong <aisheng.dong@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dongas86@gmail.com" <dongas86@gmail.com>,
	Peng Fan <peng.fan@nxp.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>
Subject: Re: [PATCH RFC 1/2] regmap: add option to disable debugfs
Date: Wed, 22 Jun 2022 13:25:04 +0100	[thread overview]
Message-ID: <YrMKINPtKfmnxLep@sirena.org.uk> (raw)
In-Reply-To: <abbc4d80377dcf5393afa143f9d3542cd2cd45a7.camel@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2986 bytes --]

On Wed, Jun 22, 2022 at 10:08:10AM +0200, Lucas Stach wrote:
> Am Dienstag, dem 21.06.2022 um 18:16 +0000 schrieb Aisheng Dong:

> > 1. There's a warning dump if using cache_only without cache
> > void regcache_cache_only(struct regmap *map, bool enable)
> > {
> >         map->lock(map->lock_arg);
> >         WARN_ON(map->cache_bypass && enable);
> >         ...
> > }
> > 2. It seems _regmap_write() did not handle cache_only case well
> > without cache.
> > It may still writes HW even for cache_only mode?
> > 
> > I guess we may need fix those two issues first before we can safely
> > use it?

> Why would you write to a cache only regmap. The debugfs interface only
> allows to dump the registers, no?

One of the use cases is where you've got settings that can be changed
while the device is idle and just map those directly onto the registers,
syncing the cache to the device when it gets powered up for actual use.
This can only be done when there's a cache, and won't apply to a lot of
devices.

There is debugfs code to do writes but you have to modify the kernel to
enable it, there's no config option for it upstream.

> I think it wouldn't be too hard to fix this for the blk-ctrl drivers.
> I'll give it a try today.

The other thing is that even with the bodge to just turn debugfs
presumably any case where the driver would try to write to a powered off
device is still a bug that needs fixing anyway - having a regmap in
cache only mode will translate it into a warning rather than a write
that goes AWOL or otherwise fails.

> > > That's a different thing, that's due to us naming the directory
> > > after the struct
> > > device but syscons being created before we have that struct device
> > > available.

> > Yes, but syscon has the same issue that the system may hang if dump
> > registers
> > through debugfs without power on.
> > How would you suggest for this case as syscon is also a common
> > driver?

> This is a general issue. If something uses a syscon that is inside a
> power-domain where the runtime PM is controlled by some other entity,
> how is it safe to use the syscon at all? Every access might end up
> locking up the system. So those syscons really need to learn some kind
> of runtime PM handling.

Right.  If you can interact with the device safely there's no need to
put it into cache only mode and you don't need to worry about managing
things (this should be the normal case for system controllers).  If you
can't interact with the device without powering it up then you still
have to worry about doing that regardless of what regmap is doing, if
anything I'd guess the warnings from regmap might be easier to debug
than the hardware misbehaviour.

Please delete unneeded context from mails when replying.  Doing this
makes it much easier to find your reply in the message, helping ensure
it won't be missed by people scrolling through the irrelevant quoted
material.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2022-06-22 12:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 13:47 [PATCH RFC 0/2] regmap: option to disable debugfs Dong Aisheng
2022-06-20 13:47 ` [PATCH RFC 1/2] regmap: add " Dong Aisheng
2022-06-20 15:05   ` Mark Brown
2022-06-20 15:47     ` Aisheng Dong
2022-06-20 15:49       ` Mark Brown
2022-06-20 16:15         ` Aisheng Dong
2022-06-20 17:51           ` Mark Brown
2022-06-21 14:56             ` Aisheng Dong
2022-06-21 15:31               ` Mark Brown
2022-06-21 18:16                 ` Aisheng Dong
2022-06-22  8:08                   ` Lucas Stach
2022-06-22  8:18                     ` Aisheng Dong
2022-06-22  8:35                       ` Lucas Stach
2022-06-22 12:25                     ` Mark Brown [this message]
2022-06-22 10:12                   ` Dong Aisheng
2022-06-22 12:36                     ` Mark Brown
2022-06-22 16:05                       ` Dong Aisheng
2022-06-22 16:27                         ` Mark Brown
2022-06-22 16:42                           ` Dong Aisheng
2022-06-22 16:48                             ` Mark Brown
2022-06-22 17:01                               ` Dong Aisheng
2022-06-22 17:07                                 ` Mark Brown
2022-06-20 13:47 ` [PATCH RFC 2/2] soc: imx8m-blk-ctrl: do not export debugfs Dong Aisheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrMKINPtKfmnxLep@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=aisheng.dong@nxp.com \
    --cc=dongas86@gmail.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).