[kernel/f20] Fix r8169 ethernet after suspend (rhbz 1054408)

Josh Boyer jwboyer at fedoraproject.org
Tue Feb 18 13:47:14 UTC 2014


commit 4443d18dd78c7c74e0d441c1b8a707a996f798a2
Author: Josh Boyer <jwboyer at fedoraproject.org>
Date:   Tue Feb 18 08:43:12 2014 -0500

    Fix r8169 ethernet after suspend (rhbz 1054408)

 ...itialize-per-cpu-data-structures-properly.patch |  138 ++++++++++++++++++++
 kernel.spec                                        |    9 ++
 2 files changed, 147 insertions(+), 0 deletions(-)
---
diff --git a/cpufreq-powernow-k8-Initialize-per-cpu-data-structures-properly.patch b/cpufreq-powernow-k8-Initialize-per-cpu-data-structures-properly.patch
new file mode 100644
index 0000000..70a553d
--- /dev/null
+++ b/cpufreq-powernow-k8-Initialize-per-cpu-data-structures-properly.patch
@@ -0,0 +1,138 @@
+Bugzilla: 1054408
+Upstream-status: Queued for 3.14 and CC'd to stable                                                                                                                                                                                                                                                               
+Delivered-To: jwboyer at gmail.com
+Received: by 10.76.82.162 with SMTP id j2csp112184oay;
+        Mon, 17 Feb 2014 03:01:52 -0800 (PST)
+X-Received: by 10.68.164.4 with SMTP id ym4mr26078759pbb.53.1392634911720;
+        Mon, 17 Feb 2014 03:01:51 -0800 (PST)
+Return-Path: <linux-kernel-owner at vger.kernel.org>
+Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67])
+        by mx.google.com with ESMTP id xf4si14383267pab.191.2014.02.17.03.01.15
+        for <multiple recipients>;
+        Mon, 17 Feb 2014 03:01:51 -0800 (PST)
+Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner at vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67;
+Authentication-Results: mx.google.com;
+       spf=pass (google.com: best guess record for domain of linux-kernel-owner at vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mail=linux-kernel-owner at vger.kernel.org
+Received: (majordomo at vger.kernel.org) by vger.kernel.org via listexpand
+	id S1752151AbaBQKyA (ORCPT <rfc822;gardner.ben.linux at gmail.com>
+	+ 99 others); Mon, 17 Feb 2014 05:54:00 -0500
+Received: from e28smtp06.in.ibm.com ([122.248.162.6]:51044 "EHLO
+	e28smtp06.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+	with ESMTP id S1752134AbaBQKx6 (ORCPT
+	<rfc822;linux-kernel at vger.kernel.org>);
+	Mon, 17 Feb 2014 05:53:58 -0500
+Received: from /spool/local
+	by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted
+	for <linux-kernel at vger.kernel.org> from <srivatsa.bhat at linux.vnet.ibm.com>;
+	Mon, 17 Feb 2014 16:23:53 +0530
+Received: from d28dlp03.in.ibm.com (9.184.220.128)
+	by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted;
+	Mon, 17 Feb 2014 16:23:50 +0530
+Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58])
+	by d28dlp03.in.ibm.com (Postfix) with ESMTP id 80C82125805C;
+	Mon, 17 Feb 2014 16:25:47 +0530 (IST)
+Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65])
+	by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1HArhEA64749632;
+	Mon, 17 Feb 2014 16:23:44 +0530
+Received: from d28av03.in.ibm.com (localhost [127.0.0.1])
+	by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s1HArkHs009945;
+	Mon, 17 Feb 2014 16:23:47 +0530
+Received: from srivatsabhat.in.ibm.com ([9.79.254.57])
+	by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s1HAriQk009844;
+	Mon, 17 Feb 2014 16:23:45 +0530
+From:	"Srivatsa S. Bhat" <srivatsa.bhat at linux.vnet.ibm.com>
+Subject: [PATCH] cpufreq,
+ powernow-k8: Initialize per-cpu data-structures properly
+To:	pierre-list at ossman.eu, rjw at rjwysocki.net
+Cc:	viresh.kumar at linaro.org, linux-pm at vger.kernel.org,
+	linux-kernel at vger.kernel.org,
+	"Srivatsa S. Bhat" <srivatsa.bhat at linux.vnet.ibm.com>
+Date:	Mon, 17 Feb 2014 16:18:21 +0530
+Message-ID: <20140217104821.21147.71463.stgit at srivatsabhat.in.ibm.com>
+User-Agent: StGIT/0.14.3
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 7bit
+X-TM-AS-MML: disable
+X-Content-Scanned: Fidelis XPS MAILER
+x-cbid:	14021710-9574-0000-0000-00000BFDA307
+Sender:	linux-kernel-owner at vger.kernel.org
+Precedence: bulk
+List-ID: <linux-kernel.vger.kernel.org>
+X-Mailing-List:	linux-kernel at vger.kernel.org
+
+The powernow-k8 driver maintains a per-cpu data-structure called powernow_data
+that is used to perform the frequency transitions. It initializes this data-
+structure only for the policy->cpu. So, accesses to this data-structure by
+other CPUs results in various problems because they would have been
+uninitialized.
+
+Specifically, if a cpu (!= policy->cpu) invokes the drivers' ->get() function,
+it returns 0 as the KHz value, since its per-cpu memory doesn't point to
+anything valid. This causes problems during suspend/resume since
+cpufreq_update_policy() tries to enforce this (0 KHz) as the current frequency
+of the CPU, and this madness gets propagated to adjust_jiffies() as well.
+Eventually, lots of things start breaking down, including the r8169 ethernet
+card, in one particularly interesting case reported by Pierre Ossman.
+
+https://bugzilla.kernel.org/show_bug.cgi?id=70311
+
+Fix this by initializing the per-cpu data-structures of _all_ the CPUs
+in the policy appropriately.
+
+Cc: stable at vger.kernel.org
+Reported-by: Pierre Ossman <pierre at ossman.eu>
+Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat at linux.vnet.ibm.com>
+---
+
+ drivers/cpufreq/powernow-k8.c |   10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
+index e10b646..6684e03 100644
+--- a/drivers/cpufreq/powernow-k8.c
++++ b/drivers/cpufreq/powernow-k8.c
+@@ -1076,7 +1076,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
+ {
+ 	struct powernow_k8_data *data;
+ 	struct init_on_cpu init_on_cpu;
+-	int rc;
++	int rc, cpu;
+ 
+ 	smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1);
+ 	if (rc)
+@@ -1140,7 +1140,9 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
+ 	pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n",
+ 		 data->currfid, data->currvid);
+ 
+-	per_cpu(powernow_data, pol->cpu) = data;
++	/* Point all the CPUs in this policy to the same data */
++	for_each_cpu(cpu, pol->cpus)
++		per_cpu(powernow_data, cpu) = data;
+ 
+ 	return 0;
+ 
+@@ -1155,6 +1157,7 @@ err_out:
+ static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
+ {
+ 	struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
++	int cpu;
+ 
+ 	if (!data)
+ 		return -EINVAL;
+@@ -1165,7 +1168,8 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
+ 
+ 	kfree(data->powernow_table);
+ 	kfree(data);
+-	per_cpu(powernow_data, pol->cpu) = NULL;
++	for_each_cpu(cpu, pol->cpus)
++		per_cpu(powernow_data, cpu) = NULL;
+ 
+ 	return 0;
+ }
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
+the body of a message to majordomo at vger.kernel.org
+More majordomo info at  http://vger.kernel.org/majordomo-info.html
+Please read the FAQ at  http://www.tux.org/lkml/
diff --git a/kernel.spec b/kernel.spec
index 9bb79ce..df5af05 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -767,6 +767,9 @@ Patch25198: pinctrl-protect-pinctrl_list-add.patch
 Patch25200: cifs-ensure-that-uncached-writes-handle-unmapped-areas-correctly.patch
 Patch25201: cifs-sanity-check-length-of-data-to-send-before-sending.patch
 
+#rhbz 1054408
+Patch25203: cpufreq-powernow-k8-Initialize-per-cpu-data-structures-properly.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1490,6 +1493,9 @@ ApplyPatch pinctrl-protect-pinctrl_list-add.patch
 ApplyPatch cifs-ensure-that-uncached-writes-handle-unmapped-areas-correctly.patch
 ApplyPatch cifs-sanity-check-length-of-data-to-send-before-sending.patch
 
+#rhbz 1054408
+ApplyPatch cpufreq-powernow-k8-Initialize-per-cpu-data-structures-properly.patch
+
 
 # END OF PATCH APPLICATIONS
 
@@ -2302,6 +2308,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Tue Feb 18 2014 Josh Boyer <jwboyer at fedoraproject.org>
+- Fix r8169 ethernet after suspend (rhbz 1054408)
+
 * Fri Feb 14 2014 Josh Boyer <jwboyer at fedoraproject.org> - 3.13.3-201
 - CVE-2014-0069 cifs: incorrect handling of bogus user pointers (rhbz 1064253 1062584)
 


More information about the scm-commits mailing list