[linux] 01/01: e1000e: Fix tight loop implementation of systime read algorithm

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Tue Sep 22 18:34:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository linux.

commit 30da8b4d4f4c919f0e3ac931f2678d5a53955b61
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Tue Sep 22 20:33:59 2015 +0200

    e1000e: Fix tight loop implementation of systime read algorithm
---
 debian/changelog                                   |  1 +
 ...tight-loop-implementation-of-systime-read.patch | 61 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 63 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index eb152ad..b20696c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,7 @@ linux (4.2.1-1) UNRELEASED; urgency=medium
   * RDS: verify the underlying transport exists before creating a connection
     (CVE-2015-6937)
   * Set ABI to 1
+  * e1000e: Fix tight loop implementation of systime read algorithm
 
   [ Aurelien Jarno ]
   * [mips*el] Fix BPF assembly code for pre-R2 CPUs. (fixes FTBFS)
diff --git a/debian/patches/bugfix/all/e1000e-fix-tight-loop-implementation-of-systime-read.patch b/debian/patches/bugfix/all/e1000e-fix-tight-loop-implementation-of-systime-read.patch
new file mode 100644
index 0000000..12f6aa2
--- /dev/null
+++ b/debian/patches/bugfix/all/e1000e-fix-tight-loop-implementation-of-systime-read.patch
@@ -0,0 +1,61 @@
+From: Raanan Avargil <raanan.avargil at intel.com>
+Date: Sun, 19 Jul 2015 16:33:20 +0300
+Subject: e1000e: Fix tight loop implementation of systime read algorithm
+Origin: https://git.kernel.org/linus/37b12910dd11d9ab969f2c310dc9160b7f3e3405
+
+Change the algorithm. Read systimel twice and check for overflow.
+If there was no overflow, use the first value.
+If there was an overflow, read systimeh again and use the second
+systimel value.
+
+Signed-off-by: Raanan Avargil <raanan.avargil at intel.com>
+Tested-by: Aaron Brown <aaron.f.brown at intel.com>
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher at intel.com>
+---
+ drivers/net/ethernet/intel/e1000e/netdev.c | 31 ++++++++++++++++++++----------
+ 1 file changed, 21 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
+index 24b7269..96a8166 100644
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c
+@@ -4280,18 +4280,29 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
+ 	struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
+ 						     cc);
+ 	struct e1000_hw *hw = &adapter->hw;
++	u32 systimel_1, systimel_2, systimeh;
+ 	cycle_t systim, systim_next;
+-	/* SYSTIMH latching upon SYSTIML read does not work well. To fix that
+-	 * we don't want to allow overflow of SYSTIML and a change to SYSTIMH
+-	 * to occur between reads, so if we read a vale close to overflow, we
+-	 * wait for overflow to occur and read both registers when its safe.
++	/* SYSTIMH latching upon SYSTIML read does not work well.
++	 * This means that if SYSTIML overflows after we read it but before
++	 * we read SYSTIMH, the value of SYSTIMH has been incremented and we
++	 * will experience a huge non linear increment in the systime value
++	 * to fix that we test for overflow and if true, we re-read systime.
+ 	 */
+-	u32 systim_overflow_latch_fix = 0x3FFFFFFF;
+-
+-	do {
+-		systim = (cycle_t)er32(SYSTIML);
+-	} while (systim > systim_overflow_latch_fix);
+-	systim |= (cycle_t)er32(SYSTIMH) << 32;
++	systimel_1 = er32(SYSTIML);
++	systimeh = er32(SYSTIMH);
++	systimel_2 = er32(SYSTIML);
++	/* Check for overflow. If there was no overflow, use the values */
++	if (systimel_1 < systimel_2) {
++		systim = (cycle_t)systimel_1;
++		systim |= (cycle_t)systimeh << 32;
++	} else {
++		/* There was an overflow, read again SYSTIMH, and use
++		 * systimel_2
++		 */
++		systimeh = er32(SYSTIMH);
++		systim = (cycle_t)systimel_2;
++		systim |= (cycle_t)systimeh << 32;
++	}
+ 
+ 	if ((hw->mac.type == e1000_82574) || (hw->mac.type == e1000_82583)) {
+ 		u64 incvalue, time_delta, rem, temp;
diff --git a/debian/patches/series b/debian/patches/series
index 0249b65..7bb0ee7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -95,3 +95,4 @@ bugfix/all/dcache-handle-escaped-paths-in-prepend_path.patch
 bugfix/all/dcache-reduce-the-scope-of-i_lock-in-d_splice_alias.patch
 bugfix/all/vfs-test-for-and-handle-paths-that-are-unreachable-f.patch
 bugfix/all/rds-verify-the-underlying-transport-exists-before-cr.patch
+bugfix/all/e1000e-fix-tight-loop-implementation-of-systime-read.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list