From f2833dd8a10aa8a3f3803b86888f79311d06129f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 14 Feb 2013 11:30:50 -0800 Subject: [PATCH] 3.7-stable patches added patches: drivers-rtc-rtc-pl031.c-restore-st-variant-functionality.patch mm-don-t-overwrite-mm-def_flags-in-do_mlockall.patch s390-timer-avoid-overflow-when-programming-clock-comparator.patch --- ...1.c-restore-st-variant-functionality.patch | 43 ++++++++++++++++ ...verwrite-mm-def_flags-in-do_mlockall.patch | 49 +++++++++++++++++++ ...ow-when-programming-clock-comparator.patch | 47 ++++++++++++++++++ queue-3.7/series | 3 ++ 4 files changed, 142 insertions(+) create mode 100644 queue-3.7/drivers-rtc-rtc-pl031.c-restore-st-variant-functionality.patch create mode 100644 queue-3.7/mm-don-t-overwrite-mm-def_flags-in-do_mlockall.patch create mode 100644 queue-3.7/s390-timer-avoid-overflow-when-programming-clock-comparator.patch diff --git a/queue-3.7/drivers-rtc-rtc-pl031.c-restore-st-variant-functionality.patch b/queue-3.7/drivers-rtc-rtc-pl031.c-restore-st-variant-functionality.patch new file mode 100644 index 00000000000..05af3d6cf44 --- /dev/null +++ b/queue-3.7/drivers-rtc-rtc-pl031.c-restore-st-variant-functionality.patch @@ -0,0 +1,43 @@ +From 3399cfb5df9594495b876d1843a7165f77366b2b Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Tue, 12 Feb 2013 13:46:19 -0800 +Subject: drivers/rtc/rtc-pl031.c: restore ST variant functionality + +From: Linus Walleij + +commit 3399cfb5df9594495b876d1843a7165f77366b2b upstream. + +Commit e7e034e18a0a ("drivers/rtc/rtc-pl031.c: fix the missing operation +on enable") accidentally broke the ST variants of PL031. + +The bit that is being poked as "clockwatch" enable bit for the ST +variants does the work of bit 0 on this variant. Bit 0 is used for a +clock divider on the ST variants, and setting it to 1 will affect +timekeeping in a very bad way. + +Signed-off-by: Linus Walleij +Acked-by: Haojian Zhuang +Cc: Mian Yousaf KAUKAB +Cc: Srinidhi Kasagar +Cc: Alessandro Zummo +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-pl031.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/rtc/rtc-pl031.c ++++ b/drivers/rtc/rtc-pl031.c +@@ -350,7 +350,9 @@ static int pl031_probe(struct amba_devic + /* Enable the clockwatch on ST Variants */ + if (vendor->clockwatch) + data |= RTC_CR_CWEN; +- writel(data | RTC_CR_EN, ldata->base + RTC_CR); ++ else ++ data |= RTC_CR_EN; ++ writel(data, ldata->base + RTC_CR); + + /* + * On ST PL031 variants, the RTC reset value does not provide correct diff --git a/queue-3.7/mm-don-t-overwrite-mm-def_flags-in-do_mlockall.patch b/queue-3.7/mm-don-t-overwrite-mm-def_flags-in-do_mlockall.patch new file mode 100644 index 00000000000..b14023add67 --- /dev/null +++ b/queue-3.7/mm-don-t-overwrite-mm-def_flags-in-do_mlockall.patch @@ -0,0 +1,49 @@ +From 9977f0f164d46613288e0b5778eae500dfe06f31 Mon Sep 17 00:00:00 2001 +From: Gerald Schaefer +Date: Tue, 12 Feb 2013 13:46:20 -0800 +Subject: mm: don't overwrite mm->def_flags in do_mlockall() + +From: Gerald Schaefer + +commit 9977f0f164d46613288e0b5778eae500dfe06f31 upstream. + +With commit 8e72033f2a48 ("thp: make MADV_HUGEPAGE check for +mm->def_flags") the VM_NOHUGEPAGE flag may be set on s390 in +mm->def_flags for certain processes, to prevent future thp mappings. +This would be overwritten by do_mlockall(), which sets it back to 0 with +an optional VM_LOCKED flag set. + +To fix this, instead of overwriting mm->def_flags in do_mlockall(), only +the VM_LOCKED flag should be set or cleared. + +Signed-off-by: Gerald Schaefer +Reported-by: Vivek Goyal +Cc: Andrea Arcangeli +Cc: Hugh Dickins +Cc: Martin Schwidefsky +Cc: Heiko Carstens +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/mlock.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/mm/mlock.c ++++ b/mm/mlock.c +@@ -517,11 +517,11 @@ SYSCALL_DEFINE2(munlock, unsigned long, + static int do_mlockall(int flags) + { + struct vm_area_struct * vma, * prev = NULL; +- unsigned int def_flags = 0; + + if (flags & MCL_FUTURE) +- def_flags = VM_LOCKED; +- current->mm->def_flags = def_flags; ++ current->mm->def_flags |= VM_LOCKED; ++ else ++ current->mm->def_flags &= ~VM_LOCKED; + if (flags == MCL_FUTURE) + goto out; + diff --git a/queue-3.7/s390-timer-avoid-overflow-when-programming-clock-comparator.patch b/queue-3.7/s390-timer-avoid-overflow-when-programming-clock-comparator.patch new file mode 100644 index 00000000000..d8ec787c907 --- /dev/null +++ b/queue-3.7/s390-timer-avoid-overflow-when-programming-clock-comparator.patch @@ -0,0 +1,47 @@ +From d911e03d097bdc01363df5d81c43f69432eb785c Mon Sep 17 00:00:00 2001 +From: Heiko Carstens +Date: Tue, 29 Jan 2013 09:16:28 +0100 +Subject: s390/timer: avoid overflow when programming clock comparator + +From: Heiko Carstens + +commit d911e03d097bdc01363df5d81c43f69432eb785c upstream. + +Since ed4f209 "s390/time: fix sched_clock() overflow" a new helper function +is used to avoid overflows when converting TOD format values to nanosecond +values. +The kvm interrupt code formerly however only worked by accident because of +an overflow. It tried to program a timer that would expire in more than ~29 +years. Because of the old TOD-to-nanoseconds overflow bug the real expiry +value however was much smaller, but now it isn't anymore. +This however triggers yet another bug in the function that programs the clock +comparator s390_next_ktime(): if the absolute "expires" value is after 2042 +this will result in an overflow and the programmed value is lower than the +current TOD value which immediatly triggers a clock comparator (= timer) +interrupt. +Since the timer isn't expired it will be programmed immediately again and so +on... the result is a dead system. +To fix this simply program the maximum possible value if an overflow is +detected. + +Reported-by: Christian Borntraeger +Tested-by: Christian Borntraeger +Signed-off-by: Heiko Carstens +Signed-off-by: Greg Kroah-Hartman + +--- + arch/s390/kernel/time.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/s390/kernel/time.c ++++ b/arch/s390/kernel/time.c +@@ -120,6 +120,9 @@ static int s390_next_ktime(ktime_t expir + nsecs = ktime_to_ns(ktime_add(timespec_to_ktime(ts), expires)); + do_div(nsecs, 125); + S390_lowcore.clock_comparator = sched_clock_base_cc + (nsecs << 9); ++ /* Program the maximum value if we have an overflow (== year 2042) */ ++ if (unlikely(S390_lowcore.clock_comparator < sched_clock_base_cc)) ++ S390_lowcore.clock_comparator = -1ULL; + set_clock_comparator(S390_lowcore.clock_comparator); + return 0; + } diff --git a/queue-3.7/series b/queue-3.7/series index 30c95980272..e92cf35bb3e 100644 --- a/queue-3.7/series +++ b/queue-3.7/series @@ -1 +1,4 @@ revert-xfs-fix-_xfs_buf_find-oops-on-blocks-beyond-the-filesystem-end.patch +drivers-rtc-rtc-pl031.c-restore-st-variant-functionality.patch +mm-don-t-overwrite-mm-def_flags-in-do_mlockall.patch +s390-timer-avoid-overflow-when-programming-clock-comparator.patch -- 2.47.3