mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] blk-mq: create correct map for fallback case
@ 2025-01-23 13:08 Daniel Wagner
  2025-01-23 13:34 ` Jens Axboe
  2025-01-23 15:18 ` Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Wagner @ 2025-01-23 13:08 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Steven Rostedt, Hannes Reinecke, Ming Lei, John Garry,
	linux-block, linux-kernel, Daniel Wagner

The fallback code in blk_mq_map_hw_queues is original from
blk_mq_pci_map_queues and was added to handle the case where
pci_irq_get_affinity will return NULL for !SMP configuration.

blk_mq_map_hw_queues replaces besides blk_mq_pci_map_queues also
blk_mq_virtio_map_queues which used to use blk_mq_map_queues for the
fallback.

It's possible to use blk_mq_map_queues for both cases though.
blk_mq_map_queues creates the same map as blk_mq_clear_mq_map for !SMP
that is CPU 0 will be mapped to hctx 0.

The WARN_ON_ONCE has to be dropped for virtio as the fallback is also
taken for certain configuration on default. Though there is still a
WARN_ON_ONCE check in lib/group_cpus.c:

       WARN_ON(nr_present + nr_others < numgrps);

which will trigger if the caller tries to create more hardware queues
than CPUs. It tests the same as the WARN_ON_ONCE in
blk_mq_pci_map_queues did.

Fixes: a5665c3d150c ("virtio: blk/scsi: replace blk_mq_virtio_map_queues with blk_mq_map_hw_queues")
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Closes: https://lore.kernel.org/all/20250122093020.6e8a4e5b@gandalf.local.home/
Signed-off-by: Daniel Wagner <wagi@kernel.org>
---
 block/blk-mq-cpumap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index ad8d6a363f24ae11968b42f7bcfd6a719a0499b7..444798c5374f48088b661b519f2638bda8556cf2 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -87,7 +87,6 @@ void blk_mq_map_hw_queues(struct blk_mq_queue_map *qmap,
 	return;
 
 fallback:
-	WARN_ON_ONCE(qmap->nr_queues > 1);
-	blk_mq_clear_mq_map(qmap);
+	blk_mq_map_queues(qmap);
 }
 EXPORT_SYMBOL_GPL(blk_mq_map_hw_queues);

---
base-commit: c4b9570cfb63501638db720f3bee9f6dfd044b82
change-id: 20250123-fix-blk_mq_map_hw_queues-dc72a6a1c71a

Best regards,
-- 
Daniel Wagner <wagi@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-mq: create correct map for fallback case
  2025-01-23 13:08 [PATCH] blk-mq: create correct map for fallback case Daniel Wagner
@ 2025-01-23 13:34 ` Jens Axboe
  2025-01-23 15:18 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-01-23 13:34 UTC (permalink / raw)
  To: Daniel Wagner
  Cc: Steven Rostedt, Hannes Reinecke, Ming Lei, John Garry,
	linux-block, linux-kernel


On Thu, 23 Jan 2025 14:08:29 +0100, Daniel Wagner wrote:
> The fallback code in blk_mq_map_hw_queues is original from
> blk_mq_pci_map_queues and was added to handle the case where
> pci_irq_get_affinity will return NULL for !SMP configuration.
> 
> blk_mq_map_hw_queues replaces besides blk_mq_pci_map_queues also
> blk_mq_virtio_map_queues which used to use blk_mq_map_queues for the
> fallback.
> 
> [...]

Applied, thanks!

[1/1] blk-mq: create correct map for fallback case
      commit: a9ae6fe1c319c4776c2b11e85e15109cd3f04076

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-mq: create correct map for fallback case
  2025-01-23 13:08 [PATCH] blk-mq: create correct map for fallback case Daniel Wagner
  2025-01-23 13:34 ` Jens Axboe
@ 2025-01-23 15:18 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2025-01-23 15:18 UTC (permalink / raw)
  To: Daniel Wagner
  Cc: Jens Axboe, Hannes Reinecke, Ming Lei, John Garry, linux-block,
	linux-kernel

On Thu, 23 Jan 2025 14:08:29 +0100
Daniel Wagner <wagi@kernel.org> wrote:

> The fallback code in blk_mq_map_hw_queues is original from
> blk_mq_pci_map_queues and was added to handle the case where
> pci_irq_get_affinity will return NULL for !SMP configuration.
> 
> blk_mq_map_hw_queues replaces besides blk_mq_pci_map_queues also
> blk_mq_virtio_map_queues which used to use blk_mq_map_queues for the
> fallback.
> 
> It's possible to use blk_mq_map_queues for both cases though.
> blk_mq_map_queues creates the same map as blk_mq_clear_mq_map for !SMP
> that is CPU 0 will be mapped to hctx 0.
> 
> The WARN_ON_ONCE has to be dropped for virtio as the fallback is also
> taken for certain configuration on default. Though there is still a
> WARN_ON_ONCE check in lib/group_cpus.c:
> 
>        WARN_ON(nr_present + nr_others < numgrps);
> 
> which will trigger if the caller tries to create more hardware queues
> than CPUs. It tests the same as the WARN_ON_ONCE in
> blk_mq_pci_map_queues did.
> 
> Fixes: a5665c3d150c ("virtio: blk/scsi: replace blk_mq_virtio_map_queues with blk_mq_map_hw_queues")
> Reported-by: Steven Rostedt <rostedt@goodmis.org>

Tested-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> Closes: https://lore.kernel.org/all/20250122093020.6e8a4e5b@gandalf.local.home/
> Signed-off-by: Daniel Wagner <wagi@kernel.org>
> ---
>  block/blk-mq-cpumap.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-23 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-23 13:08 [PATCH] blk-mq: create correct map for fallback case Daniel Wagner
2025-01-23 13:34 ` Jens Axboe
2025-01-23 15:18 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®