expose queue the queue mapping for SCSI drivers
Subsystems (3)
In 4.9 I've added support in the interrupt layer to automatically assign the interrupt affinity at interrupt allocation time, and expose that information to blk-mq.
This series extents that so that SCSI driver can pass on the information as well. The SCSI part is fairly trivial, although we need to also export the default queue mapping function in blk-mq to keep things simple.
I've also converted over the smartpqi driver as an example as it's the easiest of the multiqueue SCSI drivers to convert. I don't actually have smartpqi hardware, so that part will need additionaly testing.
(I've tested it with virtio_scsi, but that requires a lot of virtio
changes not ready to post yet)
PATCH 1/3 blk-mq: export blk_mq_map_queues
This will allow SCSI to have a single blk_mq_ops structure that either lets the LLDD map the queues to PCIe MSIx vectors or use the default.
--- block/blk-mq.h | 1 - include/linux/blk-mq.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.h +0 -1
@@ -38,7 +38,6 @@ void blk_mq_disable_hotplug(void);/* * CPU -> queue mappings */ -int blk_mq_map_queues (struct blk_mq_tag_set *set);extern int blk_mq_hw_queue_to_node (unsigned int *map,unsigned int ); static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q,
include/linux/blk-mq.h +1 -0
@@ -237,6 +237,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q);void blk_mq_freeze_queue_start (struct request_queue *q);int blk_mq_reinit_tagset (struct blk_mq_tag_set *set); +int blk_mq_map_queues (struct blk_mq_tag_set *set);void blk_mq_update_nr_hw_queues (struct blk_mq_tag_set *set,int nr_hw_queues);/*
Signature · 1 line
2.1.4
Re: [PATCH 1/3] blk-mq: export blk_mq_map_queues
Quoted 27 lines · Christoph Hellwig
This will allow SCSI to have a single
blk_mq_opsstructure that either lets the LLDD map the queues to PCIe MSIx vectors or use the default.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-mq.h | 1 - include/linux/blk-mq.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)block/blk-mq.h +0
-1@@ -38,7 +38,6 @@ void blk_mq_disable_hotplug(void);/* * CPU -> queue mappings */ -int blk_mq_map_queues (struct blk_mq_tag_set *set);extern int blk_mq_hw_queue_to_node (unsigned int *map,unsigned int ); static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q,include/linux/blk-mq.h +0
-0
include/linux/blk-mq.h void blk_mq_unfreeze_queue(struct request_queue *q); · line 243
Quoted 7 lines
include/linux/blk-mq.h +1
-0@@ -237,6 +237,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q);void blk_mq_freeze_queue_start (struct request_queue *q);int blk_mq_reinit_tagset (struct blk_mq_tag_set *set); +int blk_mq_map_queues (struct blk_mq_tag_set *set);void blk_mq_update_nr_hw_queues (struct blk_mq_tag_set *set,int nr_hw_queues);/*
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: J. Hawn, J. Guild, F. Imend�rffer, HRB 16746 (AG N�rnberg)
Re: [PATCH 1/3] blk-mq: export blk_mq_map_queues
In reply to Christoph HellwigQuoted 35 lines · Christoph Hellwig
This will allow SCSI to have a single
blk_mq_opsstructure that either lets the LLDD map the queues to PCIe MSIx vectors or use the default.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-mq.h | 1 - include/linux/blk-mq.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)block/blk-mq.h +0
-1@@ -38,7 +38,6 @@ void blk_mq_disable_hotplug(void);/* * CPU -> queue mappings */ -int blk_mq_map_queues (struct blk_mq_tag_set *set);extern int blk_mq_hw_queue_to_node (unsigned int *map,unsigned int ); static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q,include/linux/blk-mq.h +1
-0@@ -237,6 +237,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q);void blk_mq_freeze_queue_start (struct request_queue *q);int blk_mq_reinit_tagset (struct blk_mq_tag_set *set); +int blk_mq_map_queues (struct blk_mq_tag_set *set);void blk_mq_update_nr_hw_queues (struct blk_mq_tag_set *set,int nr_hw_queues);/* Signature · 1 line
2.1.4
See comment on patch 2, otherwise
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
PATCH 2/3 scsi: allow LLDDs to expose the queue mapping to blk-mq
In reply to Christoph HellwigJust hand through the blk-mq map_queues method in the host template.
--- block/blk-mq-cpumap.c | 1 + drivers/scsi/scsi_lib.c | 10 ++++++++++ include/scsi/scsi_host.h | 8 ++++++++ 3 files changed, 19 insertions(+)
block/blk-mq-cpumap.c +1 -0
@@ -87,6 +87,7 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set)free_cpumask_var (cpus);return 0 ; } +EXPORT_SYMBOL_GPL (blk_mq_map_queues);/* * We have no quick way of doing reverse lookups. This is only used at
drivers/scsi/scsi_lib.c +10 -0
@@ -1990,6 +1990,15 @@ static void scsi_exit_request(void *data, struct request *rq,kfree (cmd->sense_buffer); } +static int scsi_map_queues (struct blk_mq_tag_set *set) +{ + struct Scsi_Host *shost = container_of(set, struct Scsi_Host, tag_set); + +if (shost->hostt->map_queues) +return shost->hostt->map_queues (shost); +return blk_mq_map_queues (set); +} +static u64 scsi_calculate_bounce_limit (struct Scsi_Host *shost) {struct device *host_dev;
@@ -2082,6 +2091,7 @@ static struct blk_mq_ops scsi_mq_ops = { .timeout = scsi_timeout, .init_request = scsi_init_request, .exit_request = scsi_exit_request, + .map_queues = scsi_map_queues, };struct request_queue *scsi_mq_alloc_queue (struct scsi_device *sdev)
include/scsi/scsi_host.h +8 -0
@@ -278,6 +278,14 @@ struct scsi_host_template {int (* change_queue_depth)(struct scsi_device *,int );/* +* This functions lets the driver expose the queue mapping +* to the block layer. +* +* Status: OPTIONAL +*/ +int (* map_queues)(struct Scsi_Host *shost); + +/* * This function determines the BIOS parameters for a given * harddisk. These tend to be numbers that are made up by * the host adapter. Parameters:
Signature · 1 line
2.1.4
Re: [PATCH 2/3] scsi: allow LLDDs to expose the queue mapping to blk-mq
Quoted 59 lines · Christoph Hellwig
Just hand through the blk-mq
map_queuesmethod in the host template.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-mq-cpumap.c | 1 + drivers/scsi/scsi_lib.c | 10 ++++++++++ include/scsi/scsi_host.h | 8 ++++++++ 3 files changed, 19 insertions(+)block/blk-mq-cpumap.c +1
-0@@ -87,6 +87,7 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set)free_cpumask_var (cpus);return 0 ; } +EXPORT_SYMBOL_GPL (blk_mq_map_queues);/* * We have no quick way of doing reverse lookups. This is only used at drivers/scsi/scsi_lib.c +10
-0@@ -1990,6 +1990,15 @@ static void scsi_exit_request(void *data, struct request *rq,kfree (cmd->sense_buffer); } +static int scsi_map_queues (struct blk_mq_tag_set *set) +{ + struct Scsi_Host *shost = container_of(set, struct Scsi_Host, tag_set); + +if (shost->hostt->map_queues) +return shost->hostt->map_queues (shost); +return blk_mq_map_queues (set); +} +static u64 scsi_calculate_bounce_limit (struct Scsi_Host *shost) {struct device *host_dev;@@ -2082,6 +2091,7 @@ static struct blk_mq_ops scsi_mq_ops = { .timeout = scsi_timeout, .init_request = scsi_init_request, .exit_request = scsi_exit_request, + .map_queues = scsi_map_queues, };struct request_queue *scsi_mq_alloc_queue (struct scsi_device *sdev)include/scsi/scsi_host.h +1
-0@@ -278,6 +278,14 @@ struct scsi_host_template {int (* change_queue_depth)(struct scsi_device *,int );/* +* This functions lets the driver expose the queue mapping
include/scsi/scsi_host.h struct scsi_host_template { · line 291
Quoted 10 lines
include/scsi/scsi_host.h +7
-0+* to the block layer. +* +* Status: OPTIONAL +*/ +int (* map_queues)(struct Scsi_Host *shost); + +/* * This function determines the BIOS parameters for a given * harddisk. These tend to be numbers that are made up by * the host adapter. Parameters:
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: J. Hawn, J. Guild, F. Imend�rffer, HRB 16746 (AG N�rnberg)
Re: [PATCH 2/3] scsi: allow LLDDs to expose the queue mapping to blk-mq
In reply to Christoph HellwigQuoted 14 lines · Christoph Hellwig
Just hand through the blk-mq
map_queuesmethod in the host template.Signed-off-by Christoph Hellwig <[email protected]>--- block/blk-mq-cpumap.c | 1 + drivers/scsi/scsi_lib.c | 10 ++++++++++ include/scsi/scsi_host.h | 8 ++++++++ 3 files changed, 19 insertions(+)block/blk-mq-cpumap.c +0
-0
block/blk-mq-cpumap.c int blk_mq_map_queues(struct blk_mq_tag_set *set) · line 93
Quoted 7 lines
block/blk-mq-cpumap.c +1
-0@@ -87,6 +87,7 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set)free_cpumask_var (cpus);return 0 ; } +EXPORT_SYMBOL_GPL (blk_mq_map_queues);/* * We have no quick way of doing reverse lookups. This is only used at
Shouldn't this hunk go into the previous patch?
Otherwise,
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 2/3] scsi: allow LLDDs to expose the queue mapping to blk-mq
Quoted 1 line · Johannes Thumshirn
Shouldn't this hunk go into the previous patch?
Yes, it should, thanks.
PATCH 3/3 smartpqi: switch to pci_alloc_irq_vectors
In reply to Christoph HellwigWhich cleans up a lot of the MSI-X handling, and allows us to use the PCI IRQ layer provided vector mapping, which we can then expose to blk-mq.
--- drivers/scsi/smartpqi/smartpqi.h | 2 - drivers/scsi/smartpqi/smartpqi_init.c | 102 +++++++++++----------------------- 2 files changed, 32 insertions(+), 72 deletions(-)
drivers/scsi/smartpqi/smartpqi.h +0 -2
@@ -929,8 +929,6 @@ struct pqi_ctrl_info {int max_msix_vectors;int num_msix_vectors_enabled;int num_msix_vectors_initialized; -u32 msix_vectors[PQI_MAX_MSIX_VECTORS ]; -void *intr_data[PQI_MAX_MSIX_VECTORS ];int event_irq;struct Scsi_Host *scsi_host;
drivers/scsi/smartpqi/smartpqi_init.c +32 -70
166 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH 3/3] smartpqi: switch to pci_alloc_irq_vectors
Quoted 9 lines · Christoph Hellwig
Which cleans up a lot of the MSI-X handling, and allows us to use the PCI IRQ layer provided vector mapping, which we can then expose to blk-mq.
Signed-off-by Christoph Hellwig <[email protected]>--- drivers/scsi/smartpqi/smartpqi.h | 2 - drivers/scsi/smartpqi/smartpqi_init.c | 102 +++++++++++----------------------- 2 files changed, 32 insertions(+), 72 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: J. Hawn, J. Guild, F. Imend�rffer, HRB 16746 (AG N�rnberg)
Re: [PATCH 3/3] smartpqi: switch to pci_alloc_irq_vectors
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
Which cleans up a lot of the MSI-X handling, and allows us to use the PCI IRQ layer provided vector mapping, which we can then expose to blk-mq.
Signed-off-by Christoph Hellwig <[email protected]>---
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Don Brace
Acked-byRE: [PATCH 3/3] smartpqi: switch to pci_alloc_irq_vectors
Quoted 20 lines
-----Original Message-----
From: Johannes Thumshirn [mailto:[email protected]]
Sent: Monday, October 17, 2016 2:34 AM
To: Christoph Hellwig
Cc: [email protected]; Don Brace; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 3/3] smartpqi: switch topci_alloc_irq_vectors=20
EXTERNAL EMAIL
=20
=20Quoted 2 lines · Christoph Hellwig
Which cleans up a lot of the MSI-X handling, and allows us to use the PCI IRQ layer provided vector mapping, which we can then expose to blk-
mq.
Quoted 3 lines
Signed-off-by Christoph Hellwig <[email protected]>---
=20
Quoted 8 lines
Reviewed-by Johannes Thumshirn <[email protected]>--
Johannes Thumshirn Storage
[email protected] +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N=FCrnberg
GF: Felix Imend=F6rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N=FCrnberg)
Key fingerprint =3D EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 3/3] smartpqi: switch to pci_alloc_irq_vectors
Hi Don,
did you also have a chance to test the patch and verify that the queues are properly set up with a smartpqi controller?
RE: [PATCH 3/3] smartpqi: switch to pci_alloc_irq_vectors
Quoted 16 lines
-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Monday, October 17, 2016 9:21 AM
To: Don Brace
Cc: Johannes Thumshirn; Christoph Hellwig; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 3/3] smartpqi: switch topci_alloc_irq_vectors=20
EXTERNAL EMAIL
=20
=20
Hi Don,
=20
did you also have a chance to test the patch and verify that the queues are properly set up with a smartpqi controller?
I need more time to test, I need to apply some other patches to fully test.
Don Brace
Tested-byRE: [PATCH 3/3] smartpqi: switch to pci_alloc_irq_vectors
In reply to Johannes ThumshirnQuoted 23 lines
-----Original Message-----
From: Don Brace
Sent: Monday, October 17, 2016 8:45 AM
To: 'Johannes Thumshirn'; Christoph Hellwig
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: RE: [PATCH 3/3] smartpqi: switch topci_alloc_irq_vectors=20
=20Quoted 14 lines
-----Original Message-----
From: Johannes Thumshirn [mailto:[email protected]]
Sent: Monday, October 17, 2016 2:34 AM
To: Christoph Hellwig
Cc: [email protected]; Don Brace; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 3/3] smartpqi: switch topci_alloc_irq_vectorsEXTERNAL EMAIL
Quoted 2 lines · Christoph Hellwig
Which cleans up a lot of the MSI-X handling, and allows us to use the PCI IRQ layer provided vector mapping, which we can then expose to bl=
k-
Quoted 13 lines
Quoted 5 lines
mq.
Quoted 3 lines
Signed-off-by Christoph Hellwig <[email protected]>---
Quoted 8 lines
Reviewed-by Johannes Thumshirn <[email protected]>--
Johannes Thumshirn Storage
[email protected] +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N=FCrnberg
GF: Felix Imend=F6rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N=FCrnberg)
Key fingerprint =3D EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Quoted 2 lines
=20
Acked-by Don Brace <[email protected]>
Quoted 8 lines · Christoph Hellwig
In 4.9 I've added support in the interrupt layer to automatically assign the interrupt affinity at interrupt allocation time, and expose that information to blk-mq.
This series extents that so that SCSI driver can pass on the information as well. The SCSI part is fairly trivial, although we need to also export the default queue mapping function in blk-mq to keep things simple.
Quoted 7 lines
I've also converted over the smartpqi driver as an example as it's the easiest of the multiqueue SCSI drivers to convert. I don't actually have smartpqi hardware, so that part will need additionaly testing.
(I've tested it with
virtio_scsi, but that requires a lot of virtio
changes not ready to post yet)
Very nice.
I've recently looked into exposing the multiqueue settings for fcoe/ixgbe, and figured that the SCSI part was indeed missing. Thanks for doing this.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: J. Hawn, J. Guild, F. Imend�rffer, HRB 16746 (AG N�rnberg)