mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: Kyle Swenson <kyle.swenson@est.tech>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
	"netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>,
	"github@szelinsky.de" <github@szelinsky.de>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@kernel.org" <edumazet@kernel.org>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"piotr.kubik@adtran.com" <piotr.kubik@adtran.com>,
	"saikrishnag@marvell.com" <saikrishnag@marvell.com>,
	"horms@kernel.org" <horms@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"mazziesaccount@gmail.com" <mazziesaccount@gmail.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: Re: [PATCH net 05/10] net: pse-pd: check the PI state under the lock when setting a power limit
Date: Wed, 21 Oct 2026 17:42:59 +0200	[thread overview]
Message-ID: <2c27a1a0-b0a4-4adc-a3af-edb74e12dcfb@bootlin.com> (raw)
In-Reply-To: <atjcxjV-scVhA6aF@p620>



On 10/21/26 17:40, Kyle Swenson wrote:
> On Tue, Oct 20, 2026 at 12:19:28PM +0200, Kory Maincent wrote:
>>
>>
>> On 10/20/26 07:40, Oleksij Rempel wrote:
>>> CCing regulator related folks.
>>>
>>> On Mon, Oct 19, 2026 at 02:30:24PM +0200, Kory Maincent wrote:
>>>>
>>>> On 10/19/26 10:51, netdev-bot+sashiko@kernel.org wrote:
>>>>>>     	previous_pw_allocated = pi->pw_allocated_mW;
>>>>>>     	pw_diff = pw_req - previous_pw_allocated;
>>>>>>     	if (!pw_diff) {
> 
> [...]
> 
>>>>> regulator_set_current_limit()
>>>>>      pse_pi_set_current_limit()
>>>>>        ops->pi_set_pw_limit()         <- new, higher limit
>>>>
>>>> @Oleksij, Here is another example of an issue related to the PSE PI being a
>>>> regulator provider.
>>>>
>>>> @Carlo, Kyle is working on a series that remove the support for a PSE PI
>>>> being a regulator provider. We will see where it goes.
>>>
>>> Removing the regulator provider support is a bad idea:
>>>
>>> - We will end up implementing a poor man's regulator framework inside the
>>> network subsystem. Networking folks will have to deal with physical constraints
>>> already solved by the power management community, requiring a different mindset
>>> and domain experience.
>>
>> That's what we thought at the beginning of the implementation of PoE but in
>> fact that's not the case. I don't see currently any cases of using already
>> solved regulator constraint in the PoE core.
>> The drawback are:
>> - locks issues: solved one by using worker but there are still others
>>    appearing like this one
>> - code complexity due to all the regulator callback wrapper
>> - converting mW to mA for regulator framework then to mW again for the
>>    PSE driver callbacks. There are even devices that are using current
>>    limit therefore there will be 3 conversions.
>>
>> The more painful issues are the lock issues.
>>
>>> - We lose built-in regulator infrastructure: DT safety constraints
>>> (regulator-max-microamp), over-current/under-voltage notifications, and
>>> sysfs/debugfs (regulator_summary) visibility.
>>
>> I disagree here.
>> regulator-max-microamp: has not interest from the PI side but this is
>> related to its power supply. The PI should still stay as a regulator
>> consumer so the power supply could describe this binding.
>>
>> over-current/under-voltage notifications: we are already reporting these PSE
>> PIs notification through ethtool. We will loose
>> regulator_notifier_call_chain() call but well there is no consumer to the PI
>> regulator provider so it's mainly useless.
>>
>> Yes, we will loose sysfs/debugfs visibility, but is someone really using it
>> as all PSE communication goes through ethtool?
>>
>>> - The race above is just a lock scope issue across pcdev->lock and the
>>> regulator call, not a flaw in the abstraction.
>>
>> That's not something easy to solve as PSE and regulator provider are nested
>> together.
>> Either we put all of the lock issues inside workers, it will not be
>> synchronous and will smell hackish but well...
>> Or we try to combine the PSE lock with the regulator nested lock in one way
>> or another.
>> Do you have a better idea?
>>
>>> - Writing a custom power state machine in net/ will introduce more bugs than it
>>> fixes - especially if we overestimate our ability to upstream complex custom
>>> logic under LLM review supervision.
>>
>> Removing regulator provider will simplify a lot the implementation so I
>> think it will rather remove bugs than introduce new one.
>> I think we should let Kyle works on it with a RFC and we will see where it
>> goes.
> 
> For what it's worth, and for others that might be interested but I missed
> on cc, the RFC is here:
> 
> https://lore.kernel.org/netdev/20261020-pse_regulator_fixes-v1-1-fd6084a22cba@est.tech/

Thank's for that.

I will take a look at it when I have time, but it seems promising to me 
to solve lots of issue as you mention.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


  reply	other threads:[~2026-10-21 15:43 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18  8:23 [PATCH net 00/10] net: pse-pd: assorted lifetime and error-path fixes Carlo Szelinsky
2026-10-18  8:23 ` [PATCH net 01/10] net: pse-pd: size the notification kfifo after defaulting nr_lines Carlo Szelinsky
2026-10-19  9:22   ` Kory Maincent
2026-10-18  8:23 ` [PATCH net 02/10] net: pse-pd: fix module refcount leak in pse_control_get_internal() Carlo Szelinsky
2026-10-19  8:51   ` netdev-bot+sashiko
2026-10-19 19:56     ` Carlo Szelinsky
2026-10-19  9:31   ` Kory Maincent
2026-10-19 19:56     ` Carlo Szelinsky
2026-10-18  8:23 ` [PATCH net 03/10] net: pse-pd: do not keep a failed IRQ in pcdev->irq Carlo Szelinsky
2026-10-19  9:33   ` Kory Maincent
2026-10-18  8:23 ` [PATCH net 04/10] net: pse-pd: do not reach a freed PHY from the notification worker Carlo Szelinsky
2026-10-19  8:51   ` netdev-bot+sashiko
2026-10-19 19:56     ` Carlo Szelinsky
2026-10-18  8:23 ` [PATCH net 05/10] net: pse-pd: check the PI state under the lock when setting a power limit Carlo Szelinsky
2026-10-19  8:51   ` netdev-bot+sashiko
2026-10-19 12:30     ` Kory Maincent
2026-10-19 19:56       ` Carlo Szelinsky
2026-10-20  5:40       ` Oleksij Rempel
2026-10-20 10:19         ` Kory Maincent
2026-10-21 15:40           ` Kyle Swenson
2026-10-21 15:42             ` Kory Maincent [this message]
2026-10-19 19:56     ` Carlo Szelinsky
2026-10-18  8:23 ` [PATCH net 06/10] net: pse-pd: do not tie a shared power domain to its creator's devres Carlo Szelinsky
2026-10-19  8:51   ` netdev-bot+sashiko
2026-10-19 19:56     ` Carlo Szelinsky
2026-10-18  8:23 ` [PATCH net 07/10] net: pse-pd: pd692x0: release the manager power budget through devres Carlo Szelinsky
2026-10-19 12:45   ` Kory Maincent
2026-10-18  8:23 ` [PATCH net 08/10] net: pse-pd: pd692x0: defer probe while a manager supply is unresolved Carlo Szelinsky
2026-10-19 12:47   ` Kory Maincent
2026-10-18  8:23 ` [PATCH net 09/10] net: pse-pd: si3474: fix use-after-free in ancillary client error path Carlo Szelinsky
2026-10-19 12:50   ` Kory Maincent
2026-10-19 19:56     ` Carlo Szelinsky
2026-10-18  8:23 ` [PATCH net 10/10] net: pse-pd: reject a power limit whose current does not fit an int Carlo Szelinsky
2026-10-19 12:53   ` Kory Maincent
2026-10-19 19:56     ` Carlo Szelinsky
2026-10-18 23:32 ` [PATCH net 00/10] net: pse-pd: assorted lifetime and error-path fixes Ross Cawston
2026-10-19 19:56   ` Carlo Szelinsky

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=2c27a1a0-b0a4-4adc-a3af-edb74e12dcfb@bootlin.com \
    --to=kory.maincent@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=github@szelinsky.de \
    --cc=horms@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=kyle.swenson@est.tech \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=piotr.kubik@adtran.com \
    --cc=saikrishnag@marvell.com \
    /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®