mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sander Vanheule <sander@svanheule.net>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] regmap: add cache validity to REGCACHE_FLAT
Date: Thu, 16 Oct 2025 14:08:41 +0200	[thread overview]
Message-ID: <187bc058ff944dbde0e876efa6e72046bcc2a124.camel@svanheule.net> (raw)
In-Reply-To: <ca528e3e-39f1-41cc-9f46-ad787af48a77@sirena.org.uk>

On Thu, 2025-10-16 at 12:53 +0100, Mark Brown wrote:
> On Thu, Oct 16, 2025 at 10:46:33AM +0200, Sander Vanheule wrote:
> 
> > Would you be open to providing a new type of flat cache with sparse
> > initalisation (e.g. REGCACHE_FLAT_SPARSE) to provide the behavior provided
> > by
> > this patches? Most of the code could be shared with REGCACHE_FLAT.
> 
> Taking a step back for a minute, what's the actual problem you're trying
> to solve here?  Why use a flat cache rather than a maple tree cache for
> your application?

The device I want to use this for has a small contiguous register space, so a
flat cache should be sufficient. The driver can also works with maple (or RB-
tree) cache.

The problem with the current flat cache, is that it provides different caching
behavior than the other cache types. I want to keep the register values written
by the bootloader, so I can't provide defaults. That means a flat cache will
seed these registers with 0x00 values, which don't reflect the hardware state.
Any RMW operation can then cause the part of the register to be cleared, as the
read comes from the (invalid) cache.

This difference in caching behavior isn't (wasn't) immediately clear to me from
the documentation. Don't the different cache types exist to optimize speed or
memory for different use-cases? Because then I would only expect differences in
memory/speed, not in way the cache is initialized.

Best,
Sander

  reply	other threads:[~2025-10-16 12:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 18:02 Sander Vanheule
2025-01-09 20:11 ` Mark Brown
2025-10-16  8:46   ` Sander Vanheule
2025-10-16 11:53     ` Mark Brown
2025-10-16 12:08       ` Sander Vanheule [this message]
2025-10-16 13:55         ` Mark Brown
2025-10-16 20:49           ` Sander Vanheule
2025-10-17 13:56             ` Mark Brown
2025-10-22 20:21               ` Sander Vanheule

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=187bc058ff944dbde0e876efa6e72046bcc2a124.camel@svanheule.net \
    --to=sander@svanheule.net \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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

all inboxes | Powered by JetHome®