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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 10 Dec 2017 16:14:01 +0100
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Mark Brown <broonie@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] regmap: allow to disable all locking mechanisms

2017-12-10 14:10 GMT+01:00 Andy Shevchenko <andy.shevchenko@...il.com>:
> On Wed, Dec 6, 2017 at 4:26 PM, Bartosz Golaszewski <brgl@...ev.pl> wrote:
>> We have a use case in the at24 EEPROM driver (recently converted to
>> using regmap instead of raw i2c/smbus calls) where we read from/write
>> to the regmap in a loop, while protecting the entire loop with
>> a mutex.
>>
>> Currently this implicitly makes us use two mutexes - one in the driver
>> and one in regmap. While browsing the code for similar use cases I
>> noticed a significant number of places where locking *seems* redundant.
>>
>> Allow users to completely disable any locking mechanisms in regmap
>> config.
>
>> +static void regmap_lock_unlock_empty(void *__map)
>
> ..._none()?
>

Too late, Mark already applied it.

>
>> +{
>> +
>> +}
>> +
>>  static void regmap_lock_mutex(void *__map)
>
>> -       if (config->lock && config->unlock) {
>> +       if (config->disable_locking) {
>> +               map->lock = map->unlock = regmap_lock_unlock_empty;
>> +       } else if (config->lock && config->unlock) {
>
> Why not to introduce positive switch, namely
>  bool mutex_lock; // choose better name
> and assign ..._none() by default?

Because we don't want to break all the existing regmaps, if map->lock
or map->unlock is empty, regmap core decides internally whether to use
a mutex or a spinlock.

Best regards,
Bartosz Golaszewski

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ