Re: [PATCH 1/1] PCI: Cleanup link activation wait logic

From: Ilpo Järvinen
Date: Fri Feb 02 2024 - 09:32:06 EST


On Fri, 2 Feb 2024, Maciej W. Rozycki wrote:

> On Fri, 2 Feb 2024, Ilpo Järvinen wrote:
>
> > 1. Change pcie_failed_link_retrain() to return true only if link was
> > retrained successfully due to the Target Speed quirk. If there is no
> > LBMS set, return false instead of true because no retraining was
> > even attempted. This seems correct considering expectations of both
> > callers of pcie_failed_link_retrain().
>
> You change the logic here in that the second conditional isn't run if the
> first has not. This is wrong, unclamping is not supposed to rely on LBMS.
> It is supposed to be always run and any failure has to be reported too, as
> a retraining error. I'll send an update according to what I have outlined
> before then, with some testing done first.

Oh I see now, I'm sorry, I didn't read all the way to the last paragraph
of the commit message because the earlier one in the commit message hinted
the restriction is removed afterwards so I thought it was only linked to
the first part of the quirk.

> > 2. Handle link-was-not-retrained-successfully return (false) from
> > pcie_failed_link_retrain() properly in pcie_wait_for_link_delay() by
> > directly returning false.
>
> I think it has to be a separate change, as a fix to what I can see is an
> issue with a three-way-merge done with commit 1abb47390350 ("Merge branch
> 'pci/enumeration'"); surely a bool result wasn't supposed to be assigned
> to an int variable carrying an error code.
>
> Either or both changes may have to be backported independently.

But can it be? Won't the intermediate state cause more breakage? (although
that obviously can only hit some very unfortunate bisecter so perhaps not
a big deal because one would need many holes to align, the biggest being
the link has to fail training which is rare to begin with).

--
i.