[PATCH] rescan-scsi-bus.sh: use LUN wildcard in idlist
By scanning for LUN 0 only, we may encounter a device that the kernel won't add (e.g. peripheral device type 31) and which may thus never appear in sysfs for us to use for REPORT LUNS. That causes LUN additions for such devices to be missed by "rescan-iscsi-bus.sh -a". Signed-off-by: Martin Wilck --- scripts/rescan-scsi-bus.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh index 6989208..a2aa8d8 100755 --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh @@ -376,7 +376,7 @@ idlist () oldlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq) # Rescan LUN 0 to check if we found new targets - echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan + echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan newlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq) for newid in $newlist ; do oldid=$newid -- 2.19.1
Submit Proposals to the 2019 Linux Storage and Filesystems Conference!
After a one-year hiatus, the Linux Storage and Filesystems Conference (Vault) returns in 2019, under the sponsorship and organization of the USENIX Association. Vault brings together practitioners, implementers, users, and researchers working on storage in open source and related projects. We welcome creators and users of open source storage, file systems, and related technologies to submit their work and to join us for Vault '19, which will take place on February 25 - 26, 2019, in Boston, MA, USA, and will be co-located with the 17th USENIX Conference on File and Storage Technologies (FAST '19). Learn More about Vault '19: https://www.usenix.org/conference/vault19 Learn More about FAST '19: https://www.usenix.org/conference/fast19 We are looking for proposals on a diverse range of topics related to storage, Linux, and open source. The best talks will share your or your team's experience with a new technology, a new idea, a new approach, or inspire the audience to think beyond the ways they have always done things. We are also accepting proposals for a limited number of workshop sessions, where content can be more like a tutorial in nature or include hands-on participation by attendees. We encourage new speakers to submit talks as some of the most insightful talks often come from people with new experiences to share. Previous Vault events have drawn multiple hundreds of attendees from a range of companies, with backgrounds ranging from individual open source contributors, to new startups, through teams within the technology and storage giants, or storage end users. Talk and workshop proposals are due on Thursday, November 15, 2018. Please read through the Call for Participation for additional details, including topics of interest, and submission instructions. View the Vault '19 Call for Participation: https://www.usenix.org/conference/vault19/call-for-participation We look forward to receiving your proposals! Christoph Hellwig Erik Riedel Ric Wheeler, Red Hat vault19cha...@usenix.org
Re: [PATCH v3 2/5] qla2xxx_nvmet: Add files for FC-NVMe Target support
On 9/28/2018 3:46 PM, Himanshu Madhani wrote: + .target_features= NVMET_FCTGTFEAT_READDATA_RSP | + NVMET_FCTGTFEAT_CMD_IN_ISR | + NVMET_FCTGTFEAT_OPDONE_IN_ISR, Himanshu, I'm looking at these but had a quick question. Did you really want the IN_ISR flags set ? they schedule processing vs calling the nvmet routines inline. The intent was the queueing was only needed if in the hard isr routine. Last contact I had with your group said you were in soft isr routines and inline calling would be used. I'm asking because I had intended to remove these flags/features. -- james
Re: [PATCH] bsg: convert to use blk-mq
On 10/23/18 12:07 PM, Jens Axboe wrote: > On 10/23/18 11:40 AM, Benjamin Block wrote: >> On Mon, Oct 22, 2018 at 06:38:36AM -0600, Jens Axboe wrote: >>> On 10/22/18 4:03 AM, Benjamin Block wrote: On Fri, Oct 19, 2018 at 09:50:53AM -0600, Jens Axboe wrote: Ok so, that gets past the stage where we initialize the queues. Simple SCSI-I/O also seems to work, that is for example an INQUIRY(10), but transport commands that get passed to the driver break. Tried to send a FibreChannel GPN_FT (remote port discovery). As the BSG interface goes. This is a bidirectional command, that has both a buffer for the request and for the reply. AFAIR BSG will create a struct request for each of them. Protocol is BSG_PROTOCOL_SCSI, Subprotocol BSG_SUB_PROTOCOL_SCSI_TRANSPORT. The rest should be transparent till we get into the driver. First got this: [ 566.531100] BUG: sleeping function called from invalid context at mm/slab.h:421 [ 566.531452] in_atomic(): 1, irqs_disabled(): 0, pid: 3104, name: bsg_api_test [ 566.531460] 1 lock held by bsg_api_test/3104: [ 566.531466] #0: cb4b58e8 (rcu_read_lock){}, at: hctx_lock+0x30/0x118 [ 566.531498] Preemption disabled at: [ 566.531503] [<008175d0>] __blk_mq_delay_run_hw_queue+0x50/0x218 [ 566.531519] CPU: 3 PID: 3104 Comm: bsg_api_test Tainted: GW 4.19.0-rc6-bb-next+ #1 [ 566.531527] Hardware name: IBM 3906 M03 704 (LPAR) [ 566.531533] Call Trace: [ 566.531544] ([<001167fa>] show_stack+0x8a/0xd8) [ 566.531555] [<00bcc6d2>] dump_stack+0x9a/0xd8 [ 566.531565] [<00196410>] ___might_sleep+0x280/0x298 [ 566.531576] [<003e528c>] __kmalloc+0xbc/0x560 [ 566.531584] [<0083186a>] bsg_map_buffer+0x5a/0xb0 [ 566.531591] [<00831948>] bsg_queue_rq+0x88/0x118 [ 566.531599] [<0081ab56>] blk_mq_dispatch_rq_list+0x37e/0x670 [ 566.531607] [<0082050e>] blk_mq_do_dispatch_sched+0x11e/0x130 [ 566.531615] [<00820dfe>] blk_mq_sched_dispatch_requests+0x156/0x1a0 [ 566.531622] [<00817564>] __blk_mq_run_hw_queue+0x144/0x160 [ 566.531630] [<00817614>] __blk_mq_delay_run_hw_queue+0x94/0x218 [ 566.531638] [<008178b2>] blk_mq_run_hw_queue+0xda/0xf0 [ 566.531645] [<008211d8>] blk_mq_sched_insert_request+0x1a8/0x1e8 [ 566.531653] [<00811ee2>] blk_execute_rq_nowait+0x72/0x80 [ 566.531660] [<00811f66>] blk_execute_rq+0x76/0xb8 [ 566.531778] [<00830d0e>] bsg_ioctl+0x426/0x500 [ 566.531787] [<00440cb4>] do_vfs_ioctl+0x68c/0x710 [ 566.531794] [<00440dac>] ksys_ioctl+0x74/0xa0 [ 566.531801] [<00440e0a>] sys_ioctl+0x32/0x40 [ 566.531808] [<00bf1dd0>] system_call+0xd8/0x2d0 [ 566.531815] 1 lock held by bsg_api_test/3104: [ 566.531821] #0: cb4b58e8 (rcu_read_lock){}, at: hctx_lock+0x30/0x118 >>> >>> The first one is an easy fix, not sure how I missed that. The other >>> one I have no idea, any chance you could try with this one: >>> >>> http://git.kernel.dk/cgit/linux-block/commit/?h=mq-conversions&id=142dc9f36e3113b6a76d472978c33c8c2a2b702c >>> >>> which fixes the first one, and also corrects a wrong end_io call, >>> but I don't think that's the cause of the above. >>> >>> If it crashes, can you figure out where in the source that is? >>> Basically just do >>> >>> gdb vmlinux >>> l *zfcp_fc_exec_bsg_job+0x116 >>> >>> assuming that works fine on s390 :-) >>> >> >> So I tried 4.19.0 with only the two patches from you: >> http://git.kernel.dk/cgit/linux-block/commit/?h=mq-conversions&id=2b2ffa16193e9a69a076595ed64429b8cc9b42aa >> http://git.kernel.dk/cgit/linux-block/commit/?h=mq-conversions&id=142dc9f36e3113b6a76d472978c33c8c2a2b702c >> >> This fixed the first warning from before, as you suggested, but it still >> crash like this: >> >> [ ] Unable to handle kernel pointer dereference in virtual kernel address >> space >> [ ] Failing address: TEID: 0483 >> [ ] Fault in home space mode while using kernel ASCE. >> [ ] AS:025f0007 R3:dffb8007 S:dffbf000 >> P:013d >> [ ] Oops: 0004 ilc:3 [#1] PREEMPT SMP DEBUG_PAGEALLOC >> [ ] Modules linked in: >> [ ] CPU: 2 PID: 609 Comm: kworker/2:1H Kdump: loaded Tainted: GW >> 4.19.0-bb-next+ #1 >> [ ] Hardware name: IBM 3906 M03 704 (LPAR) >> [ ] Workqueue: kblockd blk_mq_run_work_fn >> [ ] Krnl PSW : 0704e0018000 03ff806a6b40 >> (zfcp_fc_exec_bsg_job+0x1c0/0x440 [zfcp]) >> [ ]R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0 RI:0 EA:3 >> [ ] Krnl GPRS: 83e0f3c0 >> 0300 >> [ ]0300 0
[PATCH 0/2]mpt3sas: Update MPI headers to support Aero controllers.
Updating MPI headers to the latest version 2.6.7 to add support to the driver to detect new 3816 and 3916 chip based controllers. Seperate out firmware image data from mpi2_ioc.h to new file mpi2_image.h Suganath Prabu (2): mpt3sas: Update MPI headers to support Aero controllers. mpt3sas: Add support to Aero PCI IDs. drivers/scsi/mpt3sas/mpi/mpi2.h | 17 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 94 +-- drivers/scsi/mpt3sas/mpi/mpi2_image.h | 507 ++ drivers/scsi/mpt3sas/mpi/mpi2_init.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 359 +--- drivers/scsi/mpt3sas/mpi/mpi2_pci.h | 11 +- drivers/scsi/mpt3sas/mpi/mpi2_raid.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_sas.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 72 - drivers/scsi/mpt3sas/mpt3sas_base.h | 1 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 26 ++ 11 files changed, 705 insertions(+), 388 deletions(-) create mode 100644 drivers/scsi/mpt3sas/mpi/mpi2_image.h -- 1.8.3.1
[PATCH 1/2] mpt3sas: Update MPI headers to support Aero controllers.
Updating MPI headers to the latest version 2.6.7 to add support to the driver to detect the new 3816 and 3916 chip based controllers. Separate out firmware image data from mpi2_ioc.h to new file mpi2_image.h Signed-off-by: Suganath Prabu --- drivers/scsi/mpt3sas/mpi/mpi2.h | 17 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 94 +-- drivers/scsi/mpt3sas/mpi/mpi2_image.h | 507 ++ drivers/scsi/mpt3sas/mpi/mpi2_init.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 359 +--- drivers/scsi/mpt3sas/mpi/mpi2_pci.h | 11 +- drivers/scsi/mpt3sas/mpi/mpi2_raid.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_sas.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 72 - 9 files changed, 678 insertions(+), 388 deletions(-) create mode 100644 drivers/scsi/mpt3sas/mpi/mpi2_image.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h index 1e45268..7efd17a 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * Copyright 2000-2015 Avago Technologies. All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2.h @@ -9,7 +9,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.50 + * mpi2.h Version: 02.00.53 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -116,7 +116,12 @@ * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * 06-13-17 02.00.49 Bumped MPI2_HEADER_VERSION_UNIT. * 09-29-17 02.00.50 Bumped MPI2_HEADER_VERSION_UNIT. - * -- + * 07-22-18 02.00.51 Added SECURE_BOOT define. + * Bumped MPI2_HEADER_VERSION_UNIT + * 08-15-18 02.00.52 Bumped MPI2_HEADER_VERSION_UNIT. + * 08-28-18 02.00.53 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI2_IOCSTATUS_FAILURE + * -- */ #ifndef MPI2_H @@ -156,7 +161,7 @@ /* Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT(0x32) +#define MPI2_HEADER_VERSION_UNIT(0x35) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) @@ -257,6 +262,8 @@ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS { */ #define MPI2_HOST_DIAGNOSTIC_OFFSET (0x0008) +#define MPI26_DIAG_SECURE_BOOT (0x8000) + #define MPI2_DIAG_SBR_RELOAD(0x2000) #define MPI2_DIAG_BOOT_DEVICE_SELECT_MASK (0x1800) @@ -687,7 +694,9 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UNION { #define MPI2_IOCSTATUS_INVALID_FIELD(0x0007) #define MPI2_IOCSTATUS_INVALID_STATE(0x0008) #define MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED (0x0009) +/*MPI v2.6 and later */ #define MPI2_IOCSTATUS_INSUFFICIENT_POWER (0x000A) +#define MPI2_IOCSTATUS_FAILURE (0x000F) / * Config IOCStatus values diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index 5122920..398fa6f 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -1,13 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * Copyright 2000-2015 Avago Technologies. All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2_cnfg.h * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - *mpi2_cnfg.h Version: 02.00.42 + *mpi2_cnfg.h Version: 02.00.46 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -231,6 +231,18 @@ * Added NOIOB field to PCIe Device Page 2. * Added MPI26_PCIEDEV2_CAP_DATA_BLK_ALIGN_AND_GRAN to * the Capabilities field of PCIe Device Page 2. + * 07-22-18 02.00.43 Added defines for SAS3916 and SAS3816. + * Added WRiteCache defines to IO Unit Page 1. + * Added MaxEnclosureLevel to BIOS Page 1. + * Added OEMRD to SAS Enclosure Page 1. + * Added DMDReportPCIe to PCIe IO Unit Page 1. + * Added Flags field and flags for Retimers to + * PCIe Switch Page 1. + * 08-02-18 02.00.44 Added Slotx2, Slotx4 to ManPage 7. + * 08-15-18 02.00.45 Added ProductSpecific field at end of IOC Page 1 + * 08-28-18 02.00.46 Added NVMs
[PATCH 2/2] mpt3sas: Add support to Aero PCI IDs.
Add support for Aero/Sea controllers and add warning for configurable secure type IOC. Signed-off-by: Suganath Prabu --- drivers/scsi/mpt3sas/mpt3sas_base.h | 1 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 26 ++ 2 files changed, 27 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 7fdaf29..b11f5f5 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -55,6 +55,7 @@ #include "mpi/mpi2_tool.h" #include "mpi/mpi2_sas.h" #include "mpi/mpi2_pci.h" +#include "mpi/mpi2_image.h" #include #include diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index df56cbe..5001439 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -10284,6 +10284,10 @@ _scsih_determine_hba_mpi_version(struct pci_dev *pdev) case MPI26_MFGPAGE_DEVID_SAS3516_1: case MPI26_MFGPAGE_DEVID_SAS3416: case MPI26_MFGPAGE_DEVID_SAS3616: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3916: + case MPI26_MFGPAGE_DEVID_HARD_SEC_3916: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3816: + case MPI26_MFGPAGE_DEVID_HARD_SEC_3816: return MPI26_VERSION; } return 0; @@ -10369,6 +10373,11 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) case MPI26_MFGPAGE_DEVID_SAS3516_1: case MPI26_MFGPAGE_DEVID_SAS3416: case MPI26_MFGPAGE_DEVID_SAS3616: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3816: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3916: + ioc_warn(ioc, "HBA is in Configurable Secure mode\n"); + case MPI26_MFGPAGE_DEVID_HARD_SEC_3816: + case MPI26_MFGPAGE_DEVID_HARD_SEC_3916: ioc->is_gen35_ioc = 1; break; default: @@ -10830,6 +10839,23 @@ static const struct pci_device_id mpt3sas_pci_table[] = { /* Mercator ~ 3616*/ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3616, PCI_ANY_ID, PCI_ANY_ID }, + + /* Aero SI 0x00E1 Configurable Secure +* 0x00E2 Hard Secure +*/ + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_CFG_SEC_3916, + PCI_ANY_ID, PCI_ANY_ID }, + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_HARD_SEC_3916, + PCI_ANY_ID, PCI_ANY_ID }, + + /* Sea SI 0x00E5 Configurable Secure +* 0x00E6 Hard Secure +*/ + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_CFG_SEC_3816, + PCI_ANY_ID, PCI_ANY_ID }, + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_HARD_SEC_3816, + PCI_ANY_ID, PCI_ANY_ID }, + {0} /* Terminating entry */ }; MODULE_DEVICE_TABLE(pci, mpt3sas_pci_table); -- 1.8.3.1
Re: [PATCH 1/2] mpt3sas: Update MPI headers to support Aero controllers.
Hi Suganath, I love your patch! Yet something to improve: [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.19 next-20181019] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Suganath-Prabu/mpt3sas-Update-MPI-headers-to-support-Aero-controllers/20181025-181347 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: x86_64-randconfig-x014-201842 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: the linux-review/Suganath-Prabu/mpt3sas-Update-MPI-headers-to-support-Aero-controllers/20181025-181347 HEAD 0d477ec5db33da0ceaa200504780c2962def87db builds fine. It only hurts bisectibility. All error/warnings (new ones prefixed by >>): drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_display_fwpkg_version': >> drivers/scsi/mpt3sas/mpt3sas_base.c:3761:2: error: unknown type name >> 'Mpi2FWImageHeader_t'; did you mean 'Mpi2ConfigPageHeader_t'? Mpi2FWImageHeader_t *FWImgHdr; ^~~ Mpi2ConfigPageHeader_t >> drivers/scsi/mpt3sas/mpt3sas_base.c:3777:23: error: 'Mpi2FWImageHeader_t' >> undeclared (first use in this function); did you mean >> 'Mpi2ConfigPageHeader_t'? data_length = sizeof(Mpi2FWImageHeader_t); ^~~ Mpi2ConfigPageHeader_t drivers/scsi/mpt3sas/mpt3sas_base.c:3777:23: note: each undeclared identifier is reported only once for each function it appears in >> drivers/scsi/mpt3sas/mpt3sas_base.c:3821:38: error: expected expression >> before ')' token FWImgHdr = (Mpi2FWImageHeader_t *)fwpkg_data; ^ In file included from include/linux/export.h:45:0, from include/linux/linkage.h:7, from include/linux/kernel.h:7, from drivers/scsi/mpt3sas/mpt3sas_base.c:46: >> drivers/scsi/mpt3sas/mpt3sas_base.c:3822:17: error: request for member >> 'PackageVersion' in something not a structure or union if (FWImgHdr->PackageVersion.Word) { ^ include/linux/compiler.h:58:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3822:5: note: in expansion of macro 'if' if (FWImgHdr->PackageVersion.Word) { ^~ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3822:17: error: request for member >> 'PackageVersion' in something not a structure or union if (FWImgHdr->PackageVersion.Word) { ^ include/linux/compiler.h:58:42: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3822:5: note: in expansion of macro 'if' if (FWImgHdr->PackageVersion.Word) { ^~ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3822:17: error: request for member >> 'PackageVersion' in something not a structure or union if (FWImgHdr->PackageVersion.Word) { ^ include/linux/compiler.h:69:16: note: in definition of macro '__trace_if' __r = !!(cond); \ ^~~~ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3822:5: note: in expansion of macro 'if' if (FWImgHdr->PackageVersion.Word) { ^~ In file included from include/linux/kernel.h:14:0, from drivers/scsi/mpt3sas/mpt3sas_base.c:46: drivers/scsi/mpt3sas/mpt3sas_base.c:3824:16: error: request for member 'PackageVersion' in something not a structure or union FWImgHdr->PackageVersion.Struct.Major, ^ include/linux/printk.h:315:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3823:6: note: in expansion of macro >> 'ioc_info' ioc_info(ioc, "FW Package Version (%02d.%02d.%02d.%02d)\n", ^~~~ drivers/scsi/mpt3sas/mpt3sas_base.c:3825:16: error: request for member 'PackageVersion' in something not a structure or union FWImgHdr->PackageVersion.Struct.Minor, ^ include/linux/printk.h:315:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~ >&g
[Resend 0/2] mpt3sas: Add support to Aero controllers.
1) Updated MPI headers to the latest version 2.6.7. 2) Added support for Aero/Sea controllers. Suganath Prabu (2): mpt3sas: Update MPI headers to support Aero controllers. mpt3sas: Add support to Aero PCI IDs. drivers/scsi/mpt3sas/mpi/mpi2.h | 17 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 94 +-- drivers/scsi/mpt3sas/mpi/mpi2_image.h | 507 ++ drivers/scsi/mpt3sas/mpi/mpi2_init.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 359 +--- drivers/scsi/mpt3sas/mpi/mpi2_pci.h | 11 +- drivers/scsi/mpt3sas/mpi/mpi2_raid.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_sas.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 72 - drivers/scsi/mpt3sas/mpt3sas_base.h | 1 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 26 ++ 11 files changed, 705 insertions(+), 388 deletions(-) create mode 100644 drivers/scsi/mpt3sas/mpi/mpi2_image.h -- 1.8.3.1
[Resend 2/2] mpt3sas: Add support to Aero PCI IDs.
Add support for Aero/Sea controllers and add warning for configurable secure type IOC. Signed-off-by: Suganath Prabu --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index df56cbe..5001439 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -10284,6 +10284,10 @@ _scsih_determine_hba_mpi_version(struct pci_dev *pdev) case MPI26_MFGPAGE_DEVID_SAS3516_1: case MPI26_MFGPAGE_DEVID_SAS3416: case MPI26_MFGPAGE_DEVID_SAS3616: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3916: + case MPI26_MFGPAGE_DEVID_HARD_SEC_3916: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3816: + case MPI26_MFGPAGE_DEVID_HARD_SEC_3816: return MPI26_VERSION; } return 0; @@ -10369,6 +10373,11 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) case MPI26_MFGPAGE_DEVID_SAS3516_1: case MPI26_MFGPAGE_DEVID_SAS3416: case MPI26_MFGPAGE_DEVID_SAS3616: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3816: + case MPI26_MFGPAGE_DEVID_CFG_SEC_3916: + ioc_warn(ioc, "HBA is in Configurable Secure mode\n"); + case MPI26_MFGPAGE_DEVID_HARD_SEC_3816: + case MPI26_MFGPAGE_DEVID_HARD_SEC_3916: ioc->is_gen35_ioc = 1; break; default: @@ -10830,6 +10839,23 @@ static const struct pci_device_id mpt3sas_pci_table[] = { /* Mercator ~ 3616*/ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3616, PCI_ANY_ID, PCI_ANY_ID }, + + /* Aero SI 0x00E1 Configurable Secure +* 0x00E2 Hard Secure +*/ + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_CFG_SEC_3916, + PCI_ANY_ID, PCI_ANY_ID }, + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_HARD_SEC_3916, + PCI_ANY_ID, PCI_ANY_ID }, + + /* Sea SI 0x00E5 Configurable Secure +* 0x00E6 Hard Secure +*/ + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_CFG_SEC_3816, + PCI_ANY_ID, PCI_ANY_ID }, + { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_HARD_SEC_3816, + PCI_ANY_ID, PCI_ANY_ID }, + {0} /* Terminating entry */ }; MODULE_DEVICE_TABLE(pci, mpt3sas_pci_table); -- 1.8.3.1
[Resend 1/2] mpt3sas: Update MPI headers to support Aero controllers.
Updating MPI headers to the latest version 2.6.7 to add support to the driver to detect the new 3816 and 3916 chip based controllers. Separate out firmware image data from mpi2_ioc.h to new file mpi2_image.h Signed-off-by: Suganath Prabu --- drivers/scsi/mpt3sas/mpi/mpi2.h | 17 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 94 +-- drivers/scsi/mpt3sas/mpi/mpi2_image.h | 507 ++ drivers/scsi/mpt3sas/mpi/mpi2_init.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 359 +--- drivers/scsi/mpt3sas/mpi/mpi2_pci.h | 11 +- drivers/scsi/mpt3sas/mpi/mpi2_raid.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_sas.h | 2 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 72 - drivers/scsi/mpt3sas/mpt3sas_base.h | 1 + 10 files changed, 679 insertions(+), 388 deletions(-) create mode 100644 drivers/scsi/mpt3sas/mpi/mpi2_image.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h index 1e45268..7efd17a 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * Copyright 2000-2015 Avago Technologies. All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2.h @@ -9,7 +9,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.50 + * mpi2.h Version: 02.00.53 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -116,7 +116,12 @@ * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. * 06-13-17 02.00.49 Bumped MPI2_HEADER_VERSION_UNIT. * 09-29-17 02.00.50 Bumped MPI2_HEADER_VERSION_UNIT. - * -- + * 07-22-18 02.00.51 Added SECURE_BOOT define. + * Bumped MPI2_HEADER_VERSION_UNIT + * 08-15-18 02.00.52 Bumped MPI2_HEADER_VERSION_UNIT. + * 08-28-18 02.00.53 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI2_IOCSTATUS_FAILURE + * -- */ #ifndef MPI2_H @@ -156,7 +161,7 @@ /* Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT(0x32) +#define MPI2_HEADER_VERSION_UNIT(0x35) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) @@ -257,6 +262,8 @@ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS { */ #define MPI2_HOST_DIAGNOSTIC_OFFSET (0x0008) +#define MPI26_DIAG_SECURE_BOOT (0x8000) + #define MPI2_DIAG_SBR_RELOAD(0x2000) #define MPI2_DIAG_BOOT_DEVICE_SELECT_MASK (0x1800) @@ -687,7 +694,9 @@ typedef union _MPI2_REPLY_DESCRIPTORS_UNION { #define MPI2_IOCSTATUS_INVALID_FIELD(0x0007) #define MPI2_IOCSTATUS_INVALID_STATE(0x0008) #define MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED (0x0009) +/*MPI v2.6 and later */ #define MPI2_IOCSTATUS_INSUFFICIENT_POWER (0x000A) +#define MPI2_IOCSTATUS_FAILURE (0x000F) / * Config IOCStatus values diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index 5122920..398fa6f 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -1,13 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * Copyright 2000-2015 Avago Technologies. All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2_cnfg.h * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - *mpi2_cnfg.h Version: 02.00.42 + *mpi2_cnfg.h Version: 02.00.46 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -231,6 +231,18 @@ * Added NOIOB field to PCIe Device Page 2. * Added MPI26_PCIEDEV2_CAP_DATA_BLK_ALIGN_AND_GRAN to * the Capabilities field of PCIe Device Page 2. + * 07-22-18 02.00.43 Added defines for SAS3916 and SAS3816. + * Added WRiteCache defines to IO Unit Page 1. + * Added MaxEnclosureLevel to BIOS Page 1. + * Added OEMRD to SAS Enclosure Page 1. + * Added DMDReportPCIe to PCIe IO Unit Page 1. + * Added Flags field and flags for Retimers to + * PCIe Switch Page 1. + * 08-02-18 02.00.44 Added Slotx2, Slotx4 to ManPage 7. + * 08-15-18 02.00.45 Added ProductSpecific field at end
Re: [PATCH v4 00/11] Zoned block device support improvements
On 10/24/18 10:04 AM, Bart Van Assche wrote: > On Wed, 2018-10-24 at 11:37 -0400, Martin K. Petersen wrote: >> Mike, >> You keep mentioning this, but I don't recall ever seeing anything to that effect. The rest of the kernel appears to be either arbitrary ordering or favoring author SoB as the first tag. >>> >>> I've always felt the proper order is how Jens likes it too (all dm >>> commits from me follow that order). >> >> That's fine, I don't have any particular preference. And I don't have >> any issue with you guys sticking to a certain ordering in your >> respective subsystems. I occasionally shuffle tags when I commit things >> in SCSI too. >> >> I just think it should be properly documented if there is a preferred >> way to order things... > > When I tried to look up documentation for this I couldn't find anything under > the Documentation directory. Maybe it's there but I didn't look carefully > enough. All I could find on the web is e-mails from Linus in which he explains > that the order of Signed-off-by's should match the chain of authorship. I don't think there's any documentation on it, none that I've seen. Haven't looked for it, though. It's more of a "it always looked like that", until we got patchwork messing things up. And then people see that, and do the same. It's a bit frustrating. I like to be able to see the SOB chain in a patch, and if it's intermingled with other things, it's much harder to read. At least for me. I'll continue fixing these up, but I do hope that at least the regulars on the block side use the proper formatting. -- Jens Axboe
Re: [GIT PULL] first round of SCSI updates for the 4.19+ merge window
On Wed, Oct 24, 2018 at 3:59 AM James Bottomley wrote: > > This is mostly updates of the usual drivers: [...] Hmm. No diffstat? The shortlog matches, but I really prefer seeing what the diffstat is too and confirm that part. Anyway, pulled, Linus
[PATCH] scsi: aic7xxx: Fix unintended sign extension issue
From: Colin Ian King In the expression "ahc_inb(ahc, port+3) << 24", the initial value is a u8, but is promoted to a signed int, then sign-extended to uint64_t. If the value read from the port has the upper bit set then the sign extension will set all the upper bits of the expression which is probably not what was intended. Cast to uint64_t to avoid the sign extension. Detected by CoverityScan, CID#138806, 138807 ("Unintended sign extension") Fixes: be0d67680d52 ("[SCSI] aic7xxx, aic79xx: deinline functions") Signed-off-by: Colin Ian King --- drivers/scsi/aic7xxx/aic79xx_core.c | 2 +- drivers/scsi/aic7xxx/aic7xxx_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 9ee75c9a9aa1..a836233edb91 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -622,7 +622,7 @@ ahd_inq(struct ahd_softc *ahd, u_int port) return ((ahd_inb(ahd, port)) | (ahd_inb(ahd, port+1) << 8) | (ahd_inb(ahd, port+2) << 16) - | (ahd_inb(ahd, port+3) << 24) + | (((uint64_t)ahd_inb(ahd, port+3)) << 24) | (((uint64_t)ahd_inb(ahd, port+4)) << 32) | (((uint64_t)ahd_inb(ahd, port+5)) << 40) | (((uint64_t)ahd_inb(ahd, port+6)) << 48) diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index f3362f4ab16e..74d3f1dd0427 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -493,7 +493,7 @@ ahc_inq(struct ahc_softc *ahc, u_int port) return ((ahc_inb(ahc, port)) | (ahc_inb(ahc, port+1) << 8) | (ahc_inb(ahc, port+2) << 16) - | (ahc_inb(ahc, port+3) << 24) + | (((uint64_t)ahc_inb(ahc, port+3)) << 24) | (((uint64_t)ahc_inb(ahc, port+4)) << 32) | (((uint64_t)ahc_inb(ahc, port+5)) << 40) | (((uint64_t)ahc_inb(ahc, port+6)) << 48) -- 2.19.1
Re: [PATCH] scsi: aic7xxx: Fix unintended sign extension issue
On Thu, 2018-10-25 at 16:13 +0100, Colin King wrote: > From: Colin Ian King > > In the expression "ahc_inb(ahc, port+3) << 24", the initial value is a > u8, but is promoted to a signed int, then sign-extended to uint64_t. If > the value read from the port has the upper bit set then the sign > extension will set all the upper bits of the expression which is probably > not what was intended. Cast to uint64_t to avoid the sign extension. [] > diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c > b/drivers/scsi/aic7xxx/aic79xx_core.c [] > @@ -622,7 +622,7 @@ ahd_inq(struct ahd_softc *ahd, u_int port) > return ((ahd_inb(ahd, port)) > | (ahd_inb(ahd, port+1) << 8) > | (ahd_inb(ahd, port+2) << 16) > - | (ahd_inb(ahd, port+3) << 24) > + | (((uint64_t)ahd_inb(ahd, port+3)) << 24) > | (((uint64_t)ahd_inb(ahd, port+4)) << 32) > | (((uint64_t)ahd_inb(ahd, port+5)) << 40) > | (((uint64_t)ahd_inb(ahd, port+6)) << 48) Perhaps a different method using two calls to ahd_inl is clearer and possibly faster like: uint64_t ahd_inq(struct ahd_softc *ahd, u_int port) { return ahd_inl(port) | ((uint64_t)ahd_inl(port + 4) << 32); } > diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c > b/drivers/scsi/aic7xxx/aic7xxx_core.c [] > @@ -493,7 +493,7 @@ ahc_inq(struct ahc_softc *ahc, u_int port) > return ((ahc_inb(ahc, port)) > | (ahc_inb(ahc, port+1) << 8) > | (ahc_inb(ahc, port+2) << 16) > - | (ahc_inb(ahc, port+3) << 24) > + | (((uint64_t)ahc_inb(ahc, port+3)) << 24) > | (((uint64_t)ahc_inb(ahc, port+4)) << 32) > | (((uint64_t)ahc_inb(ahc, port+5)) << 40) > | (((uint64_t)ahc_inb(ahc, port+6)) << 48) here too
Re: [PATCH] scsi: aic7xxx: Fix unintended sign extension issue
On Thu, 2018-10-25 at 16:13 +0100, Colin King wrote: > From: Colin Ian King > > In the expression "ahc_inb(ahc, port+3) << 24", the initial value is > a u8, but is promoted to a signed int, then sign-extended to > uint64_t. Why is this, that's highly non intuitive? The compiler is supposed to promote to the biggest type, which is uint64_t and then do the calculation James
RE: [PATCH] scsi: aic7xxx: Fix unintended sign extension issue
From: James Bottomley > Sent: 25 October 2018 16:33 > > On Thu, 2018-10-25 at 16:13 +0100, Colin King wrote: > > From: Colin Ian King > > > > In the expression "ahc_inb(ahc, port+3) << 24", the initial value is > > a u8, but is promoted to a signed int, then sign-extended to > > uint64_t. > > Why is this, that's highly non intuitive? The compiler is supposed to > promote to the biggest type, which is uint64_t and then do the > calculation Do not doubt the wisdom on the ANSI C committee that decided to do 'value preserving' integer promotions instead of the 'sign preserving' ones of K&R C. So 'unsigned char' is promoted to 'int' almost everywhere it is used (unless they are both the same size - which is allowed). This means that ahc_inb() << 24 is actually undefined (signed integer overflow can do anything it likes). By far the best fix is to change the return type of ahc_inb() to be 'unsigned int'. On systems without byte sized registers (about everything except x86) this will almost certainly generate better code. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
[PATCH v3] scsi: ufs: Fix hynix ufs bug with quirk on hi36xx SoC
From: Wei Li Hynix ufs has deviations on hi36xx platform which will result in ufs bursts transfer failures. To fix the problem, the Hynix device must set the register VS_DebugSaveConfigTime to 0x10, which will set time reference for SaveConfigTime is 250 ns. The time reference for SaveConfigTime is 40 ns by default. This patch is necessary to boot on HiKey960 boards that use Hynix UFS chips (H28U62301AMR model: hB8aL1). Cc: Vinayak Holikatti Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Signed-off-by: Wei Li Signed-off-by: Dmitry Shmidt [jstultz: Forward ported from older code, slight tweak to commit message] Signed-off-by: John Stultz --- v2: * Narrowed the UFS chip model to the specific model where the issue has been seen. (SKhynix H28U62301AMR model: hB8aL1) * Reworked logic to be contained in ufs-hisi.c since it seems to be a controller issue that crops up with this specific chip v3: * Reworked back to using generic hba quriks which we then key on in the hisi driver. --- drivers/scsi/ufs/ufs-hisi.c | 9 + drivers/scsi/ufs/ufs_quirks.h | 6 ++ drivers/scsi/ufs/ufshcd.c | 2 ++ 3 files changed, 17 insertions(+) diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c index 46df707..452e19f 100644 --- a/drivers/scsi/ufs/ufs-hisi.c +++ b/drivers/scsi/ufs/ufs-hisi.c @@ -20,6 +20,7 @@ #include "unipro.h" #include "ufs-hisi.h" #include "ufshci.h" +#include "ufs_quirks.h" static int ufs_hisi_check_hibern8(struct ufs_hba *hba) { @@ -390,6 +391,14 @@ static void ufs_hisi_set_dev_cap(struct ufs_hisi_dev_params *hisi_param) static void ufs_hisi_pwr_change_pre_change(struct ufs_hba *hba) { + if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME) { + pr_info("ufs flash device must set VS_DebugSaveConfigTime 0x10\n"); + /* VS_DebugSaveConfigTime */ + ufshcd_dme_set(hba, UIC_ARG_MIB(0xD0A0), 0x10); + /* sync length */ + ufshcd_dme_set(hba, UIC_ARG_MIB(0x1556), 0x48); + } + /* update */ ufshcd_dme_set(hba, UIC_ARG_MIB(0x15A8), 0x1); /* PA_TxSkip */ diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h index 71f73d1..5d2dfdb 100644 --- a/drivers/scsi/ufs/ufs_quirks.h +++ b/drivers/scsi/ufs/ufs_quirks.h @@ -131,4 +131,10 @@ struct ufs_dev_fix { */ #define UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME(1 << 8) +/* + * Some UFS devices require VS_DebugSaveConfigTime is 0x10, + * enabling this quirk ensure this. + */ +#define UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME (1 << 9) + #endif /* UFS_QUIRKS_H_ */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c55f38e..9c6cac9 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -230,6 +230,8 @@ static struct ufs_dev_fix ufs_fixups[] = { UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ), UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME), + UFS_FIX(UFS_VENDOR_SKHYNIX, "hB8aL1" /*H28U62301AMR*/, + UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME), END_FIX }; -- 2.7.4
[PATCH 08/28] scsi: kill off the legacy IO path
Cc: linux-scsi@vger.kernel.org Signed-off-by: Jens Axboe --- Documentation/scsi/scsi-parameters.txt | 5 - drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c| 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/scsi_lib.c| 624 ++--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/ufs/ufshcd.c | 6 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h| 14 +- 17 files changed, 73 insertions(+), 705 deletions(-) diff --git a/Documentation/scsi/scsi-parameters.txt b/Documentation/scsi/scsi-parameters.txt index 92999d4e0cb8..25a4b4cf04a6 100644 --- a/Documentation/scsi/scsi-parameters.txt +++ b/Documentation/scsi/scsi-parameters.txt @@ -97,11 +97,6 @@ parameters may be changed at runtime by the command allowing boot to proceed. none ignores them, expecting user space to do the scan. - scsi_mod.use_blk_mq= - [SCSI] use blk-mq I/O path by default - See SCSI_MQ_DEFAULT in drivers/scsi/Kconfig. - Format: - sim710= [SCSI,HW] See header of drivers/scsi/sim710.c. diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 70988c381268..ff5a569fdbcb 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -50,18 +50,6 @@ config SCSI_NETLINK default n depends on NET -config SCSI_MQ_DEFAULT - bool "SCSI: use blk-mq I/O path by default" - default y - depends on SCSI - ---help--- - This option enables the blk-mq based I/O path for SCSI devices by - default. With this option the scsi_mod.use_blk_mq module/boot - option defaults to Y, without it to N, but it can still be - overridden either way. - - If unsure say Y. - config SCSI_PROC_FS bool "legacy /proc/scsi/ support" depends on SCSI && PROC_FS diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 6637116529aa..abdc9eac4173 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -3088,12 +3088,6 @@ static ssize_t hwq_mode_store(struct device *dev, return -EINVAL; } - if ((mode == HWQ_MODE_TAG) && !shost_use_blk_mq(shost)) { - dev_info(cfgdev, "SCSI-MQ is not enabled, use a different " -"HWQ steering mode.\n"); - return -EINVAL; - } - afu->hwq_mode = mode; return count; diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index ea4b0bb0c1cd..cc71136ba300 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -222,18 +222,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, if (error) goto fail; - if (shost_use_blk_mq(shost)) { - error = scsi_mq_setup_tags(shost); - if (error) - goto fail; - } else { - shost->bqt = blk_init_tags(shost->can_queue, - shost->hostt->tag_alloc_policy); - if (!shost->bqt) { - error = -ENOMEM; - goto fail; - } - } + error = scsi_mq_setup_tags(shost); + if (error) + goto fail; if (!shost->shost_gendev.parent) shost->shost_gendev.parent = dev ? dev : &platform_bus; @@ -309,8 +300,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, pm_runtime_disable(&shost->shost_gendev); pm_runtime_set_suspended(&shost->shost_gendev); pm_runtime_put_noidle(&shost->shost_gendev); - if (shost_use_blk_mq(shost)) - scsi_mq_destroy_tags(shost); + scsi_mq_destroy_tags(shost); fail: return error; } @@ -344,13 +334,8 @@ static void scsi_host_dev_release(struct device *dev) kfree(dev_name(&shost->shost_dev)); } - if (shost_use_blk_mq(shost)) { - if (shost->tag_set.tags) - scsi_mq_destroy_tags(shost); - } else { - if (shost->bqt) - blk_free_tags(shost->bqt); - } + if (shost->tag_set.tags) + scsi_mq_destroy_tags(shost); kfree(shost->shost_data); @@ -472,8 +457,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) else shost->d
[PATCH 06/28] blk-mq: remove the request_list usage
We don't do anything with it, that's just the legacy path. Signed-off-by: Jens Axboe --- block/blk-mq.c | 5 - 1 file changed, 5 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 3f91c6e5b17a..4c82dc44d4d8 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -510,9 +510,6 @@ void blk_mq_free_request(struct request *rq) rq_qos_done(q, rq); - if (blk_rq_rl(rq)) - blk_put_rl(blk_rq_rl(rq)); - WRITE_ONCE(rq->state, MQ_RQ_IDLE); if (refcount_dec_and_test(&rq->ref)) __blk_mq_free_request(rq); @@ -1675,8 +1672,6 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio) { blk_init_request_from_bio(rq, bio); - blk_rq_set_rl(rq, blk_get_rl(rq->q, bio)); - blk_account_io_start(rq, true); } -- 2.17.1
[PATCH 05/28] IB/srp: remove old request_fn_active check
This check is only viable for non scsi-mq. Since that is going away, kill this legacy check. Cc: Bart Van Assche Cc: Parav Pandit Cc: linux-scsi@vger.kernel.org Signed-off-by: Jens Axboe --- drivers/infiniband/ulp/srp/ib_srp.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 0b34e909505f..5a79444c2f3c 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1334,13 +1334,6 @@ static void srp_terminate_io(struct srp_rport *rport) struct scsi_device *sdev; int i, j; - /* -* Invoking srp_terminate_io() while srp_queuecommand() is running -* is not safe. Hence the warning statement below. -*/ - shost_for_each_device(sdev, shost) - WARN_ON_ONCE(sdev->request_queue->request_fn_active); - for (i = 0; i < target->ch_count; i++) { ch = &target->ch[i]; -- 2.17.1
[PATCH 07/28] blk-mq: remove legacy check in queue blk_freeze_queue()
Signed-off-by: Jens Axboe --- block/blk-mq.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 4c82dc44d4d8..a58d2d953876 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -177,8 +177,6 @@ void blk_freeze_queue(struct request_queue *q) * exported to drivers as the only user for unfreeze is blk_mq. */ blk_freeze_queue_start(q); - if (!q->mq_ops) - blk_drain_queue(q); blk_mq_freeze_queue_wait(q); } -- 2.17.1
[PATCH 04/28] ide: convert to blk-mq
ide-disk and ide-cd tested as working just fine, ide-tape and ide-floppy haven't. But the latter don't require changes, so they should work without issue. Add helper function to insert a request from a work queue, since we cannot invoke the blk-mq request insertion from IRQ context. Cc: David Miller Signed-off-by: Jens Axboe --- drivers/ide/ide-atapi.c | 25 -- drivers/ide/ide-cd.c| 175 +--- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c| 101 +-- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c| 28 ++- drivers/ide/ide-probe.c | 68 +++- include/linux/ide.h | 13 ++- 8 files changed, 240 insertions(+), 179 deletions(-) diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 8b2b72b93885..33210bc67618 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -172,8 +172,8 @@ EXPORT_SYMBOL_GPL(ide_create_request_sense_cmd); void ide_prep_sense(ide_drive_t *drive, struct request *rq) { struct request_sense *sense = &drive->sense_data; - struct request *sense_rq = drive->sense_rq; - struct scsi_request *req = scsi_req(sense_rq); + struct request *sense_rq; + struct scsi_request *req; unsigned int cmd_len, sense_len; int err; @@ -196,9 +196,16 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq) if (ata_sense_request(rq) || drive->sense_rq_armed) return; + sense_rq = drive->sense_rq; + if (!sense_rq) { + sense_rq = blk_mq_alloc_request(drive->queue, REQ_OP_DRV_IN, + BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT); + drive->sense_rq = sense_rq; + } + req = scsi_req(sense_rq); + memset(sense, 0, sizeof(*sense)); - blk_rq_init(rq->q, sense_rq); scsi_req_init(req); err = blk_rq_map_kern(drive->queue, sense_rq, sense, sense_len, @@ -207,6 +214,8 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq) if (printk_ratelimit()) printk(KERN_WARNING PFX "%s: failed to map sense " "buffer\n", drive->name); + blk_mq_free_request(sense_rq); + drive->sense_rq = NULL; return; } @@ -226,6 +235,8 @@ EXPORT_SYMBOL_GPL(ide_prep_sense); int ide_queue_sense_rq(ide_drive_t *drive, void *special) { + struct request *sense_rq = drive->sense_rq; + /* deferred failure from ide_prep_sense() */ if (!drive->sense_rq_armed) { printk(KERN_WARNING PFX "%s: error queuing a sense request\n", @@ -233,12 +244,12 @@ int ide_queue_sense_rq(ide_drive_t *drive, void *special) return -ENOMEM; } - drive->sense_rq->special = special; + sense_rq->special = special; drive->sense_rq_armed = false; drive->hwif->rq = NULL; - elv_add_request(drive->queue, drive->sense_rq, ELEVATOR_INSERT_FRONT); + ide_insert_request_head(drive, sense_rq); return 0; } EXPORT_SYMBOL_GPL(ide_queue_sense_rq); @@ -270,10 +281,8 @@ void ide_retry_pc(ide_drive_t *drive) */ drive->hwif->rq = NULL; ide_requeue_and_plug(drive, failed_rq); - if (ide_queue_sense_rq(drive, pc)) { - blk_start_request(failed_rq); + if (ide_queue_sense_rq(drive, pc)) ide_complete_rq(drive, BLK_STS_IOERR, blk_rq_bytes(failed_rq)); - } } EXPORT_SYMBOL_GPL(ide_retry_pc); diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index f9b59d41813f..4ecaf2ace4cb 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -258,11 +258,22 @@ static int ide_cd_breathe(ide_drive_t *drive, struct request *rq) /* * take a breather */ - blk_delay_queue(drive->queue, 1); + blk_mq_requeue_request(rq, false); + blk_mq_delay_kick_requeue_list(drive->queue, 1); return 1; } } +static void ide_cd_free_sense(ide_drive_t *drive) +{ + if (!drive->sense_rq) + return; + + blk_mq_free_request(drive->sense_rq); + drive->sense_rq = NULL; + drive->sense_rq_armed = false; +} + /** * Returns: * 0: if the request should be continued. @@ -516,6 +527,82 @@ static bool ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) return false; } +/* standard prep_rq_fn that builds 10 byte cmds */ +static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) +{ + int hard_sect = queue_logical_block_size(q); + long block = (long)blk_rq_pos(rq) / (hard_sect >> 9); + unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9); + struct scsi_request *req = scsi_req(rq); + + if (rq_data_dir(rq) == READ) + req->cmd[0] = GPCMD_READ_10; +
[PATCH 11/28] bsg: pass in desired timeout handler
This will ease in the conversion to blk-mq, where we can't set a timeout handler after queue init. Cc: Johannes Thumshirn Cc: Benjamin Block Cc: linux-scsi@vger.kernel.org Signed-off-by: Jens Axboe --- block/bsg-lib.c | 3 ++- drivers/scsi/scsi_transport_fc.c| 7 +++ drivers/scsi/scsi_transport_iscsi.c | 2 +- drivers/scsi/scsi_transport_sas.c | 4 ++-- include/linux/bsg-lib.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index f3501cdaf1a6..1da011ec04e6 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -304,7 +304,7 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req) * @dd_job_size: size of LLD data needed for each job */ struct request_queue *bsg_setup_queue(struct device *dev, const char *name, - bsg_job_fn *job_fn, int dd_job_size) + bsg_job_fn *job_fn, rq_timed_out_fn *timeout, int dd_job_size) { struct request_queue *q; int ret; @@ -327,6 +327,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name, blk_queue_flag_set(QUEUE_FLAG_BIDI, q); blk_queue_softirq_done(q, bsg_softirq_done); blk_queue_rq_timeout(q, BLK_DEFAULT_SG_TIMEOUT); + blk_queue_rq_timed_out(q, timeout); ret = bsg_register_queue(q, dev, name, &bsg_transport_ops); if (ret) { diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 381668fa135d..98aaffb4c715 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -3780,7 +3780,8 @@ fc_bsg_hostadd(struct Scsi_Host *shost, struct fc_host_attrs *fc_host) snprintf(bsg_name, sizeof(bsg_name), "fc_host%d", shost->host_no); - q = bsg_setup_queue(dev, bsg_name, fc_bsg_dispatch, i->f->dd_bsg_size); + q = bsg_setup_queue(dev, bsg_name, fc_bsg_dispatch, fc_bsg_job_timeout, + i->f->dd_bsg_size); if (IS_ERR(q)) { dev_err(dev, "fc_host%d: bsg interface failed to initialize - setup queue\n", @@ -3788,7 +3789,6 @@ fc_bsg_hostadd(struct Scsi_Host *shost, struct fc_host_attrs *fc_host) return PTR_ERR(q); } __scsi_init_queue(shost, q); - blk_queue_rq_timed_out(q, fc_bsg_job_timeout); blk_queue_rq_timeout(q, FC_DEFAULT_BSG_TIMEOUT); fc_host->rqst_q = q; return 0; @@ -3826,14 +3826,13 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport) return -ENOTSUPP; q = bsg_setup_queue(dev, dev_name(dev), fc_bsg_dispatch, - i->f->dd_bsg_size); + fc_bsg_job_timeout, i->f->dd_bsg_size); if (IS_ERR(q)) { dev_err(dev, "failed to setup bsg queue\n"); return PTR_ERR(q); } __scsi_init_queue(shost, q); blk_queue_prep_rq(q, fc_bsg_rport_prep); - blk_queue_rq_timed_out(q, fc_bsg_job_timeout); blk_queue_rq_timeout(q, BLK_DEFAULT_SG_TIMEOUT); rport->rqst_q = q; return 0; diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 6fd2fe210fc3..26b11a775be9 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1542,7 +1542,7 @@ iscsi_bsg_host_add(struct Scsi_Host *shost, struct iscsi_cls_host *ihost) return -ENOTSUPP; snprintf(bsg_name, sizeof(bsg_name), "iscsi_host%d", shost->host_no); - q = bsg_setup_queue(dev, bsg_name, iscsi_bsg_host_dispatch, 0); + q = bsg_setup_queue(dev, bsg_name, iscsi_bsg_host_dispatch, NULL, 0); if (IS_ERR(q)) { shost_printk(KERN_ERR, shost, "bsg interface failed to " "initialize - no request queue\n"); diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 0a165b2b3e81..cf6d47891d77 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -198,7 +198,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy) if (rphy) { q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev), - sas_smp_dispatch, 0); + sas_smp_dispatch, NULL, 0); if (IS_ERR(q)) return PTR_ERR(q); rphy->q = q; @@ -207,7 +207,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy) snprintf(name, sizeof(name), "sas_host%d", shost->host_no); q = bsg_setup_queue(&shost->shost_gendev, name, - sas_smp_dispatch, 0); + sas_smp_dispatch, NULL, 0); if (IS_ERR(q)) return PTR_ERR(q); to_sas_host_attrs(shost)->q =
[PATCHSET 0/28] blk-mq driver conversions and legacy path removal
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off. This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch. Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt| 291 -- Documentation/scsi/scsi-parameters.txt |5 - block/Kconfig |6 - block/Kconfig.iosched | 61 - block/Makefile |5 +- block/bfq-iosched.c|1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +--- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c| 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c |2 - block/blk-mq-tag.c |6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c| 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c| 378 --- block/blk-timeout.c| 99 +- block/blk-wbt.c|3 +- block/blk.h| 60 +- block/bsg-lib.c| 131 +- block/cfq-iosched.c| 4916 block/deadline-iosched.c | 560 block/elevator.c | 447 +-- block/kyber-iosched.c |1 - block/mq-deadline.c|1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c| 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c |5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c |4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c| 68 +- drivers/infiniband/ulp/srp/ib_srp.c|7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h |4 - drivers/md/dm-sysfs.c |3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c| 21 +- drivers/md/dm.h|1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h |1 + drivers/memstick/core/mspro_block.c| 121 +- drivers/s390/block/dasd_ioctl.c| 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c |6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c |2 +- drivers/scsi/osd/osd_initiator.c |4 +- drivers/scsi/osst.c|2 +- drivers/scsi/qedi/qedi_main.c |3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c|5 +- drivers/scsi/scsi_debug.c |3 +- drivers/scsi/scsi_error.c |4 +- drivers/scsi/scsi_lib.c| 624 +--- drivers/scsi/scsi_priv.h |1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c |8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c|9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c |2 +- drivers/scsi/st.c |2 +- drivers/scsi/ufs/ufshcd.c |6 - drivers/target/target_core_pscsi.c |2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h|3 +- include/linux/elevator.h | 90 +- include/linux/ide.h| 13 +- include/linux/init.h |1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h| 14 +- init/do_mounts_initrd.c|3 - init/initramfs.c |6 - init/main.c| 12 - 85 files changed, 833 insertions(+), 11144 deletions(-) -- Jens Axboe
[PATCH 03/28] mspro_block: convert to blk-mq
Straight forward conversion, there's room for improvement. Signed-off-by: Jens Axboe --- drivers/memstick/core/mspro_block.c | 121 +++- 1 file changed, 66 insertions(+), 55 deletions(-) diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 0cd30dcb6801..aba50ec98b4d 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c @@ -12,7 +12,7 @@ * */ -#include +#include #include #include #include @@ -142,6 +142,7 @@ struct mspro_block_data { struct gendisk*disk; struct request_queue *queue; struct request*block_req; + struct blk_mq_tag_set tag_set; spinlock_tq_lock; unsigned shortpage_size; @@ -152,7 +153,6 @@ struct mspro_block_data { unsigned char system; unsigned char read_only:1, eject:1, - has_request:1, data_dir:1, active:1; unsigned char transfer_cmd; @@ -694,13 +694,12 @@ static void h_mspro_block_setup_cmd(struct memstick_dev *card, u64 offset, /*** Data transfer ***/ -static int mspro_block_issue_req(struct memstick_dev *card, int chunk) +static int mspro_block_issue_req(struct memstick_dev *card, bool chunk) { struct mspro_block_data *msb = memstick_get_drvdata(card); u64 t_off; unsigned int count; -try_again: while (chunk) { msb->current_page = 0; msb->current_seg = 0; @@ -709,9 +708,17 @@ static int mspro_block_issue_req(struct memstick_dev *card, int chunk) msb->req_sg); if (!msb->seg_count) { - chunk = __blk_end_request_cur(msb->block_req, - BLK_STS_RESOURCE); - continue; + unsigned int bytes = blk_rq_cur_bytes(msb->block_req); + + chunk = blk_update_request(msb->block_req, + BLK_STS_RESOURCE, + bytes); + if (chunk) + continue; + __blk_mq_end_request(msb->block_req, + BLK_STS_RESOURCE); + msb->block_req = NULL; + break; } t_off = blk_rq_pos(msb->block_req); @@ -729,30 +736,22 @@ static int mspro_block_issue_req(struct memstick_dev *card, int chunk) return 0; } - dev_dbg(&card->dev, "blk_fetch\n"); - msb->block_req = blk_fetch_request(msb->queue); - if (!msb->block_req) { - dev_dbg(&card->dev, "issue end\n"); - return -EAGAIN; - } - - dev_dbg(&card->dev, "trying again\n"); - chunk = 1; - goto try_again; + return 1; } static int mspro_block_complete_req(struct memstick_dev *card, int error) { struct mspro_block_data *msb = memstick_get_drvdata(card); - int chunk, cnt; + int cnt; + bool chunk; unsigned int t_len = 0; unsigned long flags; spin_lock_irqsave(&msb->q_lock, flags); - dev_dbg(&card->dev, "complete %d, %d\n", msb->has_request ? 1 : 0, + dev_dbg(&card->dev, "complete %d, %d\n", msb->block_req ? 1 : 0, error); - if (msb->has_request) { + if (msb->block_req) { /* Nothing to do - not really an error */ if (error == -EAGAIN) error = 0; @@ -777,15 +776,17 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error) if (error && !t_len) t_len = blk_rq_cur_bytes(msb->block_req); - chunk = __blk_end_request(msb->block_req, + chunk = blk_update_request(msb->block_req, errno_to_blk_status(error), t_len); - - error = mspro_block_issue_req(card, chunk); - - if (!error) - goto out; - else - msb->has_request = 0; + if (chunk) { + error = mspro_block_issue_req(card, chunk); + if (!error) + goto out; + } else { + __blk_mq_end_request(msb->block_req, + errno_to_blk_status(error)); + msb->block_req = NULL; + } } else { if (!error) error = -EAGAIN; @@ -806,8 +807,8 @@ static void mspro_block_stop(struct memstick_dev *card) while (1) { spin_lock_irqsave(&msb->q_
[PATCH 15/28] blk-wbt: kill check for legacy queue type
Everything is blk-mq at this point, so it doesn't make any sense to have this option available as it does nothing. Signed-off-by: Jens Axboe --- block/Kconfig | 6 -- block/blk-wbt.c | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/block/Kconfig b/block/Kconfig index f7045aa47edb..8044452a4fd3 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -155,12 +155,6 @@ config BLK_CGROUP_IOLATENCY Note, this is an experimental interface and could be changed someday. -config BLK_WBT_SQ - bool "Single queue writeback throttling" - depends on BLK_WBT - ---help--- - Enable writeback throttling by default on legacy single queue devices - config BLK_WBT_MQ bool "Multiqueue writeback throttling" default y diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 8ac93fcbaa2e..49fac89a981c 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -709,8 +709,7 @@ void wbt_enable_default(struct request_queue *q) if (!test_bit(QUEUE_FLAG_REGISTERED, &q->queue_flags)) return; - if ((q->mq_ops && IS_ENABLED(CONFIG_BLK_WBT_MQ)) || - (q->request_fn && IS_ENABLED(CONFIG_BLK_WBT_SQ))) + if (IS_ENABLED(CONFIG_BLK_WBT_MQ)) wbt_init(q); } EXPORT_SYMBOL_GPL(wbt_enable_default); -- 2.17.1
[PATCH 21/28] block: remove __blk_put_request()
Now there's no difference between blk_put_request() and __blk_put_request() anymore, get rid of the underscore version and convert the few callers. Signed-off-by: Jens Axboe --- block/blk-core.c | 9 - block/blk-merge.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 ++-- drivers/scsi/osst.c| 2 +- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/target/target_core_pscsi.c | 2 +- include/linux/blkdev.h | 1 - 9 files changed, 8 insertions(+), 18 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 009ac18cc7e1..ad79e8b09801 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -800,15 +800,6 @@ void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part) } EXPORT_SYMBOL_GPL(part_round_stats); -void __blk_put_request(struct request_queue *q, struct request *req) -{ - if (unlikely(!q)) - return; - - blk_mq_free_request(req); -} -EXPORT_SYMBOL_GPL(__blk_put_request); - void blk_put_request(struct request *req) { blk_mq_free_request(req); diff --git a/block/blk-merge.c b/block/blk-merge.c index 5e4e30a88ced..7fedc0391610 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -839,7 +839,7 @@ int blk_attempt_req_merge(struct request_queue *q, struct request *rq, free = attempt_merge(q, rq, next); if (free) { - __blk_put_request(q, free); + blk_put_request(free); return 1; } diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index e19fa883376f..60cf7c5eb880 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c @@ -506,11 +506,11 @@ static void osd_request_async_done(struct request *req, blk_status_t error) _set_error_resid(or, req, error); if (req->next_rq) { - __blk_put_request(req->q, req->next_rq); + blk_put_request(req->next_rq); req->next_rq = NULL; } - __blk_put_request(req->q, req); + blk_put_request(req); or->request = NULL; or->in.req = NULL; or->out.req = NULL; diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 7a1a1edde35d..664c1238a87f 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c @@ -341,7 +341,7 @@ static void osst_end_async(struct request *req, blk_status_t status) blk_rq_unmap_user(SRpnt->bio); } - __blk_put_request(req->q, req); + blk_put_request(req); } /* osst_request memory management */ diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index fff128aa9ec2..dd338a8cd275 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1932,7 +1932,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) static void eh_lock_door_done(struct request *req, blk_status_t status) { - __blk_put_request(req->q, req); + blk_put_request(req); } /** diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index c6ad00703c5b..4e27460ec926 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1390,7 +1390,7 @@ sg_rq_end_io(struct request *rq, blk_status_t status) */ srp->rq = NULL; scsi_req_free_cmd(scsi_req(rq)); - __blk_put_request(rq->q, rq); + blk_put_request(rq); write_lock_irqsave(&sfp->rq_list_lock, iflags); if (unlikely(srp->orphan)) { diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 307df2fa39a3..7ff22d3f03e3 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -530,7 +530,7 @@ static void st_scsi_execute_end(struct request *req, blk_status_t status) complete(SRpnt->waiting); blk_rq_unmap_user(tmp); - __blk_put_request(req->q, req); + blk_put_request(req); } static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd, diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 47d76c862014..c062d363dce3 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -1094,7 +1094,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status) break; } - __blk_put_request(req->q, req); + blk_put_request(req); kfree(pt); } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e87eeb47aac3..33a81cfde6a6 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -908,7 +908,6 @@ extern blk_qc_t direct_make_request(struct bio *bio); extern void blk_rq_init(struct request_queue *q, struct request *rq); extern void blk_init_request_from_bio(struct request *req, struct bio *bio); extern void blk_put_request(struct request *); -extern void __blk_put_request(struct request_queue *, struct request *); extern struct request *blk_get_request(struct reque
[PATCH 01/28] sunvdc: convert to blk-mq
Convert from the old request_fn style driver to blk-mq. Cc: David Miller Signed-off-by: Jens Axboe --- drivers/block/sunvdc.c | 149 +++-- 1 file changed, 98 insertions(+), 51 deletions(-) diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index b54fa6726303..95cb4ea8e402 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -66,9 +66,10 @@ struct vdc_port { u64 max_xfer_size; u32 vdisk_block_size; + u32 drain; u64 ldc_timeout; - struct timer_list ldc_reset_timer; + struct delayed_work ldc_reset_timer_work; struct work_struct ldc_reset_work; /* The server fills these in for us in the disk attribute @@ -80,12 +81,14 @@ struct vdc_port { u8 vdisk_mtype; u32 vdisk_phys_blksz; + struct blk_mq_tag_set tag_set; + chardisk_name[32]; }; static void vdc_ldc_reset(struct vdc_port *port); static void vdc_ldc_reset_work(struct work_struct *work); -static void vdc_ldc_reset_timer(struct timer_list *t); +static void vdc_ldc_reset_timer_work(struct work_struct *work); static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) { @@ -175,11 +178,8 @@ static void vdc_blk_queue_start(struct vdc_port *port) * handshake completes, so check for initial handshake before we've * allocated a disk. */ - if (port->disk && blk_queue_stopped(port->disk->queue) && - vdc_tx_dring_avail(dr) * 100 / VDC_TX_RING_SIZE >= 50) { - blk_start_queue(port->disk->queue); - } - + if (port->disk && vdc_tx_dring_avail(dr) * 100 / VDC_TX_RING_SIZE >= 50) + blk_mq_start_hw_queues(port->disk->queue); } static void vdc_finish(struct vio_driver_state *vio, int err, int waiting_for) @@ -197,7 +197,7 @@ static void vdc_handshake_complete(struct vio_driver_state *vio) { struct vdc_port *port = to_vdc_port(vio); - del_timer(&port->ldc_reset_timer); + cancel_delayed_work(&port->ldc_reset_timer_work); vdc_finish(vio, 0, WAITING_FOR_LINK_UP); vdc_blk_queue_start(port); } @@ -320,7 +320,7 @@ static void vdc_end_one(struct vdc_port *port, struct vio_dring_state *dr, rqe->req = NULL; - __blk_end_request(req, (desc->status ? BLK_STS_IOERR : 0), desc->size); + blk_mq_end_request(req, desc->status ? BLK_STS_IOERR : 0); vdc_blk_queue_start(port); } @@ -525,29 +525,40 @@ static int __send_request(struct request *req) return err; } -static void do_vdc_request(struct request_queue *rq) +static blk_status_t vdc_queue_rq(struct blk_mq_hw_ctx *hctx, +const struct blk_mq_queue_data *bd) { - struct request *req; + struct vdc_port *port = hctx->queue->queuedata; + struct vio_dring_state *dr; + unsigned long flags; - while ((req = blk_peek_request(rq)) != NULL) { - struct vdc_port *port; - struct vio_dring_state *dr; + dr = &port->vio.drings[VIO_DRIVER_TX_RING]; - port = req->rq_disk->private_data; - dr = &port->vio.drings[VIO_DRIVER_TX_RING]; - if (unlikely(vdc_tx_dring_avail(dr) < 1)) - goto wait; + blk_mq_start_request(bd->rq); - blk_start_request(req); + spin_lock_irqsave(&port->vio.lock, flags); - if (__send_request(req) < 0) { - blk_requeue_request(rq, req); -wait: - /* Avoid pointless unplugs. */ - blk_stop_queue(rq); - break; - } + /* +* Doing drain, just end the request in error +*/ + if (unlikely(port->drain)) { + spin_unlock_irqrestore(&port->vio.lock, flags); + return BLK_STS_IOERR; } + + if (unlikely(vdc_tx_dring_avail(dr) < 1)) { + spin_unlock_irqrestore(&port->vio.lock, flags); + blk_mq_stop_hw_queue(hctx); + return BLK_STS_DEV_RESOURCE; + } + + if (__send_request(bd->rq) < 0) { + spin_unlock_irqrestore(&port->vio.lock, flags); + return BLK_STS_IOERR; + } + + spin_unlock_irqrestore(&port->vio.lock, flags); + return BLK_STS_OK; } static int generic_request(struct vdc_port *port, u8 op, void *buf, int len) @@ -759,6 +770,32 @@ static void vdc_port_down(struct vdc_port *port) vio_ldc_free(&port->vio); } +static const struct blk_mq_ops vdc_mq_ops = { + .queue_rq = vdc_queue_rq, +}; + +static void cleanup_queue(struct request_queue *q) +{ + struct vdc_port
[PATCH 16/28] blk-cgroup: remove legacy queue bypassing
We only support mq devices now. Signed-off-by: Jens Axboe --- block/blk-cgroup.c | 8 1 file changed, 8 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 992da5592c6e..5f10d755ec52 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1446,8 +1446,6 @@ int blkcg_activate_policy(struct request_queue *q, if (q->mq_ops) blk_mq_freeze_queue(q); - else - blk_queue_bypass_start(q); pd_prealloc: if (!pd_prealloc) { pd_prealloc = pol->pd_alloc_fn(GFP_KERNEL, q->node); @@ -1487,8 +1485,6 @@ int blkcg_activate_policy(struct request_queue *q, out_bypass_end: if (q->mq_ops) blk_mq_unfreeze_queue(q); - else - blk_queue_bypass_end(q); if (pd_prealloc) pol->pd_free_fn(pd_prealloc); return ret; @@ -1513,8 +1509,6 @@ void blkcg_deactivate_policy(struct request_queue *q, if (q->mq_ops) blk_mq_freeze_queue(q); - else - blk_queue_bypass_start(q); spin_lock_irq(q->queue_lock); @@ -1533,8 +1527,6 @@ void blkcg_deactivate_policy(struct request_queue *q, if (q->mq_ops) blk_mq_unfreeze_queue(q); - else - blk_queue_bypass_end(q); } EXPORT_SYMBOL_GPL(blkcg_deactivate_policy); -- 2.17.1
[PATCH 14/28] block: remove blk_complete_request()
It's now unused. Signed-off-by: Jens Axboe --- block/blk-softirq.c| 20 include/linux/blkdev.h | 1 - 2 files changed, 21 deletions(-) diff --git a/block/blk-softirq.c b/block/blk-softirq.c index e47a2f751884..8ca0f6caf174 100644 --- a/block/blk-softirq.c +++ b/block/blk-softirq.c @@ -145,26 +145,6 @@ void __blk_complete_request(struct request *req) } EXPORT_SYMBOL(__blk_complete_request); -/** - * blk_complete_request - end I/O on a request - * @req: the request being processed - * - * Description: - * Ends all I/O on a request. It does not handle partial completions, - * unless the driver actually implements this in its completion callback - * through requeueing. The actual completion happens out-of-order, - * through a softirq handler. The user must have registered a completion - * callback through blk_queue_softirq_done(). - **/ -void blk_complete_request(struct request *req) -{ - if (unlikely(blk_should_fake_timeout(req->q))) - return; - if (!blk_mark_rq_complete(req)) - __blk_complete_request(req); -} -EXPORT_SYMBOL(blk_complete_request); - static __init int blk_softirq_init(void) { int i; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4293dc1cd160..9ff9ab6fc1fe 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1205,7 +1205,6 @@ extern bool __blk_end_request(struct request *rq, blk_status_t error, extern void __blk_end_request_all(struct request *rq, blk_status_t error); extern bool __blk_end_request_cur(struct request *rq, blk_status_t error); -extern void blk_complete_request(struct request *); extern void __blk_complete_request(struct request *); extern void blk_abort_request(struct request *); extern void blk_unprep_request(struct request *); -- 2.17.1
[PATCH 09/28] dm: remove legacy IO path
dm supports both, and since we're killing off the legacy path in general, get rid of it in dm as well. Signed-off-by: Jens Axboe --- drivers/md/Kconfig| 11 -- drivers/md/dm-core.h | 10 -- drivers/md/dm-mpath.c | 14 +- drivers/md/dm-rq.c| 293 -- drivers/md/dm-rq.h| 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +-- drivers/md/dm.h | 1 - 9 files changed, 35 insertions(+), 358 deletions(-) diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index 8b8c123cae66..3db222509e44 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig @@ -215,17 +215,6 @@ config BLK_DEV_DM If unsure, say N. -config DM_MQ_DEFAULT - bool "request-based DM: use blk-mq I/O path by default" - depends on BLK_DEV_DM - ---help--- - This option enables the blk-mq based I/O path for request-based - DM devices by default. With the option the dm_mod.use_blk_mq - module/boot option defaults to Y, without it to N, but it can - still be overriden either way. - - If unsure say N. - config DM_DEBUG bool "Device mapper debugging support" depends on BLK_DEV_DM diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h index 7d480c930eaf..224d44503a06 100644 --- a/drivers/md/dm-core.h +++ b/drivers/md/dm-core.h @@ -112,18 +112,8 @@ struct mapped_device { struct dm_stats stats; - struct kthread_worker kworker; - struct task_struct *kworker_task; - - /* for request-based merge heuristic in dm_request_fn() */ - unsigned seq_rq_merge_deadline_usecs; - int last_rq_rw; - sector_t last_rq_pos; - ktime_t last_rq_start_time; - /* for blk-mq request-based DM support */ struct blk_mq_tag_set *tag_set; - bool use_blk_mq:1; bool init_tio_pdu:1; struct srcu_struct io_barrier; diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 419362c2d8ac..a24ed3973e7c 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -203,14 +203,7 @@ static struct multipath *alloc_multipath(struct dm_target *ti) static int alloc_multipath_stage2(struct dm_target *ti, struct multipath *m) { if (m->queue_mode == DM_TYPE_NONE) { - /* -* Default to request-based. -*/ - if (dm_use_blk_mq(dm_table_get_md(ti->table))) - m->queue_mode = DM_TYPE_MQ_REQUEST_BASED; - else - m->queue_mode = DM_TYPE_REQUEST_BASED; - + m->queue_mode = DM_TYPE_MQ_REQUEST_BASED; } else if (m->queue_mode == DM_TYPE_BIO_BASED) { INIT_WORK(&m->process_queued_bios, process_queued_bios); /* @@ -537,10 +530,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, * get the queue busy feedback (via BLK_STS_RESOURCE), * otherwise I/O merging can suffer. */ - if (q->mq_ops) - return DM_MAPIO_REQUEUE; - else - return DM_MAPIO_DELAY_REQUEUE; + return DM_MAPIO_REQUEUE; } clone->bio = clone->biotail = NULL; clone->rq_disk = bdev->bd_disk; diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 6e547b8dd298..37192b396473 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -23,19 +23,6 @@ static unsigned dm_mq_queue_depth = DM_MQ_QUEUE_DEPTH; #define RESERVED_REQUEST_BASED_IOS 256 static unsigned reserved_rq_based_ios = RESERVED_REQUEST_BASED_IOS; -static bool use_blk_mq = IS_ENABLED(CONFIG_DM_MQ_DEFAULT); - -bool dm_use_blk_mq_default(void) -{ - return use_blk_mq; -} - -bool dm_use_blk_mq(struct mapped_device *md) -{ - return md->use_blk_mq; -} -EXPORT_SYMBOL_GPL(dm_use_blk_mq); - unsigned dm_get_reserved_rq_based_ios(void) { return __dm_get_module_param(&reserved_rq_based_ios, @@ -59,16 +46,6 @@ int dm_request_based(struct mapped_device *md) return queue_is_rq_based(md->queue); } -static void dm_old_start_queue(struct request_queue *q) -{ - unsigned long flags; - - spin_lock_irqsave(q->queue_lock, flags); - if (blk_queue_stopped(q)) - blk_start_queue(q); - spin_unlock_irqrestore(q->queue_lock, flags); -} - static void dm_mq_start_queue(struct request_queue *q) { blk_mq_unquiesce_queue(q); @@ -77,20 +54,7 @@ static void dm_mq_start_queue(struct request_queue *q) void dm_start_queue(struct request_queue *q) { - if (!q->mq_ops) - dm_old_start_queue(q); - else - dm_mq_start_queue(q); -} - -static void dm_old_stop_queue(struct request_queue *q) -{ - unsigned long flags; - - spin_lock_irqsave(q->queue_lock, flags); - if (!blk_queue_stopped(q)) - blk_stop_queue(q); - spi
[PATCH 02/28] ms_block: convert to blk-mq
Straight forward conversion, room for optimization in how everything is punted to a work queue. Also looks plenty racy all over the map, with the state changes. I fixed a bunch of them up while doing the conversion, but there are surely more. Cc: Maxim Levitsky Signed-off-by: Jens Axboe --- drivers/memstick/core/ms_block.c | 110 +-- drivers/memstick/core/ms_block.h | 1 + 2 files changed, 62 insertions(+), 49 deletions(-) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index 8a02f11076f9..ee0be66a9a03 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -15,7 +15,7 @@ #define pr_fmt(fmt) DRIVER_NAME ": " fmt #include -#include +#include #include #include #include @@ -1873,69 +1873,65 @@ static void msb_io_work(struct work_struct *work) struct msb_data *msb = container_of(work, struct msb_data, io_work); int page, error, len; sector_t lba; - unsigned long flags; struct scatterlist *sg = msb->prealloc_sg; + struct request *req; dbg_verbose("IO: work started"); while (1) { - spin_lock_irqsave(&msb->q_lock, flags); + spin_lock_irq(&msb->q_lock); if (msb->need_flush_cache) { msb->need_flush_cache = false; - spin_unlock_irqrestore(&msb->q_lock, flags); + spin_unlock_irq(&msb->q_lock); msb_cache_flush(msb); continue; } - if (!msb->req) { - msb->req = blk_fetch_request(msb->queue); - if (!msb->req) { - dbg_verbose("IO: no more requests exiting"); - spin_unlock_irqrestore(&msb->q_lock, flags); - return; - } + req = msb->req; + if (!req) { + dbg_verbose("IO: no more requests exiting"); + spin_unlock_irq(&msb->q_lock); + return; } - spin_unlock_irqrestore(&msb->q_lock, flags); - - /* If card was removed meanwhile */ - if (!msb->req) - return; + spin_unlock_irq(&msb->q_lock); /* process the request */ dbg_verbose("IO: processing new request"); - blk_rq_map_sg(msb->queue, msb->req, sg); + blk_rq_map_sg(msb->queue, req, sg); - lba = blk_rq_pos(msb->req); + lba = blk_rq_pos(req); sector_div(lba, msb->page_size / 512); page = sector_div(lba, msb->pages_in_block); if (rq_data_dir(msb->req) == READ) error = msb_do_read_request(msb, lba, page, sg, - blk_rq_bytes(msb->req), &len); + blk_rq_bytes(req), &len); else error = msb_do_write_request(msb, lba, page, sg, - blk_rq_bytes(msb->req), &len); - - spin_lock_irqsave(&msb->q_lock, flags); + blk_rq_bytes(req), &len); - if (len) - if (!__blk_end_request(msb->req, BLK_STS_OK, len)) - msb->req = NULL; + if (len && !blk_update_request(req, BLK_STS_OK, len)) { + __blk_mq_end_request(req, BLK_STS_OK); + spin_lock_irq(&msb->q_lock); + msb->req = NULL; + spin_unlock_irq(&msb->q_lock); + } if (error && msb->req) { blk_status_t ret = errno_to_blk_status(error); + dbg_verbose("IO: ending one sector of the request with error"); - if (!__blk_end_request(msb->req, ret, msb->page_size)) - msb->req = NULL; + blk_mq_end_request(req, ret); + spin_lock_irq(&msb->q_lock); + msb->req = NULL; + spin_unlock_irq(&msb->q_lock); } if (msb->req) dbg_verbose("IO: request still pending"); - - spin_unlock_irqrestore(&msb->q_lock, flags); } } @@ -2002,29 +1998,40 @@ static int msb_bd_getgeo(struct block_device *bdev, return 0; } -static void msb_submit_req(struct request_queue *q) +static blk_status_t msb_queue_rq(struct blk_mq_hw_ctx *hctx, +const struct blk_mq_queue_data *bd) { - struct memstick_dev *card = q->queuedata; + struct memstick_dev *card = hctx->queue->queuedata; struct msb_data *msb = memstick_get_drvdata(card); - struc
[PATCH 18/28] block: remove non mq parts from the flush code
Signed-off-by: Jens Axboe --- block/blk-flush.c | 154 +- block/blk.h | 4 +- 2 files changed, 31 insertions(+), 127 deletions(-) diff --git a/block/blk-flush.c b/block/blk-flush.c index 8b44b86779da..9baa9a119447 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c @@ -134,16 +134,8 @@ static void blk_flush_restore_request(struct request *rq) static bool blk_flush_queue_rq(struct request *rq, bool add_front) { - if (rq->q->mq_ops) { - blk_mq_add_to_requeue_list(rq, add_front, true); - return false; - } else { - if (add_front) - list_add(&rq->queuelist, &rq->q->queue_head); - else - list_add_tail(&rq->queuelist, &rq->q->queue_head); - return true; - } + blk_mq_add_to_requeue_list(rq, add_front, true); + return false; } /** @@ -204,10 +196,7 @@ static bool blk_flush_complete_seq(struct request *rq, BUG_ON(!list_empty(&rq->queuelist)); list_del_init(&rq->flush.list); blk_flush_restore_request(rq); - if (q->mq_ops) - blk_mq_end_request(rq, error); - else - __blk_end_request_all(rq, error); + blk_mq_end_request(rq, error); break; default: @@ -226,20 +215,17 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error) struct request *rq, *n; unsigned long flags = 0; struct blk_flush_queue *fq = blk_get_flush_queue(q, flush_rq->mq_ctx); + struct blk_mq_hw_ctx *hctx; - if (q->mq_ops) { - struct blk_mq_hw_ctx *hctx; - - /* release the tag's ownership to the req cloned from */ - spin_lock_irqsave(&fq->mq_flush_lock, flags); - hctx = blk_mq_map_queue(q, flush_rq->mq_ctx->cpu); - if (!q->elevator) { - blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq); - flush_rq->tag = -1; - } else { - blk_mq_put_driver_tag_hctx(hctx, flush_rq); - flush_rq->internal_tag = -1; - } + /* release the tag's ownership to the req cloned from */ + spin_lock_irqsave(&fq->mq_flush_lock, flags); + hctx = blk_mq_map_queue(q, flush_rq->mq_ctx->cpu); + if (!q->elevator) { + blk_mq_tag_set_rq(hctx, flush_rq->tag, fq->orig_rq); + flush_rq->tag = -1; + } else { + blk_mq_put_driver_tag_hctx(hctx, flush_rq); + flush_rq->internal_tag = -1; } running = &fq->flush_queue[fq->flush_running_idx]; @@ -248,9 +234,6 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error) /* account completion of the flush request */ fq->flush_running_idx ^= 1; - if (!q->mq_ops) - elv_completed_request(q, flush_rq); - /* and push the waiting requests to the next stage */ list_for_each_entry_safe(rq, n, running, flush.list) { unsigned int seq = blk_flush_cur_seq(rq); @@ -259,24 +242,8 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error) queued |= blk_flush_complete_seq(rq, fq, seq, error); } - /* -* Kick the queue to avoid stall for two cases: -* 1. Moving a request silently to empty queue_head may stall the -* queue. -* 2. When flush request is running in non-queueable queue, the -* queue is hold. Restart the queue after flush request is finished -* to avoid stall. -* This function is called from request completion path and calling -* directly into request_fn may confuse the driver. Always use -* kblockd. -*/ - if (queued || fq->flush_queue_delayed) { - WARN_ON(q->mq_ops); - blk_run_queue_async(q); - } fq->flush_queue_delayed = 0; - if (q->mq_ops) - spin_unlock_irqrestore(&fq->mq_flush_lock, flags); + spin_unlock_irqrestore(&fq->mq_flush_lock, flags); } /** @@ -301,6 +268,7 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq, struct request *first_rq = list_first_entry(pending, struct request, flush.list); struct request *flush_rq = fq->flush_rq; + struct blk_mq_hw_ctx *hctx; /* C1 described at the top of this file */ if (fq->flush_pending_idx != fq->flush_running_idx || list_empty(pending)) @@ -334,19 +302,15 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq, * In case of IO scheduler, flush rq need to borrow scheduler tag * just for cheating put/get driver tag. */ - if (q->mq_ops) { - struct blk_mq_hw_ctx *hctx; - -
[PATCH 17/28] block: remove legacy rq tagging
It's now unused, kill it. Signed-off-by: Jens Axboe --- Documentation/block/biodoc.txt | 88 block/Makefile | 2 +- block/blk-core.c | 6 - block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-sysfs.c | 3 - block/blk-tag.c| 378 - include/linux/blkdev.h | 35 --- 8 files changed, 3 insertions(+), 517 deletions(-) delete mode 100644 block/blk-tag.c diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt index 207eca58efaa..ac18b488cb5e 100644 --- a/Documentation/block/biodoc.txt +++ b/Documentation/block/biodoc.txt @@ -65,7 +65,6 @@ Description of Contents: 3.2.3 I/O completion 3.2.4 Implications for drivers that do not interpret bios (don't handle multiple segments) -3.2.5 Request command tagging 3.3 I/O submission 4. The I/O scheduler 5. Scalability related changes @@ -708,93 +707,6 @@ is crossed on completion of a transfer. (The end*request* functions should be used if only if the request has come down from block/bio path, not for direct access requests which only specify rq->buffer without a valid rq->bio) -3.2.5 Generic request command tagging - -3.2.5.1 Tag helpers - -Block now offers some simple generic functionality to help support command -queueing (typically known as tagged command queueing), ie manage more than -one outstanding command on a queue at any given time. - - blk_queue_init_tags(struct request_queue *q, int depth) - - Initialize internal command tagging structures for a maximum - depth of 'depth'. - - blk_queue_free_tags((struct request_queue *q) - - Teardown tag info associated with the queue. This will be done - automatically by block if blk_queue_cleanup() is called on a queue - that is using tagging. - -The above are initialization and exit management, the main helpers during -normal operations are: - - blk_queue_start_tag(struct request_queue *q, struct request *rq) - - Start tagged operation for this request. A free tag number between - 0 and 'depth' is assigned to the request (rq->tag holds this number), - and 'rq' is added to the internal tag management. If the maximum depth - for this queue is already achieved (or if the tag wasn't started for - some other reason), 1 is returned. Otherwise 0 is returned. - - blk_queue_end_tag(struct request_queue *q, struct request *rq) - - End tagged operation on this request. 'rq' is removed from the internal - book keeping structures. - -To minimize struct request and queue overhead, the tag helpers utilize some -of the same request members that are used for normal request queue management. -This means that a request cannot both be an active tag and be on the queue -list at the same time. blk_queue_start_tag() will remove the request, but -the driver must remember to call blk_queue_end_tag() before signalling -completion of the request to the block layer. This means ending tag -operations before calling end_that_request_last()! For an example of a user -of these helpers, see the IDE tagged command queueing support. - -3.2.5.2 Tag info - -Some block functions exist to query current tag status or to go from a -tag number to the associated request. These are, in no particular order: - - blk_queue_tagged(q) - - Returns 1 if the queue 'q' is using tagging, 0 if not. - - blk_queue_tag_request(q, tag) - - Returns a pointer to the request associated with tag 'tag'. - - blk_queue_tag_depth(q) - - Return current queue depth. - - blk_queue_tag_queue(q) - - Returns 1 if the queue can accept a new queued command, 0 if we are - at the maximum depth already. - - blk_queue_rq_tagged(rq) - - Returns 1 if the request 'rq' is tagged. - -3.2.5.2 Internal structure - -Internally, block manages tags in the blk_queue_tag structure: - - struct blk_queue_tag { - struct request **tag_index; /* array or pointers to rq */ - unsigned long *tag_map; /* bitmap of free tags */ - struct list_head busy_list; /* fifo list of busy tags */ - int busy; /* queue depth */ - int max_depth; /* max queue depth */ - }; - -Most of the above is simple and straight forward, however busy_list may need -a bit of explaining. Normally we don't care too much about request ordering, -but in the event of any barrier requests in the tag queue we need to ensure -that requests are restarted in the order they were queue. - 3.3 I/O Submission The routine submit_bio() is used to submit a single io. Higher level i/o diff --git a/block/Makefile b/block/Makefile index 27eac600474f..213674c8faaa 100644 --- a/block/Makefile +++ b/block/Makefile @@ -3,7 +3,7 @@ # Makefile for the kernel blo
[PATCH 12/28] bsg: provide bsg_remove_queue() helper
All drivers do unregister + cleanup, provide a helper for that. Cc: Johannes Thumshirn Cc: Benjamin Block Cc: linux-scsi@vger.kernel.org Signed-off-by: Jens Axboe --- block/bsg-lib.c | 7 +++ drivers/scsi/scsi_transport_fc.c| 6 ++ drivers/scsi/scsi_transport_iscsi.c | 7 +++ drivers/scsi/scsi_transport_sas.c | 6 ++ include/linux/bsg-lib.h | 1 + 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index 1da011ec04e6..267f965af77a 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -296,6 +296,13 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req) kfree(job->reply); } +void bsg_remove_queue(struct request_queue *q) +{ + bsg_unregister_queue(q); + blk_cleanup_queue(q); +} +EXPORT_SYMBOL_GPL(bsg_remove_queue); + /** * bsg_setup_queue - Create and add the bsg hooks so we can receive requests * @dev: device to attach bsg device to diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 98aaffb4c715..4d64956bb5d3 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -3851,10 +3851,8 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport) static void fc_bsg_remove(struct request_queue *q) { - if (q) { - bsg_unregister_queue(q); - blk_cleanup_queue(q); - } + if (q) + bsg_remove_queue(q); } diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 26b11a775be9..3ead0dba5d8d 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1576,10 +1576,9 @@ static int iscsi_remove_host(struct transport_container *tc, struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data; - if (ihost->bsg_q) { - bsg_unregister_queue(ihost->bsg_q); - blk_cleanup_queue(ihost->bsg_q); - } + if (ihost->bsg_q) + bsg_remove_queue(ihost->bsg_q); + return 0; } diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index cf6d47891d77..c46d642dc133 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -246,10 +246,8 @@ static int sas_host_remove(struct transport_container *tc, struct device *dev, struct Scsi_Host *shost = dev_to_shost(dev); struct request_queue *q = to_sas_host_attrs(shost)->q; - if (q) { - bsg_unregister_queue(q); - blk_cleanup_queue(q); - } + if (q) + bsg_remove_queue(q); return 0; } diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h index b13ae143e7ef..9c9b134b1fa5 100644 --- a/include/linux/bsg-lib.h +++ b/include/linux/bsg-lib.h @@ -73,6 +73,7 @@ void bsg_job_done(struct bsg_job *job, int result, unsigned int reply_payload_rcv_len); struct request_queue *bsg_setup_queue(struct device *dev, const char *name, bsg_job_fn *job_fn, rq_timed_out_fn *timeout, int dd_job_size); +void bsg_remove_queue(struct request_queue *q); void bsg_job_put(struct bsg_job *job); int __must_check bsg_job_get(struct bsg_job *job); -- 2.17.1
[PATCH 10/28] dasd: remove dead code
Since e443343e509a we haven't had a request_fn attached to this driver, hence any code inside an if (q->request_fn) is unreachable. Fixes: e443343e509a ("s390/dasd: blk-mq conversion") [sth: Keep and fix the dasd_info->chanq_len counter.] Reviewed-by: Jan Hoeppner Signed-off-by: Stefan Haberland Signed-off-by: Jens Axboe --- drivers/s390/block/dasd_ioctl.c | 22 +- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 2016e0ed5865..8e26001dc11c 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -412,6 +412,7 @@ static int dasd_ioctl_information(struct dasd_block *block, struct ccw_dev_id dev_id; struct dasd_device *base; struct ccw_device *cdev; + struct list_head *l; unsigned long flags; int rc; @@ -462,23 +463,10 @@ static int dasd_ioctl_information(struct dasd_block *block, memcpy(dasd_info->type, base->discipline->name, 4); - if (block->request_queue->request_fn) { - struct list_head *l; -#ifdef DASD_EXTENDED_PROFILING - { - struct list_head *l; - spin_lock_irqsave(&block->lock, flags); - list_for_each(l, &block->request_queue->queue_head) - dasd_info->req_queue_len++; - spin_unlock_irqrestore(&block->lock, flags); - } -#endif /* DASD_EXTENDED_PROFILING */ - spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags); - list_for_each(l, &base->ccw_queue) - dasd_info->chanq_len++; - spin_unlock_irqrestore(get_ccwdev_lock(base->cdev), - flags); - } + spin_lock_irqsave(&block->queue_lock, flags); + list_for_each(l, &base->ccw_queue) + dasd_info->chanq_len++; + spin_unlock_irqrestore(&block->queue_lock, flags); rc = 0; if (copy_to_user(argp, dasd_info, -- 2.17.1
[PATCH 13/28] bsg: convert to use blk-mq
Requires a few changes to the FC transport class as well. Cc: Johannes Thumshirn Cc: Benjamin Block Cc: linux-scsi@vger.kernel.org Signed-off-by: Jens Axboe --- block/bsg-lib.c | 123 +++ drivers/scsi/scsi_transport_fc.c | 59 +-- 2 files changed, 110 insertions(+), 72 deletions(-) diff --git a/block/bsg-lib.c b/block/bsg-lib.c index 267f965af77a..ef176b472914 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -21,7 +21,7 @@ * */ #include -#include +#include #include #include #include @@ -129,7 +129,7 @@ static void bsg_teardown_job(struct kref *kref) kfree(job->request_payload.sg_list); kfree(job->reply_payload.sg_list); - blk_end_request_all(rq, BLK_STS_OK); + blk_mq_end_request(rq, BLK_STS_OK); } void bsg_job_put(struct bsg_job *job) @@ -157,15 +157,15 @@ void bsg_job_done(struct bsg_job *job, int result, { job->result = result; job->reply_payload_rcv_len = reply_payload_rcv_len; - blk_complete_request(blk_mq_rq_from_pdu(job)); + blk_mq_complete_request(blk_mq_rq_from_pdu(job)); } EXPORT_SYMBOL_GPL(bsg_job_done); /** - * bsg_softirq_done - softirq done routine for destroying the bsg requests + * bsg_complete - softirq done routine for destroying the bsg requests * @rq: BSG request that holds the job to be destroyed */ -static void bsg_softirq_done(struct request *rq) +static void bsg_complete(struct request *rq) { struct bsg_job *job = blk_mq_rq_to_pdu(rq); @@ -224,54 +224,46 @@ static bool bsg_prepare_job(struct device *dev, struct request *req) } /** - * bsg_request_fn - generic handler for bsg requests - * @q: request queue to manage + * bsg_queue_rq - generic handler for bsg requests + * @hctx: hardware queue + * @bd: queue data * * On error the create_bsg_job function should return a -Exyz error value * that will be set to ->result. * * Drivers/subsys should pass this to the queue init function. */ -static void bsg_request_fn(struct request_queue *q) - __releases(q->queue_lock) - __acquires(q->queue_lock) +static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx, +const struct blk_mq_queue_data *bd) { + struct request_queue *q = hctx->queue; struct device *dev = q->queuedata; - struct request *req; + struct request *req = bd->rq; int ret; + blk_mq_start_request(req); + if (!get_device(dev)) - return; - - while (1) { - req = blk_fetch_request(q); - if (!req) - break; - spin_unlock_irq(q->queue_lock); - - if (!bsg_prepare_job(dev, req)) { - blk_end_request_all(req, BLK_STS_OK); - spin_lock_irq(q->queue_lock); - continue; - } - - ret = q->bsg_job_fn(blk_mq_rq_to_pdu(req)); - spin_lock_irq(q->queue_lock); - if (ret) - break; - } + return BLK_STS_IOERR; + + if (!bsg_prepare_job(dev, req)) + return BLK_STS_IOERR; + + ret = q->bsg_job_fn(blk_mq_rq_to_pdu(req)); + if (ret) + return BLK_STS_IOERR; - spin_unlock_irq(q->queue_lock); put_device(dev); - spin_lock_irq(q->queue_lock); + return BLK_STS_OK; } /* called right after the request is allocated for the request_queue */ -static int bsg_init_rq(struct request_queue *q, struct request *req, gfp_t gfp) +static int bsg_init_rq(struct blk_mq_tag_set *set, struct request *req, + unsigned int hctx_idx, unsigned int numa_node) { struct bsg_job *job = blk_mq_rq_to_pdu(req); - job->reply = kzalloc(SCSI_SENSE_BUFFERSIZE, gfp); + job->reply = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); if (!job->reply) return -ENOMEM; return 0; @@ -289,7 +281,8 @@ static void bsg_initialize_rq(struct request *req) job->dd_data = job + 1; } -static void bsg_exit_rq(struct request_queue *q, struct request *req) +static void bsg_exit_rq(struct blk_mq_tag_set *set, struct request *req, + unsigned int hctx_idx) { struct bsg_job *job = blk_mq_rq_to_pdu(req); @@ -298,11 +291,35 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req) void bsg_remove_queue(struct request_queue *q) { + struct blk_mq_tag_set *set = q->tag_set; + bsg_unregister_queue(q); blk_cleanup_queue(q); + blk_mq_free_tag_set(set); + kfree(set); } EXPORT_SYMBOL_GPL(bsg_remove_queue); +static enum blk_eh_timer_return bsg_timeout(struct request *rq, bool reserved) +{ + enum blk_eh_timer_return ret = BLK_EH_DONE; + struct request_queue *q = rq->q; + + if (q->rq_timed_out_fn) + ret = q->rq_timed_out_fn(rq); + +
[PATCH 28/28] block: get rid of blk_queued_rq()
No point in hiding what this does, just open code it in the one spot where we are still using it. Signed-off-by: Jens Axboe --- block/blk-mq.c | 2 +- include/linux/blkdev.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index d43c9232c77c..21e4147c4810 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -692,7 +692,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list) /* this request will be re-inserted to io scheduler queue */ blk_mq_sched_requeue_request(rq); - BUG_ON(blk_queued_rq(rq)); + BUG_ON(!list_empty(&rq->queuelist)); blk_mq_add_to_requeue_list(rq, true, kick_requeue_list); } EXPORT_SYMBOL(blk_mq_requeue_request); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 95e119409490..82b6cf45c6e0 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -678,8 +678,6 @@ static inline bool blk_account_rq(struct request *rq) #define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) #define blk_bidi_rq(rq)((rq)->next_rq != NULL) -/* rq->queuelist of dequeued request must be list_empty() */ -#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) -- 2.17.1
[PATCH 20/28] block: remove dead elevator code
This removes a bunch of core and elevator related code. On the core front, we remove anything related to queue running, draining, initialization, plugging, and congestions. We also kill anything related to request allocation, merging, retrieval, and completion. Remove any checking for single queue IO schedulers, as they no longer exist. This means we can also delete a bunch of code related to request issue, adding, completion, etc - and all the SQ related ops and helpers. Also kill the load_default_modules(), as all that did was provide for a way to load the default single queue elevator. Signed-off-by: Jens Axboe --- block/bfq-iosched.c |1 - block/blk-core.c | 1749 +- block/blk-exec.c | 20 +- block/blk-ioc.c | 46 +- block/blk-merge.c|5 - block/blk-settings.c | 36 - block/blk-sysfs.c| 36 +- block/blk.h | 51 -- block/elevator.c | 377 +--- block/kyber-iosched.c|1 - block/mq-deadline.c |1 - include/linux/blkdev.h | 93 +- include/linux/elevator.h | 90 +- include/linux/init.h |1 - init/do_mounts_initrd.c |3 - init/initramfs.c |6 - init/main.c | 12 - 17 files changed, 73 insertions(+), 2455 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 6075100f03a5..83b29c007f76 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5745,7 +5745,6 @@ static struct elevator_type iosched_bfq_mq = { .exit_sched = bfq_exit_queue, }, - .uses_mq = true, .icq_size = sizeof(struct bfq_io_cq), .icq_align =__alignof__(struct bfq_io_cq), .elevator_attrs = bfq_attrs, diff --git a/block/blk-core.c b/block/blk-core.c index 1a814bce323d..009ac18cc7e1 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -144,46 +144,6 @@ bool blk_queue_flag_test_and_clear(unsigned int flag, struct request_queue *q) } EXPORT_SYMBOL_GPL(blk_queue_flag_test_and_clear); -static void blk_clear_congested(struct request_list *rl, int sync) -{ -#ifdef CONFIG_CGROUP_WRITEBACK - clear_wb_congested(rl->blkg->wb_congested, sync); -#else - /* -* If !CGROUP_WRITEBACK, all blkg's map to bdi->wb and we shouldn't -* flip its congestion state for events on other blkcgs. -*/ - if (rl == &rl->q->root_rl) - clear_wb_congested(rl->q->backing_dev_info->wb.congested, sync); -#endif -} - -static void blk_set_congested(struct request_list *rl, int sync) -{ -#ifdef CONFIG_CGROUP_WRITEBACK - set_wb_congested(rl->blkg->wb_congested, sync); -#else - /* see blk_clear_congested() */ - if (rl == &rl->q->root_rl) - set_wb_congested(rl->q->backing_dev_info->wb.congested, sync); -#endif -} - -void blk_queue_congestion_threshold(struct request_queue *q) -{ - int nr; - - nr = q->nr_requests - (q->nr_requests / 8) + 1; - if (nr > q->nr_requests) - nr = q->nr_requests; - q->nr_congestion_on = nr; - - nr = q->nr_requests - (q->nr_requests / 8) - (q->nr_requests / 16) - 1; - if (nr < 1) - nr = 1; - q->nr_congestion_off = nr; -} - void blk_rq_init(struct request_queue *q, struct request *rq) { memset(rq, 0, sizeof(*rq)); @@ -292,99 +252,6 @@ void blk_dump_rq_flags(struct request *rq, char *msg) } EXPORT_SYMBOL(blk_dump_rq_flags); -static void blk_delay_work(struct work_struct *work) -{ - struct request_queue *q; - - q = container_of(work, struct request_queue, delay_work.work); - spin_lock_irq(q->queue_lock); - __blk_run_queue(q); - spin_unlock_irq(q->queue_lock); -} - -/** - * blk_delay_queue - restart queueing after defined interval - * @q: The &struct request_queue in question - * @msecs: Delay in msecs - * - * Description: - * Sometimes queueing needs to be postponed for a little while, to allow - * resources to come back. This function will make sure that queueing is - * restarted around the specified time. - */ -void blk_delay_queue(struct request_queue *q, unsigned long msecs) -{ - lockdep_assert_held(q->queue_lock); - WARN_ON_ONCE(q->mq_ops); - - if (likely(!blk_queue_dead(q))) - queue_delayed_work(kblockd_workqueue, &q->delay_work, - msecs_to_jiffies(msecs)); -} -EXPORT_SYMBOL(blk_delay_queue); - -/** - * blk_start_queue_async - asynchronously restart a previously stopped queue - * @q:The &struct request_queue in question - * - * Description: - * blk_start_queue_async() will clear the stop flag on the queue, and - * ensure that the request_fn for the queue is run from an async - * context. - **/ -void blk_start_queue_async(struct request_queue *q) -{ - lockdep_assert_held(q->queue_lock); - WARN_ON_ONCE(q->mq_ops); - - queue
[PATCH 23/28] block: kill lld busy
Nobody sets the helper, so we always return 0. Kill it. Signed-off-by: Jens Axboe --- block/blk-core.c | 28 block/blk-settings.c | 6 -- drivers/md/dm-mpath.c | 4 +--- include/linux/blkdev.h | 4 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 4c39c7865f9c..dd1328f4dc31 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1795,34 +1795,6 @@ void rq_flush_dcache_pages(struct request *rq) EXPORT_SYMBOL_GPL(rq_flush_dcache_pages); #endif -/** - * blk_lld_busy - Check if underlying low-level drivers of a device are busy - * @q : the queue of the device being checked - * - * Description: - *Check if underlying low-level drivers of a device are busy. - *If the drivers want to export their busy state, they must set own - *exporting function using blk_queue_lld_busy() first. - * - *Basically, this function is used only by request stacking drivers - *to stop dispatching requests to underlying devices when underlying - *devices are busy. This behavior helps more I/O merging on the queue - *of the request stacking driver and prevents I/O throughput regression - *on burst I/O load. - * - * Return: - *0 - Not busy (The request stacking driver should dispatch request) - *1 - Busy (The request stacking driver should stop dispatching request) - */ -int blk_lld_busy(struct request_queue *q) -{ - if (q->lld_busy_fn) - return q->lld_busy_fn(q); - - return 0; -} -EXPORT_SYMBOL_GPL(blk_lld_busy); - /** * blk_rq_unprep_clone - Helper function to free all bios in a cloned request * @rq: the clone request to be cleaned up diff --git a/block/blk-settings.c b/block/blk-settings.c index 3c5da75c2def..1895f499bbe5 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -32,12 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) } EXPORT_SYMBOL_GPL(blk_queue_rq_timeout); -void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn) -{ - q->lld_busy_fn = fn; -} -EXPORT_SYMBOL_GPL(blk_queue_lld_busy); - /** * blk_set_default_limits - reset limits to default values * @lim: the queue_limits structure to reset diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index a24ed3973e7c..4d736e0fd67f 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1936,9 +1936,7 @@ static int multipath_iterate_devices(struct dm_target *ti, static int pgpath_busy(struct pgpath *pgpath) { - struct request_queue *q = bdev_get_queue(pgpath->path.dev->bdev); - - return blk_lld_busy(q); + return 0; } /* diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index bfe40de81c19..115199e7c581 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -312,7 +312,6 @@ typedef bool (poll_q_fn) (struct request_queue *q, blk_qc_t); struct bio_vec; typedef void (softirq_done_fn)(struct request *); typedef int (dma_drain_needed_fn)(struct request *); -typedef int (lld_busy_fn) (struct request_queue *q); typedef int (bsg_job_fn) (struct bsg_job *); typedef int (init_rq_fn)(struct request_queue *, struct request *, gfp_t); typedef void (exit_rq_fn)(struct request_queue *, struct request *); @@ -443,7 +442,6 @@ struct request_queue { poll_q_fn *poll_fn; softirq_done_fn *softirq_done_fn; dma_drain_needed_fn *dma_drain_needed; - lld_busy_fn *lld_busy_fn; /* Called just after a request is allocated */ init_rq_fn *init_rq_fn; /* Called just before a request is freed */ @@ -909,7 +907,6 @@ extern void blk_init_request_from_bio(struct request *req, struct bio *bio); extern void blk_put_request(struct request *); extern struct request *blk_get_request(struct request_queue *, unsigned int op, blk_mq_req_flags_t flags); -extern int blk_lld_busy(struct request_queue *q); extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, struct bio_set *bs, gfp_t gfp_mask, int (*bio_ctr)(struct bio *, struct bio *, void *), @@ -1152,7 +1149,6 @@ extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); extern int blk_queue_dma_drain(struct request_queue *q, dma_drain_needed_fn *dma_drain_needed, void *buf, unsigned int size); -extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); extern void blk_queue_virt_boundary(struct request_queue *, unsigned long); extern void blk_queue_dma_alignment(struct request_queue *, int); -- 2.17.1
[PATCH 24/28] block: remove request_list code
It's now dead code, nobody uses it. Signed-off-by: Jens Axboe --- block/blk-cgroup.c | 47 block/blk-core.c | 75 -- block/blk-mq.c | 4 -- block/blk.h| 3 -- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 34 6 files changed, 271 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 5f10d755ec52..020869a37d11 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -76,9 +76,6 @@ static void blkg_free(struct blkcg_gq *blkg) if (blkg->pd[i]) blkcg_policy[i]->pd_free_fn(blkg->pd[i]); - if (blkg->blkcg != &blkcg_root) - blk_exit_rl(blkg->q, &blkg->rl); - blkg_rwstat_exit(&blkg->stat_ios); blkg_rwstat_exit(&blkg->stat_bytes); kfree(blkg); @@ -142,13 +139,6 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, INIT_LIST_HEAD(&blkg->q_node); blkg->blkcg = blkcg; - /* root blkg uses @q->root_rl, init rl only for !root blkgs */ - if (blkcg != &blkcg_root) { - if (blk_init_rl(&blkg->rl, q, gfp_mask)) - goto err_free; - blkg->rl.blkg = blkg; - } - for (i = 0; i < BLKCG_MAX_POLS; i++) { struct blkcg_policy *pol = blkcg_policy[i]; struct blkg_policy_data *pd; @@ -448,42 +438,6 @@ static void blkg_destroy_all(struct request_queue *q) } q->root_blkg = NULL; - q->root_rl.blkg = NULL; -} - -/* - * The next function used by blk_queue_for_each_rl(). It's a bit tricky - * because the root blkg uses @q->root_rl instead of its own rl. - */ -struct request_list *__blk_queue_next_rl(struct request_list *rl, -struct request_queue *q) -{ - struct list_head *ent; - struct blkcg_gq *blkg; - - /* -* Determine the current blkg list_head. The first entry is -* root_rl which is off @q->blkg_list and mapped to the head. -*/ - if (rl == &q->root_rl) { - ent = &q->blkg_list; - /* There are no more block groups, hence no request lists */ - if (list_empty(ent)) - return NULL; - } else { - blkg = container_of(rl, struct blkcg_gq, rl); - ent = &blkg->q_node; - } - - /* walk to the next list_head, skip root blkcg */ - ent = ent->next; - if (ent == &q->root_blkg->q_node) - ent = ent->next; - if (ent == &q->blkg_list) - return NULL; - - blkg = container_of(ent, struct blkcg_gq, q_node); - return &blkg->rl; } static int blkcg_reset_stats(struct cgroup_subsys_state *css, @@ -1278,7 +1232,6 @@ int blkcg_init_queue(struct request_queue *q) if (IS_ERR(blkg)) goto err_unlock; q->root_blkg = blkg; - q->root_rl.blkg = blkg; spin_unlock_irq(q->queue_lock); rcu_read_unlock(); diff --git a/block/blk-core.c b/block/blk-core.c index dd1328f4dc31..e8f60ed456a2 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -447,81 +447,6 @@ void blk_cleanup_queue(struct request_queue *q) } EXPORT_SYMBOL(blk_cleanup_queue); -/* Allocate memory local to the request queue */ -static void *alloc_request_simple(gfp_t gfp_mask, void *data) -{ - struct request_queue *q = data; - - return kmem_cache_alloc_node(request_cachep, gfp_mask, q->node); -} - -static void free_request_simple(void *element, void *data) -{ - kmem_cache_free(request_cachep, element); -} - -static void *alloc_request_size(gfp_t gfp_mask, void *data) -{ - struct request_queue *q = data; - struct request *rq; - - rq = kmalloc_node(sizeof(struct request) + q->cmd_size, gfp_mask, - q->node); - if (rq && q->init_rq_fn && q->init_rq_fn(q, rq, gfp_mask) < 0) { - kfree(rq); - rq = NULL; - } - return rq; -} - -static void free_request_size(void *element, void *data) -{ - struct request_queue *q = data; - - if (q->exit_rq_fn) - q->exit_rq_fn(q, element); - kfree(element); -} - -int blk_init_rl(struct request_list *rl, struct request_queue *q, - gfp_t gfp_mask) -{ - if (unlikely(rl->rq_pool) || q->mq_ops) - return 0; - - rl->q = q; - rl->count[BLK_RW_SYNC] = rl->count[BLK_RW_ASYNC] = 0; - rl->starved[BLK_RW_SYNC] = rl->starved[BLK_RW_ASYNC] = 0; - init_waitqueue_head(&rl->wait[BLK_RW_SYNC]); - init_waitqueue_head(&rl->wait[BLK_RW_ASYNC]); - - if (q->cmd_size) { - rl->rq_pool = mempool_create_node(BLKDEV_MIN_RQ, - alloc_request_size, free_request_size, - q, gfp_mask, q->node); -
[PATCH 26/28] block: remove req_no_special_merge() from merging code
It'll always be false at this point, just remove it. Signed-off-by: Jens Axboe --- block/blk-merge.c | 25 +++-- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 7fedc0391610..3561dcce2260 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -595,17 +595,6 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req, return ll_new_hw_segment(q, req, bio); } -/* - * blk-mq uses req->special to carry normal driver per-request payload, it - * does not indicate a prepared command that we cannot merge with. - */ -static bool req_no_special_merge(struct request *req) -{ - struct request_queue *q = req->q; - - return !q->mq_ops && req->special; -} - static bool req_attempt_discard_merge(struct request_queue *q, struct request *req, struct request *next) { @@ -631,13 +620,6 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, unsigned int seg_size = req->biotail->bi_seg_back_size + next->bio->bi_seg_front_size; - /* -* First check if the either of the requests are re-queued -* requests. Can't merge them if they are. -*/ - if (req_no_special_merge(req) || req_no_special_merge(next)) - return 0; - if (req_gap_back_merge(req, next->bio)) return 0; @@ -738,8 +720,7 @@ static struct request *attempt_merge(struct request_queue *q, return NULL; if (rq_data_dir(req) != rq_data_dir(next) - || req->rq_disk != next->rq_disk - || req_no_special_merge(next)) + || req->rq_disk != next->rq_disk) return NULL; if (req_op(req) == REQ_OP_WRITE_SAME && @@ -858,8 +839,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) if (bio_data_dir(bio) != rq_data_dir(rq)) return false; - /* must be same device and not a special request */ - if (rq->rq_disk != bio->bi_disk || req_no_special_merge(rq)) + /* must be same device */ + if (rq->rq_disk != bio->bi_disk) return false; /* only merge integrity protected bio into ditto rq */ -- 2.17.1
[PATCH 22/28] block: kill legacy parts of timeout handling
The only user of legacy timing now is BSG, which is invoked from the mq timeout handler. Kill the legacy code, and rename the q->rq_timed_out_fn to q->bsg_job_timeout_fn. Signed-off-by: Jens Axboe --- block/blk-core.c | 1 - block/blk-settings.c | 7 --- block/blk-timeout.c| 99 +++--- block/blk.h| 1 - block/bsg-lib.c| 6 +-- include/linux/blkdev.h | 4 +- 6 files changed, 11 insertions(+), 107 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index ad79e8b09801..4c39c7865f9c 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -653,7 +653,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, laptop_mode_timer_fn, 0); timer_setup(&q->timeout, blk_rq_timed_out_timer, 0); INIT_WORK(&q->timeout_work, NULL); - INIT_LIST_HEAD(&q->timeout_list); INIT_LIST_HEAD(&q->icq_list); #ifdef CONFIG_BLK_CGROUP INIT_LIST_HEAD(&q->blkg_list); diff --git a/block/blk-settings.c b/block/blk-settings.c index 764d0e9e092f..3c5da75c2def 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -32,13 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) } EXPORT_SYMBOL_GPL(blk_queue_rq_timeout); -void blk_queue_rq_timed_out(struct request_queue *q, rq_timed_out_fn *fn) -{ - WARN_ON_ONCE(q->mq_ops); - q->rq_timed_out_fn = fn; -} -EXPORT_SYMBOL_GPL(blk_queue_rq_timed_out); - void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn) { q->lld_busy_fn = fn; diff --git a/block/blk-timeout.c b/block/blk-timeout.c index f2cfd56e1606..6428d458072a 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -78,70 +78,6 @@ void blk_delete_timer(struct request *req) list_del_init(&req->timeout_list); } -static void blk_rq_timed_out(struct request *req) -{ - struct request_queue *q = req->q; - enum blk_eh_timer_return ret = BLK_EH_RESET_TIMER; - - if (q->rq_timed_out_fn) - ret = q->rq_timed_out_fn(req); - switch (ret) { - case BLK_EH_RESET_TIMER: - blk_add_timer(req); - blk_clear_rq_complete(req); - break; - case BLK_EH_DONE: - /* -* LLD handles this for now but in the future -* we can send a request msg to abort the command -* and we can move more of the generic scsi eh code to -* the blk layer. -*/ - break; - default: - printk(KERN_ERR "block: bad eh return: %d\n", ret); - break; - } -} - -static void blk_rq_check_expired(struct request *rq, unsigned long *next_timeout, - unsigned int *next_set) -{ - const unsigned long deadline = blk_rq_deadline(rq); - - if (time_after_eq(jiffies, deadline)) { - list_del_init(&rq->timeout_list); - - /* -* Check if we raced with end io completion -*/ - if (!blk_mark_rq_complete(rq)) - blk_rq_timed_out(rq); - } else if (!*next_set || time_after(*next_timeout, deadline)) { - *next_timeout = deadline; - *next_set = 1; - } -} - -void blk_timeout_work(struct work_struct *work) -{ - struct request_queue *q = - container_of(work, struct request_queue, timeout_work); - unsigned long flags, next = 0; - struct request *rq, *tmp; - int next_set = 0; - - spin_lock_irqsave(q->queue_lock, flags); - - list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list) - blk_rq_check_expired(rq, &next, &next_set); - - if (next_set) - mod_timer(&q->timeout, round_jiffies_up(next)); - - spin_unlock_irqrestore(q->queue_lock, flags); -} - /** * blk_abort_request -- Request request recovery for the specified command * @req: pointer to the request of interest @@ -153,20 +89,13 @@ void blk_timeout_work(struct work_struct *work) */ void blk_abort_request(struct request *req) { - if (req->q->mq_ops) { - /* -* All we need to ensure is that timeout scan takes place -* immediately and that scan sees the new timeout value. -* No need for fancy synchronizations. -*/ - blk_rq_set_deadline(req, jiffies); - kblockd_schedule_work(&req->q->timeout_work); - } else { - if (blk_mark_rq_complete(req)) - return; - blk_delete_timer(req); - blk_rq_timed_out(req); - } + /* +* All we need to ensure is that timeout scan takes place +* immediately and that scan sees the new timeout value. +* No need for fancy synchronizations. +*/ + blk_rq_set_deadline(req, jiffies)
[PATCH 25/28] block: kill request slab cache
Signed-off-by: Jens Axboe --- block/blk-core.c | 8 block/blk.h | 1 - 2 files changed, 9 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index e8f60ed456a2..6074bf2ee2e7 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -57,11 +57,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(block_unplug); DEFINE_IDA(blk_queue_ida); -/* - * For the allocated request tables - */ -struct kmem_cache *request_cachep; - /* * For queue allocation */ @@ -1941,9 +1936,6 @@ int __init blk_dev_init(void) if (!kblockd_workqueue) panic("Failed to create kblockd\n"); - request_cachep = kmem_cache_create("blkdev_requests", - sizeof(struct request), 0, SLAB_PANIC, NULL); - blk_requestq_cachep = kmem_cache_create("request_queue", sizeof(struct request_queue), 0, SLAB_PANIC, NULL); diff --git a/block/blk.h b/block/blk.h index e925cf4fe4de..2bf1cfeeb9c0 100644 --- a/block/blk.h +++ b/block/blk.h @@ -32,7 +32,6 @@ struct blk_flush_queue { }; extern struct kmem_cache *blk_requestq_cachep; -extern struct kmem_cache *request_cachep; extern struct kobj_type blk_queue_ktype; extern struct ida blk_queue_ida; -- 2.17.1
[PATCH 27/28] blk-merge: kill dead queue lock held check
This is dead code, any queue reaching this part has mq_ops attached. Signed-off-by: Jens Axboe --- block/blk-merge.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 3561dcce2260..0128284bded4 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -704,9 +704,6 @@ static void blk_account_io_merge(struct request *req) static struct request *attempt_merge(struct request_queue *q, struct request *req, struct request *next) { - if (!q->mq_ops) - lockdep_assert_held(q->queue_lock); - if (!rq_mergeable(req) || !rq_mergeable(next)) return NULL; -- 2.17.1
Re: [PATCH 05/28] IB/srp: remove old request_fn_active check
On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: > This check is only viable for non scsi-mq. Since that is going away, > kill this legacy check. > > Cc: Bart Van Assche > Cc: Parav Pandit > Cc: linux-scsi@vger.kernel.org > Signed-off-by: Jens Axboe > --- > drivers/infiniband/ulp/srp/ib_srp.c | 7 --- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/infiniband/ulp/srp/ib_srp.c > b/drivers/infiniband/ulp/srp/ib_srp.c > index 0b34e909505f..5a79444c2f3c 100644 > --- a/drivers/infiniband/ulp/srp/ib_srp.c > +++ b/drivers/infiniband/ulp/srp/ib_srp.c > @@ -1334,13 +1334,6 @@ static void srp_terminate_io(struct srp_rport *rport) > struct scsi_device *sdev; > int i, j; > > - /* > - * Invoking srp_terminate_io() while srp_queuecommand() is running > - * is not safe. Hence the warning statement below. > - */ > - shost_for_each_device(sdev, shost) > - WARN_ON_ONCE(sdev->request_queue->request_fn_active); > - > for (i = 0; i < target->ch_count; i++) { > ch = &target->ch[i]; It seems like Hannes' and my Signed-off-by/Reviewed-by tags are missing? See also https://marc.info/?l=linux-scsi&m=153970174514608. Bart.
Re: [PATCH 05/28] IB/srp: remove old request_fn_active check
On 10/25/18 3:23 PM, Bart Van Assche wrote: > On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: >> This check is only viable for non scsi-mq. Since that is going away, >> kill this legacy check. >> >> Cc: Bart Van Assche >> Cc: Parav Pandit >> Cc: linux-scsi@vger.kernel.org >> Signed-off-by: Jens Axboe >> --- >> drivers/infiniband/ulp/srp/ib_srp.c | 7 --- >> 1 file changed, 7 deletions(-) >> >> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c >> b/drivers/infiniband/ulp/srp/ib_srp.c >> index 0b34e909505f..5a79444c2f3c 100644 >> --- a/drivers/infiniband/ulp/srp/ib_srp.c >> +++ b/drivers/infiniband/ulp/srp/ib_srp.c >> @@ -1334,13 +1334,6 @@ static void srp_terminate_io(struct srp_rport *rport) >> struct scsi_device *sdev; >> int i, j; >> >> -/* >> - * Invoking srp_terminate_io() while srp_queuecommand() is running >> - * is not safe. Hence the warning statement below. >> - */ >> -shost_for_each_device(sdev, shost) >> -WARN_ON_ONCE(sdev->request_queue->request_fn_active); >> - >> for (i = 0; i < target->ch_count; i++) { >> ch = &target->ch[i]; > > It seems like Hannes' and my Signed-off-by/Reviewed-by tags are missing? > See also https://marc.info/?l=linux-scsi&m=153970174514608. Sorry, forgot to update that one. I'll do that for v2. Thanks for letting me know. -- Jens Axboe
Re: [PATCH] libosd: Remove ignored __weak attribute
On Tue, Oct 02, 2018 at 04:06:31PM -0700, Bart Van Assche wrote: > On Tue, 2018-10-02 at 15:33 -0700, Nick Desaulniers wrote: > > On Tue, Oct 2, 2018 at 10:57 AM Bart Van Assche wrote: > > > Explicitly initialized global and static variables end up in the .data > > > section and need space in that section. > > > > Unless the initial value is zero. > > https://godbolt.org/z/curRoO > > > > So you don't wind up with an increase in binary size simply by having > > global variables initialized to zero, right? Instead the kernel knows > > to create a zero'd out mapping for bss. You don't need a run of zeros > > in the binary. > > > > So I disagree when you said earlier "zero initializers should be left > > out to minimize the size of object files." I assert they don't affect > > the size of the binary. > > > > If you had many global variables all initialized to zero, why would > > you encode that many zeros in a binary, when you can just set a size > > on the bss section and have the kernel create the appropriate sized > > and zero'd mapping? > > > > > That is not the case if the > > > initializer is left out and these variables end up in the .bss section. > > > > From my above link, gcc will put globals without initializers into "common." > > No matter what particular compiler versions do with explicit initialization > to zero, the preferred kernel coding style is to leave out such explicit > initialization. > > Bart. Hi Bart, I'm sorry if I didn't follow the conclusion of this conversation properly but this is the below diff you were initially looking for, correct? If so, Boaz and Nick, do you have any objections if this is v2? I'd like to get this patch accepted so the warning can be fixed for everyone. Thanks, Nathan diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index e19fa883376f..4250f739beb3 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c @@ -58,6 +58,8 @@ enum { OSD_REQ_RETRIES = 1 }; +static const struct osd_obj_id osd_root_object; + MODULE_AUTHOR("Boaz Harrosh "); MODULE_DESCRIPTION("open-osd initiator library libosd.ko"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c index eaf36ccf58db..770c758baaa9 100644 --- a/drivers/scsi/osd/osd_uld.c +++ b/drivers/scsi/osd/osd_uld.c @@ -73,6 +73,7 @@ static const char osd_name[] = "osd"; static const char *osd_version_string = "open-osd 0.2.1"; +static const struct osd_obj_id osd_root_object; MODULE_AUTHOR("Boaz Harrosh "); MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko"); diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h index 48e8a165e136..eb31357ec8b3 100644 --- a/include/scsi/osd_types.h +++ b/include/scsi/osd_types.h @@ -28,8 +28,6 @@ struct osd_obj_id { osd_id id; }; -static const struct __weak osd_obj_id osd_root_object = {0, 0}; - struct osd_attr { u32 attr_page; u32 attr_id;
Re: [PATCH 08/28] scsi: kill off the legacy IO path
On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: > @@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct > pci_device_id *id) > base_vha->mgmt_svr_loop_id, host->sg_tablesize); > > if (ha->mqenable) { > - bool mq = false; > bool startit = false; > > - if (QLA_TGT_MODE_ENABLED()) { > - mq = true; > + if (QLA_TGT_MODE_ENABLED()) > startit = false; > - } > > - if ((ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) && > - shost_use_blk_mq(host)) { > - mq = true; > + if (ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) > startit = true; > - } > > - if (mq) { > - /* Create start of day qpairs for Block MQ */ > - for (i = 0; i < ha->max_qpairs; i++) > - qla2xxx_create_qpair(base_vha, 5, 0, startit); > - } > + /* Create start of day qpairs for Block MQ */ > + for (i = 0; i < ha->max_qpairs; i++) > + qla2xxx_create_qpair(base_vha, 5, 0, startit); > } > > if (ha->flags.running_gold_fw) (+Himanshu) Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor that it refers to "blk-mq", I'm not sure the above changes should be included in this patch. Himanshu, can you have a look? > +static ssize_t > +show_use_blk_mq(struct device *dev, struct device_attribute *attr, char *buf) > +{ > + return snprintf(buf, 20, "1\n"); > +} > +static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL); The pattern "snprintf(buf, 20, ...)" looks like cargo-cult programming to me. Please consider changing "snprintf(buf, 20, " into "sprintf(buf, ". Thanks, Bart.
Re: [PATCH 23/28] block: kill lld busy
On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: > Nobody sets the helper, so we always return 0. Kill it. How about changing the description of this patch into something like "Now that the blk_lld_busy() and blk_queue_lld_busy() callers have been removed, also remove the implementations of these functions."? Thanks, Bart.
Re: [PATCH] libosd: Remove ignored __weak attribute
On Thu, Oct 25, 2018 at 2:31 PM Nathan Chancellor wrote: > > On Tue, Oct 02, 2018 at 04:06:31PM -0700, Bart Van Assche wrote: > > On Tue, 2018-10-02 at 15:33 -0700, Nick Desaulniers wrote: > > > On Tue, Oct 2, 2018 at 10:57 AM Bart Van Assche > > > wrote: > > > > Explicitly initialized global and static variables end up in the .data > > > > section and need space in that section. > > > > > > Unless the initial value is zero. > > > https://godbolt.org/z/curRoO > > > > > > So you don't wind up with an increase in binary size simply by having > > > global variables initialized to zero, right? Instead the kernel knows > > > to create a zero'd out mapping for bss. You don't need a run of zeros > > > in the binary. > > > > > > So I disagree when you said earlier "zero initializers should be left > > > out to minimize the size of object files." I assert they don't affect > > > the size of the binary. > > > > > > If you had many global variables all initialized to zero, why would > > > you encode that many zeros in a binary, when you can just set a size > > > on the bss section and have the kernel create the appropriate sized > > > and zero'd mapping? > > > > > > > That is not the case if the > > > > initializer is left out and these variables end up in the .bss section. > > > > > > From my above link, gcc will put globals without initializers into > > > "common." > > > > No matter what particular compiler versions do with explicit initialization > > to zero, the preferred kernel coding style is to leave out such explicit > > initialization. > > > > Bart. > > Hi Bart, > > I'm sorry if I didn't follow the conclusion of this conversation properly > but this is the below diff you were initially looking for, correct? > > If so, Boaz and Nick, do you have any objections if this is v2? I'd like > to get this patch accepted so the warning can be fixed for everyone. Hi Nathan, Thanks for following up on this. Bart's note about the one definition rule is important. If you define the variable static in two different translation units, you've suddenly created two different copies accessible only to their respective translation units. So it should be declared extern in one source file (but not defined/initialized), and defined (non-static) in another. See below for example. > > Thanks, > Nathan > > > > diff --git a/drivers/scsi/osd/osd_initiator.c > b/drivers/scsi/osd/osd_initiator.c > index e19fa883376f..4250f739beb3 100644 > --- a/drivers/scsi/osd/osd_initiator.c > +++ b/drivers/scsi/osd/osd_initiator.c > @@ -58,6 +58,8 @@ > > enum { OSD_REQ_RETRIES = 1 }; > > +static const struct osd_obj_id osd_root_object; extern const struct osd_obj_id osd_root_object; > + > MODULE_AUTHOR("Boaz Harrosh "); > MODULE_DESCRIPTION("open-osd initiator library libosd.ko"); > MODULE_LICENSE("GPL"); > diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c > index eaf36ccf58db..770c758baaa9 100644 > --- a/drivers/scsi/osd/osd_uld.c > +++ b/drivers/scsi/osd/osd_uld.c > @@ -73,6 +73,7 @@ > > static const char osd_name[] = "osd"; > static const char *osd_version_string = "open-osd 0.2.1"; > +static const struct osd_obj_id osd_root_object; const struct osd_obj_id osd_root_object; > > MODULE_AUTHOR("Boaz Harrosh "); > MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko"); > diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h > index 48e8a165e136..eb31357ec8b3 100644 > --- a/include/scsi/osd_types.h > +++ b/include/scsi/osd_types.h > @@ -28,8 +28,6 @@ struct osd_obj_id { > osd_id id; > }; > > -static const struct __weak osd_obj_id osd_root_object = {0, 0}; > - LGTM > struct osd_attr { > u32 attr_page; > u32 attr_id; That way the linker knows there's only one instance of this struct in memory, and that the two different translation units are referring to the same instance. The other maintainers may have a preference which translation you define osd_root_object in (I arbitrarily chose drivers/scsi/osd/osd_uld.c), but if they don't have additional feedback after some amount of time, I'd assume they're ok with the above suggestion. What do you think? -- Thanks, ~Nick Desaulniers
Re: [PATCH 08/28] scsi: kill off the legacy IO path
On 10/25/18 3:36 PM, Bart Van Assche wrote: > On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: >> @@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct >> pci_device_id *id) >> base_vha->mgmt_svr_loop_id, host->sg_tablesize); >> >> if (ha->mqenable) { >> -bool mq = false; >> bool startit = false; >> >> -if (QLA_TGT_MODE_ENABLED()) { >> -mq = true; >> +if (QLA_TGT_MODE_ENABLED()) >> startit = false; >> -} >> >> -if ((ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) && >> -shost_use_blk_mq(host)) { >> -mq = true; >> +if (ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) >> startit = true; >> -} >> >> -if (mq) { >> -/* Create start of day qpairs for Block MQ */ >> -for (i = 0; i < ha->max_qpairs; i++) >> -qla2xxx_create_qpair(base_vha, 5, 0, startit); >> -} >> +/* Create start of day qpairs for Block MQ */ >> +for (i = 0; i < ha->max_qpairs; i++) >> +qla2xxx_create_qpair(base_vha, 5, 0, startit); >> } >> >> if (ha->flags.running_gold_fw) > > (+Himanshu) > > Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor that it > refers to "blk-mq", I'm not sure the above changes should be included in this > patch. Himanshu, can you have a look? There's literally a comment there that says "for Block MQ" :-) >> +static ssize_t >> +show_use_blk_mq(struct device *dev, struct device_attribute *attr, char >> *buf) >> +{ >> +return snprintf(buf, 20, "1\n"); >> +} >> +static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL); > > The pattern "snprintf(buf, 20, ...)" looks like cargo-cult programming to me. > Please consider changing "snprintf(buf, 20, " into "sprintf(buf, ". Good point, I'll do that. -- Jens Axboe
Re: [PATCH 23/28] block: kill lld busy
On 10/25/18 3:42 PM, Bart Van Assche wrote: > On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: >> Nobody sets the helper, so we always return 0. Kill it. > > How about changing the description of this patch into something > like "Now that the blk_lld_busy() and blk_queue_lld_busy() callers > have been removed, also remove the implementations of these functions."? Sure, I can improve the commit message. -- Jens Axboe
Re: [PATCH] libosd: Remove ignored __weak attribute
On Thu, Oct 25, 2018 at 03:02:13PM -0700, Nick Desaulniers wrote: > On Thu, Oct 25, 2018 at 2:31 PM Nathan Chancellor > wrote: > > > > On Tue, Oct 02, 2018 at 04:06:31PM -0700, Bart Van Assche wrote: > > > On Tue, 2018-10-02 at 15:33 -0700, Nick Desaulniers wrote: > > > > On Tue, Oct 2, 2018 at 10:57 AM Bart Van Assche > > > > wrote: > > > > > Explicitly initialized global and static variables end up in the .data > > > > > section and need space in that section. > > > > > > > > Unless the initial value is zero. > > > > https://godbolt.org/z/curRoO > > > > > > > > So you don't wind up with an increase in binary size simply by having > > > > global variables initialized to zero, right? Instead the kernel knows > > > > to create a zero'd out mapping for bss. You don't need a run of zeros > > > > in the binary. > > > > > > > > So I disagree when you said earlier "zero initializers should be left > > > > out to minimize the size of object files." I assert they don't affect > > > > the size of the binary. > > > > > > > > If you had many global variables all initialized to zero, why would > > > > you encode that many zeros in a binary, when you can just set a size > > > > on the bss section and have the kernel create the appropriate sized > > > > and zero'd mapping? > > > > > > > > > That is not the case if the > > > > > initializer is left out and these variables end up in the .bss > > > > > section. > > > > > > > > From my above link, gcc will put globals without initializers into > > > > "common." > > > > > > No matter what particular compiler versions do with explicit > > > initialization > > > to zero, the preferred kernel coding style is to leave out such explicit > > > initialization. > > > > > > Bart. > > > > Hi Bart, > > > > I'm sorry if I didn't follow the conclusion of this conversation properly > > but this is the below diff you were initially looking for, correct? > > > > If so, Boaz and Nick, do you have any objections if this is v2? I'd like > > to get this patch accepted so the warning can be fixed for everyone. > > Hi Nathan, > Thanks for following up on this. Bart's note about the one definition > rule is important. If you define the variable static in two different > translation units, you've suddenly created two different copies > accessible only to their respective translation units. So it should > be declared extern in one source file (but not defined/initialized), > and defined (non-static) in another. See below for example. > Hi Nick, I just want to make sure I understand what is going on here. Doesn't the first part already happen because osd_root_object is declared static in osd_types.h? I tried this little simple example of adding a 'static const' variable to a header file and using it in two separate files/functions. When compiled together, they point to two different locations in memory. == $ clang -std=gnu89 main.c test1.c test2.c $ ./a.out test in test1(): 0x55b4df3a001c test in test2(): 0x55b4df3a003c == main.c: #include "test.h" int main(void) { test1(); test2(); } == test1.c: #include #include "test.h" void test1() { printf("test in test1(): %p\n", &test); } == test2.c: #include #include "test.h" void test2() { printf("test in test2(): %p\n", &test); } == test.h: struct test_struct { int a; int b; }; static const struct test_struct test = {0, 0}; void test1(); void test2(); == If that is the case, could your suggested change result in a functional change given that the code would now refer to the same osd_root_object? This isn't necessarily a problem, especially since it sounds like not referring to the same object could be a bug, but I want to make sure that's what is intended by these changes, which I'll be happy to spin up in a v2. If I am thinking about this incorrectly or my example is wrong in any way, please let me know. I'm trying to soak up all of this knowledge so I can be a better contributor. Thanks for the reply and explanation! Nathan > > > > Thanks, > > Nathan > > > > > > > > diff --git a/drivers/scsi/osd/osd_initiator.c > > b/drivers/scsi/osd/osd_initiator.c > > index e19fa883376f..4250f739beb3 100644 > > --- a/drivers/scsi/osd/osd_initiator.c > > +++ b/drivers/scsi/osd/osd_initiator.c > > @@ -58,6 +58,8 @@ > > > > enum { OSD_REQ_RETRIES = 1 }; > > > > +static const struct osd_obj_id osd_root_object; > > extern const struct osd_obj_id osd_root_object; > > > + > > MODULE_AUTHOR("Boaz Harrosh "); > > MODULE_DESCRIPTION("open-osd initiator library libosd.ko"); > > MODULE_LICENSE("GPL"); > > diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/
Re: [PATCH 08/28] scsi: kill off the legacy IO path
Jens, > On Oct 25, 2018, at 3:18 PM, Jens Axboe wrote: > > External Email > > On 10/25/18 3:36 PM, Bart Van Assche wrote: >> On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: >>> @@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const >>> struct pci_device_id *id) >>> base_vha->mgmt_svr_loop_id, host->sg_tablesize); >>> >>> if (ha->mqenable) { >>> -bool mq = false; >>> bool startit = false; >>> >>> -if (QLA_TGT_MODE_ENABLED()) { >>> -mq = true; >>> +if (QLA_TGT_MODE_ENABLED()) >>> startit = false; >>> -} >>> >>> -if ((ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) && >>> -shost_use_blk_mq(host)) { >>> -mq = true; >>> +if (ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) >>> startit = true; >>> -} >>> >>> -if (mq) { >>> -/* Create start of day qpairs for Block MQ */ >>> -for (i = 0; i < ha->max_qpairs; i++) >>> -qla2xxx_create_qpair(base_vha, 5, 0, startit); >>> -} >>> +/* Create start of day qpairs for Block MQ */ >>> +for (i = 0; i < ha->max_qpairs; i++) >>> +qla2xxx_create_qpair(base_vha, 5, 0, startit); >>> } >>> >>> if (ha->flags.running_gold_fw) >> >> (+Himanshu) >> >> Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor that >> it >> refers to "blk-mq", I'm not sure the above changes should be included in this >> patch. Himanshu, can you have a look? > > There's literally a comment there that says "for Block MQ" :-) This change is Good. We were using mq boolean to determine if we are in Target mode or Initiator with BLK-MQ on to create qpair in firmware. Since this patch is removing shost_use_blk_mq)(), so the mq boolean becomes no-op. >>> +static ssize_t >>> +show_use_blk_mq(struct device *dev, struct device_attribute *attr, char >>> *buf) >>> +{ >>> +return snprintf(buf, 20, "1\n"); >>> +} >>> +static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL); >> >> The pattern "snprintf(buf, 20, ...)" looks like cargo-cult programming to me. >> Please consider changing "snprintf(buf, 20, " into "sprintf(buf, ". > > Good point, I'll do that. > > -- > Jens Axboe > Thanks, - Himanshu
Re: [PATCH 08/28] scsi: kill off the legacy IO path
On 10/25/18 4:44 PM, Madhani, Himanshu wrote: > Jens, > >> On Oct 25, 2018, at 3:18 PM, Jens Axboe wrote: >> >> External Email >> >> On 10/25/18 3:36 PM, Bart Van Assche wrote: >>> On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: @@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) base_vha->mgmt_svr_loop_id, host->sg_tablesize); if (ha->mqenable) { -bool mq = false; bool startit = false; -if (QLA_TGT_MODE_ENABLED()) { -mq = true; +if (QLA_TGT_MODE_ENABLED()) startit = false; -} -if ((ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) && -shost_use_blk_mq(host)) { -mq = true; +if (ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) startit = true; -} -if (mq) { -/* Create start of day qpairs for Block MQ */ -for (i = 0; i < ha->max_qpairs; i++) -qla2xxx_create_qpair(base_vha, 5, 0, startit); -} +/* Create start of day qpairs for Block MQ */ +for (i = 0; i < ha->max_qpairs; i++) +qla2xxx_create_qpair(base_vha, 5, 0, startit); } if (ha->flags.running_gold_fw) >>> >>> (+Himanshu) >>> >>> Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor that >>> it >>> refers to "blk-mq", I'm not sure the above changes should be included in >>> this >>> patch. Himanshu, can you have a look? >> >> There's literally a comment there that says "for Block MQ" :-) > > This change is Good. > > We were using mq boolean to determine if we are in Target mode or Initiator > with BLK-MQ on > to create qpair in firmware. > > Since this patch is removing shost_use_blk_mq)(), so the mq boolean becomes > no-op. Thanks for checking. Can I add your acked-by or reviewed-by to the patch? -- Jens Axboe
Re: [PATCH 08/28] scsi: kill off the legacy IO path
> On Oct 25, 2018, at 4:00 PM, Jens Axboe wrote: > > External Email > > On 10/25/18 4:44 PM, Madhani, Himanshu wrote: >> Jens, >> >>> On Oct 25, 2018, at 3:18 PM, Jens Axboe wrote: >>> >>> External Email >>> >>> On 10/25/18 3:36 PM, Bart Van Assche wrote: On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: > @@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const > struct pci_device_id *id) >base_vha->mgmt_svr_loop_id, host->sg_tablesize); > >if (ha->mqenable) { > -bool mq = false; >bool startit = false; > > -if (QLA_TGT_MODE_ENABLED()) { > -mq = true; > +if (QLA_TGT_MODE_ENABLED()) >startit = false; > -} > > -if ((ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) && > -shost_use_blk_mq(host)) { > -mq = true; > +if (ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED) >startit = true; > -} > > -if (mq) { > -/* Create start of day qpairs for Block MQ */ > -for (i = 0; i < ha->max_qpairs; i++) > -qla2xxx_create_qpair(base_vha, 5, 0, > startit); > -} > +/* Create start of day qpairs for Block MQ */ > +for (i = 0; i < ha->max_qpairs; i++) > +qla2xxx_create_qpair(base_vha, 5, 0, startit); >} > >if (ha->flags.running_gold_fw) (+Himanshu) Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor that it refers to "blk-mq", I'm not sure the above changes should be included in this patch. Himanshu, can you have a look? >>> >>> There's literally a comment there that says "for Block MQ" :-) >> >> This change is Good. >> >> We were using mq boolean to determine if we are in Target mode or Initiator >> with BLK-MQ on >> to create qpair in firmware. >> >> Since this patch is removing shost_use_blk_mq)(), so the mq boolean becomes >> no-op. > > Thanks for checking. Can I add your acked-by or reviewed-by to the patch? > Yes, for qla2xxx changes Acked-by: Himanshu Madhani > -- > Jens Axboe Thanks, - Himanshu
Re: [PATCHSET 0/28] blk-mq driver conversions and legacy path removal
On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: > The first round of this went into 4.20-rc, but we've still some of > them pending. This patch series converts the remaining drivers to > blk-mq. The ones that support dual paths (like SCSI and DM) have > the non-mq path removed. At the end, legacy IO code and schedulers > are killed off. > > This patch series is on top of my for-linus branch. It can also > be bound in my mq-conversions branch. Hi Jens, I cloned your mq-conversions branch and ran the block, srp and nvmeof-mp test groups from the blktests project. The result of these tests on my setup is the same as with kernel v4.19: except for a few false positive lockdep complaints, all tests pass. The most recent commit that is involved in the false positive lockdep complaints I encountered is 87915adc3f0a ("workqueue: re-add lockdep dependencies for flushing"). Patches are being discussed to address these false positives. Bart.
Re: [PATCHSET 0/28] blk-mq driver conversions and legacy path removal
On 10/25/18 5:09 PM, Bart Van Assche wrote: > On Thu, 2018-10-25 at 15:10 -0600, Jens Axboe wrote: >> The first round of this went into 4.20-rc, but we've still some of >> them pending. This patch series converts the remaining drivers to >> blk-mq. The ones that support dual paths (like SCSI and DM) have >> the non-mq path removed. At the end, legacy IO code and schedulers >> are killed off. >> >> This patch series is on top of my for-linus branch. It can also >> be bound in my mq-conversions branch. > > Hi Jens, > > I cloned your mq-conversions branch and ran the block, srp and nvmeof-mp > test groups from the blktests project. The result of these tests on my > setup is the same as with kernel v4.19: except for a few false positive > lockdep complaints, all tests pass. The most recent commit that is > involved in the false positive lockdep complaints I encountered is > 87915adc3f0a ("workqueue: re-add lockdep dependencies for flushing"). > Patches are being discussed to address these false positives. Great, thanks for doing this testing, Bart! -- Jens Axboe
[PATCH -next] mvsas: remove set but not used variables 'res_flag'
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/mvsas/mv_init.c: In function 'mvs_ioremap': drivers/scsi/mvsas/mv_init.c:315:36: warning: variable 'res_flag' set but not used [-Wunused-but-set-variable] unsigned long res_start, res_len, res_flag, res_flag_ex = 0; It not used anymore after commit 92b19ff50e8f ("cleanup IORESOURCE_CACHEABLE vs ioremap()") Signed-off-by: YueHaibing --- drivers/scsi/mvsas/mv_init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 3ac3437..d7534fb 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -312,7 +312,7 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex) { - unsigned long res_start, res_len, res_flag, res_flag_ex = 0; + unsigned long res_start, res_len, res_flag_ex = 0; struct pci_dev *pdev = mvi->pdev; if (bar_ex != -1) { /* @@ -340,7 +340,6 @@ int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex) goto err_out; } - res_flag = pci_resource_flags(pdev, bar); mvi->regs = ioremap(res_start, res_len); if (!mvi->regs) {