mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 09/14] reset: protect struct reset_controller_dev with its own mutex
Date: Wed, 04 Mar 2026 11:56:59 +0100	[thread overview]
Message-ID: <7cfe3f33947c036e428d135f6c2e8a321cf3db8b.camel@pengutronix.de> (raw)
In-Reply-To: <20260223-reset-core-refactor-v2-9-5e5a7289190c@oss.qualcomm.com>

On Mo, 2026-02-23 at 11:06 +0100, Bartosz Golaszewski wrote:
> Currently we use a single, global mutex - misleadingly names
> reset_list_mutex - to protect the global list of reset devices,
> per-controller list of reset control handles and also internal fields of
> struct reset_control. Locking can be made a lot more fine-grained if we
> use a separate mutex for serializing operations on the list AND
> accessing the reset controller device.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
>  drivers/reset/core.c             | 44 ++++++++++++++++++++++++----------------
>  include/linux/reset-controller.h |  3 +++
>  2 files changed, 30 insertions(+), 17 deletions(-)
> 
[...]
> diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
> index aa95b460fdf86f10002a465e285cd0119da6eeaf..2fecb4edeba1a2b1f5f5db2b34c867362c5f9c18 100644
> --- a/include/linux/reset-controller.h
> +++ b/include/linux/reset-controller.h
> @@ -3,6 +3,7 @@
>  #define _LINUX_RESET_CONTROLLER_H_
>  
>  #include <linux/list.h>
> +#include <linux/mutex.h>
>  
>  struct reset_controller_dev;
>  
> @@ -40,6 +41,7 @@ struct of_phandle_args;
>   *            device tree to id as given to the reset control ops, defaults
>   *            to :c:func:`of_reset_simple_xlate`.
>   * @nr_resets: number of reset controls in this reset controller device
> + * @lock: synchronizes concurrent access to the structure's fields

This is not true, or at least not very precise. The lock protects the
reset control list.

The contents of rcdev->list are protected by reset_list_mutex instead:
they are modified outside the rcdev->lock scope in
reset_controller_unregister().

The other fields in struct reset_controller_dev are expected to be
constant over its lifetime.

regards
Philipp

  reply	other threads:[~2026-03-04 10:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 10:06 [PATCH v2 00/14] reset: major reset core refactoring Bartosz Golaszewski
2026-02-23 10:06 ` [PATCH v2 01/14] reset: gpio: remove unneeded OF-node put Bartosz Golaszewski
2026-02-23 10:06 ` [PATCH v2 02/14] reset: gpio: add a devlink between reset-gpio and its consumer Bartosz Golaszewski
2026-02-23 10:06 ` [PATCH v2 03/14] reset: gpio: simplify fallback device matching Bartosz Golaszewski
2026-02-23 16:07   ` Philipp Zabel
2026-02-23 10:06 ` [PATCH v2 04/14] reset: gpio: remove unneeded auxiliary_set_drvdata() Bartosz Golaszewski
2026-02-23 10:06 ` [PATCH v2 05/14] reset: warn on reset-gpio release Bartosz Golaszewski
2026-02-23 16:07   ` Philipp Zabel
2026-02-23 10:06 ` [PATCH v2 06/14] reset: fold ida_alloc() into reset_create_gpio_aux_device() Bartosz Golaszewski
2026-02-23 10:06 ` [PATCH v2 07/14] reset: use lock guards in reset core Bartosz Golaszewski
2026-02-23 16:07   ` Philipp Zabel
2026-02-23 10:06 ` [PATCH v2 08/14] reset: handle removing supplier before consumers Bartosz Golaszewski
2026-03-04 10:56   ` Philipp Zabel
2026-03-05 11:11     ` Bartosz Golaszewski
2026-02-23 10:06 ` [PATCH v2 09/14] reset: protect struct reset_controller_dev with its own mutex Bartosz Golaszewski
2026-03-04 10:56   ` Philipp Zabel [this message]
2026-02-23 10:06 ` [PATCH v2 10/14] reset: protect struct reset_control " Bartosz Golaszewski
2026-03-04 10:57   ` Philipp Zabel
2026-02-23 10:06 ` [PATCH v2 11/14] reset: convert of_reset_control_get_count() to using firmware nodes Bartosz Golaszewski
2026-03-04 11:05   ` Philipp Zabel
2026-02-23 10:06 ` [PATCH v2 12/14] reset: convert the core API " Bartosz Golaszewski
2026-03-04 11:10   ` Philipp Zabel
2026-02-23 10:06 ` [PATCH v2 13/14] reset: convert reset core " Bartosz Golaszewski
2026-03-04 11:34   ` Philipp Zabel
2026-02-23 10:06 ` [PATCH v2 14/14] reset: gpio: make the driver fwnode-agnostic Bartosz Golaszewski
2026-03-04 11:34   ` Philipp Zabel
2026-03-03  8:55 ` [PATCH v2 00/14] reset: major reset core refactoring Bartosz Golaszewski

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=7cfe3f33947c036e428d135f6c2e8a321cf3db8b.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.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®