diff mbox series

[3/3] e1000e: Disable jumbo receive workaround on Lynx Point and newer

Message ID 20171107221332.28283-3-mattst88@gmail.com
State Rejected
Headers show
Series [1/3] e1000e: Set HTHRESH when PTHRESH is used | expand

Commit Message

Matt Turner Nov. 7, 2017, 10:13 p.m. UTC
From: Matt Turner <matt.turner@intel.com>

Commit 3e35d9918cbb ("e1000e: adjust PM QoS request") expanded the
application of what is evidently a hardware workaround to apply to all
e1000e devices. Prior to the commit, it applied only to e1000_pch2lan
(Sandy Bridge era) and the commit message notes that other earlier parts
such as ICH9 and ICH10 suffer from the problem as well.

The workaround works by preventing the CPU from entering deep sleep
states, which increases energy consumption significantly. My Skylake
CPU reaches the C10 state the PC8 package state with the MTU for its
I219-LM set to 1500. At an MTU of 9000, it can only reach the C1E state
and no low power package state at all. With this patch, the CPU again
reaches the C10 state and (only) the PC2 package state. Not ideal, but an
improvement nonetheless.

Signed-off-by: Matt Turner <matt.turner@intel.com>
---
This patch is speculative -- I'm an Intel employee (not in the networking
division), but I have no idea where to find documentation about the hardware
bug in question. I'm hoping that someone more in the know can check if the
hardware was fixed in subsequent generations and this workaround can be
disabled. I have chosen the pch2 cut off only because nothing further is
mentioned about the bug in git history.

 drivers/net/ethernet/intel/e1000e/netdev.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Comments

Sasha Neftin Nov. 9, 2017, 8:19 a.m. UTC | #1
On 11/8/2017 00:13, Matt Turner wrote:
> From: Matt Turner <matt.turner@intel.com>
>
> Commit 3e35d9918cbb ("e1000e: adjust PM QoS request") expanded the
> application of what is evidently a hardware workaround to apply to all
> e1000e devices. Prior to the commit, it applied only to e1000_pch2lan
> (Sandy Bridge era) and the commit message notes that other earlier parts
> such as ICH9 and ICH10 suffer from the problem as well.
>
> The workaround works by preventing the CPU from entering deep sleep
> states, which increases energy consumption significantly. My Skylake
> CPU reaches the C10 state the PC8 package state with the MTU for its
> I219-LM set to 1500. At an MTU of 9000, it can only reach the C1E state
> and no low power package state at all. With this patch, the CPU again
> reaches the C10 state and (only) the PC2 package state. Not ideal, but an
> improvement nonetheless.
>
> Signed-off-by: Matt Turner <matt.turner@intel.com>
> ---
> This patch is speculative -- I'm an Intel employee (not in the networking
> division), but I have no idea where to find documentation about the hardware
> bug in question. I'm hoping that someone more in the know can check if the
> hardware was fixed in subsequent generations and this workaround can be
> disabled. I have chosen the pch2 cut off only because nothing further is
> mentioned about the bug in git history.
>
>   drivers/net/ethernet/intel/e1000e/netdev.c | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 4dcff481c4b4..553f8bd45eea 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -3277,7 +3277,8 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
>   	/* With jumbo frames, excessive C-state transition latencies result
>   	 * in dropped transactions.
>   	 */
> -	if (adapter->netdev->mtu > ETH_DATA_LEN) {
> +	if (adapter->hw.mac.type <= e1000_pch2lan &&
> +	    adapter->netdev->mtu > ETH_DATA_LEN) {
>   		u32 lat =
>   		    ((er32(PBA) & E1000_PBA_RXA_MASK) * 1024 -
>   		     adapter->max_frame_size) * 8 / 1000;
> @@ -3292,9 +3293,6 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
>   			 "Some CPU C-states have been disabled in order to "
>   			 "enable jumbo frames\n");
>   		pm_qos_update_request(&adapter->pm_qos_req, lat);
> -	} else {
> -		pm_qos_update_request(&adapter->pm_qos_req,
> -				      PM_QOS_DEFAULT_VALUE);
>   	}
>   
>   	/* Enable Receives */
> @@ -4625,8 +4623,9 @@ int e1000e_open(struct net_device *netdev)
>   		e1000_update_mng_vlan(adapter);
>   
>   	/* DMA latency requirement to workaround jumbo issue */
> -	pm_qos_add_request(&adapter->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
> -			   PM_QOS_DEFAULT_VALUE);
> +	if (adapter->hw.mac.type <= e1000_pch2lan)
> +		pm_qos_add_request(&adapter->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
> +				   PM_QOS_DEFAULT_VALUE);
>   
>   	/* before we allocate an interrupt, we must be ready to handle it.
>   	 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
> @@ -4669,7 +4668,8 @@ int e1000e_open(struct net_device *netdev)
>   	return 0;
>   
>   err_req_irq:
> -	pm_qos_remove_request(&adapter->pm_qos_req);
> +	if (adapter->hw.mac.type <= e1000_pch2lan)
> +		pm_qos_remove_request(&adapter->pm_qos_req);
>   	e1000e_release_hw_control(adapter);
>   	e1000_power_down_phy(adapter);
>   	e1000e_free_rx_resources(adapter->rx_ring);
> @@ -4733,7 +4733,8 @@ int e1000e_close(struct net_device *netdev)
>   	    !test_bit(__E1000_TESTING, &adapter->state))
>   		e1000e_release_hw_control(adapter);
>   
> -	pm_qos_remove_request(&adapter->pm_qos_req);
> +	if (adapter->hw.mac.type <= e1000_pch2lan)
> +		pm_qos_remove_request(&adapter->pm_qos_req);
>   
>   	pm_runtime_put_sync(&pdev->dev);
>   

This patch should be rejected. The original patch 3e35d9918cbb ("e1000e: 
adjust PM QoS request") is from 2013, before Lynx Point and later 
devices were introduced. However, nothing was changed in this regard in 
the later devices and same limitation still apply. Enabling deep CPU Cx 
states with jumbo frame can lead to packet loss, which is worse than 
extra power consumption. Therefore we suggest to reject this patch. Note 
that on modern systems, the effect of jumbo frames on performance is 
negligible, as near-wire speed can be reached with standard MTU size.
Matt Turner Nov. 9, 2017, 9:40 p.m. UTC | #2
On Thu, Nov 9, 2017 at 12:19 AM, Neftin, Sasha <sasha.neftin@intel.com> wrote:
> This patch should be rejected. The original patch 3e35d9918cbb ("e1000e:
> adjust PM QoS request") is from 2013, before Lynx Point and later devices
> were introduced. However, nothing was changed in this regard in the later
> devices and same limitation still apply.

Dang, that's unfortunate. Thanks for checking.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 4dcff481c4b4..553f8bd45eea 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3277,7 +3277,8 @@  static void e1000_configure_rx(struct e1000_adapter *adapter)
 	/* With jumbo frames, excessive C-state transition latencies result
 	 * in dropped transactions.
 	 */
-	if (adapter->netdev->mtu > ETH_DATA_LEN) {
+	if (adapter->hw.mac.type <= e1000_pch2lan &&
+	    adapter->netdev->mtu > ETH_DATA_LEN) {
 		u32 lat =
 		    ((er32(PBA) & E1000_PBA_RXA_MASK) * 1024 -
 		     adapter->max_frame_size) * 8 / 1000;
@@ -3292,9 +3293,6 @@  static void e1000_configure_rx(struct e1000_adapter *adapter)
 			 "Some CPU C-states have been disabled in order to "
 			 "enable jumbo frames\n");
 		pm_qos_update_request(&adapter->pm_qos_req, lat);
-	} else {
-		pm_qos_update_request(&adapter->pm_qos_req,
-				      PM_QOS_DEFAULT_VALUE);
 	}
 
 	/* Enable Receives */
@@ -4625,8 +4623,9 @@  int e1000e_open(struct net_device *netdev)
 		e1000_update_mng_vlan(adapter);
 
 	/* DMA latency requirement to workaround jumbo issue */
-	pm_qos_add_request(&adapter->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
-			   PM_QOS_DEFAULT_VALUE);
+	if (adapter->hw.mac.type <= e1000_pch2lan)
+		pm_qos_add_request(&adapter->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
+				   PM_QOS_DEFAULT_VALUE);
 
 	/* before we allocate an interrupt, we must be ready to handle it.
 	 * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
@@ -4669,7 +4668,8 @@  int e1000e_open(struct net_device *netdev)
 	return 0;
 
 err_req_irq:
-	pm_qos_remove_request(&adapter->pm_qos_req);
+	if (adapter->hw.mac.type <= e1000_pch2lan)
+		pm_qos_remove_request(&adapter->pm_qos_req);
 	e1000e_release_hw_control(adapter);
 	e1000_power_down_phy(adapter);
 	e1000e_free_rx_resources(adapter->rx_ring);
@@ -4733,7 +4733,8 @@  int e1000e_close(struct net_device *netdev)
 	    !test_bit(__E1000_TESTING, &adapter->state))
 		e1000e_release_hw_control(adapter);
 
-	pm_qos_remove_request(&adapter->pm_qos_req);
+	if (adapter->hw.mac.type <= e1000_pch2lan)
+		pm_qos_remove_request(&adapter->pm_qos_req);
 
 	pm_runtime_put_sync(&pdev->dev);