Re: [PATCH net v3 06/14] net: pse-pd: check the PI state under the lock when setting a power limit
From: Carlo Szelinsky
Date: Thu Nov 05 2026 - 13:03:11 EST
On Thu, 05 Nov 2026 10:08:34 +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Does this check tell whether the PI is actually powered? Both flags can be
> set while the port is off and pw_allocated_mW is 0, and no race is needed
> to get there.
No, and it did not before this patch either. The patch only moves the
same check under the lock. That fixes the race in the commit message:
a disconnect clears isr_pd_detected, and the check now sees it.
The pending and shed cases need their own fix. Kory and Oleksij do not
want set_pw_limit to skip a pending PI, so it is not a one-line change.
I keep it out of this series.
> Is previous_pw_allocated still valid when the rollback runs?
> This is a pre-existing issue, but the return value of the rollback
> pse_pi_update_pw_budget() call is ignored.
> This isn't a bug introduced by this patch, but the budget update and the
> hardware limit write still happen in separate pcdev->lock sections.
All three come from the same thing: the budget update and the hardware
limit write run in two lock sections. That was already the case before
this patch. The real fix is to do both under one lock, as Oleksij
suggested, and that needs a different structure. I leave it for a
follow-up.
Carlo