From c6e50afcada0de1252e1ec9d924cd8d53738ea62 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 16 Oct 2022 12:53:34 +0200 Subject: [PATCH] 5.10-stable patches added patches: block-fix-inflight-statistics-of-part0.patch drm-udl-restore-display-mode-on-resume.patch drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch nvme-pci-set-min_align_mask-before-calculating-max_hw_sectors.patch um-cpuinfo-fix-a-warning-for-config_cpumask_offstack.patch --- ...ock-fix-inflight-statistics-of-part0.patch | 72 +++++++++++++++++++ ...m-udl-restore-display-mode-on-resume.patch | 50 +++++++++++++ ...k-whether-transferred-2d-bo-is-shmem.patch | 33 +++++++++ ...sk-before-calculating-max_hw_sectors.patch | 40 +++++++++++ queue-5.10/series | 5 ++ ...-warning-for-config_cpumask_offstack.patch | 62 ++++++++++++++++ 6 files changed, 262 insertions(+) create mode 100644 queue-5.10/block-fix-inflight-statistics-of-part0.patch create mode 100644 queue-5.10/drm-udl-restore-display-mode-on-resume.patch create mode 100644 queue-5.10/drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch create mode 100644 queue-5.10/nvme-pci-set-min_align_mask-before-calculating-max_hw_sectors.patch create mode 100644 queue-5.10/um-cpuinfo-fix-a-warning-for-config_cpumask_offstack.patch diff --git a/queue-5.10/block-fix-inflight-statistics-of-part0.patch b/queue-5.10/block-fix-inflight-statistics-of-part0.patch new file mode 100644 index 00000000000..ec93915c572 --- /dev/null +++ b/queue-5.10/block-fix-inflight-statistics-of-part0.patch @@ -0,0 +1,72 @@ +From b0d97557ebfc9d5ba5f2939339a9fdd267abafeb Mon Sep 17 00:00:00 2001 +From: Jeffle Xu +Date: Wed, 2 Dec 2020 19:11:45 +0800 +Subject: block: fix inflight statistics of part0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jeffle Xu + +commit b0d97557ebfc9d5ba5f2939339a9fdd267abafeb upstream. + +The inflight of partition 0 doesn't include inflight IOs to all +sub-partitions, since currently mq calculates inflight of specific +partition by simply camparing the value of the partition pointer. + +Thus the following case is possible: + +$ cat /sys/block/vda/inflight +       0        0 +$ cat /sys/block/vda/vda1/inflight +       0      128 + +While single queue device (on a previous version, e.g. v3.10) has no +this issue: + +$cat /sys/block/sda/sda3/inflight + 0 33 +$cat /sys/block/sda/inflight + 0 33 + +Partition 0 should be specially handled since it represents the whole +disk. This issue is introduced since commit bf0ddaba65dd ("blk-mq: fix +sysfs inflight counter"). + +Besides, this patch can also fix the inflight statistics of part 0 in +/proc/diskstats. Before this patch, the inflight statistics of part 0 +doesn't include that of sub partitions. (I have marked the 'inflight' +field with asterisk.) + +$cat /proc/diskstats + 259 0 nvme0n1 45974469 0 367814768 6445794 1 0 1 0 *0* 111062 6445794 0 0 0 0 0 0 + 259 2 nvme0n1p1 45974058 0 367797952 6445727 0 0 0 0 *33* 111001 6445727 0 0 0 0 0 0 + +This is introduced since commit f299b7c7a9de ("blk-mq: provide internal +in-flight variant"). + +Fixes: bf0ddaba65dd ("blk-mq: fix sysfs inflight counter") +Fixes: f299b7c7a9de ("blk-mq: provide internal in-flight variant") +Signed-off-by: Jeffle Xu +Reviewed-by: Christoph Hellwig +[axboe: adapt for 5.11 partition change] +Signed-off-by: Jens Axboe +[khazhy: adapt for 5.10 partition] +Signed-off-by: Khazhismel Kumykov +Signed-off-by: Greg Kroah-Hartman +--- + block/blk-mq.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/block/blk-mq.c ++++ b/block/blk-mq.c +@@ -105,7 +105,8 @@ static bool blk_mq_check_inflight(struct + { + struct mq_inflight *mi = priv; + +- if (rq->part == mi->part && blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) ++ if ((!mi->part->partno || rq->part == mi->part) && ++ blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) + mi->inflight[rq_data_dir(rq)]++; + + return true; diff --git a/queue-5.10/drm-udl-restore-display-mode-on-resume.patch b/queue-5.10/drm-udl-restore-display-mode-on-resume.patch new file mode 100644 index 00000000000..104e68adede --- /dev/null +++ b/queue-5.10/drm-udl-restore-display-mode-on-resume.patch @@ -0,0 +1,50 @@ +From 6d6e732835db92e66c28dbcf258a7e3d3c71420d Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 8 Sep 2022 11:51:04 +0200 +Subject: drm/udl: Restore display mode on resume + +From: Takashi Iwai + +commit 6d6e732835db92e66c28dbcf258a7e3d3c71420d upstream. + +Restore the display mode whne resuming from suspend. Currently, the +display remains dark. + +On resume, the CRTC's mode does not change, but the 'active' flag +changes to 'true'. Taking this into account when considering a mode +switch restores the display mode. + +The bug is reproducable by using Gnome with udl and observing the +adapter's suspend/resume behavior. + +Actually, the whole check added in udl_simple_display_pipe_enable() +about the crtc_state->mode_changed was bogus. We should drop the +whole check and always apply the mode change in this function. + +[ tiwai -- Drop the mode_changed check entirely instead, per Daniel's + suggestion ] + +Fixes: 997d33c35618 ("drm/udl: Inline DPMS code into CRTC enable and disable functions") +Cc: +Suggested-by: Daniel Vetter +Reviewed-by: Daniel Vetter +Signed-off-by: Takashi Iwai +Signed-off-by: Thomas Zimmermann +Link: https://patchwork.freedesktop.org/patch/msgid/20220908095115.23396-2-tiwai@suse.de +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/udl/udl_modeset.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/gpu/drm/udl/udl_modeset.c ++++ b/drivers/gpu/drm/udl/udl_modeset.c +@@ -400,9 +400,6 @@ udl_simple_display_pipe_enable(struct dr + + udl_handle_damage(fb, 0, 0, fb->width, fb->height); + +- if (!crtc_state->mode_changed) +- return; +- + /* enable display */ + udl_crtc_write_mode_to_hw(crtc); + } diff --git a/queue-5.10/drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch b/queue-5.10/drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch new file mode 100644 index 00000000000..49f2b0b22d8 --- /dev/null +++ b/queue-5.10/drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch @@ -0,0 +1,33 @@ +From e473216b42aa1fd9fc6b94b608b42c210c655908 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Thu, 30 Jun 2022 23:07:19 +0300 +Subject: drm/virtio: Check whether transferred 2D BO is shmem + +From: Dmitry Osipenko + +commit e473216b42aa1fd9fc6b94b608b42c210c655908 upstream. + +Transferred 2D BO always must be a shmem BO. Add check for that to prevent +NULL dereference if userspace passes a VRAM BO. + +Cc: stable@vger.kernel.org +Reviewed-by: Emil Velikov +Signed-off-by: Dmitry Osipenko +Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-3-dmitry.osipenko@collabora.com +Signed-off-by: Gerd Hoffmann +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/virtio/virtgpu_vq.c ++++ b/drivers/gpu/drm/virtio/virtgpu_vq.c +@@ -601,7 +601,7 @@ void virtio_gpu_cmd_transfer_to_host_2d( + bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); + struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo); + +- if (use_dma_api) ++ if (virtio_gpu_is_shmem(bo) && use_dma_api) + dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, + shmem->pages, DMA_TO_DEVICE); + diff --git a/queue-5.10/nvme-pci-set-min_align_mask-before-calculating-max_hw_sectors.patch b/queue-5.10/nvme-pci-set-min_align_mask-before-calculating-max_hw_sectors.patch new file mode 100644 index 00000000000..e5e712f3cde --- /dev/null +++ b/queue-5.10/nvme-pci-set-min_align_mask-before-calculating-max_hw_sectors.patch @@ -0,0 +1,40 @@ +From 61ce339f19fabbc3e51237148a7ef6f2270e44fa Mon Sep 17 00:00:00 2001 +From: Rishabh Bhatnagar +Date: Tue, 20 Sep 2022 19:19:32 +0000 +Subject: nvme-pci: set min_align_mask before calculating max_hw_sectors + +From: Rishabh Bhatnagar + +commit 61ce339f19fabbc3e51237148a7ef6f2270e44fa upstream. + +If swiotlb is force enabled dma_max_mapping_size ends up calling +swiotlb_max_mapping_size which takes into account the min align mask for +the device. Set the min align mask for nvme driver before calling +dma_max_mapping_size while calculating max hw sectors. + +Signed-off-by: Rishabh Bhatnagar +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvme/host/pci.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -2624,6 +2624,8 @@ static void nvme_reset_work(struct work_ + if (result) + goto out_unlock; + ++ dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); ++ + /* + * Limit the max command size to prevent iod->sg allocations going + * over a single page. +@@ -2636,7 +2638,6 @@ static void nvme_reset_work(struct work_ + * Don't limit the IOMMU merged segment size. + */ + dma_set_max_seg_size(dev->dev, 0xffffffff); +- dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1); + + mutex_unlock(&dev->shutdown_lock); + diff --git a/queue-5.10/series b/queue-5.10/series index 61fd69e2d49..974080b0f17 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -34,3 +34,8 @@ parisc-fbdev-stifb-align-graphics-memory-size-to-4mb.patch riscv-allow-prot_write-only-mmap.patch riscv-make-vm_write-imply-vm_read.patch riscv-pass-mno-relax-only-on-lld-15.0.0.patch +um-cpuinfo-fix-a-warning-for-config_cpumask_offstack.patch +nvme-pci-set-min_align_mask-before-calculating-max_hw_sectors.patch +drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch +drm-udl-restore-display-mode-on-resume.patch +block-fix-inflight-statistics-of-part0.patch diff --git a/queue-5.10/um-cpuinfo-fix-a-warning-for-config_cpumask_offstack.patch b/queue-5.10/um-cpuinfo-fix-a-warning-for-config_cpumask_offstack.patch new file mode 100644 index 00000000000..0f3db342ccf --- /dev/null +++ b/queue-5.10/um-cpuinfo-fix-a-warning-for-config_cpumask_offstack.patch @@ -0,0 +1,62 @@ +From 16c546e148fa6d14a019431436a6f7b4087dbccd Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Tue, 12 Jul 2022 15:52:55 +0800 +Subject: UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK + +From: Huacai Chen + +commit 16c546e148fa6d14a019431436a6f7b4087dbccd upstream. + +When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, +cpu_max_bits_warn() generates a runtime warning similar as below while +we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) +instead of NR_CPUS to iterate CPUs. + +[ 3.052463] ------------[ cut here ]------------ +[ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 +[ 3.070072] Modules linked in: efivarfs autofs4 +[ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 +[ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 +[ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 +[ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff +[ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 +[ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa +[ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 +[ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 +[ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 +[ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 +[ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c +[ 3.195868] ... +[ 3.199917] Call Trace: +[ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c +[ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 +[ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 +[ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc +[ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 +[ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 +[ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 +[ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 +[ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 +[ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 +[ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 +[ 3.281824] ---[ end trace 8b484262b4b8c24c ]--- + +Cc: stable@vger.kernel.org +Signed-off-by: Huacai Chen +Signed-off-by: Richard Weinberger +Signed-off-by: Greg Kroah-Hartman +--- + arch/um/kernel/um_arch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/um/kernel/um_arch.c ++++ b/arch/um/kernel/um_arch.c +@@ -77,7 +77,7 @@ static int show_cpuinfo(struct seq_file + + static void *c_start(struct seq_file *m, loff_t *pos) + { +- return *pos < NR_CPUS ? cpu_data + *pos : NULL; ++ return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; + } + + static void *c_next(struct seq_file *m, void *v, loff_t *pos) -- 2.47.3