summaryrefslogtreecommitdiffstats
path: root/x86-range-make-add_range-use-blank-slot.patch
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@redhat.com>2013-06-11 14:51:35 -0400
committerJosh Boyer <jwboyer@redhat.com>2013-06-11 15:01:42 -0400
commitd08f67e2b7e48a4065b37bc9b1e3bf7a5a056d55 (patch)
treef4da828b2bd9e1814065570d6e0e38a1f4795189 /x86-range-make-add_range-use-blank-slot.patch
parent52b765c50c997f321eb98b1242520f285770a370 (diff)
downloadkernel-d08f67e2b7e48a4065b37bc9b1e3bf7a5a056d55.tar.gz
kernel-d08f67e2b7e48a4065b37bc9b1e3bf7a5a056d55.tar.xz
kernel-d08f67e2b7e48a4065b37bc9b1e3bf7a5a056d55.zip
Add patches to fix MTRR issues (rhbz 973185)
Diffstat (limited to 'x86-range-make-add_range-use-blank-slot.patch')
-rw-r--r--x86-range-make-add_range-use-blank-slot.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/x86-range-make-add_range-use-blank-slot.patch b/x86-range-make-add_range-use-blank-slot.patch
new file mode 100644
index 000000000..50d393794
--- /dev/null
+++ b/x86-range-make-add_range-use-blank-slot.patch
@@ -0,0 +1,80 @@
+Now add_range_with_merge will generate blank slot as subtract_range.
+we could reach the array limit because of blank slots.
+
+We can let add_range to have second try to use blank slot.
+
+Also use WARN_ONCE to print trace.
+
+Reported-by: Joshua Covington <joshuacov@googlemail.com>
+Signed-off-by: Yinghai Lu <yinghai@kernel.org>
+Cc: <stable@vger.kernel.org> v3.9
+---
+ kernel/range.c | 34 ++++++++++++++++++++++------------
+ 1 file changed, 22 insertions(+), 12 deletions(-)
+
+Index: linux-2.6/kernel/range.c
+===================================================================
+--- linux-2.6.orig/kernel/range.c
++++ linux-2.6/kernel/range.c
+@@ -3,23 +3,34 @@
+ */
+ #include <linux/kernel.h>
+ #include <linux/init.h>
++#include <linux/bug.h>
+ #include <linux/sort.h>
+-
+ #include <linux/range.h>
+
+ int add_range(struct range *range, int az, int nr_range, u64 start, u64 end)
+ {
+- if (start >= end)
+- return nr_range;
++ int i;
+
+- /* Out of slots: */
+- if (nr_range >= az)
++ if (start >= end)
+ return nr_range;
+
+- range[nr_range].start = start;
+- range[nr_range].end = end;
++ /* Out of slots ? */
++ if (nr_range < az) {
++ i = nr_range;
++ nr_range++;
++ } else {
++ /* find blank slot */
++ for (i = 0; i < az; i++)
++ if (!range[i].end)
++ break;
++ if (i == az) {
++ WARN_ONCE(1, "run out of slot in ranges\n");
++ return az;
++ }
++ }
+
+- nr_range++;
++ range[i].start = start;
++ range[i].end = end;
+
+ return nr_range;
+ }
+@@ -98,10 +109,9 @@ void subtract_range(struct range *range,
+ if (i < az) {
+ range[i].end = range[j].end;
+ range[i].start = end;
+- } else {
+- pr_err("%s: run out of slot in ranges\n",
+- __func__);
+- }
++ } else
++ WARN_ONCE(1, "run out of slot in ranges\n");
++
+ range[j].end = start;
+ continue;
+ }
+--
+To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
+the body of a message to majordomo@vger.kernel.org
+More majordomo info at http://vger.kernel.org/majordomo-info.html
+Please read the FAQ at http://www.tux.org/lkml/ \ No newline at end of file