Use maximum latency when determining L1 ASPM
PATCH 1/1 Use maximum latency when determining L1 ASPM
Hi, just thought that I should send this out properly...
I would also suggest that this should go in to stable, if you don't disagree =)
I'm still interested in the L0S but I don't know how they work...
PATCH 1/1 Use maximum latency when determining L1 ASPM
The current solution verifies per "hop" but doesn't check the maximum latency, instead it checks the current "hops" max latency for upstream and downstrea,
This would work if all "hops" have the same latency, but:
root -> a -> b -> c -> endpoint
If c or b has the higest latency, it might not register
Fix this by maintaining a maximum value for comparison
--- drivers/pci/pcie/aspm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/pcie/aspm.c +3 -2
@@ -434,7 +434,7 @@ static void pcie_get_aspm_reg(struct pci_dev *pdev,static void pcie_aspm_check_latency (struct pci_dev *endpoint) { -u32 latency, l1_switch_latency =0 ; +u32 latency, l1_max_latency =0 , l1_switch_latency =0 ;struct aspm_latency *acceptable;struct pcie_link_state *link;
@@ -470,8 +470,9 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)* substate latencies (and hence do not do any check). */ latency =max_t (u32, link->latency_up.l1, link->latency_dw.l1); + l1_max_latency =max_t (u32, latency, l1_max_latency);if ((link->aspm_capable &ASPM_STATE_L1 ) && - (latency + l1_switch_latency > acceptable->l1)) + (l1_max_latency + l1_switch_latency > acceptable->l1)) link->aspm_capable &= ~ASPM_STATE_L1 ; l1_switch_latency +=1000 ;
Signature · 1 line
2.27.0
Sorry, the changelog is broken -- Will resend...
That'll teach me for thinking after working out... =)
Quoted 45 lines · Ian Kumlien
The current solution verifies per "hop" but doesn't check the maximum latency, instead it checks the current "hops" max latency for upstream and downstrea,
This would work if all "hops" have the same latency, but:
root -> a -> b -> c -> endpoint
If c or b has the higest latency, it might not register
Fix this by maintaining a maximum value for comparison
Signed-off-by Ian Kumlien <[email protected]>--- drivers/pci/pcie/aspm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/pci/pcie/aspm.c +3
-3@@ -434,7 +434,7 @@ static void pcie_get_aspm_reg(struct pci_dev *pdev,static void pcie_aspm_check_latency (struct pci_dev *endpoint) { -u32 latency, l1_switch_latency =0 ; +u32 latency, l1_max_latency =0 , l1_switch_latency =0 ;struct aspm_latency *acceptable;struct pcie_link_state *link;@@ -470,8 +470,9 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)* substate latencies (and hence do not do any check). */ latency =max_t (u32, link->latency_up.l1, link->latency_dw.l1); + l1_max_latency =max_t (u32, latency, l1_max_latency);if ((link->aspm_capable &ASPM_STATE_L1 ) && - (latency + l1_switch_latency > acceptable->l1)) + (l1_max_latency + l1_switch_latency > acceptable->l1)) link->aspm_capable &= ~ASPM_STATE_L1 ; l1_switch_latency +=1000 ; --2.27.0