linux/drivers/scsi
Ming Lei c66d4bd110 genirq/affinity: Add new callback for (re)calculating interrupt sets
The interrupt affinity spreading mechanism supports to spread out
affinities for one or more interrupt sets. A interrupt set contains one or
more interrupts. Each set is mapped to a specific functionality of a
device, e.g. general I/O queues and read I/O queus of multiqueue block
devices.

The number of interrupts per set is defined by the driver. It depends on
the total number of available interrupts for the device, which is
determined by the PCI capabilites and the availability of underlying CPU
resources, and the number of queues which the device provides and the
driver wants to instantiate.

The driver passes initial configuration for the interrupt allocation via a
pointer to struct irq_affinity.

Right now the allocation mechanism is complex as it requires to have a loop
in the driver to determine the maximum number of interrupts which are
provided by the PCI capabilities and the underlying CPU resources.  This
loop would have to be replicated in every driver which wants to utilize
this mechanism. That's unwanted code duplication and error prone.

In order to move this into generic facilities it is required to have a
mechanism, which allows the recalculation of the interrupt sets and their
size, in the core code. As the core code does not have any knowledge about the
underlying device, a driver specific callback is required in struct
irq_affinity, which can be invoked by the core code. The callback gets the
number of available interupts as an argument, so the driver can calculate the
corresponding number and size of interrupt sets.

At the moment the struct irq_affinity pointer which is handed in from the
driver and passed through to several core functions is marked 'const', but for
the callback to be able to modify the data in the struct it's required to
remove the 'const' qualifier.

Add the optional callback to struct irq_affinity, which allows drivers to
recalculate the number and size of interrupt sets and remove the 'const'
qualifier.

For simple invocations, which do not supply a callback, a default callback
is installed, which just sets nr_sets to 1 and transfers the number of
spreadable vectors to the set_size array at index 0.

This is for now guarded by a check for nr_sets != 0 to keep the NVME driver
working until it is converted to the callback mechanism.

To make sure that the driver configuration is correct under all circumstances
the callback is invoked even when there are no interrupts for queues left,
i.e. the pre/post requirements already exhaust the numner of available
interrupts.

At the PCI layer irq_create_affinity_masks() has to be invoked even for the
case where the legacy interrupt is used. That ensures that the callback is
invoked and the device driver can adjust to that situation.

[ tglx: Fixed the simple case (no sets required). Moved the sanity check
  	for nr_sets after the invocation of the callback so it catches
  	broken drivers. Fixed the kernel doc comments for struct
  	irq_affinity and de-'This patch'-ed the changelog ]

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org
Cc: linux-pci@vger.kernel.org
Cc: Keith Busch <keith.busch@intel.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
Link: https://lkml.kernel.org/r/20190216172228.512444498@linutronix.de
2019-02-18 11:21:28 +01:00
..
aacraid scsi: communicate max segment size to the DMA mapping code 2019-01-22 20:40:59 -05:00
aic7xxx scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
aic94xx scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
arcmsr cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
arm scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
be2iscsi genirq/affinity: Add new callback for (re)calculating interrupt sets 2019-02-18 11:21:28 +01:00
bfa cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
bnx2fc SCSI fixes on 20190201 2019-02-02 10:12:53 -08:00
bnx2i cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
csiostor SCSI fixes on 20190125 2019-01-26 15:03:43 -08:00
cxgbi scsi: cxgb4i: add wait_for_completion() 2019-01-11 22:33:49 -05:00
cxlflash SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
device_handler scsi: return blk_status_t from device handler ->prep_fn 2018-11-09 19:17:14 -07:00
dpt
esas2r scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
fcoe scsi: fcoe: remove set but not used variable 'port' 2018-12-20 19:46:20 -05:00
fnic SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
hisi_sas scsi: hisi_sas: Set protection parameters prior to adding SCSI host 2019-01-11 21:38:43 -05:00
ibmvscsi scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ibmvscsi_tgt scsi: target: replace fabric_ops.name with fabric_alias 2018-11-28 18:50:59 -05:00
isci scsi: isci: initialize shost fully before calling scsi_add_host() 2019-01-08 22:27:24 -05:00
libfc scsi: libfc: free skb when receiving invalid flogi resp 2019-01-29 01:19:25 -05:00
libsas SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
lpfc SCSI fixes on 20190125 2019-01-26 15:03:43 -08:00
megaraid SCSI fixes on 20190118 2019-01-20 09:15:04 +12:00
mpt3sas scsi: mpt3sas: mpt3sas_scsih: Mark expected switch fall-through 2018-12-20 19:48:07 -05:00
mvsas scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
osd block: remove __blk_put_request() 2018-11-07 13:42:32 -07:00
pcmcia scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
pm8001 SCSI fixes on 20190118 2019-01-20 09:15:04 +12:00
qedf cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
qedi SCSI fixes on 20190118 2019-01-20 09:15:04 +12:00
qla2xxx SCSI fixes on 20190118 2019-01-20 09:15:04 +12:00
qla4xxx SCSI fixes on 20190118 2019-01-20 09:15:04 +12:00
smartpqi SCSI fixes on 20190118 2019-01-20 09:15:04 +12:00
snic scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
sym53c8xx_2 scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ufs scsi: ufs: Use explicit access size in ufshcd_dump_regs 2019-01-22 21:11:40 -05:00
.gitignore
3w-9xxx.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
3w-9xxx.h
3w-sas.c cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
3w-sas.h
3w-xxxx.c scsi: 3w-xxxx: fix indentation issue, add missing tab 2018-12-19 21:54:07 -05:00
3w-xxxx.h scsi: 3w-xxx: fully convert to the generic DMA API 2018-10-17 21:58:51 -04:00
53c700_d.h_shipped
53c700.c scsi: 53c700: pass correct "dev" to dma_alloc_attrs() 2019-01-29 01:33:00 -05:00
53c700.h scsi: 53c700: Fix spelling of 'NEGOTIATION' 2018-08-30 07:27:22 -04:00
53c700.scr
a100u2w.c cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
a100u2w.h
a2091.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
a2091.h
a3000.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
a3000.h
a4000t.c
advansys.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
aha152x.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
aha152x.h
aha1542.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
aha1542.h
aha1740.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
aha1740.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
am53c974.c scsi: esp_scsi: move dma mapping into the core code 2018-10-15 23:00:38 -04:00
atari_scsi.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
atp870u.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
atp870u.h
BusLogic.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
BusLogic.h
bvme6000_scsi.c
ch.c scsi: core: check for equality of result byte values 2018-06-26 12:27:06 -04:00
constants.c
dc395x.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
dc395x.h
dmx3191d.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
dpt_i2o.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
dpti.h scsi: dpt_i2o: stop using scsi_unregister 2018-03-15 00:25:37 -04:00
esp_scsi.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
esp_scsi.h scsi: esp_scsi: De-duplicate PIO routines 2018-10-17 21:38:20 -04:00
FlashPoint.c scsi: FlashPoint: Remove unnecessary parentheses 2018-09-25 20:45:53 -04:00
g_NCR5380.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
gdth_ioctl.h
gdth_proc.c scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
gdth_proc.h
gdth.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
gdth.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
gvp11.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
gvp11.h
hosts.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
hpsa_cmd.h
hpsa.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
hpsa.h scsi: hpsa: correct enclosure sas address 2018-07-10 22:25:03 -04:00
hptiop.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
hptiop.h
imm.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
imm.h
initio.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
initio.h
ipr.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ipr.h scsi: ipr: System hung while dlpar adding primary ipr adapter back 2018-09-21 12:35:39 -04:00
ips.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
ips.h scsi: ips: properly handle 64-bit DMA 2018-11-06 21:31:28 -05:00
iscsi_boot_sysfs.c
iscsi_tcp.c scsi: iscsi: Capture iscsi debug messages using tracepoints 2018-12-20 20:03:55 -05:00
iscsi_tcp.h
jazz_esp.c scsi: esp_scsi: move dma mapping into the core code 2018-10-15 23:00:38 -04:00
Kconfig Linux 4.20-rc3 2018-11-18 15:46:03 -07:00
lasi700.c
libiscsi_tcp.c scsi: iscsi: Capture iscsi debug messages using tracepoints 2018-12-20 20:03:55 -05:00
libiscsi.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
mac53c94.c scsi: mac53c94: remove DISABLE_CLUSTERING 2018-12-18 23:13:12 -05:00
mac53c94.h
mac_esp.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
mac_scsi.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
Makefile scsi: myrs: Add Mylex RAID controller (SCSI interface) 2018-10-17 21:07:54 -04:00
megaraid.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
megaraid.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
mesh.c cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
mesh.h
mvme16x_scsi.c
mvme147.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
mvme147.h
mvumi.c cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
mvumi.h
myrb.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
myrb.h scsi: myrb: Add Mylex RAID controller (block interface) 2018-10-17 21:06:49 -04:00
myrs.c scsi: myrs: remove the dma_boundary_limit 2018-12-19 21:43:30 -05:00
myrs.h scsi: myrs: Add Mylex RAID controller (SCSI interface) 2018-10-17 21:07:54 -04:00
ncr53c8xx.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ncr53c8xx.h
NCR5380.c scsi: NCR5380: Return false instead of NULL 2018-11-05 22:47:38 -05:00
NCR5380.h scsi: NCR5380: Have NCR5380_select() return a bool 2018-09-28 02:17:51 -04:00
nsp32_debug.c scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
nsp32_io.h
nsp32.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
nsp32.h
osst_detect.h
osst_options.h
osst.c block: remove __blk_put_request() 2018-11-07 13:42:32 -07:00
osst.h
pmcraid.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
pmcraid.h scsi: pmcraid: Use sgl_alloc_order() and sgl_free_order() 2018-02-13 21:49:15 -05:00
ppa.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
ppa.h
ps3rom.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qla1280.c scsi: qla1280: set 64bit coherent mask 2019-01-11 22:30:51 -05:00
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
qlogicpti.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
qlogicpti.h
raid_class.c scsi: raid_attrs: fix unused variable warning 2018-08-30 07:21:04 -04:00
script_asm.pl
scsi_common.c
scsi_debug.c scsi: scsi_debug: fix write_same with virtual_gb problem 2019-01-29 01:24:31 -05:00
scsi_debugfs.c scsi: devinfo: use const_ilog2 for array indices 2018-04-20 19:14:28 -04:00
scsi_debugfs.h
scsi_devinfo.c scsi: devinfo: BLIST_RETRY_ASC_C1 for Fujitsu ETERNUS 2018-04-20 19:14:36 -04:00
scsi_dh.c scsi: scsi_dh: replace too broad "TP9" string with the exact models 2018-04-18 19:34:08 -04:00
scsi_error.c scsi: Do not rely on blk-mq for double completions 2018-11-26 10:34:26 -07:00
scsi_ioctl.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
scsi_lib_dma.c
scsi_lib.c scsi: communicate max segment size to the DMA mapping code 2019-01-22 20:40:59 -05:00
scsi_logging.c
scsi_logging.h
scsi_netlink.c
scsi_pm.c scsi: core: Synchronize request queue PM status only on successful resume 2019-01-08 21:57:26 -05:00
scsi_priv.h scsi: kill off the legacy IO path 2018-11-07 13:42:32 -07:00
scsi_proc.c
scsi_sas_internal.h
scsi_scan.c scsi: kill off the legacy IO path 2018-11-07 13:42:32 -07:00
scsi_sysctl.c
scsi_sysfs.c scsi: kill off the legacy IO path 2018-11-07 13:42:32 -07:00
scsi_trace.c
scsi_transport_api.h
scsi_transport_fc.c bsg: convert to use blk-mq 2018-11-07 13:42:32 -07:00
scsi_transport_iscsi.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
scsi_transport_sas.c bsg: provide bsg_remove_queue() helper 2018-11-07 13:42:32 -07:00
scsi_transport_spi.c scsi: core: check for equality of result byte values 2018-06-26 12:27:06 -04:00
scsi_transport_srp.c for-4.18/block-20180603 2018-06-04 07:58:06 -07:00
scsi.c scsi: kill off the legacy IO path 2018-11-07 13:42:32 -07:00
scsi.h scsi: core: remove Scsi_Cmnd typedef 2018-06-19 22:02:25 -04:00
scsicam.c
sd_dif.c block: move dif_prepare/dif_complete functions to block layer 2018-07-30 08:27:02 -06:00
sd_zbc.c scsi: return blk_status_t from scsi_init_io and ->init_command 2018-11-09 19:17:14 -07:00
sd.c scsi: sd: Fix cache_type_store() 2019-01-08 21:57:25 -05:00
sd.h scsi: return blk_status_t from scsi_init_io and ->init_command 2018-11-09 19:17:14 -07:00
sense_codes.h
ses.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
sg.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
sgiwd93.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
sim710.c
sni_53c710.c
sr_ioctl.c block: Switch struct packet_command to use struct scsi_sense_hdr 2018-08-02 15:22:13 -06:00
sr_vendor.c
sr.c scsi: return blk_status_t from scsi_init_io and ->init_command 2018-11-09 19:17:14 -07:00
sr.h
st_options.h
st.c block: remove __blk_put_request() 2018-11-07 13:42:32 -07:00
st.h
stex.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
storvsc_drv.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
sun3_scsi_vme.c
sun3_scsi.c scsi: remove the use_clustering flag 2018-12-18 23:19:21 -05:00
sun3x_esp.c scsi: esp_scsi: move dma mapping into the core code 2018-10-15 23:00:38 -04:00
sun_esp.c scsi: sun_esp: Use of_node_name_eq for node name comparisons 2018-12-07 21:56:06 -05:00
virtio_scsi.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
vmw_pvscsi.c SCSI misc on 20181224 2018-12-28 14:48:06 -08:00
vmw_pvscsi.h
wd33c93.c
wd33c93.h
wd719x.c scsi: flip the default on use_clustering 2018-12-18 23:13:12 -05:00
wd719x.h scsi: wd719x: use per-command private data 2018-11-15 14:27:08 -05:00
xen-scsifront.c scsi: xen-scsifront: remove DISABLE_CLUSTERING 2018-12-18 23:13:12 -05:00
zalon.c
zorro7xx.c
zorro_esp.c scsi: esp_scsi: De-duplicate PIO routines 2018-10-17 21:38:20 -04:00