Re: [PATCH net-next 11/12] net: pse-pd: Add support for event reporting using devm_regulator_irq_helper

Kory Maincent
2024-10-03T13:33:08Z

On Thu, 3 Oct 2024 14:56:21 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> > > https://docs.kernel.org/power/regulator/consumer.html#regulator-events
> > >
> > > Suggests these are internal events, using a notification chain. How
> > > does user space get to know about such events?
> >
> > When events appears, _notifier_call_chain() is called which can generate
> > netlink messages alongside the internal events:
> > https://elixir.bootlin.com/linux/v6.11.1/source/drivers/regulator/core.c#L4898
> >
>
> Ah, O.K.
>
> But is this in the correct 'address space' for the want of a better
> term. Everything else to do with PSE is in the networking domain of
> netlink. ethtool is used to configure PSE. Shouldn't the notification
> also close by to ethtool? When an interface changes state, there is a
> notification sent. Maybe we want to piggyback on that?

Indeed, but regulator API already provide such events, which will even be sent
when we enable or disable the PSE. Should we write a second event management.
Using regulator event API allows to report over current internal events to the
parents regulator the power supply of the PSE which could also do something to
avoid smoke.

Or maybe we should add another wrapper which will send PSE ethtool netlink
notification alongside the regulator notifications supported by this patch.

> Also, how do regulator events work in combination with network
> namespaces? If you move the interface into a different network
> namespace, do the regulator events get delivered to the root namespace
> or the namespace the interface is in?

regulator events are sent in root namespace.

Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering