From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 234553A451F for ; Wed, 4 Mar 2026 10:57:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772621825; cv=none; b=PfGB0gXqHnT4swZ5S8KKArZUkMWjcN82UoaHb1hB9c0KzsLwa9TwOgfrf5tjV4TBgt1gyDtfY2T7S1Hvsg4LxXPUZRRlgLc4LLN7wUQ7jjL7cub1Fhma0pSbQJsF+maD46Gu/79jYxkOvj1BNJrCnKjZ+GiRY9jpJZQ8fy4rn/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772621825; c=relaxed/simple; bh=iP4UpjUBsmfBi2EXJbVwypBs6ZPjk2K0DRfkKHYyr1M=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=euhZ34AO8GNaFnh+cFx/PTQXzzYKTTI9Dx0BUvOEbXPi0nGqxFoQZoNjtwi9d8mW7f/w+nbSEwoitqoteZDpfITlJmJDvC4B4vK6kNH4PozsbR+Ni7h1gaoTKQO8T55o/UfhCG81/Qz5jxGqFYpZjCZ1/DCMvGIYODGXyYHqkEM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vxjuV-0004if-KV; Wed, 04 Mar 2026 11:56:59 +0100 Received: from lupine.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::4e] helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vxjuU-003hP1-0I; Wed, 04 Mar 2026 11:56:59 +0100 Received: from pza by lupine with local (Exim 4.98.2) (envelope-from ) id 1vxjuV-000000007kV-1XwZ; Wed, 04 Mar 2026 11:56:59 +0100 Message-ID: <7cfe3f33947c036e428d135f6c2e8a321cf3db8b.camel@pengutronix.de> Subject: Re: [PATCH v2 09/14] reset: protect struct reset_controller_dev with its own mutex From: Philipp Zabel To: Bartosz Golaszewski , Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org Date: Wed, 04 Mar 2026 11:56:59 +0100 In-Reply-To: <20260223-reset-core-refactor-v2-9-5e5a7289190c@oss.qualcomm.com> References: <20260223-reset-core-refactor-v2-0-5e5a7289190c@oss.qualcomm.com> <20260223-reset-core-refactor-v2-9-5e5a7289190c@oss.qualcomm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-0+deb13u1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org 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. >=20 > Signed-off-by: Bartosz Golaszewski > --- > drivers/reset/core.c | 44 ++++++++++++++++++++++++----------= ------ > include/linux/reset-controller.h | 3 +++ > 2 files changed, 30 insertions(+), 17 deletions(-) >=20 [...] > diff --git a/include/linux/reset-controller.h b/include/linux/reset-contr= oller.h > index aa95b460fdf86f10002a465e285cd0119da6eeaf..2fecb4edeba1a2b1f5f5db2b3= 4c867362c5f9c18 100644 > --- a/include/linux/reset-controller.h > +++ b/include/linux/reset-controller.h > @@ -3,6 +3,7 @@ > #define _LINUX_RESET_CONTROLLER_H_ > =20 > #include > +#include > =20 > struct reset_controller_dev; > =20 > @@ -40,6 +41,7 @@ struct of_phandle_args; > * device tree to id as given to the reset control ops, defau= lts > * 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