From: Greg Kroah-Hartman Date: Tue, 18 Feb 2020 08:09:18 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.19.105~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=89009fce58ff57a6ee644eea8b01768c2b9d24ed;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: hwmon-pmbus-ltc2978-fix-pmbus-polling-of-mfr_common-definitions.patch perf-x86-intel-fix-inaccurate-period-in-context-switch-for-auto-reload.patch s390-time-fix-clk-type-in-get_tod_clock.patch --- diff --git a/queue-4.9/hwmon-pmbus-ltc2978-fix-pmbus-polling-of-mfr_common-definitions.patch b/queue-4.9/hwmon-pmbus-ltc2978-fix-pmbus-polling-of-mfr_common-definitions.patch new file mode 100644 index 00000000000..6aa9bf38e0b --- /dev/null +++ b/queue-4.9/hwmon-pmbus-ltc2978-fix-pmbus-polling-of-mfr_common-definitions.patch @@ -0,0 +1,40 @@ +From cf2b012c90e74e85d8aea7d67e48868069cfee0c Mon Sep 17 00:00:00 2001 +From: Mike Jones +Date: Tue, 28 Jan 2020 10:59:59 -0700 +Subject: hwmon: (pmbus/ltc2978) Fix PMBus polling of MFR_COMMON definitions. + +From: Mike Jones + +commit cf2b012c90e74e85d8aea7d67e48868069cfee0c upstream. + +Change 21537dc driver PMBus polling of MFR_COMMON from bits 5/4 to +bits 6/5. This fixs a LTC297X family bug where polling always returns +not busy even when the part is busy. This fixes a LTC388X and +LTM467X bug where polling used PEND and NOT_IN_TRANS, and BUSY was +not polled, which can lead to NACKing of commands. LTC388X and +LTM467X modules now poll BUSY and PEND, increasing reliability by +eliminating NACKing of commands. + +Signed-off-by: Mike Jones +Link: https://lore.kernel.org/r/1580234400-2829-2-git-send-email-michael-a1.jones@analog.com +Fixes: e04d1ce9bbb49 ("hwmon: (ltc2978) Add polling for chips requiring it") +Signed-off-by: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwmon/pmbus/ltc2978.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/hwmon/pmbus/ltc2978.c ++++ b/drivers/hwmon/pmbus/ltc2978.c +@@ -89,8 +89,8 @@ enum chips { ltc2974, ltc2975, ltc2977, + + #define LTC_POLL_TIMEOUT 100 /* in milli-seconds */ + +-#define LTC_NOT_BUSY BIT(5) +-#define LTC_NOT_PENDING BIT(4) ++#define LTC_NOT_BUSY BIT(6) ++#define LTC_NOT_PENDING BIT(5) + + /* + * LTC2978 clears peak data whenever the CLEAR_FAULTS command is executed, which diff --git a/queue-4.9/perf-x86-intel-fix-inaccurate-period-in-context-switch-for-auto-reload.patch b/queue-4.9/perf-x86-intel-fix-inaccurate-period-in-context-switch-for-auto-reload.patch new file mode 100644 index 00000000000..d986e13ed5b --- /dev/null +++ b/queue-4.9/perf-x86-intel-fix-inaccurate-period-in-context-switch-for-auto-reload.patch @@ -0,0 +1,87 @@ +From f861854e1b435b27197417f6f90d87188003cb24 Mon Sep 17 00:00:00 2001 +From: Kan Liang +Date: Tue, 21 Jan 2020 11:01:25 -0800 +Subject: perf/x86/intel: Fix inaccurate period in context switch for auto-reload + +From: Kan Liang + +commit f861854e1b435b27197417f6f90d87188003cb24 upstream. + +Perf doesn't take the left period into account when auto-reload is +enabled with fixed period sampling mode in context switch. + +Here is the MSR trace of the perf command as below. +(The MSR trace is simplified from a ftrace log.) + + #perf record -e cycles:p -c 2000000 -- ./triad_loop + + //The MSR trace of task schedule out + //perf disable all counters, disable PEBS, disable GP counter 0, + //read GP counter 0, and re-enable all counters. + //The counter 0 stops at 0xfffffff82840 + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value 0 + write_msr: MSR_IA32_PEBS_ENABLE(3f1), value 0 + write_msr: MSR_P6_EVNTSEL0(186), value 40003003c + rdpmc: 0, value fffffff82840 + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value f000000ff + + //The MSR trace of the same task schedule in again + //perf disable all counters, enable and set GP counter 0, + //enable PEBS, and re-enable all counters. + //0xffffffe17b80 (-2000000) is written to GP counter 0. + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value 0 + write_msr: MSR_IA32_PMC0(4c1), value ffffffe17b80 + write_msr: MSR_P6_EVNTSEL0(186), value 40043003c + write_msr: MSR_IA32_PEBS_ENABLE(3f1), value 1 + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value f000000ff + +When the same task schedule in again, the counter should starts from +previous left. However, it starts from the fixed period -2000000 again. + +A special variant of intel_pmu_save_and_restart() is used for +auto-reload, which doesn't update the hwc->period_left. +When the monitored task schedules in again, perf doesn't know the left +period. The fixed period is used, which is inaccurate. + +With auto-reload, the counter always has a negative counter value. So +the left period is -value. Update the period_left in +intel_pmu_save_and_restart_reload(). + +With the patch: + + //The MSR trace of task schedule out + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value 0 + write_msr: MSR_IA32_PEBS_ENABLE(3f1), value 0 + write_msr: MSR_P6_EVNTSEL0(186), value 40003003c + rdpmc: 0, value ffffffe25cbc + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value f000000ff + + //The MSR trace of the same task schedule in again + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value 0 + write_msr: MSR_IA32_PMC0(4c1), value ffffffe25cbc + write_msr: MSR_P6_EVNTSEL0(186), value 40043003c + write_msr: MSR_IA32_PEBS_ENABLE(3f1), value 1 + write_msr: MSR_CORE_PERF_GLOBAL_CTRL(38f), value f000000ff + +Fixes: d31fc13fdcb2 ("perf/x86/intel: Fix event update for auto-reload") +Signed-off-by: Kan Liang +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Link: https://lkml.kernel.org/r/20200121190125.3389-1-kan.liang@linux.intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/events/intel/ds.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/x86/events/intel/ds.c ++++ b/arch/x86/events/intel/ds.c +@@ -1326,6 +1326,8 @@ intel_pmu_save_and_restart_reload(struct + old = ((s64)(prev_raw_count << shift) >> shift); + local64_add(new - old + count * period, &event->count); + ++ local64_set(&hwc->period_left, -new); ++ + perf_event_update_userpage(event); + + return 0; diff --git a/queue-4.9/s390-time-fix-clk-type-in-get_tod_clock.patch b/queue-4.9/s390-time-fix-clk-type-in-get_tod_clock.patch new file mode 100644 index 00000000000..7ac88a80d7b --- /dev/null +++ b/queue-4.9/s390-time-fix-clk-type-in-get_tod_clock.patch @@ -0,0 +1,54 @@ +From 0f8a206df7c920150d2aa45574fba0ab7ff6be4f Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Sat, 8 Feb 2020 07:08:59 -0700 +Subject: s390/time: Fix clk type in get_tod_clock + +From: Nathan Chancellor + +commit 0f8a206df7c920150d2aa45574fba0ab7ff6be4f upstream. + +Clang warns: + +In file included from ../arch/s390/boot/startup.c:3: +In file included from ../include/linux/elf.h:5: +In file included from ../arch/s390/include/asm/elf.h:132: +In file included from ../include/linux/compat.h:10: +In file included from ../include/linux/time.h:74: +In file included from ../include/linux/time32.h:13: +In file included from ../include/linux/timex.h:65: +../arch/s390/include/asm/timex.h:160:20: warning: passing 'unsigned char +[16]' to parameter of type 'char *' converts between pointers to integer +types with different sign [-Wpointer-sign] + get_tod_clock_ext(clk); + ^~~ +../arch/s390/include/asm/timex.h:149:44: note: passing argument to +parameter 'clk' here +static inline void get_tod_clock_ext(char *clk) + ^ + +Change clk's type to just be char so that it matches what happens in +get_tod_clock_ext. + +Fixes: 57b28f66316d ("[S390] s390_hypfs: Add new attributes") +Link: https://github.com/ClangBuiltLinux/linux/issues/861 +Link: http://lkml.kernel.org/r/20200208140858.47970-1-natechancellor@gmail.com +Reviewed-by: Nick Desaulniers +Signed-off-by: Nathan Chancellor +Signed-off-by: Vasily Gorbik +Signed-off-by: Greg Kroah-Hartman + +--- + arch/s390/include/asm/timex.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/s390/include/asm/timex.h ++++ b/arch/s390/include/asm/timex.h +@@ -146,7 +146,7 @@ static inline void get_tod_clock_ext(cha + + static inline unsigned long long get_tod_clock(void) + { +- unsigned char clk[STORE_CLOCK_EXT_SIZE]; ++ char clk[STORE_CLOCK_EXT_SIZE]; + + get_tod_clock_ext(clk); + return *((unsigned long long *)&clk[1]); diff --git a/queue-4.9/series b/queue-4.9/series index 8c5e296d7e2..c01cdc89a9e 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -6,3 +6,6 @@ btrfs-fix-race-between-using-extent-maps-and-merging-them.patch btrfs-log-message-when-rw-remount-is-attempted-with-unclean-tree-log.patch perf-x86-amd-add-missing-l2-misses-event-spec-to-amd-family-17h-s-event-map.patch padata-remove-broken-queue-flushing.patch +s390-time-fix-clk-type-in-get_tod_clock.patch +perf-x86-intel-fix-inaccurate-period-in-context-switch-for-auto-reload.patch +hwmon-pmbus-ltc2978-fix-pmbus-polling-of-mfr_common-definitions.patch