From dbab1cbc540722954aa18ec0cb96460515b9649f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 27 Aug 2023 12:26:12 +0200 Subject: [PATCH] 5.4-stable patches added patches: alsa-pcm-check-for-null-pointer-of-pointer-substream-before-dereferencing-it.patch alsa-pcm-fix-build-error-on-m68k-and-others.patch documentation-sysctl-document-page_lock_unfairness.patch interconnect-do-not-skip-aggregation-for-disabled-paths.patch irqchip-mips-gic-don-t-touch-vl_map-if-a-local-interrupt-is-not-routable.patch revert-alsa-pcm-use-sg-buffer-only-when-direct-dma-is-available.patch --- ...er-substream-before-dereferencing-it.patch | 42 ++++++++++++++ ...m-fix-build-error-on-m68k-and-others.patch | 47 +++++++++++++++ ...sysctl-document-page_lock_unfairness.patch | 56 ++++++++++++++++++ ...-skip-aggregation-for-disabled-paths.patch | 57 +++++++++++++++++++ ...if-a-local-interrupt-is-not-routable.patch | 45 +++++++++++++++ ...er-only-when-direct-dma-is-available.patch | 55 ++++++++++++++++++ queue-5.4/series | 6 ++ 7 files changed, 308 insertions(+) create mode 100644 queue-5.4/alsa-pcm-check-for-null-pointer-of-pointer-substream-before-dereferencing-it.patch create mode 100644 queue-5.4/alsa-pcm-fix-build-error-on-m68k-and-others.patch create mode 100644 queue-5.4/documentation-sysctl-document-page_lock_unfairness.patch create mode 100644 queue-5.4/interconnect-do-not-skip-aggregation-for-disabled-paths.patch create mode 100644 queue-5.4/irqchip-mips-gic-don-t-touch-vl_map-if-a-local-interrupt-is-not-routable.patch create mode 100644 queue-5.4/revert-alsa-pcm-use-sg-buffer-only-when-direct-dma-is-available.patch diff --git a/queue-5.4/alsa-pcm-check-for-null-pointer-of-pointer-substream-before-dereferencing-it.patch b/queue-5.4/alsa-pcm-check-for-null-pointer-of-pointer-substream-before-dereferencing-it.patch new file mode 100644 index 00000000000..f44e095004b --- /dev/null +++ b/queue-5.4/alsa-pcm-check-for-null-pointer-of-pointer-substream-before-dereferencing-it.patch @@ -0,0 +1,42 @@ +From 011b559be832194f992f73d6c0d5485f5925a10b Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Sun, 24 Apr 2022 21:59:45 +0100 +Subject: ALSA: pcm: Check for null pointer of pointer substream before dereferencing it + +From: Colin Ian King + +commit 011b559be832194f992f73d6c0d5485f5925a10b upstream. + +Pointer substream is being dereferenced on the assignment of pointer card +before substream is being null checked with the macro PCM_RUNTIME_CHECK. +Although PCM_RUNTIME_CHECK calls BUG_ON, it still is useful to perform the +the pointer check before card is assigned. + +Fixes: d4cfb30fce03 ("ALSA: pcm: Set per-card upper limit of PCM buffer allocations") +Signed-off-by: Colin Ian King +Link: https://lore.kernel.org/r/20220424205945.1372247-1-colin.i.king@gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/core/pcm_memory.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/sound/core/pcm_memory.c ++++ b/sound/core/pcm_memory.c +@@ -401,7 +401,6 @@ EXPORT_SYMBOL(snd_pcm_lib_malloc_pages); + */ + int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream) + { +- struct snd_card *card = substream->pcm->card; + struct snd_pcm_runtime *runtime; + + if (PCM_RUNTIME_CHECK(substream)) +@@ -410,6 +409,8 @@ int snd_pcm_lib_free_pages(struct snd_pc + if (runtime->dma_area == NULL) + return 0; + if (runtime->dma_buffer_p != &substream->dma_buffer) { ++ struct snd_card *card = substream->pcm->card; ++ + /* it's a newly allocated buffer. release it now. */ + do_free_pages(card, runtime->dma_buffer_p); + kfree(runtime->dma_buffer_p); diff --git a/queue-5.4/alsa-pcm-fix-build-error-on-m68k-and-others.patch b/queue-5.4/alsa-pcm-fix-build-error-on-m68k-and-others.patch new file mode 100644 index 00000000000..f492e491010 --- /dev/null +++ b/queue-5.4/alsa-pcm-fix-build-error-on-m68k-and-others.patch @@ -0,0 +1,47 @@ +From 467fd0e82b6265b8e6cc078a70bd7592574d5c83 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 7 Jul 2020 13:12:25 +0200 +Subject: ALSA: pcm: Fix build error on m68k and others + +From: Takashi Iwai + +commit 467fd0e82b6265b8e6cc078a70bd7592574d5c83 upstream. + +The commit 3ad796cbc36a ("ALSA: pcm: Use SG-buffer only when direct +DMA is available") introduced a check of the DMA type and this caused +a build error on m68k (and possibly some others) due to the lack of +dma_is_direct() definition. Since the check is needed only for +CONFIG_SND_DMA_SGBUF enablement (i.e. solely x86), use #ifdef instead +of IS_ENABLED() for avoiding such a build error. + +Fixes: 3ad796cbc36a ("ALSA: pcm: Use SG-buffer only when direct DMA is available") +Reported-by: kernel test robot +Link: https://lore.kernel.org/r/20200707111225.26826-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/core/pcm_memory.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/sound/core/pcm_memory.c ++++ b/sound/core/pcm_memory.c +@@ -66,8 +66,9 @@ static int do_alloc_pages(struct snd_car + __update_allocated_size(card, size); + mutex_unlock(&card->memory_mutex); + +- if (IS_ENABLED(CONFIG_SND_DMA_SGBUF) && +- (type == SNDRV_DMA_TYPE_DEV_SG || type == SNDRV_DMA_TYPE_DEV_UC_SG) && ++ ++#ifdef CONFIG_SND_DMA_SGBUF ++ if ((type == SNDRV_DMA_TYPE_DEV_SG || type == SNDRV_DMA_TYPE_DEV_UC_SG) && + !dma_is_direct(get_dma_ops(dev))) { + /* mutate to continuous page allocation */ + dev_dbg(dev, "Use continuous page allocator\n"); +@@ -76,6 +77,7 @@ static int do_alloc_pages(struct snd_car + else + type = SNDRV_DMA_TYPE_DEV_UC; + } ++#endif /* CONFIG_SND_DMA_SGBUF */ + + err = snd_dma_alloc_pages(type, dev, size, dmab); + if (!err) { diff --git a/queue-5.4/documentation-sysctl-document-page_lock_unfairness.patch b/queue-5.4/documentation-sysctl-document-page_lock_unfairness.patch new file mode 100644 index 00000000000..cca6fac58d6 --- /dev/null +++ b/queue-5.4/documentation-sysctl-document-page_lock_unfairness.patch @@ -0,0 +1,56 @@ +From 8d98e42fb20c25e8efdab4cc1ac46d52ba964aca Mon Sep 17 00:00:00 2001 +From: Joel Savitz +Date: Thu, 28 Apr 2022 23:16:01 -0700 +Subject: Documentation/sysctl: document page_lock_unfairness + +From: Joel Savitz + +commit 8d98e42fb20c25e8efdab4cc1ac46d52ba964aca upstream. + +commit 5ef64cc8987a ("mm: allow a controlled amount of unfairness in the +page lock") introduced a new systctl but no accompanying documentation. + +Add a simple entry to the documentation. + +Link: https://lkml.kernel.org/r/20220325164437.120246-1-jsavitz@redhat.com +Signed-off-by: Joel Savitz +Cc: Jonathan Corbet +Cc: Vlastimil Babka +Cc: Mel Gorman +Cc: Dave Hansen +Cc: Suren Baghdasaryan +Cc: Mike Rapoport +Cc: "zhangyi (F)" +Cc: Charan Teja Reddy +Cc: Linus Torvalds +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + Documentation/admin-guide/sysctl/vm.rst | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/Documentation/admin-guide/sysctl/vm.rst ++++ b/Documentation/admin-guide/sysctl/vm.rst +@@ -61,6 +61,7 @@ Currently, these files are in /proc/sys/ + - overcommit_memory + - overcommit_ratio + - page-cluster ++- page_lock_unfairness + - panic_on_oom + - percpu_pagelist_fraction + - stat_interval +@@ -741,6 +742,14 @@ extra faults and I/O delays for followin + that consecutive pages readahead would have brought in. + + ++page_lock_unfairness ++==================== ++ ++This value determines the number of times that the page lock can be ++stolen from under a waiter. After the lock is stolen the number of times ++specified in this file (default is 5), the "fair lock handoff" semantics ++will apply, and the waiter will only be awakened if the lock can be taken. ++ + panic_on_oom + ============ + diff --git a/queue-5.4/interconnect-do-not-skip-aggregation-for-disabled-paths.patch b/queue-5.4/interconnect-do-not-skip-aggregation-for-disabled-paths.patch new file mode 100644 index 00000000000..fa4f450d056 --- /dev/null +++ b/queue-5.4/interconnect-do-not-skip-aggregation-for-disabled-paths.patch @@ -0,0 +1,57 @@ +From 91b44981a2316e7b00574d32dec4fae356444dcf Mon Sep 17 00:00:00 2001 +From: Georgi Djakov +Date: Thu, 23 Jul 2020 11:37:34 +0300 +Subject: interconnect: Do not skip aggregation for disabled paths + +From: Georgi Djakov + +commit 91b44981a2316e7b00574d32dec4fae356444dcf upstream. + +When an interconnect path is being disabled, currently we don't aggregate +the requests for it afterwards. But the re-aggregation step shouldn't be +skipped, as it may leave the nodes with outdated bandwidth data. This +outdated data may actually keep the path still enabled and prevent the +device from going into lower power states. + +Reported-by: Atul Dhudase +Fixes: 7d374b209083 ("interconnect: Add helpers for enabling/disabling a path") +Reviewed-by: Sibi Sankar +Tested-by: Atul Dhudase +Reviewed-by: Atul Dhudase +Link: https://lore.kernel.org/r/20200721120740.3436-1-georgi.djakov@linaro.org +Signed-off-by: Georgi Djakov +Link: https://lore.kernel.org/r/20200723083735.5616-2-georgi.djakov@linaro.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman +--- + drivers/interconnect/core.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/interconnect/core.c ++++ b/drivers/interconnect/core.c +@@ -176,6 +176,7 @@ static int aggregate_requests(struct icc + { + struct icc_provider *p = node->provider; + struct icc_req *r; ++ u32 avg_bw, peak_bw; + + node->avg_bw = 0; + node->peak_bw = 0; +@@ -184,9 +185,14 @@ static int aggregate_requests(struct icc + p->pre_aggregate(node); + + hlist_for_each_entry(r, &node->req_list, req_node) { +- if (!r->enabled) +- continue; +- p->aggregate(node, r->tag, r->avg_bw, r->peak_bw, ++ if (r->enabled) { ++ avg_bw = r->avg_bw; ++ peak_bw = r->peak_bw; ++ } else { ++ avg_bw = 0; ++ peak_bw = 0; ++ } ++ p->aggregate(node, r->tag, avg_bw, peak_bw, + &node->avg_bw, &node->peak_bw); + } + diff --git a/queue-5.4/irqchip-mips-gic-don-t-touch-vl_map-if-a-local-interrupt-is-not-routable.patch b/queue-5.4/irqchip-mips-gic-don-t-touch-vl_map-if-a-local-interrupt-is-not-routable.patch new file mode 100644 index 00000000000..d348ee4444c --- /dev/null +++ b/queue-5.4/irqchip-mips-gic-don-t-touch-vl_map-if-a-local-interrupt-is-not-routable.patch @@ -0,0 +1,45 @@ +From 2c6c9c049510163090b979ea5f92a68ae8d93c45 Mon Sep 17 00:00:00 2001 +From: Jiaxun Yang +Date: Mon, 24 Apr 2023 11:31:55 +0100 +Subject: irqchip/mips-gic: Don't touch vl_map if a local interrupt is not routable + +From: Jiaxun Yang + +commit 2c6c9c049510163090b979ea5f92a68ae8d93c45 upstream. + +When a GIC local interrupt is not routable, it's vl_map will be used +to control some internal states for core (providing IPTI, IPPCI, IPFDC +input signal for core). Overriding it will interfere core's intetrupt +controller. + +Do not touch vl_map if a local interrupt is not routable, we are not +going to remap it. + +Before dd098a0e0319 (" irqchip/mips-gic: Get rid of the reliance on +irq_cpu_online()"), if a local interrupt is not routable, then it won't +be requested from GIC Local domain, and thus gic_all_vpes_irq_cpu_online +won't be called for that particular interrupt. + +Fixes: dd098a0e0319 (" irqchip/mips-gic: Get rid of the reliance on irq_cpu_online()") +Cc: stable@vger.kernel.org +Signed-off-by: Jiaxun Yang +Reviewed-by: Serge Semin +Tested-by: Serge Semin +Signed-off-by: Marc Zyngier +Link: https://lore.kernel.org/r/20230424103156.66753-2-jiaxun.yang@flygoat.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/irqchip/irq-mips-gic.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/irqchip/irq-mips-gic.c ++++ b/drivers/irqchip/irq-mips-gic.c +@@ -396,6 +396,8 @@ static void gic_all_vpes_irq_cpu_online( + unsigned int intr = local_intrs[i]; + struct gic_all_vpes_chip_data *cd; + ++ if (!gic_local_irq_is_routable(intr)) ++ continue; + cd = &gic_all_vpes_chip_data[intr]; + write_gic_vl_map(mips_gic_vx_map_reg(intr), cd->map); + if (cd->mask) diff --git a/queue-5.4/revert-alsa-pcm-use-sg-buffer-only-when-direct-dma-is-available.patch b/queue-5.4/revert-alsa-pcm-use-sg-buffer-only-when-direct-dma-is-available.patch new file mode 100644 index 00000000000..3dd933a1768 --- /dev/null +++ b/queue-5.4/revert-alsa-pcm-use-sg-buffer-only-when-direct-dma-is-available.patch @@ -0,0 +1,55 @@ +From 7d50b295c4af16f814ee82369c4a234df5228801 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 17 Jul 2020 08:41:30 +0200 +Subject: Revert "ALSA: pcm: Use SG-buffer only when direct DMA is available" + +From: Takashi Iwai + +commit 7d50b295c4af16f814ee82369c4a234df5228801 upstream. + +This reverts commit 3ad796cbc36a ("ALSA: pcm: Use SG-buffer only when +direct DMA is available") also the modification commit 467fd0e82b62 +("ALSA: pcm: Fix build error on m68k and others"). + +Poking the DMA internal helper is a layer violation, so we should +avoid that. Meanwhile the actual bug has been addressed by the +Kconfig fix in commit dbed452a078d ("dma-pool: decouple DMA_REMAP from +DMA_COHERENT_POOL"), so we can live without this hack. + +Link: https://lore.kernel.org/r/20200717064130.22957-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/core/pcm_memory.c | 14 -------------- + 1 file changed, 14 deletions(-) + +--- a/sound/core/pcm_memory.c ++++ b/sound/core/pcm_memory.c +@@ -11,7 +11,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -66,19 +65,6 @@ static int do_alloc_pages(struct snd_car + __update_allocated_size(card, size); + mutex_unlock(&card->memory_mutex); + +- +-#ifdef CONFIG_SND_DMA_SGBUF +- if ((type == SNDRV_DMA_TYPE_DEV_SG || type == SNDRV_DMA_TYPE_DEV_UC_SG) && +- !dma_is_direct(get_dma_ops(dev))) { +- /* mutate to continuous page allocation */ +- dev_dbg(dev, "Use continuous page allocator\n"); +- if (type == SNDRV_DMA_TYPE_DEV_SG) +- type = SNDRV_DMA_TYPE_DEV; +- else +- type = SNDRV_DMA_TYPE_DEV_UC; +- } +-#endif /* CONFIG_SND_DMA_SGBUF */ +- + err = snd_dma_alloc_pages(type, dev, size, dmab); + if (!err) { + /* the actual allocation size might be bigger than requested, diff --git a/queue-5.4/series b/queue-5.4/series index e9721d3d146..8fbd453d302 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -147,3 +147,9 @@ drm-display-dp-fix-the-dp-dsc-receiver-cap-size.patch x86-fpu-set-x86_feature_osxsave-feature-after-enabling-osxsave-in-cr4.patch mm-allow-a-controlled-amount-of-unfairness-in-the-page-lock.patch rtnetlink-reject-negative-ifindexes-in-rtm_newlink.patch +alsa-pcm-fix-build-error-on-m68k-and-others.patch +revert-alsa-pcm-use-sg-buffer-only-when-direct-dma-is-available.patch +interconnect-do-not-skip-aggregation-for-disabled-paths.patch +alsa-pcm-check-for-null-pointer-of-pointer-substream-before-dereferencing-it.patch +documentation-sysctl-document-page_lock_unfairness.patch +irqchip-mips-gic-don-t-touch-vl_map-if-a-local-interrupt-is-not-routable.patch -- 2.47.3