From: Greg Kroah-Hartman Date: Mon, 7 Oct 2024 10:08:46 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v6.6.55~112 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=685c2a21aad8d04c64696dcd88272631a1d97ec7;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: alsa-core-add-isascii-check-to-card-id-generator.patch alsa-line6-add-hw-monitor-volume-control-to-pod-hd500x.patch parisc-fix-itlb-miss-handler-for-64-bit-programs.patch perf-core-fix-small-negative-period-being-ignored.patch --- diff --git a/queue-4.19/alsa-core-add-isascii-check-to-card-id-generator.patch b/queue-4.19/alsa-core-add-isascii-check-to-card-id-generator.patch new file mode 100644 index 00000000000..23a9069a4e6 --- /dev/null +++ b/queue-4.19/alsa-core-add-isascii-check-to-card-id-generator.patch @@ -0,0 +1,74 @@ +From d278a9de5e1837edbe57b2f1f95a104ff6c84846 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 2 Oct 2024 21:46:49 +0200 +Subject: ALSA: core: add isascii() check to card ID generator +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jaroslav Kysela + +commit d278a9de5e1837edbe57b2f1f95a104ff6c84846 upstream. + +The card identifier should contain only safe ASCII characters. The isalnum() +returns true also for characters for non-ASCII characters. + +Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4135 +Link: https://lore.kernel.org/linux-sound/yk3WTvKkwheOon_LzZlJ43PPInz6byYfBzpKkbasww1yzuiMRqn7n6Y8vZcXB-xwFCu_vb8hoNjv7DTNwH5TWjpEuiVsyn9HPCEXqwF4120=@protonmail.com/ +Cc: stable@vger.kernel.org +Reported-by: Barnabás Pőcze +Signed-off-by: Jaroslav Kysela +Link: https://patch.msgid.link/20241002194649.1944696-1-perex@perex.cz +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/core/init.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +--- a/sound/core/init.c ++++ b/sound/core/init.c +@@ -548,13 +548,19 @@ int snd_card_free(struct snd_card *card) + } + EXPORT_SYMBOL(snd_card_free); + ++/* check, if the character is in the valid ASCII range */ ++static inline bool safe_ascii_char(char c) ++{ ++ return isascii(c) && isalnum(c); ++} ++ + /* retrieve the last word of shortname or longname */ + static const char *retrieve_id_from_card_name(const char *name) + { + const char *spos = name; + + while (*name) { +- if (isspace(*name) && isalnum(name[1])) ++ if (isspace(*name) && safe_ascii_char(name[1])) + spos = name + 1; + name++; + } +@@ -581,12 +587,12 @@ static void copy_valid_id_string(struct + { + char *id = card->id; + +- while (*nid && !isalnum(*nid)) ++ while (*nid && !safe_ascii_char(*nid)) + nid++; + if (isdigit(*nid)) + *id++ = isalpha(*src) ? *src : 'D'; + while (*nid && (size_t)(id - card->id) < sizeof(card->id) - 1) { +- if (isalnum(*nid)) ++ if (safe_ascii_char(*nid)) + *id++ = *nid; + nid++; + } +@@ -684,7 +690,7 @@ card_id_store_attr(struct device *dev, s + + for (idx = 0; idx < copy; idx++) { + c = buf[idx]; +- if (!isalnum(c) && c != '_' && c != '-') ++ if (!safe_ascii_char(c) && c != '_' && c != '-') + return -EINVAL; + } + memcpy(buf1, buf, copy); diff --git a/queue-4.19/alsa-line6-add-hw-monitor-volume-control-to-pod-hd500x.patch b/queue-4.19/alsa-line6-add-hw-monitor-volume-control-to-pod-hd500x.patch new file mode 100644 index 00000000000..a33394d3fc8 --- /dev/null +++ b/queue-4.19/alsa-line6-add-hw-monitor-volume-control-to-pod-hd500x.patch @@ -0,0 +1,32 @@ +From 703235a244e533652346844cfa42623afb36eed1 Mon Sep 17 00:00:00 2001 +From: "Hans P. Moller" +Date: Thu, 3 Oct 2024 20:28:28 -0300 +Subject: ALSA: line6: add hw monitor volume control to POD HD500X + +From: Hans P. Moller + +commit 703235a244e533652346844cfa42623afb36eed1 upstream. + +Add hw monitor volume control for POD HD500X. This is done adding +LINE6_CAP_HWMON_CTL to the capabilities + +Signed-off-by: Hans P. Moller +Cc: +Signed-off-by: Takashi Iwai +Link: https://patch.msgid.link/20241003232828.5819-1-hmoller@uc.cl +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/line6/podhd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/usb/line6/podhd.c ++++ b/sound/usb/line6/podhd.c +@@ -461,7 +461,7 @@ static const struct line6_properties pod + [LINE6_PODHD500X] = { + .id = "PODHD500X", + .name = "POD HD500X", +- .capabilities = LINE6_CAP_CONTROL ++ .capabilities = LINE6_CAP_CONTROL | LINE6_CAP_HWMON_CTL + | LINE6_CAP_PCM | LINE6_CAP_HWMON, + .altsetting = 1, + .ep_ctrl_r = 0x81, diff --git a/queue-4.19/parisc-fix-itlb-miss-handler-for-64-bit-programs.patch b/queue-4.19/parisc-fix-itlb-miss-handler-for-64-bit-programs.patch new file mode 100644 index 00000000000..332d4b2ecca --- /dev/null +++ b/queue-4.19/parisc-fix-itlb-miss-handler-for-64-bit-programs.patch @@ -0,0 +1,45 @@ +From 9542130937e9dc707dd7c6b7af73326437da2d50 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Tue, 10 Sep 2024 18:32:24 +0200 +Subject: parisc: Fix itlb miss handler for 64-bit programs + +From: Helge Deller + +commit 9542130937e9dc707dd7c6b7af73326437da2d50 upstream. + +For an itlb miss when executing code above 4 Gb on ILP64 adjust the +iasq/iaoq in the same way isr/ior was adjusted. This fixes signal +delivery for the 64-bit static test program from +http://ftp.parisc-linux.org/src/64bit.tar.gz. Note that signals are +handled by the signal trampoline code in the 64-bit VDSO which is mapped +into high userspace memory region above 4GB for 64-bit processes. + +Signed-off-by: Helge Deller +Cc: stable@vger.kernel.org # v4.19+ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/kernel/entry.S | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/arch/parisc/kernel/entry.S ++++ b/arch/parisc/kernel/entry.S +@@ -1089,8 +1089,7 @@ ENTRY_CFI(intr_save) /* for os_hpmc */ + STREG %r16, PT_ISR(%r29) + STREG %r17, PT_IOR(%r29) + +-#if 0 && defined(CONFIG_64BIT) +- /* Revisit when we have 64-bit code above 4Gb */ ++#if defined(CONFIG_64BIT) + b,n intr_save2 + + skip_save_ior: +@@ -1098,8 +1097,7 @@ skip_save_ior: + * need to adjust iasq/iaoq here in the same way we adjusted isr/ior + * above. + */ +- extrd,u,* %r8,PSW_W_BIT,1,%r1 +- cmpib,COND(=),n 1,%r1,intr_save2 ++ bb,COND(>=),n %r8,PSW_W_BIT,intr_save2 + LDREG PT_IASQ0(%r29), %r16 + LDREG PT_IAOQ0(%r29), %r17 + /* adjust iasq/iaoq */ diff --git a/queue-4.19/perf-core-fix-small-negative-period-being-ignored.patch b/queue-4.19/perf-core-fix-small-negative-period-being-ignored.patch new file mode 100644 index 00000000000..1e3e099974f --- /dev/null +++ b/queue-4.19/perf-core-fix-small-negative-period-being-ignored.patch @@ -0,0 +1,104 @@ +From 62c0b1061593d7012292f781f11145b2d46f43ab Mon Sep 17 00:00:00 2001 +From: Luo Gengkun +Date: Sat, 31 Aug 2024 07:43:15 +0000 +Subject: perf/core: Fix small negative period being ignored + +From: Luo Gengkun + +commit 62c0b1061593d7012292f781f11145b2d46f43ab upstream. + +In perf_adjust_period, we will first calculate period, and then use +this period to calculate delta. However, when delta is less than 0, +there will be a deviation compared to when delta is greater than or +equal to 0. For example, when delta is in the range of [-14,-1], the +range of delta = delta + 7 is between [-7,6], so the final value of +delta/8 is 0. Therefore, the impact of -1 and -2 will be ignored. +This is unacceptable when the target period is very short, because +we will lose a lot of samples. + +Here are some tests and analyzes: +before: + # perf record -e cs -F 1000 ./a.out + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.022 MB perf.data (518 samples) ] + + # perf script + ... + a.out 396 257.956048: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.957891: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.959730: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.961545: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.963355: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.965163: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.966973: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.968785: 23 cs: ffffffff81f4eeec schedul> + a.out 396 257.970593: 23 cs: ffffffff81f4eeec schedul> + ... + +after: + # perf record -e cs -F 1000 ./a.out + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.058 MB perf.data (1466 samples) ] + + # perf script + ... + a.out 395 59.338813: 11 cs: ffffffff81f4eeec schedul> + a.out 395 59.339707: 12 cs: ffffffff81f4eeec schedul> + a.out 395 59.340682: 13 cs: ffffffff81f4eeec schedul> + a.out 395 59.341751: 13 cs: ffffffff81f4eeec schedul> + a.out 395 59.342799: 12 cs: ffffffff81f4eeec schedul> + a.out 395 59.343765: 11 cs: ffffffff81f4eeec schedul> + a.out 395 59.344651: 11 cs: ffffffff81f4eeec schedul> + a.out 395 59.345539: 12 cs: ffffffff81f4eeec schedul> + a.out 395 59.346502: 13 cs: ffffffff81f4eeec schedul> + ... + +test.c + +int main() { + for (int i = 0; i < 20000; i++) + usleep(10); + + return 0; +} + + # time ./a.out + real 0m1.583s + user 0m0.040s + sys 0m0.298s + +The above results were tested on x86-64 qemu with KVM enabled using +test.c as test program. Ideally, we should have around 1500 samples, +but the previous algorithm had only about 500, whereas the modified +algorithm now has about 1400. Further more, the new version shows 1 +sample per 0.001s, while the previous one is 1 sample per 0.002s.This +indicates that the new algorithm is more sensitive to small negative +values compared to old algorithm. + +Fixes: bd2b5b12849a ("perf_counter: More aggressive frequency adjustment") +Signed-off-by: Luo Gengkun +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Adrian Hunter +Reviewed-by: Kan Liang +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20240831074316.2106159-2-luogengkun@huaweicloud.com +Signed-off-by: Greg Kroah-Hartman +--- + kernel/events/core.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -3618,7 +3618,11 @@ static void perf_adjust_period(struct pe + period = perf_calculate_period(event, nsec, count); + + delta = (s64)(period - hwc->sample_period); +- delta = (delta + 7) / 8; /* low pass filter */ ++ if (delta >= 0) ++ delta += 7; ++ else ++ delta -= 7; ++ delta /= 8; /* low pass filter */ + + sample_period = hwc->sample_period + delta; + diff --git a/queue-4.19/series b/queue-4.19/series index 722c1b1d287..08bf6aedcc8 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -183,3 +183,7 @@ selftests-breakpoints-use-remaining-time-to-check-if.patch selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch spi-bcm63xx-fix-module-autoloading.patch +perf-core-fix-small-negative-period-being-ignored.patch +parisc-fix-itlb-miss-handler-for-64-bit-programs.patch +alsa-core-add-isascii-check-to-card-id-generator.patch +alsa-line6-add-hw-monitor-volume-control-to-pod-hd500x.patch