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] [day] [month] [year] [list]
Date: Tue, 18 Jun 2024 17:55:33 +0200
From: Herve Codina <herve.codina@...tlin.com>
To: "Arnd Bergmann" <arnd@...db.de>
Cc: "Simon Horman" <horms@...nel.org>, "Sai Krishna Gajula"
 <saikrishnag@...vell.com>, "Thomas Gleixner" <tglx@...utronix.de>, "Rob
 Herring" <robh@...nel.org>, "Krzysztof Kozlowski" <krzk+dt@...nel.org>,
 "Conor Dooley" <conor+dt@...nel.org>, "David S . Miller"
 <davem@...emloft.net>, "Eric Dumazet" <edumazet@...gle.com>, "Jakub
 Kicinski" <kuba@...nel.org>, "Paolo Abeni" <pabeni@...hat.com>, "Lee Jones"
 <lee@...nel.org>, "Horatiu Vultur" <horatiu.vultur@...rochip.com>,
 UNGLinuxDriver@...rochip.com, "Andrew Lunn" <andrew@...n.ch>, "Heiner
 Kallweit" <hkallweit1@...il.com>, "Russell King" <linux@...linux.org.uk>,
 "Saravana Kannan" <saravanak@...gle.com>, "Bjorn Helgaas"
 <bhelgaas@...gle.com>, "Philipp Zabel" <p.zabel@...gutronix.de>, "Lars
 Povlsen" <lars.povlsen@...rochip.com>, "Steen Hegelund"
 <Steen.Hegelund@...rochip.com>, "Daniel Machon"
 <daniel.machon@...rochip.com>, "Alexandre Belloni"
 <alexandre.belloni@...tlin.com>, linux-kernel@...r.kernel.org,
 devicetree@...r.kernel.org, Netdev <netdev@...r.kernel.org>,
 linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org, "Allan
 Nielsen" <allan.nielsen@...rochip.com>, "Luca Ceresoli"
 <luca.ceresoli@...tlin.com>, "Thomas Petazzoni"
 <thomas.petazzoni@...tlin.com>, "Clement Leger" <clement.leger@...tlin.com>
Subject: Re: [PATCH v2 01/19] mfd: syscon: Add reference counting and device
 managed support

Hi Arnd,

On Tue, 18 Jun 2024 16:53:30 +0200
"Arnd Bergmann" <arnd@...db.de> wrote:

> On Mon, May 27, 2024, at 18:14, Herve Codina wrote:
> > From: Clément Léger <clement.leger@...tlin.com>
> >
> > Syscon releasing is not supported.
> > Without release function, unbinding a driver that uses syscon whether
> > explicitly or due to a module removal left the used syscon in a in-use
> > state.
> >
> > For instance a syscon_node_to_regmap() call from a consumer retrieve a
> > syscon regmap instance. Internally, syscon_node_to_regmap() can create
> > syscon instance and add it to the existing syscon list. No API is
> > available to release this syscon instance, remove it from the list and
> > free it when it is not used anymore.
> >
> > Introduce reference counting in syscon in order to keep track of syscon
> > usage using syscon_{get,put}() and add a device managed version of
> > syscon_regmap_lookup_by_phandle(), to automatically release the syscon
> > instance on the consumer removal.
> >
> > Signed-off-by: Clément Léger <clement.leger@...tlin.com>
> > Signed-off-by: Herve Codina <herve.codina@...tlin.com>  
> 
> This all looks correct from an implementation perspective,
> but it does add a lot of complexity if now every syscon user
> feels compelled to actually free up their resources again,
> while nothing else should actually depend on this.
> 
> The only reference I found in your series here is the
> reset controller, and it only does a single update to
> the regmap in the probe function.
> 
> Would it be possible to just make the syscon support in
> the reset driver optional and instead poke the register
> in the mfd driver itself when this is used as a pci device?
> Or do you expect to see the syscon get used in other
> places in the future for the PCI case?
> 

IMHO, I don't think that poking the register in the mfd driver and so
avoiding syscon usage is the right solution.

Indeed, additional devices can be added in the DT overlay and an other
syscon user can be present.

Also, overlays can be used on other PCI devices in the future and these PCI
devices can use drivers that are syscon users. In that case, the same kind
of workaround will be needed and maybe a quite more complex one depending on
syscon users.

The root issue is that syscon does not support removal.
I prefer fixing this root issue instead of finding a kind of workaround.

Even if all syscon users are not fixed right now (and probably don't need to
be fixed), a solution with the new devm_syscon_regmap_lookup_by_phandle() is
available and drivers that need to release their resources because of a
device removal can easily move to devm_syscon_regmap_lookup_by_phandle().

Best regards,
Hervé

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ