lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 28 Nov 2022 18:38:54 +0000
From:   Mark Brown <broonie@...nel.org>
To:     Alexander Stein <alexander.stein@...tq-group.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] regmap: cache: downgrade log level for no cache
 defaults message

On Mon, Nov 28, 2022 at 03:58:40PM +0100, Alexander Stein wrote:
> Am Freitag, 25. November 2022, 20:30:52 CET schrieb Mark Brown:

> > In this case if you can't use a rbtree cache I would recommend
> > bootstrapping by initially reading without a cache first to get the
> > default values, then replacing the regmap with one that uses the
> > defaults you just read.  You'll need some care over suspend/resume
> > though.

> The driver I'm working on clk-renesas-pcie.c only has 8 registers, so there is 
> no benefit to use a different cache than REGCACHE_FLAT.

There's a benefit when it comes to bootstrapping (though also a slight
performance cost, and non-atomicity).

> But I currently fail to see why this is only for non-sparse caches. This is 
> printed even before the cache_ops init() is called.

We only go into hw_init() in the case where the map has specified
num_reg_defaults_raw, as you say you could trigger that for any cache
type but if you're using a sparse cache you're either going to provide
no defaults or provide defaults in the standard, sparse format rather
than the raw format so in practice it won't trigger.

> Before the call to regcache_hw_init() there is this comment:
> > /* Some devices such as PMICs don't have cache defaults,
> >  * we cope with this by reading back the HW registers and
> >  * crafting the cache defaults by hand.
> >  */

> This is exactly what I want to do: Read back HW registers and create a cache.
> Actually regcache_hw_init() is exactly doing what you are suggesting:
> 1. reading HW registers into map->reg_defaults_raw
> 2.
>  a) copy them into map->reg_defaults
>  b) read HW register individually if 1. failed

The other thing with doing a readback to fill the cache is that it's a
potentially slow operation (depending on how big the cache is and the
bus in use) and also a potentially destructive one for things like clear
on read registers.  If regmaps are doing this deliberately (which does
seem valid) we probably want a clearer mechanism for specifying it - I
think an explicit flag would do the trick.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ