]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Jan 2026 15:34:31 +0000 (16:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Jan 2026 15:34:31 +0000 (16:34 +0100)
added patches:
blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch

queue-6.1/blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch b/queue-6.1/blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch
new file mode 100644 (file)
index 0000000..190853f
--- /dev/null
@@ -0,0 +1,71 @@
+From 7b815817aa58d2e2101feb2fcf64c60cae0b2695 Mon Sep 17 00:00:00 2001
+From: Ming Lei <ming.lei@redhat.com>
+Date: Fri, 17 May 2024 10:05:14 +0800
+Subject: blk-mq: add helper for checking if one CPU is mapped to specified hctx
+
+From: Ming Lei <ming.lei@redhat.com>
+
+commit 7b815817aa58d2e2101feb2fcf64c60cae0b2695 upstream.
+
+Commit a46c27026da1 ("blk-mq: don't schedule block kworker on isolated CPUs")
+rules out isolated CPUs from hctx->cpumask, and hctx->cpumask should only be
+used for scheduling kworker.
+
+Add helper blk_mq_cpu_mapped_to_hctx() and apply it into cpuhp handlers.
+
+This patch avoids to forget clearing INACTIVE of hctx state in case that one
+isolated CPU becomes online, and fixes hang issue when allocating request
+from this hctx's tags.
+
+Cc: Raju Cheerla <rcheerla@redhat.com>
+Fixes: a46c27026da1 ("blk-mq: don't schedule block kworker on isolated CPUs")
+Signed-off-by: Ming Lei <ming.lei@redhat.com>
+Link: https://lore.kernel.org/r/20240517020514.149771-1-ming.lei@redhat.com
+Tested-by: Raju Cheerla <rcheerla@redhat.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ block/blk-mq.c |   20 ++++++++++++++++++--
+ 1 file changed, 18 insertions(+), 2 deletions(-)
+
+--- a/block/blk-mq.c
++++ b/block/blk-mq.c
+@@ -3579,12 +3579,28 @@ static int blk_mq_hctx_notify_offline(un
+       return ret;
+ }
++/*
++ * Check if one CPU is mapped to the specified hctx
++ *
++ * Isolated CPUs have been ruled out from hctx->cpumask, which is supposed
++ * to be used for scheduling kworker only. For other usage, please call this
++ * helper for checking if one CPU belongs to the specified hctx
++ */
++static bool blk_mq_cpu_mapped_to_hctx(unsigned int cpu,
++              const struct blk_mq_hw_ctx *hctx)
++{
++      struct blk_mq_hw_ctx *mapped_hctx = blk_mq_map_queue_type(hctx->queue,
++                      hctx->type, cpu);
++
++      return mapped_hctx == hctx;
++}
++
+ static int blk_mq_hctx_notify_online(unsigned int cpu, struct hlist_node *node)
+ {
+       struct blk_mq_hw_ctx *hctx = hlist_entry_safe(node,
+                       struct blk_mq_hw_ctx, cpuhp_online);
+-      if (cpumask_test_cpu(cpu, hctx->cpumask))
++      if (blk_mq_cpu_mapped_to_hctx(cpu, hctx))
+               clear_bit(BLK_MQ_S_INACTIVE, &hctx->state);
+       return 0;
+ }
+@@ -3602,7 +3618,7 @@ static int blk_mq_hctx_notify_dead(unsig
+       enum hctx_type type;
+       hctx = hlist_entry_safe(node, struct blk_mq_hw_ctx, cpuhp_dead);
+-      if (!cpumask_test_cpu(cpu, hctx->cpumask))
++      if (!blk_mq_cpu_mapped_to_hctx(cpu, hctx))
+               return 0;
+       ctx = __blk_mq_get_ctx(hctx->queue, cpu);
index 6d9a38b01152f14b91969b6435af55231936c32e..a8d41a3b2a70e4012b0d6643a8aa8c2c03e47c72 100644 (file)
@@ -509,3 +509,4 @@ drm-ttm-avoid-null-pointer-deref-for-evicted-bos.patch
 drm-mgag200-fix-big-endian-support.patch
 drm-i915-gem-zero-initialize-the-eb.vma-array-in-i915_gem_do_execbuffer.patch
 drm-nouveau-dispnv50-don-t-call-drm_atomic_get_crtc_state-in-prepare_fb.patch
+blk-mq-add-helper-for-checking-if-one-cpu-is-mapped-to-specified-hctx.patch