Re: [PATCH Resend] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
The suggestions look reasonable to me too. >Arvind, since I was originally just resending your patch, do you want >to make the changes Johannes suggests, or should I proceed with that? > josh Hi Josh, Feel free to send out the updated patch if you would like. Thanks! Arvind From: jwbo...@gmail.comon behalf of Josh Boyer Sent: Wednesday, December 2, 2015 5:47 AM To: Johannes Thumshirn Cc: Jej B; Arvind Kumar; Thomas Hellstrom; linux-scsi@vger.kernel.org; VMware PV-Drivers; Linux-Kernel@Vger. Kernel. Org Subject: Re: [PATCH Resend] VMW_PVSCSI: Fix the issue of DMA-API related warnings. On Wed, Dec 2, 2015 at 3:42 AM, Johannes Thumshirn wrote: > Hi Josh, > > On Tue, 2015-12-01 at 11:34 -0500, Josh Boyer wrote: >> The driver is missing calls to pci_dma_mapping_error() after >> performing the DMA mapping, which caused DMA-API warning to >> show up in dmesg's output. Though that happens only when >> DMA_API_DEBUG option is enabled. This change fixes the issue >> and makes pvscsi_map_buffers() function more robust. >> >> Signed-off-by: Arvind Kumar >> Cc: Josh Boyer >> Reviewed-by: Thomas Hellstrom >> Signed-off-by: Josh Boyer >> --- >> >> - Resend of patch that was never committed for some reason >> >> drivers/scsi/vmw_pvscsi.c | 45 +++-- >> drivers/scsi/vmw_pvscsi.h | 2 +- >> 2 files changed, 40 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c >> index 0f133c1817de..19734494f9ec 100644 >> --- a/drivers/scsi/vmw_pvscsi.c >> +++ b/drivers/scsi/vmw_pvscsi.c >> @@ -349,9 +349,9 @@ static void pvscsi_create_sg(struct pvscsi_ctx *ctx, >> * Map all data buffers for a command into PCI space and >> * setup the scatter/gather list if needed. >> */ >> -static void pvscsi_map_buffers(struct pvscsi_adapter *adapter, >> -struct pvscsi_ctx *ctx, struct scsi_cmnd >> *cmd, >> -struct PVSCSIRingReqDesc *e) >> +static int pvscsi_map_buffers(struct pvscsi_adapter *adapter, >> + struct pvscsi_ctx *ctx, struct scsi_cmnd *cmd, >> + struct PVSCSIRingReqDesc *e) >> { >> unsigned count; >> unsigned bufflen = scsi_bufflen(cmd); >> @@ -360,18 +360,30 @@ static void pvscsi_map_buffers(struct pvscsi_adapter >> *adapter, >> e->dataLen = bufflen; >> e->dataAddr = 0; >> if (bufflen == 0) >> - return; >> + return 0; >> >> sg = scsi_sglist(cmd); >> count = scsi_sg_count(cmd); >> if (count != 0) { >> int segs = scsi_dma_map(cmd); >> - if (segs > 1) { >> + >> + if (segs == -ENOMEM) { >> + scmd_printk(KERN_ERR, cmd, >> + "vmw_pvscsi: Failed to map cmd sglist >> for DMA.\n"); >> + return -1; > > Please return -ENOMEM instead of -1 > >> + } else if (segs > 1) { >> pvscsi_create_sg(ctx, sg, segs); >> >> e->flags |= PVSCSI_FLAG_CMD_WITH_SG_LIST; >> ctx->sglPA = pci_map_single(adapter->dev, ctx->sgl, >> SGL_SIZE, >> PCI_DMA_TODEVICE); >> + if (pci_dma_mapping_error(adapter->dev, ctx->sglPA)) >> { >> + scmd_printk(KERN_ERR, cmd, >> + "vmw_pvscsi: Failed to map ctx >> sglist for DMA.\n"); >> + scsi_dma_unmap(cmd); >> + ctx->sglPA = 0; >> + return -1; > > Same here. > >> + } >> e->dataAddr = ctx->sglPA; >> } else >> e->dataAddr = sg_dma_address(sg); >> @@ -382,8 +394,15 @@ static void pvscsi_map_buffers(struct pvscsi_adapter >> *adapter, >>*/ >> ctx->dataPA = pci_map_single(adapter->dev, sg, bufflen, >>cmd->sc_data_direction); >> + if (pci_dma_mapping_error(adapter->dev, ctx->dataPA)) { >> + scmd_printk(KERN_ERR, cmd, >> + "vmw_pvscsi: Failed to map direct data >> buffer for DMA.\n"); >> + return -1; > > And here. > >> + } >> e->dataAddr = ctx->dataPA; >> } >> + >> + return 0; >> } >> >> static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, >> @@ -690,6 +709,12 @@ static int pvscsi_queue_ring(struct pvscsi_adapter >> *adapter, >> ctx->sensePA = pci_map_single(adapter->dev, cmd- >> >sense_buffer, >>
Re: [PATCH Resend] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
Hi Josh, On Tue, 2015-12-01 at 11:34 -0500, Josh Boyer wrote: > The driver is missing calls to pci_dma_mapping_error() after > performing the DMA mapping, which caused DMA-API warning to > show up in dmesg's output. Though that happens only when > DMA_API_DEBUG option is enabled. This change fixes the issue > and makes pvscsi_map_buffers() function more robust. > > Signed-off-by: Arvind Kumar> Cc: Josh Boyer > Reviewed-by: Thomas Hellstrom > Signed-off-by: Josh Boyer > --- > > - Resend of patch that was never committed for some reason > > drivers/scsi/vmw_pvscsi.c | 45 +++-- > drivers/scsi/vmw_pvscsi.h | 2 +- > 2 files changed, 40 insertions(+), 7 deletions(-) > > diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c > index 0f133c1817de..19734494f9ec 100644 > --- a/drivers/scsi/vmw_pvscsi.c > +++ b/drivers/scsi/vmw_pvscsi.c > @@ -349,9 +349,9 @@ static void pvscsi_create_sg(struct pvscsi_ctx *ctx, > * Map all data buffers for a command into PCI space and > * setup the scatter/gather list if needed. > */ > -static void pvscsi_map_buffers(struct pvscsi_adapter *adapter, > - struct pvscsi_ctx *ctx, struct scsi_cmnd > *cmd, > - struct PVSCSIRingReqDesc *e) > +static int pvscsi_map_buffers(struct pvscsi_adapter *adapter, > + struct pvscsi_ctx *ctx, struct scsi_cmnd *cmd, > + struct PVSCSIRingReqDesc *e) > { > unsigned count; > unsigned bufflen = scsi_bufflen(cmd); > @@ -360,18 +360,30 @@ static void pvscsi_map_buffers(struct pvscsi_adapter > *adapter, > e->dataLen = bufflen; > e->dataAddr = 0; > if (bufflen == 0) > - return; > + return 0; > > sg = scsi_sglist(cmd); > count = scsi_sg_count(cmd); > if (count != 0) { > int segs = scsi_dma_map(cmd); > - if (segs > 1) { > + > + if (segs == -ENOMEM) { > + scmd_printk(KERN_ERR, cmd, > + "vmw_pvscsi: Failed to map cmd sglist > for DMA.\n"); > + return -1; Please return -ENOMEM instead of -1 > + } else if (segs > 1) { > pvscsi_create_sg(ctx, sg, segs); > > e->flags |= PVSCSI_FLAG_CMD_WITH_SG_LIST; > ctx->sglPA = pci_map_single(adapter->dev, ctx->sgl, > SGL_SIZE, > PCI_DMA_TODEVICE); > + if (pci_dma_mapping_error(adapter->dev, ctx->sglPA)) > { > + scmd_printk(KERN_ERR, cmd, > + "vmw_pvscsi: Failed to map ctx > sglist for DMA.\n"); > + scsi_dma_unmap(cmd); > + ctx->sglPA = 0; > + return -1; Same here. > + } > e->dataAddr = ctx->sglPA; > } else > e->dataAddr = sg_dma_address(sg); > @@ -382,8 +394,15 @@ static void pvscsi_map_buffers(struct pvscsi_adapter > *adapter, > */ > ctx->dataPA = pci_map_single(adapter->dev, sg, bufflen, > cmd->sc_data_direction); > + if (pci_dma_mapping_error(adapter->dev, ctx->dataPA)) { > + scmd_printk(KERN_ERR, cmd, > + "vmw_pvscsi: Failed to map direct data > buffer for DMA.\n"); > + return -1; And here. > + } > e->dataAddr = ctx->dataPA; > } > + > + return 0; > } > > static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, > @@ -690,6 +709,12 @@ static int pvscsi_queue_ring(struct pvscsi_adapter > *adapter, > ctx->sensePA = pci_map_single(adapter->dev, cmd- > >sense_buffer, > SCSI_SENSE_BUFFERSIZE, > PCI_DMA_FROMDEVICE); > + if (pci_dma_mapping_error(adapter->dev, ctx->sensePA)) { > + scmd_printk(KERN_ERR, cmd, > + "vmw_pvscsi: Failed to map sense buffer > for DMA.\n"); > + ctx->sensePA = 0; > + return -1; And here. > + } > e->senseAddr = ctx->sensePA; > e->senseLen = SCSI_SENSE_BUFFERSIZE; > } else { > @@ -711,7 +736,15 @@ static int pvscsi_queue_ring(struct pvscsi_adapter > *adapter, > else > e->flags = 0; > > - pvscsi_map_buffers(adapter, ctx, cmd, e); > + if (pvscsi_map_buffers(adapter, ctx, cmd, e) != 0) { > + if (cmd->sense_buffer) { > + pci_unmap_single(adapter->dev, ctx->sensePA, >
Re: [PATCH 09/10] aacraid: Fix character device re initialization
Hi Raghava, On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > During EEH PCI hotplug activity kernel unloads and loads the driver, > causing character device to be unregistered(aac_remove_one).When the > driver is loaded back using aac_probe_one the character device needs > to be registered again for the AIF management tools to work. > > Fixed by adding code to register character device in aac_probe_one if > it is unregistered in aac_remove_one. > > Signed-off-by: Raghava Aditya Renukunta This one is duplicate, isn't it? -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/10] aacraid: Fix RRQ overload
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > The driver utilizes an array of atomic variables to keep track of > IO submissions to each vector. To submit an IO multiple threads > iterate through the array to find a vector which has empty slots > to send an IO. The reading and updating of the variable is not atomic, > causing race conditions when a thread uses a full vector to > submit an IO. > > Fixed by mapping each FIB to a vector, the submission path then uses > said vector to submit IO thereby removing the possibly of a race > condition.The vector assignment is started from 1 since vector 0 is > reserved for the use of AIF management FIBS.If the number of MSIx > vectors is 1 (MSI or INTx mode) then all the fibs are allocated to > vector 0. > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/aacraid.h | 1 + > drivers/scsi/aacraid/commsup.c | 12 > drivers/scsi/aacraid/src.c | 30 +++--- > 3 files changed, 20 insertions(+), 23 deletions(-) > > diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h > index da227e8..d133c4a 100644 > --- a/drivers/scsi/aacraid/aacraid.h > +++ b/drivers/scsi/aacraid/aacraid.h > @@ -944,6 +944,7 @@ struct fib { > */ > struct list_headfiblink; > void*data; > + u32 vector_no; > struct hw_fib *hw_fib_va; /* Actual > shared object */ > dma_addr_t hw_fib_pa; /* physical > address of hw_fib*/ > }; > diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c > index b5b653c..b257d3b 100644 > --- a/drivers/scsi/aacraid/commsup.c > +++ b/drivers/scsi/aacraid/commsup.c > @@ -104,6 +104,7 @@ int aac_fib_setup(struct aac_dev * dev) > struct hw_fib *hw_fib; > dma_addr_t hw_fib_pa; > int i; > + u32 vector = 1; > > while (((i = fib_map_alloc(dev)) == -ENOMEM) > && (dev->scsi_host_ptr->can_queue > (64 - AAC_NUM_MGT_FIB))) { > @@ -150,6 +151,17 @@ int aac_fib_setup(struct aac_dev * dev) > dev->max_fib_size + sizeof(struct > aac_fib_xporthdr)); > hw_fib_pa = hw_fib_pa + > dev->max_fib_size + sizeof(struct aac_fib_xporthdr); > + > + if ((dev->max_msix == 1) || > + (i > ((dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB - > 1) > + - dev->vector_cap))) { > + fibptr->vector_no = 0; > + } else { > + fibptr->vector_no = vector; > + vector++; > + if (vector == dev->max_msix) > + vector = 1; > + } > } > /* > * Add the fib chain to the free list > diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c > index 2aa34ea..bc0203f 100644 > --- a/drivers/scsi/aacraid/src.c > +++ b/drivers/scsi/aacraid/src.c > @@ -156,8 +156,8 @@ static irqreturn_t aac_src_intr_message(int irq, void > *dev_id) > break; > if (dev->msi_enabled && dev->max_msix > 1) > atomic_dec( > >rrq_outstanding[vector_no]); > - aac_intr_normal(dev, handle-1, 0, isFastResponse, > NULL); > dev->host_rrq[index++] = 0; > + aac_intr_normal(dev, handle-1, 0, isFastResponse, > NULL); > if (index == (vector_no + 1) * dev->vector_cap) > index = vector_no * dev->vector_cap; > dev->host_rrq_idx[vector_no] = index; > @@ -452,36 +452,20 @@ static int aac_src_deliver_message(struct fib *fib) > #endif > > u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size); > + u16 vector_no; > > atomic_inc(>numpending); > > if (dev->msi_enabled && fib->hw_fib_va->header.Command != AifRequest > && > dev->max_msix > 1) { > - u_int16_t vector_no, first_choice = 0x; > - > - vector_no = dev->fibs_pushed_no % dev->max_msix; > - do { > - vector_no += 1; > - if (vector_no == dev->max_msix) > - vector_no = 1; > - if (atomic_read(>rrq_outstanding[vector_no]) < > - dev->vector_cap) > - break; > - if (0x == first_choice) > - first_choice = vector_no; > - else if (vector_no == first_choice) > - break; > - } while (1); > - if (vector_no == first_choice) > - vector_no = 0; > - atomic_inc(>rrq_outstanding[vector_no]); > -
[scsi:fixes 16/18] warning: (SCSI_MPT2SAS) selects SCSI_MPT3SAS which has unmet direct dependencies (SCSI_LOWLEVEL && ..)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git fixes head: 136dc13bf2988d987682e60558bb9b9873215f29 commit: b840c3627b6f4f856b333a14a72f8ed86da2f86c [16/18] mpt3sas: Add dummy Kconfig option for backwards compatibility config: mips-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout b840c3627b6f4f856b333a14a72f8ed86da2f86c # save the attached .config to linux build tree make.cross ARCH=mips All warnings (new ones prefixed by >>): warning: (SCSI_MPT2SAS) selects SCSI_MPT3SAS which has unmet direct dependencies (SCSI_LOWLEVEL && PCI && SCSI) --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: BUG: KASAN: slab-out-of-bounds in ses_enclosure_data_process+0x900/0xe50
On Tue, 2015-12-01 at 21:20 +0100, Andrea Gelmini wrote: > Hi everybody, >and thanks a lot for your work. > >As soon as I plugged an external WD USB hard drive (details in the > attached file) >into USB3 port, I've got this (much more info in the attached files). >Using commit 2255702db4014d1c69d6037ed7bdad2d2e271985 > > Thanks again, > Andrea > > [ 542.582204] > == > [ 542.582220] BUG: KASAN: slab-out-of-bounds in > ses_enclosure_data_process+0x900/0xe50 [ses] at addr 88038c421c12 > [ 542.582223] Read of size 1 by task systemd-udevd/4017 > [ 542.582225] > = > [ 542.582227] BUG kmalloc-8 (Not tainted): kasan: bad access detected > [ 542.582228] > - > > [ 542.582229] Disabling lock debugging due to kernel taint > [ 542.582236] INFO: Allocated in ses_enclosure_data_process+0x1e6/0xe50 > [ses] age=1 cpu=2 pid=4017 > [ 542.582243] ___slab_alloc.constprop.27+0x379/0x3a0 > [ 542.582246] __slab_alloc.isra.24.constprop.26+0x26/0x40 > [ 542.582249] __kmalloc+0x19b/0x1e0 > [ 542.582253] ses_enclosure_data_process+0x1e6/0xe50 [ses] > [ 542.582256] ses_intf_add+0x9d6/0xe00 [ses] > [ 542.582261] class_interface_register+0x213/0x350 > [ 542.582264] scsi_register_interface+0x33/0x40 > [ 542.582268] ses_init+0x13/0x1000 [ses] > [ 542.582272] do_one_initcall+0x13c/0x2f0 > [ 542.582277] do_init_module+0x1d9/0x5bc > [ 542.582280] load_module+0x6029/0x9230 > [ 542.582283] SyS_finit_module+0x103/0x130 > [ 542.582288] entry_SYSCALL_64_fastpath+0x16/0x75 > [ 542.582293] INFO: Freed in sg_clean+0x12e/0x200 age=1 cpu=3 pid=4009 > [ 542.582296] __slab_free+0x292/0x3d0 > [ 542.582298] kfree+0x108/0x120 > [ 542.582300] sg_clean+0x12e/0x200 > [ 542.582302] usb_sg_wait+0x2ad/0x3d0 > [ 542.582307] usb_stor_bulk_transfer_sglist.part.3+0xc4/0x200 [usb_storage] > [ 542.582311] usb_stor_bulk_srb+0x184/0x280 [usb_storage] > [ 542.582315] usb_stor_Bulk_transport+0x53e/0xf80 [usb_storage] > [ 542.582319] usb_stor_invoke_transport+0xf2/0x1430 [usb_storage] > [ 542.582323] usb_stor_transparent_scsi_command+0x9/0x10 [usb_storage] > [ 542.582327] usb_stor_control_thread+0x530/0xac0 [usb_storage] > [ 542.582332] kthread+0x1c0/0x260 > [ 542.582335] ret_from_fork+0x3f/0x70 > [ 542.582339] INFO: Slab 0xea000e310800 objects=26 used=25 > fp=0x88038c421e78 flags=0x80004080 > [ 542.582341] INFO: Object 0x88038c421c08 @offset=7176 > fp=0x0008 > > [ 542.582345] Bytes b4 88038c421bf8: 01 00 00 00 01 00 00 00 74 97 fd ff > 00 00 00 00 t... > [ 542.582348] Object 88038c421c08: 08 00 00 00 00 00 00 00 > > [ 542.582354] CPU: 2 PID: 4017 Comm: systemd-udevd Tainted: GB > 4.4.0-rc3KASan-5-g2255702 #5 > [ 542.582356] Hardware name: LENOVO 2356LRG/2356LRG, BIOS G7ETA3WW (2.63 ) > 04/16/2015 > [ 542.582361] 88038c42 8800ac3ff6c0 819c3387 > 88038e404240 > [ 542.582365] 8800ac3ff6f0 813e22f4 88038e404240 > ea000e310800 > [ 542.582368] 88038c421c08 8800ac3ff718 > 813e69bf > [ 542.582369] Call Trace: > [ 542.582375] [] dump_stack+0x4b/0x74 > [ 542.582378] [] print_trailer+0xf4/0x150 > [ 542.582382] [] object_err+0x2f/0x40 > [ 542.582387] [] kasan_report_error+0x21c/0x540 > [ 542.582392] [] ? ses_recv_diag+0xac/0xe0 [ses] > [ 542.582397] [] __asan_report_load1_noabort+0x3e/0x40 > [ 542.582401] [] ? ses_enclosure_data_process+0x900/0xe50 > [ses] > [ 542.582406] [] ses_enclosure_data_process+0x900/0xe50 > [ses] > [ 542.582412] [] ? pm_runtime_init+0x364/0x410 > [ 542.582417] [] ses_intf_add+0x9d6/0xe00 [ses] > [ 542.582421] [] class_interface_register+0x213/0x350 > [ 542.582425] [] ? class_dev_iter_exit+0x10/0x10 > [ 542.582429] [] ? kvasprintf+0xf0/0xf0 > [ 542.582432] [] ? 0xc113 > [ 542.582435] [] scsi_register_interface+0x33/0x40 > [ 542.582439] [] ses_init+0x13/0x1000 [ses] > [ 542.582443] [] do_one_initcall+0x13c/0x2f0 > [ 542.582446] [] ? try_to_run_init_process+0x40/0x40 > [ 542.582450] [] ? kasan_unpoison_shadow+0x36/0x50 > [ 542.582454] [] ? kasan_unpoison_shadow+0x36/0x50 > [ 542.582458] [] ? __asan_register_globals+0x87/0xa0 > [ 542.582463] [] do_init_module+0x1d9/0x5bc > [ 542.582466] [] load_module+0x6029/0x9230 > [ 542.582469] [] ? symbol_put_addr+0x50/0x50 > [ 542.582475] [] ? module_frob_arch_sections+0x20/0x20 > [ 542.582479] [] ? open_exec+0x50/0x50 > [ 542.582486] [] ? ns_capable+0x4f/0xd0 > [ 542.582489] [] SyS_finit_module+0x103/0x130 > [ 542.582492] [] ? SyS_init_module+0x1d0/0x1d0 > [ 542.582497] [] entry_SYSCALL_64_fastpath+0x16/0x75 > [ 542.582498] Memory state around the
[scsi:for-next 119/125] drivers/scsi/mpt3sas/mpt3sas_base.c:140:2: error: implicit declaration of function 'pci_stop_and_remove_bus_device_locked'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next head: 54210dc420589ed7b101a6a5edcea9d9ee651512 commit: b840c3627b6f4f856b333a14a72f8ed86da2f86c [119/125] mpt3sas: Add dummy Kconfig option for backwards compatibility config: mips-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout b840c3627b6f4f856b333a14a72f8ed86da2f86c # save the attached .config to linux build tree make.cross ARCH=mips All error/warnings (new ones prefixed by >>): drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_remove_dead_ioc_func': >> drivers/scsi/mpt3sas/mpt3sas_base.c:140:2: error: implicit declaration of >> function 'pci_stop_and_remove_bus_device_locked' >> [-Werror=implicit-function-declaration] pci_stop_and_remove_bus_device_locked(pdev); ^ drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_disable_msix': >> drivers/scsi/mpt3sas/mpt3sas_base.c:1921:2: error: implicit declaration of >> function 'pci_disable_msix' [-Werror=implicit-function-declaration] pci_disable_msix(ioc->pdev); ^ drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_enable_msix': >> drivers/scsi/mpt3sas/mpt3sas_base.c:1964:51: error: invalid application of >> 'sizeof' to incomplete type 'struct msix_entry' entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry), ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:1973:61: error: increment of pointer to >> an incomplete type 'struct msix_entry' for (i = 0, a = entries; i < ioc->reply_queue_count; i++, a++) ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:1974:4: error: dereferencing pointer to >> incomplete type 'struct msix_entry' a->entry = i; ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:1976:6: error: implicit declaration of >> function 'pci_enable_msix_exact' [-Werror=implicit-function-declaration] r = pci_enable_msix_exact(ioc->pdev, entries, ioc->reply_queue_count); ^ drivers/scsi/mpt3sas/mpt3sas_base.c:1986:61: error: increment of pointer to an incomplete type 'struct msix_entry' for (i = 0, a = entries; i < ioc->reply_queue_count; i++, a++) { ^ drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_unmap_resources': >> drivers/scsi/mpt3sas/mpt3sas_base.c:2031:6: error: implicit declaration of >> function 'pci_is_enabled' [-Werror=implicit-function-declaration] if (pci_is_enabled(pdev)) { ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:2032:3: error: implicit declaration of >> function 'pci_release_selected_regions' >> [-Werror=implicit-function-declaration] pci_release_selected_regions(ioc->pdev, ioc->bars); ^ drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_map_resources': >> drivers/scsi/mpt3sas/mpt3sas_base.c:2058:14: error: implicit declaration of >> function 'pci_select_bars' [-Werror=implicit-function-declaration] ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:2059:6: error: implicit declaration of >> function 'pci_enable_device_mem' [-Werror=implicit-function-declaration] if (pci_enable_device_mem(pdev)) { ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:2067:6: error: implicit declaration of >> function 'pci_request_selected_regions' >> [-Werror=implicit-function-declaration] if (pci_request_selected_regions(pdev, ioc->bars, ^ drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_release_memory_pools': >> drivers/scsi/mpt3sas/mpt3sas_base.c:3058:3: error: implicit declaration of >> function 'pci_pool_free' [-Werror=implicit-function-declaration] pci_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma); ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3060:4: error: implicit declaration of >> function 'pci_pool_destroy' [-Werror=implicit-function-declaration] pci_pool_destroy(ioc->sense_dma_pool); ^ drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_allocate_memory_pools': >> drivers/scsi/mpt3sas/mpt3sas_base.c:3280:34: error: implicit declaration of >> function 'pci_pool_create' [-Werror=implicit-function-declaration] ioc->reply_post_free_dma_pool = pci_pool_create("reply_post_free pool", ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3280:32: warning: assignment makes >> pointer from integer without a cast [-Wint-conversion] ioc->reply_post_free_dma_pool = pci_pool_create("reply_post_free pool", ^ >> drivers/scsi/mpt3sas/mpt3sas_base.c:3291:7: error: implicit declaration of >> function 'pci_pool_alloc' [-Werror=implicit-function-declaration]
Re: [scsi:fixes 16/18] warning: (SCSI_MPT2SAS) selects SCSI_MPT3SAS which has unmet direct dependencies (SCSI_LOWLEVEL && ..)
On Thu, 2015-12-03 at 05:02 +0800, kbuild test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git fixes > head: 136dc13bf2988d987682e60558bb9b9873215f29 > commit: b840c3627b6f4f856b333a14a72f8ed86da2f86c [16/18] mpt3sas: Add dummy > Kconfig option for backwards compatibility > config: mips-allyesconfig (attached as .config) > reproduce: > wget > https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross > -O ~/bin/make.cross > chmod +x ~/bin/make.cross > git checkout b840c3627b6f4f856b333a14a72f8ed86da2f86c > # save the attached .config to linux build tree > make.cross ARCH=mips > > All warnings (new ones prefixed by >>): > > warning: (SCSI_MPT2SAS) selects SCSI_MPT3SAS which has unmet direct > dependencies (SCSI_LOWLEVEL && PCI && SCSI) That's unfortunate. The problem is that select and depend don't interact because Kconfig doesn't have a SAT solver, so depend picks up dependencies and select does onward selects, but select doesn't pick up dependencies. To fix this, we need to add the correct dependencies to the MPT2SAS option like this. James --- diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig index 25dc38f..b736dbc 100644 --- a/drivers/scsi/mpt3sas/Kconfig +++ b/drivers/scsi/mpt3sas/Kconfig @@ -76,6 +76,7 @@ config SCSI_MPT2SAS tristate "Legacy MPT2SAS config option" default n select SCSI_MPT3SAS + depends on PCI && SCSI ---help--- Dummy config option for backwards compatiblity: configure the MPT3SAS driver instead. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv2 00/18] ALUA device handler update, part 1
> "Hannes" == Hannes Reineckewrites: Hannes> Hi all, here's the first part of my ALUA device handler update. Hannes> It's mainly bugfixes and minor improvements; the two important Hannes> things are the addition of VPD parsing functions Hannes> scsi_vpd_lun_id() and scsi_vpd_tpg_id(). This series has been Hannes> split off from the original 'Asynchronous ALUA' patchset, as Hannes> these bits are pretty uncontroversial and have a good chance of Hannes> being merged reasonably soon. Applied to 4.5/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 09/10] aacraid: Fix character device re-initialization
Hello Johannes, > -Original Message- > From: Johannes Thumshirn [mailto:jthumsh...@suse.de] > Sent: Wednesday, December 2, 2015 2:14 AM > To: Raghava Aditya Renukunta; jbottom...@parallels.com; linux- > s...@vger.kernel.org > Cc: Mahesh Rajashekhara; Murthy Bhat; Santosh Akula; Gana Sridaran; > aacr...@pmc-sierra.com; Rich Bono > Subject: Re: [PATCH 09/10] aacraid: Fix character device re-initialization > > Hi Raghava, > > On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > > From: Raghava Aditya Renukunta> > > > During EEH PCI hotplug activity kernel unloads and loads the driver, > > causing character device to be unregistered(aac_remove_one).When the > > driver is loaded back using aac_probe_one the character device needs > > to be registered again for the AIF management tools to work. > > > > Fixed by adding code to register character device in aac_probe_one if > > it is unregistered in aac_remove_one. > > > > Signed-off-by: Raghava Aditya Renukunta > > > > --- > > drivers/scsi/aacraid/linit.c | 19 +-- > > 1 file changed, 13 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/scsi/aacraid/linit.c > > b/drivers/scsi/aacraid/linit.c index 2094842..7142578 100644 > > --- a/drivers/scsi/aacraid/linit.c > > +++ b/drivers/scsi/aacraid/linit.c > > @@ -1123,6 +1123,13 @@ static void __aac_shutdown(struct aac_dev * > aac) > > else if (aac->max_msix > 1) > > pci_disable_msix(aac->pdev); > > } > > +static void aac_init_char(void) > > +{ > > + aac_cfg_major = register_chrdev(0, "aac", _cfg_fops); > > + if (aac_cfg_major < 0) { > > + pr_err("aacraid: unable to register \"aac\" device.\n"); > > + } > > +} > > > > static int aac_probe_one(struct pci_dev *pdev, const struct > > pci_device_id > > *id) > > { > > @@ -1185,6 +1192,9 @@ static int aac_probe_one(struct pci_dev *pdev, > > const struct pci_device_id *id) > > shost->max_cmd_len = 16; > > shost->use_cmd_list = 1; > > > > + if (aac_cfg_major == -2) > > + aac_init_char(); > > + > > aac = (struct aac_dev *)shost->hostdata; > > aac->base_start = pci_resource_start(pdev, 0); > > aac->scsi_host_ptr = shost; > > @@ -1536,7 +1546,7 @@ static void aac_remove_one(struct pci_dev > *pdev) > > pci_disable_device(pdev); > > if (list_empty(_devices)) { > > unregister_chrdev(aac_cfg_major, "aac"); > > - aac_cfg_major = -1; > > + aac_cfg_major = -2; > > Please add something like > #define AAC_CHARDEV_UNREGISTERED -1 > #define AAC_CHARDEV_NEEDS_REINIT -2 > > so it's obvious what you're doing. Thank you for pointing that out, I will make the necessary changes in the next iteration. > > > } > > } > > > > @@ -1697,11 +1707,8 @@ static int __init aac_init(void) > > if (error < 0) > > return error; > > > > - aac_cfg_major = register_chrdev( 0, "aac", _cfg_fops); > > - if (aac_cfg_major < 0) { > > - printk(KERN_WARNING > > - "aacraid: unable to register \"aac\" device.\n"); > > - } > > + aac_init_char(); > > + > > > > return 0; > > } Regards, Raghava Aditya N�r��yb�X��ǧv�^�){.n�+{���"�{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj"��!�i
[scsi:for-next 119/125] drivers/scsi/mpt3sas/mpt3sas_transport.c:1973:3: error: implicit declaration of function 'pci_dma_mapping_error'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next head: 54210dc420589ed7b101a6a5edcea9d9ee651512 commit: b840c3627b6f4f856b333a14a72f8ed86da2f86c [119/125] mpt3sas: Add dummy Kconfig option for backwards compatibility config: openrisc-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout b840c3627b6f4f856b333a14a72f8ed86da2f86c # save the attached .config to linux build tree make.cross ARCH=openrisc All errors (new ones prefixed by >>): drivers/scsi/mpt3sas/mpt3sas_transport.c: In function '_transport_expander_report_manufacture': drivers/scsi/mpt3sas/mpt3sas_transport.c:363:2: error: implicit declaration of function 'pci_alloc_consistent' drivers/scsi/mpt3sas/mpt3sas_transport.c:363:11: warning: assignment makes pointer from integer without a cast drivers/scsi/mpt3sas/mpt3sas_transport.c:454:3: error: implicit declaration of function 'pci_free_consistent' drivers/scsi/mpt3sas/mpt3sas_transport.c: In function '_transport_get_expander_phy_error_log': drivers/scsi/mpt3sas/mpt3sas_transport.c:1162:11: warning: assignment makes pointer from integer without a cast drivers/scsi/mpt3sas/mpt3sas_transport.c: In function '_transport_expander_phy_control': drivers/scsi/mpt3sas/mpt3sas_transport.c:1477:11: warning: assignment makes pointer from integer without a cast drivers/scsi/mpt3sas/mpt3sas_transport.c: In function '_transport_smp_handler': drivers/scsi/mpt3sas/mpt3sas_transport.c:1955:16: warning: assignment makes pointer from integer without a cast drivers/scsi/mpt3sas/mpt3sas_transport.c:1971:3: error: implicit declaration of function 'pci_map_single' >> drivers/scsi/mpt3sas/mpt3sas_transport.c:1973:3: error: implicit declaration >> of function 'pci_dma_mapping_error' drivers/scsi/mpt3sas/mpt3sas_transport.c:1984:15: warning: assignment makes pointer from integer without a cast drivers/scsi/mpt3sas/mpt3sas_transport.c:2123:3: error: implicit declaration of function 'pci_unmap_single' vim +/pci_dma_mapping_error +1973 drivers/scsi/mpt3sas/mpt3sas_transport.c f92363d1 Sreekanth Reddy 2012-11-30 1957 if (!pci_addr_out) { f92363d1 Sreekanth Reddy 2012-11-30 1958 pr_info(MPT3SAS_FMT "%s(): PCI Addr out = NULL\n", f92363d1 Sreekanth Reddy 2012-11-30 1959 ioc->name, __func__); f92363d1 Sreekanth Reddy 2012-11-30 1960 rc = -ENOMEM; f92363d1 Sreekanth Reddy 2012-11-30 1961 goto out; f92363d1 Sreekanth Reddy 2012-11-30 1962 } f92363d1 Sreekanth Reddy 2012-11-30 1963 7988613b Kent Overstreet 2013-11-23 1964 bio_for_each_segment(bvec, req->bio, iter) { f92363d1 Sreekanth Reddy 2012-11-30 1965 memcpy(pci_addr_out + offset, 7988613b Kent Overstreet 2013-11-23 1966 page_address(bvec.bv_page) + bvec.bv_offset, 7988613b Kent Overstreet 2013-11-23 1967 bvec.bv_len); 7988613b Kent Overstreet 2013-11-23 1968 offset += bvec.bv_len; f92363d1 Sreekanth Reddy 2012-11-30 1969 } f92363d1 Sreekanth Reddy 2012-11-30 1970 } else { f92363d1 Sreekanth Reddy 2012-11-30 1971 dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), f92363d1 Sreekanth Reddy 2012-11-30 1972 blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); 36814028 Sreekanth Reddy 2015-06-30 @1973 if (pci_dma_mapping_error(ioc->pdev, dma_addr_out)) { f92363d1 Sreekanth Reddy 2012-11-30 1974 pr_info(MPT3SAS_FMT "%s(): DMA Addr out = NULL\n", f92363d1 Sreekanth Reddy 2012-11-30 1975 ioc->name, __func__); f92363d1 Sreekanth Reddy 2012-11-30 1976 rc = -ENOMEM; f92363d1 Sreekanth Reddy 2012-11-30 1977 goto free_pci; f92363d1 Sreekanth Reddy 2012-11-30 1978 } f92363d1 Sreekanth Reddy 2012-11-30 1979 } f92363d1 Sreekanth Reddy 2012-11-30 1980 f92363d1 Sreekanth Reddy 2012-11-30 1981 /* Check if the response needs to be populated across :: The code at line 1973 was first introduced by commit :: 36814028ad720165a6febcf9ddd7de20833fd240 mpt3sas: Call dma_mapping_error() API after mapping an address with dma_map_single() API :: TO: Sreekanth Reddy:: CC: James Bottomley --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
RE: [PATCH 07/10] aacraid: Fix AIF triggered IOP_RESET
Hello Johannes, > -Original Message- > From: Johannes Thumshirn [mailto:jthumsh...@suse.de] > Sent: Wednesday, December 2, 2015 2:01 AM > To: Raghava Aditya Renukunta; jbottom...@parallels.com; linux- > s...@vger.kernel.org > Cc: Mahesh Rajashekhara; Murthy Bhat; Santosh Akula; Gana Sridaran; > aacr...@pmc-sierra.com; Rich Bono > Subject: Re: [PATCH 07/10] aacraid: Fix AIF triggered IOP_RESET > > Hi Raghava, > > On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > > From: Raghava Aditya Renukunta> > > > while driver removal is in progress or PCI shutdown is invoked, driver > > kills AIF aacraid thread, but IOCTL requests from the management tools > > re-start AIF thread leading to IOP_RESET. > > > > Fixed by setting adapter_shutdown flag when PCI shutdown is invoked. > > > > Signed-off-by: Raghava Aditya Renukunta > > > > --- > > drivers/scsi/aacraid/linit.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/scsi/aacraid/linit.c > > b/drivers/scsi/aacraid/linit.c index 6912efd..3a4dbe7 100644 > > --- a/drivers/scsi/aacraid/linit.c > > +++ b/drivers/scsi/aacraid/linit.c > > @@ -1454,6 +1454,7 @@ static int aac_suspend(struct pci_dev *pdev, > > pm_message_t state) > > struct aac_dev *aac = (struct aac_dev *)shost->hostdata; > > > > scsi_block_requests(shost); > > + aac->adapter_shutdown = 1; > > aac_send_shutdown(aac); > > > > aac_release_resources(aac); > > I don't quite undestand that, the following is from aac_send_shutdown(): > > > 229 /* FIB should be freed only after getting the response from the > F/W > */ > 230 if (status != -ERESTARTSYS) > 231 aac_fib_free(fibctx); > 232 dev->adapter_shutdown = 1; > 233 if ((dev->pdev->device == PMC_DEVICE_S7 || > 234 dev->pdev->device == PMC_DEVICE_S8 || > > > > in line 232 you're already setting the adapter shutdown flag, why do you > need to pre-set it before calling aac_send_shutdown()? Originally the problem was that dev->adapter_shutdown was set after the Shutdown command was sent to the controller, leading to a race condition If after the controller was shut down and before dev->adapter_shutdown was set , the driver received a AIF command from management tool , it would still be sent to the controller in aac_cfg_ioctl() leading to a IOP_RESET. A fix would be to set dev->adapter_shutdown at the very beginning of aac_send_shutdown(). > > Thanks, > Johannes Thank you, Raghava Aditya
Re: [scsi:fixes 16/18] warning: (SCSI_MPT2SAS) selects SCSI_MPT3SAS which has unmet direct dependencies (SCSI_LOWLEVEL && ..)
> "James" == James Bottomleywrites: >> warning: (SCSI_MPT2SAS) selects SCSI_MPT3SAS which has unmet direct >> dependencies (SCSI_LOWLEVEL && PCI && SCSI) James> That's unfortunate. The problem is that select and depend don't James> interact because Kconfig doesn't have a SAT solver, so depend James> picks up dependencies and select does onward selects, but select James> doesn't pick up dependencies. To fix this, we need to add the James> correct dependencies to the MPT2SAS option like this. Yeah, I was wondering about whether it would make sense to add the dependency when I did the patch. I did test after unselecting SCSI but didn't get any warnings. In retrospect I probably had something else configured that pulled it back in. In any case: Patch looks good to me. I also asked Fengguang to add scsi.git to the kbuild test robot. It looks like it's only been testing the SCSI branches I kept in my regular git tree and they were a bit behind scsi.git. -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/4] bfa: Patches for scsi "misc" branch
> "Anil" ==writes: Anil> Please apply the following patches to the scsi tree, misc branch Anil> at your earliest convenience. Series applied to 4.5/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] scsi_dh_alua: Remove stale variables
With commit 83ea0e5e3501 these variables became obsolete, but weren't removed. Signed-off-by: Hannes Reinecke--- drivers/scsi/device_handler/scsi_dh_alua.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index f100cbb..5a328bf 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -320,8 +320,6 @@ static int alua_check_tpgs(struct scsi_device *sdev) */ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h) { - unsigned char *d; - unsigned char __rcu *vpd_pg83; int rel_port = -1, group_id; group_id = scsi_vpd_tpg_id(sdev, _port); -- 1.8.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/5] SCSI EH cleanup
Hi all, here's a small patchset for cleaning up SCSI EH. Primary goal is to make asynchronous aborts mandatory; there hasn't been a single report so far where asynchronous abort won't work, so the 'no_async_abort' flag has never been used and will be removed with this patchset. Additionally there's a cleanup for handle failed EH commands, and to detect retries of failed commands. As usual, comments and reviews are welcome. Christoph Hellwig (1): libsas: allow async aborts Hannes Reinecke (4): scsi: make scsi_eh_scmd_add() always succeed scsi: make eh_eflags persistent scsi: make asynchronous aborts mandatory scsi_error: do not escalate failed EH command Documentation/scsi/scsi_eh.txt | 31 - drivers/scsi/libsas/sas_scsi_host.c | 3 - drivers/scsi/scsi_error.c | 125 ++-- drivers/scsi/scsi_lib.c | 4 +- drivers/scsi/scsi_priv.h| 3 +- include/scsi/scsi_eh.h | 1 + include/scsi/scsi_host.h| 5 -- 7 files changed, 35 insertions(+), 137 deletions(-) -- 1.8.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] scsi: make asynchronous aborts mandatory
There hasn't been any reports for HBAs where asynchronous abort would not work, so we should make it mandatory and remove the fallback. Signed-off-by: Hannes Reinecke--- Documentation/scsi/scsi_eh.txt | 28 +++ drivers/scsi/scsi_error.c | 81 -- drivers/scsi/scsi_lib.c| 2 +- drivers/scsi/scsi_priv.h | 3 +- include/scsi/scsi_host.h | 5 --- 5 files changed, 22 insertions(+), 97 deletions(-) diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt index 745eed5..6e07245fb 100644 --- a/Documentation/scsi/scsi_eh.txt +++ b/Documentation/scsi/scsi_eh.txt @@ -70,7 +70,7 @@ with the command. scmd is requeued to blk queue. - otherwise - scsi_eh_scmd_add(scmd, 0) is invoked for the command. See + scsi_eh_scmd_add(scmd) is invoked for the command. See [1-3] for details of this function. @@ -103,13 +103,15 @@ function eh_timed_out() callback did not handle the command. Step #2 is taken. - 2. If the host supports asynchronous completion (as indicated by the -no_async_abort setting in the host template) scsi_abort_command() -is invoked to schedule an asynchrous abort. If that fails -Step #3 is taken. + 2. scsi_abort_command() is invoked to schedule an asynchrous abort +(Seee [1-3] for more information). +Asynchronous abort are not invoked for commands which have +SCSI_EH_ABORT_SCHEDULED set (this indicates that the command +already had been aborted once, and this is a retry which failed), +or when the EH deadline is expired. In these case Step #3 is taken. - 2. scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD) is invoked for the -command. See [1-3] for more information. + 3. scsi_eh_scmd_add(scmd) is invoked for the +command. See [1-4] for more information. [1-3] Asynchronous command aborts @@ -124,16 +126,13 @@ function scmds enter EH via scsi_eh_scmd_add(), which does the following. - 1. Turns on scmd->eh_eflags as requested. It's 0 for error -completions and SCSI_EH_CANCEL_CMD for timeouts. + 1. Links scmd->eh_entry to shost->eh_cmd_q - 2. Links scmd->eh_entry to shost->eh_cmd_q + 2. Sets SHOST_RECOVERY bit in shost->shost_state - 3. Sets SHOST_RECOVERY bit in shost->shost_state + 3. Increments shost->host_failed - 4. Increments shost->host_failed - - 5. Wakes up SCSI EH thread if shost->host_busy == shost->host_failed + 4. Wakes up SCSI EH thread if shost->host_busy == shost->host_failed As can be seen above, once any scmd is added to shost->eh_cmd_q, SHOST_RECOVERY shost_state bit is turned on. This prevents any new @@ -249,7 +248,6 @@ scmd->allowed. 1. Error completion / time out ACTION: scsi_eh_scmd_add() is invoked for scmd - - set scmd->eh_eflags - add scmd to shost->eh_cmd_q - set SHOST_RECOVERY - shost->host_failed++ diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index eb0f19f..cf47b81 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -162,7 +162,7 @@ scmd_eh_abort_handler(struct work_struct *work) } } - scsi_eh_scmd_add(scmd, 0); + scsi_eh_scmd_add(scmd); } /** @@ -216,9 +216,8 @@ scsi_abort_command(struct scsi_cmnd *scmd) /** * scsi_eh_scmd_add - add scsi cmd to error handling. * @scmd: scmd to run eh on. - * @eh_flag: optional SCSI_EH flag. */ -void scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) +void scsi_eh_scmd_add(struct scsi_cmnd *scmd) { struct Scsi_Host *shost = scmd->device->host; unsigned long flags; @@ -236,9 +235,6 @@ void scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) if (shost->eh_deadline != -1 && !shost->last_reset) shost->last_reset = jiffies; - if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) - eh_flag &= ~SCSI_EH_CANCEL_CMD; - scmd->eh_eflags |= eh_flag; list_add_tail(>eh_entry, >eh_cmd_q); shost->host_failed++; scsi_eh_wakeup(shost); @@ -273,10 +269,9 @@ enum blk_eh_timer_return scsi_times_out(struct request *req) rtn = host->hostt->eh_timed_out(scmd); if (rtn == BLK_EH_NOT_HANDLED) { - if (host->hostt->no_async_abort || - scsi_abort_command(scmd) != SUCCESS) { + if (scsi_abort_command(scmd) != SUCCESS) { set_host_byte(scmd, DID_TIME_OUT); - scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD); + scsi_eh_scmd_add(scmd); } } @@ -329,7 +324,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, list_for_each_entry(scmd, work_q, eh_entry) { if (scmd->device == sdev) { ++total_failures; - if (scmd->eh_eflags & SCSI_EH_CANCEL_CMD) +
[PATCH 3/5] scsi: make eh_eflags persistent
To detect if a failed command has been retried we must not clear scmd->eh_eflags when EH finishes. The flag should be persistent throughout the lifetime of the command. Signed-off-by: Hannes Reinecke--- Documentation/scsi/scsi_eh.txt | 3 --- drivers/scsi/scsi_error.c | 4 ++-- include/scsi/scsi_eh.h | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt index 8638f61..745eed5 100644 --- a/Documentation/scsi/scsi_eh.txt +++ b/Documentation/scsi/scsi_eh.txt @@ -264,7 +264,6 @@ scmd->allowed. 3. scmd recovered ACTION: scsi_eh_finish_cmd() is invoked to EH-finish scmd - shost->host_failed-- - - clear scmd->eh_eflags - scsi_setup_cmd_retry() - move from local eh_work_q to local eh_done_q LOCKING: none @@ -452,8 +451,6 @@ except for #1 must be implemented by eh_strategy_handler(). - shost->host_failed is zero. - - Each scmd's eh_eflags field is cleared. - - Each scmd is in such a state that scsi_setup_cmd_retry() on the scmd doesn't make any difference. diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index deb35737..eb0f19f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -182,7 +182,6 @@ scsi_abort_command(struct scsi_cmnd *scmd) /* * Retry after abort failed, escalate to next level. */ - scmd->eh_eflags &= ~SCSI_EH_ABORT_SCHEDULED; SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, "previous abort failed\n")); @@ -919,6 +918,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, ses->result = scmd->result; ses->underflow = scmd->underflow; ses->prot_op = scmd->prot_op; + ses->eh_eflags = scmd->eh_eflags; scmd->prot_op = SCSI_PROT_NORMAL; scmd->eh_eflags = 0; @@ -982,6 +982,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) scmd->result = ses->result; scmd->underflow = ses->underflow; scmd->prot_op = ses->prot_op; + scmd->eh_eflags = ses->eh_eflags; } EXPORT_SYMBOL(scsi_eh_restore_cmnd); @@ -1115,7 +1116,6 @@ static int scsi_eh_action(struct scsi_cmnd *scmd, int rtn) void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) { scmd->device->host->host_failed--; - scmd->eh_eflags = 0; list_move_tail(>eh_entry, done_q); } EXPORT_SYMBOL(scsi_eh_finish_cmd); diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index dbb8c64..f2f876c 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h @@ -30,6 +30,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user *); struct scsi_eh_save { /* saved state */ int result; + int eh_eflags; enum dma_data_direction data_direction; unsigned underflow; unsigned char cmd_len; -- 1.8.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] libsas: allow async aborts
From: Christoph HellwigWe now first try to call ->eh_abort_handler from a work queue, but libsas was always failing that for no good reason. Allow async aborts. Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig --- drivers/scsi/libsas/sas_scsi_host.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 519dac4..37a2a84 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -491,9 +491,6 @@ int sas_eh_abort_handler(struct scsi_cmnd *cmd) struct Scsi_Host *host = cmd->device->host; struct sas_internal *i = to_sas_internal(host->transportt); - if (current != host->ehandler) - return FAILED; - if (!i->dft->lldd_abort_task) return FAILED; -- 1.8.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5] scsi_error: do not escalate failed EH command
When a command is sent as part of the error handling there is not point whatsoever to start EH escalation when that command fails; we are _already_ in the error handler, and the escalation is about to commence anyway. So just call 'scsi_try_to_abort_cmd()' to abort outstanding commands and let the main EH routine handle the rest. Signed-off-by: Hannes Reinecke--- drivers/scsi/scsi_error.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index cf47b81..0159498 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -870,15 +870,6 @@ static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt, return hostt->eh_abort_handler(scmd); } -static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) -{ - if (scsi_try_to_abort_cmd(scmd->device->host->hostt, scmd) != SUCCESS) - if (scsi_try_bus_device_reset(scmd) != SUCCESS) - if (scsi_try_target_reset(scmd) != SUCCESS) - if (scsi_try_bus_reset(scmd) != SUCCESS) - scsi_try_host_reset(scmd); -} - /** * scsi_eh_prep_cmnd - Save a scsi command info as part of error recovery * @scmd: SCSI command structure to hijack @@ -1063,7 +1054,7 @@ retry: break; } } else if (rtn != FAILED) { - scsi_abort_eh_cmnd(scmd); + scsi_try_to_abort_cmd(shost->hostt, scmd); rtn = FAILED; } -- 1.8.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] scsi: make scsi_eh_scmd_add() always succeed
scsi_eh_scmd_add() currently only will fail if no error handler thread is started (which will never be the case) or if the state machine encounters an illegal transition. But if we're encountering an invalid state transition chances is we cannot fixup things with the error handler. So better add a WARN_ON for illegal host states and make scsi_dh_scmd_add() a void function. Signed-off-by: Hannes Reinecke--- drivers/scsi/scsi_error.c | 39 +-- drivers/scsi/scsi_lib.c | 4 ++-- drivers/scsi/scsi_priv.h | 2 +- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 984ddcb..deb35737 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -162,13 +162,7 @@ scmd_eh_abort_handler(struct work_struct *work) } } - if (!scsi_eh_scmd_add(scmd, 0)) { - SCSI_LOG_ERROR_RECOVERY(3, - scmd_printk(KERN_WARNING, scmd, - "terminate aborted command\n")); - set_host_byte(scmd, DID_TIME_OUT); - scsi_finish_command(scmd); - } + scsi_eh_scmd_add(scmd, 0); } /** @@ -224,37 +218,32 @@ scsi_abort_command(struct scsi_cmnd *scmd) * scsi_eh_scmd_add - add scsi cmd to error handling. * @scmd: scmd to run eh on. * @eh_flag: optional SCSI_EH flag. - * - * Return value: - * 0 on failure. */ -int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) +void scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) { struct Scsi_Host *shost = scmd->device->host; unsigned long flags; - int ret = 0; - if (!shost->ehandler) - return 0; + WARN_ON(!shost->ehandler); spin_lock_irqsave(shost->host_lock, flags); + WARN_ON(shost->shost_state != SHOST_RUNNING && + shost->shost_state != SHOST_CANCEL && + shost->shost_state != SHOST_RECOVERY && + shost->shost_state != SHOST_CANCEL_RECOVERY); if (scsi_host_set_state(shost, SHOST_RECOVERY)) - if (scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY)) - goto out_unlock; + scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY); if (shost->eh_deadline != -1 && !shost->last_reset) shost->last_reset = jiffies; - ret = 1; if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) eh_flag &= ~SCSI_EH_CANCEL_CMD; scmd->eh_eflags |= eh_flag; list_add_tail(>eh_entry, >eh_cmd_q); shost->host_failed++; scsi_eh_wakeup(shost); - out_unlock: spin_unlock_irqrestore(shost->host_lock, flags); - return ret; } /** @@ -285,13 +274,11 @@ enum blk_eh_timer_return scsi_times_out(struct request *req) rtn = host->hostt->eh_timed_out(scmd); if (rtn == BLK_EH_NOT_HANDLED) { - if (!host->hostt->no_async_abort && - scsi_abort_command(scmd) == SUCCESS) - return BLK_EH_NOT_HANDLED; - - set_host_byte(scmd, DID_TIME_OUT); - if (!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD)) - rtn = BLK_EH_HANDLED; + if (host->hostt->no_async_abort || + scsi_abort_command(scmd) != SUCCESS) { + set_host_byte(scmd, DID_TIME_OUT); + scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD); + } } return rtn; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index fa6b2c4..2dd7d0a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1647,8 +1647,8 @@ static void scsi_softirq_done(struct request *rq) scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY); break; default: - if (!scsi_eh_scmd_add(cmd, 0)) - scsi_finish_command(cmd); + scsi_eh_scmd_add(cmd, 0); + break; } } diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 27b4d0a..8c26823 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -71,7 +71,7 @@ extern enum blk_eh_timer_return scsi_times_out(struct request *req); extern int scsi_error_handler(void *host); extern int scsi_decide_disposition(struct scsi_cmnd *cmd); extern void scsi_eh_wakeup(struct Scsi_Host *shost); -extern int scsi_eh_scmd_add(struct scsi_cmnd *, int); +extern void scsi_eh_scmd_add(struct scsi_cmnd *, int); void scsi_eh_ready_devs(struct Scsi_Host *shost, struct list_head *work_q, struct list_head *done_q); -- 1.8.5.6 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at
[PATCH RESEND] cxlflash: a couple off by one bugs
From: Dan CarpenterThe "> MAX_CONTEXT" should be ">= MAX_CONTEXT". Otherwise we go one step beyond the end of the cfg->ctx_tbl[] array. Signed-off-by: Dan Carpenter Reviewed-by: Manoj Kumar Acked-by: Matthew R. Ochs Signed-off-by: Matthew R. Ochs --- This patch was originally sent by Dan Carpenter in September 2015. I had based my large patch series that went into 4.4 off of it but this patch appears to have not made it in. As a valid fix, I'd like to see this make it into 'next'. I've gone ahead and performed the rebase so that it applies cleanly. drivers/scsi/cxlflash/superpipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c index cac2e6a..34b21a0 100644 --- a/drivers/scsi/cxlflash/superpipe.c +++ b/drivers/scsi/cxlflash/superpipe.c @@ -1380,7 +1380,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev, } ctxid = cxl_process_element(ctx); - if (unlikely((ctxid > MAX_CONTEXT) || (ctxid < 0))) { + if (unlikely((ctxid >= MAX_CONTEXT) || (ctxid < 0))) { dev_err(dev, "%s: ctxid (%d) invalid!\n", __func__, ctxid); rc = -EPERM; goto err2; @@ -1508,7 +1508,7 @@ static int recover_context(struct cxlflash_cfg *cfg, struct ctx_info *ctxi) } ctxid = cxl_process_element(ctx); - if (unlikely((ctxid > MAX_CONTEXT) || (ctxid < 0))) { + if (unlikely((ctxid >= MAX_CONTEXT) || (ctxid < 0))) { dev_err(dev, "%s: ctxid (%d) invalid!\n", __func__, ctxid); rc = -EPERM; goto err1; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 03/10] aacraid: Added EEH support
Hello Johannes, > -Original Message- > From: Johannes Thumshirn [mailto:jthumsh...@suse.de] > Sent: Wednesday, December 2, 2015 1:42 AM > To: Raghava Aditya Renukunta; jbottom...@parallels.com; linux- > s...@vger.kernel.org > Cc: Mahesh Rajashekhara; Murthy Bhat; Santosh Akula; Gana Sridaran; > aacr...@pmc-sierra.com; Rich Bono > Subject: Re: [PATCH 03/10] aacraid: Added EEH support > > On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > > From: Raghava Aditya Renukunta> > > > Added support for PCI EEH(extended error handling). > > > > Signed-off-by: Raghava Aditya Renukunta > > > > --- > > drivers/scsi/aacraid/aacraid.h | 1 + > > drivers/scsi/aacraid/linit.c | 138 > > + > > 2 files changed, 139 insertions(+) > > > > diff --git a/drivers/scsi/aacraid/aacraid.h > > b/drivers/scsi/aacraid/aacraid.h index d133c4a..594de5f 100644 > > --- a/drivers/scsi/aacraid/aacraid.h > > +++ b/drivers/scsi/aacraid/aacraid.h > > @@ -1235,6 +1235,7 @@ struct aac_dev > > struct msix_entry msixentry[AAC_MAX_MSIX]; > > struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */ > > u8 adapter_shutdown; > > + u32 handle_pci_error; > > }; > > > > #define aac_adapter_interrupt(dev) \ > > diff --git a/drivers/scsi/aacraid/linit.c > > b/drivers/scsi/aacraid/linit.c index fa0fc44..0147210 100644 > > --- a/drivers/scsi/aacraid/linit.c > > +++ b/drivers/scsi/aacraid/linit.c > > @@ -38,6 +38,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1298,6 +1299,9 @@ static int aac_probe_one(struct pci_dev *pdev, > > const struct pci_device_id *id) > > goto out_deinit; > > scsi_scan_host(shost); > > > > + pci_enable_pcie_error_reporting(pdev); > > + pci_save_state(pdev); > > + > > return 0; > > > > out_deinit: > > @@ -1501,6 +1505,139 @@ static void aac_remove_one(struct pci_dev > *pdev) > > } > > } > > > > +void aac_flush_ios(struct aac_dev *aac) { > > + int i; > > + struct scsi_cmnd *cmd; > > + > > + for (i = 0; i < aac->scsi_host_ptr->can_queue; i++) { > > + cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data; > > + if (cmd && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) > { > > + scsi_dma_unmap(cmd); > > + aac_fib_free_tag(>fibs[i]); > > + > > + if (aac->handle_pci_error) > > + cmd->result = DID_NO_CONNECT << 16; > > + else > > + cmd->result = DID_RESET << 16; > > + > > + cmd->scsi_done(cmd); > > + } > > + } > > +} > > + > > +pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev, > > + enum pci_channel_state error) > > +{ > > + struct Scsi_Host *shost = pci_get_drvdata(pdev); > > + struct aac_dev *aac = shost_priv(shost); > > + > > + dev_err(>dev, "aacraid: PCI error detected %x\n", error); > > + > > + switch (error) { > > + case pci_channel_io_normal: > > + return PCI_ERS_RESULT_CAN_RECOVER; > > + case pci_channel_io_frozen: > > + > > + aac->handle_pci_error = 1; > > + > > + scsi_block_requests(aac->scsi_host_ptr); > > + aac_flush_ios(aac); > > + aac_release_resources(aac); > > + > > + pci_disable_pcie_error_reporting(pdev); > > + aac_adapter_ioremap(aac, 0); > > + > > + return PCI_ERS_RESULT_NEED_RESET; > > + case pci_channel_io_perm_failure: > > + aac->handle_pci_error = 1; > > + aac_flush_ios(aac); > > + return PCI_ERS_RESULT_DISCONNECT; > > + } > > + > > + return PCI_ERS_RESULT_NEED_RESET; > > +} > > + > > +pci_ers_result_t aac_pci_mmio_enabled(struct pci_dev *pdev) { > > + dev_err(>dev, "aacraid: PCI error - mmio enabled\n"); > > + return PCI_ERS_RESULT_NEED_RESET; > > +} > > + > > +pci_ers_result_t aac_pci_slot_reset(struct pci_dev *pdev) { > > + dev_err(>dev, "aacraid: PCI error - slot reset\n"); > > + pci_restore_state(pdev); > > + if (pci_enable_device(pdev)) { > > + dev_warn(>dev, > > + "aacraid: failed to enable slave\n"); > > + goto fail_device; > > + } > > + > > + pci_set_master(pdev); > > + > > + if (pci_enable_device_mem(pdev)) { > > + dev_err(>dev, "pci_enable_device_mem failed\n"); > > + goto fail_device; > > + } > > + > > + return PCI_ERS_RESULT_RECOVERED; > > + > > +fail_device: > > + dev_err(>dev, "aacraid: PCI error - slot reset failed\n"); > > + return PCI_ERS_RESULT_DISCONNECT; > > +} > > + > > + > > +void aac_pci_resume(struct pci_dev *pdev) { > > + struct Scsi_Host *shost = pci_get_drvdata(pdev); > > + struct scsi_device *sdev = NULL; > > + struct aac_dev *aac = (struct aac_dev
Re: [PATCH 04/10] aacraid: Fix memory leak in aac_fib_map_free
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > aac_fib_map_free() calls pci_free_consistent() without checking that > dev->hw_fib_va is not NULL and dev->max_fib_size is not zero.If they > are indeed NULL/0, this will result in a hang as pci_free_consistent() > will attempt to invalidate cache for the entire 64-bit address space > (which would take a very long time). > > Fixed by adding a check to make sure that dev->hw_fib_va and > dev->max_fib_size are not NULL and 0 respectively. > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/commsup.c | 9 ++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c > index b257d3b..9533f47 100644 > --- a/drivers/scsi/aacraid/commsup.c > +++ b/drivers/scsi/aacraid/commsup.c > @@ -83,9 +83,12 @@ static int fib_map_alloc(struct aac_dev *dev) > > void aac_fib_map_free(struct aac_dev *dev) > { > - pci_free_consistent(dev->pdev, > - dev->max_fib_size * (dev->scsi_host_ptr->can_queue + > AAC_NUM_MGT_FIB), > - dev->hw_fib_va, dev->hw_fib_pa); > + if (dev->hw_fib_va && dev->max_fib_size) { > + pci_free_consistent(dev->pdev, > + (dev->max_fib_size * > + (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)), > + dev->hw_fib_va, dev->hw_fib_pa); > + } > dev->hw_fib_va = NULL; > dev->hw_fib_pa = 0; > } Fixes: 9ad5204d6 - "[SCSI] aacraid: incorrect dma mapping mask during blinkled recover or user initiated reset" Cc: sta...@vger.kernel.org Reviewed-by: Johannes Thumshirn -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/10] aacraid: Fundamental reset support for Series 7
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > Series 7 does not support PCI hot reset used by EEH. > > Enabled fundamental reset only for Series 7 > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/linit.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c > index f88f1132..6912efd 100644 > --- a/drivers/scsi/aacraid/linit.c > +++ b/drivers/scsi/aacraid/linit.c > @@ -1135,6 +1135,12 @@ static int aac_probe_one(struct pci_dev *pdev, const > struct pci_device_id *id) > u64 dmamask; > extern int aac_sync_mode; > > + /* > + * Only series 7 needs freset. > + */ > + if (pdev->device == PMC_DEVICE_S7) > + pdev->needs_freset = 1; > + > list_for_each_entry(aac, _devices, entry) { > if (aac->id > unique_id) > break; Reviewed-by: Johannes Thumshirn -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/10] aacraid: Fix character device re-initialization
Hi Raghava, On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > During EEH PCI hotplug activity kernel unloads and loads the driver, > causing character device to be unregistered(aac_remove_one).When the > driver is loaded back using aac_probe_one the character device needs > to be registered again for the AIF management tools to work. > > Fixed by adding code to register character device in aac_probe_one if > it is unregistered in aac_remove_one. > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/linit.c | 19 +-- > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c > index 2094842..7142578 100644 > --- a/drivers/scsi/aacraid/linit.c > +++ b/drivers/scsi/aacraid/linit.c > @@ -1123,6 +1123,13 @@ static void __aac_shutdown(struct aac_dev * aac) > else if (aac->max_msix > 1) > pci_disable_msix(aac->pdev); > } > +static void aac_init_char(void) > +{ > + aac_cfg_major = register_chrdev(0, "aac", _cfg_fops); > + if (aac_cfg_major < 0) { > + pr_err("aacraid: unable to register \"aac\" device.\n"); > + } > +} > > static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id > *id) > { > @@ -1185,6 +1192,9 @@ static int aac_probe_one(struct pci_dev *pdev, const > struct pci_device_id *id) > shost->max_cmd_len = 16; > shost->use_cmd_list = 1; > > + if (aac_cfg_major == -2) > + aac_init_char(); > + > aac = (struct aac_dev *)shost->hostdata; > aac->base_start = pci_resource_start(pdev, 0); > aac->scsi_host_ptr = shost; > @@ -1536,7 +1546,7 @@ static void aac_remove_one(struct pci_dev *pdev) > pci_disable_device(pdev); > if (list_empty(_devices)) { > unregister_chrdev(aac_cfg_major, "aac"); > - aac_cfg_major = -1; > + aac_cfg_major = -2; Please add something like #define AAC_CHARDEV_UNREGISTERED -1 #define AAC_CHARDEV_NEEDS_REINIT -2 so it's obvious what you're doing. > } > } > > @@ -1697,11 +1707,8 @@ static int __init aac_init(void) > if (error < 0) > return error; > > - aac_cfg_major = register_chrdev( 0, "aac", _cfg_fops); > - if (aac_cfg_major < 0) { > - printk(KERN_WARNING > - "aacraid: unable to register \"aac\" device.\n"); > - } > + aac_init_char(); > + > > return 0; > } -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 03/10] aacraid: Added EEH support
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > Added support for PCI EEH(extended error handling). > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/aacraid.h | 1 + > drivers/scsi/aacraid/linit.c | 138 > + > 2 files changed, 139 insertions(+) > > diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h > index d133c4a..594de5f 100644 > --- a/drivers/scsi/aacraid/aacraid.h > +++ b/drivers/scsi/aacraid/aacraid.h > @@ -1235,6 +1235,7 @@ struct aac_dev > struct msix_entry msixentry[AAC_MAX_MSIX]; > struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */ > u8 adapter_shutdown; > + u32 handle_pci_error; > }; > > #define aac_adapter_interrupt(dev) \ > diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c > index fa0fc44..0147210 100644 > --- a/drivers/scsi/aacraid/linit.c > +++ b/drivers/scsi/aacraid/linit.c > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1298,6 +1299,9 @@ static int aac_probe_one(struct pci_dev *pdev, const > struct pci_device_id *id) > goto out_deinit; > scsi_scan_host(shost); > > + pci_enable_pcie_error_reporting(pdev); > + pci_save_state(pdev); > + > return 0; > > out_deinit: > @@ -1501,6 +1505,139 @@ static void aac_remove_one(struct pci_dev *pdev) > } > } > > +void aac_flush_ios(struct aac_dev *aac) > +{ > + int i; > + struct scsi_cmnd *cmd; > + > + for (i = 0; i < aac->scsi_host_ptr->can_queue; i++) { > + cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data; > + if (cmd && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) { > + scsi_dma_unmap(cmd); > + aac_fib_free_tag(>fibs[i]); > + > + if (aac->handle_pci_error) > + cmd->result = DID_NO_CONNECT << 16; > + else > + cmd->result = DID_RESET << 16; > + > + cmd->scsi_done(cmd); > + } > + } > +} > + > +pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev, > + enum pci_channel_state error) > +{ > + struct Scsi_Host *shost = pci_get_drvdata(pdev); > + struct aac_dev *aac = shost_priv(shost); > + > + dev_err(>dev, "aacraid: PCI error detected %x\n", error); > + > + switch (error) { > + case pci_channel_io_normal: > + return PCI_ERS_RESULT_CAN_RECOVER; > + case pci_channel_io_frozen: > + > + aac->handle_pci_error = 1; > + > + scsi_block_requests(aac->scsi_host_ptr); > + aac_flush_ios(aac); > + aac_release_resources(aac); > + > + pci_disable_pcie_error_reporting(pdev); > + aac_adapter_ioremap(aac, 0); > + > + return PCI_ERS_RESULT_NEED_RESET; > + case pci_channel_io_perm_failure: > + aac->handle_pci_error = 1; > + aac_flush_ios(aac); > + return PCI_ERS_RESULT_DISCONNECT; > + } > + > + return PCI_ERS_RESULT_NEED_RESET; > +} > + > +pci_ers_result_t aac_pci_mmio_enabled(struct pci_dev *pdev) > +{ > + dev_err(>dev, "aacraid: PCI error - mmio enabled\n"); > + return PCI_ERS_RESULT_NEED_RESET; > +} > + > +pci_ers_result_t aac_pci_slot_reset(struct pci_dev *pdev) > +{ > + dev_err(>dev, "aacraid: PCI error - slot reset\n"); > + pci_restore_state(pdev); > + if (pci_enable_device(pdev)) { > + dev_warn(>dev, > + "aacraid: failed to enable slave\n"); > + goto fail_device; > + } > + > + pci_set_master(pdev); > + > + if (pci_enable_device_mem(pdev)) { > + dev_err(>dev, "pci_enable_device_mem failed\n"); > + goto fail_device; > + } > + > + return PCI_ERS_RESULT_RECOVERED; > + > +fail_device: > + dev_err(>dev, "aacraid: PCI error - slot reset failed\n"); > + return PCI_ERS_RESULT_DISCONNECT; > +} > + > + > +void aac_pci_resume(struct pci_dev *pdev) > +{ > + struct Scsi_Host *shost = pci_get_drvdata(pdev); > + struct scsi_device *sdev = NULL; > + struct aac_dev *aac = (struct aac_dev *)shost_priv(shost); > + > + pci_cleanup_aer_uncorrect_error_status(pdev); > + > + if (aac_adapter_ioremap(aac, aac->base_size)) { > + > + dev_err(>dev, "aacraid: ioremap failed\n"); > + /* remap failed, go back ... */ > + aac->comm_interface = AAC_COMM_PRODUCER; > + if (aac_adapter_ioremap(aac, AAC_MIN_FOOTPRINT_SIZE)) { > + dev_warn(>dev, > + "aacraid: unable to map adapter.\n"); > + > + return; > +
Re: [PATCH 10/10] aacraid: Update driver version
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > Updated diver version to 41052 > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/aacraid.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h > index 7708a2c..bbb94ec 100644 > --- a/drivers/scsi/aacraid/aacraid.h > +++ b/drivers/scsi/aacraid/aacraid.h > @@ -62,7 +62,7 @@ enum { > #define PMC_GLOBAL_INT_BIT0 0x0001 > > #ifndef AAC_DRIVER_BUILD > -# define AAC_DRIVER_BUILD 41010 > +# define AAC_DRIVER_BUILD 41052 > # define AAC_DRIVER_BRANCH "-ms" > #endif > #define MAXIMUM_NUM_CONTAINERS 32 Reviewed-by: Johannes Thumshirn -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/10] aacraid: Set correct msix count for EEH recovery
Hi Raghava, On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > During EEH recovery number of online CPU's might change thereby changing > the number of MSIx vectors. Since each fib is allocated to a vector, > changes in the number of vectors causes fib to be sent thru invalid > vectors.In addition the correct number of MSIx vectors is not > updated in the INIT struct sent to the controller, when it is > reinitialized. > > Fixed by reassigning vectors to fibs based on the updated number of MSIx > vectors and updating the INIT structure before sending to controller. > [...] > - if (!dev->sync_mode) > + if (!dev->sync_mode) { > + /* After EEH recovery or suspend resume, max_msix count > + * may change, therfore updating in init as well. > + */ > aac_adapter_start(dev); > + dev->init->Sa_MSIXVectors = cpu_to_le32(dev->max_msix); > + } > return 0; > > error_iounmap: This is for EEH and suspend/resume isn't it? If it fixes MSI-X vector calculation for suspend/resume as well you probably should tag it for inclusion into stable as well. Thanks, Johannes -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/10] aacraid: SCSI blk tag support
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > The method to allocate and free FIB's in the present code utilizes > spinlocks.Multiple IO's have to wait on the spinlock to acquire or > free fibs creating a performance bottleneck. > > An alternative solution would be to use block layer tags to keep track > of the fibs allocated and freed. To this end 2 functions > aac_fib_alloc_tag and aac_fib_free_tag were created which utilize the > blk layer tags to plug into the Fib pool.These functions are used > exclusively in the IO path. 8 fibs are reserved for the use of AIF > management software and utilize the previous spinlock based > implementations. > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/aachba.c | 35 +- > drivers/scsi/aacraid/aacraid.h | 2 ++ > drivers/scsi/aacraid/commsup.c | 49 +++- > -- > drivers/scsi/aacraid/dpcsup.c | 4 ++-- > drivers/scsi/aacraid/linit.c | 2 ++ > 5 files changed, 72 insertions(+), 20 deletions(-) > > diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c > index e4c2437..06cbab8 100644 > --- a/drivers/scsi/aacraid/aachba.c > +++ b/drivers/scsi/aacraid/aachba.c > @@ -323,7 +323,7 @@ static inline int aac_valid_context(struct scsi_cmnd [...] > > return 0; > } > > @@ -166,6 +166,49 @@ int aac_fib_setup(struct aac_dev * dev) > * aac_fib_alloc - allocate a fib Nitpick/Typo aac_fib_alloc_tag > * @dev: Adapter to allocate the fib for > * > + * Allocate a fib from the adapter fib pool using tags > + * from the blk layer. > + */ > + > +struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd) > +{ > + struct fib *fibptr; > + > + fibptr = >fibs[scmd->request->tag]; > + /* > + * Set the proper node type code and node byte size > + */ > + fibptr->type = FSAFS_NTC_FIB_CONTEXT; > + fibptr->size = sizeof(struct fib); > + /* > + * Null out fields that depend on being zero at the start of > + * each I/O > + */ > + fibptr->hw_fib_va->header.XferState = 0; > + fibptr->flags = 0; > + fibptr->callback = NULL; > + fibptr->callback_data = NULL; > + > + return fibptr; > +} > + > +/** > + * aac_fib_free_tagfree a fib > + * @fibptr: fib to free up > + * > + * Placeholder to free tag allocated fibs > + * Does not do anything > + */ > + > +void aac_fib_free_tag(struct fib *fibptr) > +{ > + (void)fibptr; > +} > + I'm not sure if I like this placeholder. Sure it's a NOP and doesn't cost anything but it's dead code. But if I'm the only one objecting here I'm fine with it. Reviewed-by: Johannes Thumshirn -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/10] aacraid: Disable device ID wildcard
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > Added module parameter that disables device ID wild card binding. > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/aachba.c | 5 + > drivers/scsi/aacraid/aacraid.h | 1 + > drivers/scsi/aacraid/linit.c | 5 + > 3 files changed, 11 insertions(+) > > diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c > index 06cbab8..87f4f21 100644 > --- a/drivers/scsi/aacraid/aachba.c > +++ b/drivers/scsi/aacraid/aachba.c > @@ -315,6 +315,11 @@ MODULE_PARM_DESC(wwn, "Select a WWN type for the > arrays:\n" > "\t1 - Array Meta Data Signature (default)\n" > "\t2 - Adapter Serial Number"); > > +int aac_disable_device_id_wildcards; > +module_param_named(disable_device_id_wildcards, > + aac_disable_device_id_wildcards, int, S_IRUGO | S_IWUSR); > +MODULE_PARM_DESC(disable_device_id_wildcards, > + "Disable device ID wildcards"); > > static inline int aac_valid_context(struct scsi_cmnd *scsicmd, > struct fib *fibptr) { > diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h > index 594de5f..7708a2c 100644 > --- a/drivers/scsi/aacraid/aacraid.h > +++ b/drivers/scsi/aacraid/aacraid.h > @@ -2177,3 +2177,4 @@ extern int aac_commit; > extern int update_interval; > extern int check_interval; > extern int aac_check_reset; > +extern int aac_disable_device_id_wildcards; > diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c > index 3a4dbe7..2094842 100644 > --- a/drivers/scsi/aacraid/linit.c > +++ b/drivers/scsi/aacraid/linit.c > @@ -1135,6 +1135,11 @@ static int aac_probe_one(struct pci_dev *pdev, const > struct pci_device_id *id) > u64 dmamask; > extern int aac_sync_mode; > > + if (aac_disable_device_id_wildcards && > + id->subvendor == PCI_ANY_ID && > + id->subdevice == PCI_ANY_ID) > + return -ENODEV; > + > /* > * Only series 7 needs freset. > */ Reviewed-by: Johannes Thumshirn -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/10] aacraid: Fix AIF triggered IOP_RESET
Hi Raghava, On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > From: Raghava Aditya Renukunta> > while driver removal is in progress or PCI shutdown is invoked, driver > kills AIF aacraid thread, but IOCTL requests from the management tools > re-start AIF thread leading to IOP_RESET. > > Fixed by setting adapter_shutdown flag when PCI shutdown is invoked. > > Signed-off-by: Raghava Aditya Renukunta > --- > drivers/scsi/aacraid/linit.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c > index 6912efd..3a4dbe7 100644 > --- a/drivers/scsi/aacraid/linit.c > +++ b/drivers/scsi/aacraid/linit.c > @@ -1454,6 +1454,7 @@ static int aac_suspend(struct pci_dev *pdev, > pm_message_t state) > struct aac_dev *aac = (struct aac_dev *)shost->hostdata; > > scsi_block_requests(shost); > + aac->adapter_shutdown = 1; > aac_send_shutdown(aac); > > aac_release_resources(aac); I don't quite undestand that, the following is from aac_send_shutdown(): 229 /* FIB should be freed only after getting the response from the F/W */ 230 if (status != -ERESTARTSYS) 231 aac_fib_free(fibctx); 232 dev->adapter_shutdown = 1; 233 if ((dev->pdev->device == PMC_DEVICE_S7 || 234 dev->pdev->device == PMC_DEVICE_S8 || in line 232 you're already setting the adapter shutdown flag, why do you need to pre-set it before calling aac_send_shutdown()? Thanks, Johannes -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Bug 108771] New: scsi: ses: kasan: ses_enclosure_data_process use after free on boot SAS2X28
https://bugzilla.kernel.org/show_bug.cgi?id=108771 Bug ID: 108771 Summary: scsi: ses: kasan: ses_enclosure_data_process use after free on boot SAS2X28 Product: SCSI Drivers Version: 2.5 Kernel Version: 4.3 Hardware: x86-64 OS: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: Other Assignee: scsi_drivers-ot...@kernel-bugs.osdl.org Reporter: ptikhomi...@virtuozzo.com Regression: No Created attachment 196301 --> https://bugzilla.kernel.org/attachment.cgi?id=196301=edit Full /var/log/messagess log and module ses.ko Here is my setup: Kernel: Linux 4.3 (tag:v4.3 commit:6a13feb9c8) SCSI ses device: Host: scsi0 Channel: 00 Id: 16 Lun: 00 Vendor: LSI Model: SAS2X28 Rev: 0e12 Type: Enclosure ANSI SCSI revision: 05 Full /var/log/messagess log in archive attached: debug-kernel-kasan-system-log.txt Module in archive attached: ses.ko On debug kernel on boot when attaching enclosure scsi device, KASan detects use after free in ses_enclosure_data_process+0xbe5(see kasan report in the end). nm -A ./drivers/scsi/ses.ko | grep ses_enclosure_data_process ./drivers/scsi/ses.ko:2570 t ses_enclosure_data_process objdump -D -S -l ./drivers/scsi/ses.ko --start-address=0x2570 On offset 0x3155(0x2570+0xbe5) there is code generated by kasan: >3144: 4c 89 5d a0 mov%r11,-0x60(%rbp) 3148: 44 89 45 a8 mov%r8d,-0x58(%rbp) 314c: 44 89 4d b0 mov%r9d,-0x50(%rbp) /vzt/linux/drivers/scsi/ses.c:545 } if (desc_ptr) desc_ptr += len; if (addl_desc_ptr) addl_desc_ptr += addl_desc_ptr[1] + 2; 3150:e8 00 00 00 00 callq 31553155:4c 8b 5d a0 mov-0x60(%rbp),%r11 3159:44 8b 45 a8 mov-0x58(%rbp),%r8d 315d:44 8b 4d b0 mov-0x50(%rbp),%r9d 3161:e9 34 f7 ff ff jmpq 289a To witch we jump from: /vzt/linux/drivers/scsi/ses.c:545 addl_desc_ptr += addl_desc_ptr[1] + 2; 2877: 49 8d 7c 24 01 lea0x1(%r12),%rdi 287c: 48 89 f8mov%rdi,%rax 287f: 48 89 famov%rdi,%rdx 2882: 48 c1 e8 03 shr$0x3,%rax 2886: 83 e2 07and$0x7,%edx 2889: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax 288e: 38 d0 cmp%dl,%al 2890: 7f 08 jg 289a 2892: 84 c0 test %al,%al >2894: 0f 85 aa 08 00 00 jne3144 > 289a: 41 0f b6 44 24 01 movzbl 0x1(%r12),%eax 28a0: 4d 8d 64 04 02 lea0x2(%r12,%rax,1),%r12 Address addl_desc_ptr[1] is not allocated here but we want to read it. Actualy we iterate through ses_dev->page10 here and it ends unexpectedly. We get number of iterations from ses_dev->page1_num_types and ses_dev->page1_types, so it seam that meta-data given by device is not consistent for page 1 and page 10. My ideas on this: a) In ses_process_descriptor we get enclosure_component->addr from addl_desc_ptr only for ENCLOSURE_COMPONENT_DEVICE and ENCLOSURE_COMPONENT_ARRAY_DEVICE but iterate for all entries of all types, may be we need to move to next entry in addl_desc_ptr for only those types? b) May be we need same check as we have for page 7, to stop when we hit a bufer end. Sorry I'm not too common with SCSI Enclosure Services specification and how it should work. Thanks in advance for your help, Pavel. Here is KASan output: == BUG: KASan: use after free in ses_enclosure_data_process+0xbe5/0xe40 [ses] at addr 881fed1c8c01 Read of size 1 by task systemd-udevd/1348 = BUG kmalloc-512 (Not tainted): kasan: bad access detected - Disabling lock debugging due to kernel taint INFO: Slab 0xea007fb47200 objects=32 used=30 fp=0x881fed1c8800 flags=0x2f80004080 INFO: Object 0x881fed1c8c00 @offset=3072 fp=0x881fed1c8e00 Bytes b4 881fed1c8bf0: 0a 08 0b 09 0c 0a 0d 0b ff ff ff ff ff ff ff ff Object 881fed1c8c00: 00 8e 1c ed 1f 88 ff ff 08 8c 1c ed 1f 88 ff ff Object 881fed1c8c10: 08 8c 1c ed 1f 88 ff ff 18 8c 1c ed 1f 88 ff ff Object 881fed1c8c20: 18 8c 1c ed 1f 88 ff ff c0 ff ff ff 1f 00 00 00 Object
Re: [PATCH Resend] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
On Wed, Dec 2, 2015 at 3:42 AM, Johannes Thumshirnwrote: > Hi Josh, > > On Tue, 2015-12-01 at 11:34 -0500, Josh Boyer wrote: >> The driver is missing calls to pci_dma_mapping_error() after >> performing the DMA mapping, which caused DMA-API warning to >> show up in dmesg's output. Though that happens only when >> DMA_API_DEBUG option is enabled. This change fixes the issue >> and makes pvscsi_map_buffers() function more robust. >> >> Signed-off-by: Arvind Kumar >> Cc: Josh Boyer >> Reviewed-by: Thomas Hellstrom >> Signed-off-by: Josh Boyer >> --- >> >> - Resend of patch that was never committed for some reason >> >> drivers/scsi/vmw_pvscsi.c | 45 +++-- >> drivers/scsi/vmw_pvscsi.h | 2 +- >> 2 files changed, 40 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c >> index 0f133c1817de..19734494f9ec 100644 >> --- a/drivers/scsi/vmw_pvscsi.c >> +++ b/drivers/scsi/vmw_pvscsi.c >> @@ -349,9 +349,9 @@ static void pvscsi_create_sg(struct pvscsi_ctx *ctx, >> * Map all data buffers for a command into PCI space and >> * setup the scatter/gather list if needed. >> */ >> -static void pvscsi_map_buffers(struct pvscsi_adapter *adapter, >> -struct pvscsi_ctx *ctx, struct scsi_cmnd >> *cmd, >> -struct PVSCSIRingReqDesc *e) >> +static int pvscsi_map_buffers(struct pvscsi_adapter *adapter, >> + struct pvscsi_ctx *ctx, struct scsi_cmnd *cmd, >> + struct PVSCSIRingReqDesc *e) >> { >> unsigned count; >> unsigned bufflen = scsi_bufflen(cmd); >> @@ -360,18 +360,30 @@ static void pvscsi_map_buffers(struct pvscsi_adapter >> *adapter, >> e->dataLen = bufflen; >> e->dataAddr = 0; >> if (bufflen == 0) >> - return; >> + return 0; >> >> sg = scsi_sglist(cmd); >> count = scsi_sg_count(cmd); >> if (count != 0) { >> int segs = scsi_dma_map(cmd); >> - if (segs > 1) { >> + >> + if (segs == -ENOMEM) { >> + scmd_printk(KERN_ERR, cmd, >> + "vmw_pvscsi: Failed to map cmd sglist >> for DMA.\n"); >> + return -1; > > Please return -ENOMEM instead of -1 > >> + } else if (segs > 1) { >> pvscsi_create_sg(ctx, sg, segs); >> >> e->flags |= PVSCSI_FLAG_CMD_WITH_SG_LIST; >> ctx->sglPA = pci_map_single(adapter->dev, ctx->sgl, >> SGL_SIZE, >> PCI_DMA_TODEVICE); >> + if (pci_dma_mapping_error(adapter->dev, ctx->sglPA)) >> { >> + scmd_printk(KERN_ERR, cmd, >> + "vmw_pvscsi: Failed to map ctx >> sglist for DMA.\n"); >> + scsi_dma_unmap(cmd); >> + ctx->sglPA = 0; >> + return -1; > > Same here. > >> + } >> e->dataAddr = ctx->sglPA; >> } else >> e->dataAddr = sg_dma_address(sg); >> @@ -382,8 +394,15 @@ static void pvscsi_map_buffers(struct pvscsi_adapter >> *adapter, >>*/ >> ctx->dataPA = pci_map_single(adapter->dev, sg, bufflen, >>cmd->sc_data_direction); >> + if (pci_dma_mapping_error(adapter->dev, ctx->dataPA)) { >> + scmd_printk(KERN_ERR, cmd, >> + "vmw_pvscsi: Failed to map direct data >> buffer for DMA.\n"); >> + return -1; > > And here. > >> + } >> e->dataAddr = ctx->dataPA; >> } >> + >> + return 0; >> } >> >> static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, >> @@ -690,6 +709,12 @@ static int pvscsi_queue_ring(struct pvscsi_adapter >> *adapter, >> ctx->sensePA = pci_map_single(adapter->dev, cmd- >> >sense_buffer, >> SCSI_SENSE_BUFFERSIZE, >> PCI_DMA_FROMDEVICE); >> + if (pci_dma_mapping_error(adapter->dev, ctx->sensePA)) { >> + scmd_printk(KERN_ERR, cmd, >> + "vmw_pvscsi: Failed to map sense buffer >> for DMA.\n"); >> + ctx->sensePA = 0; >> + return -1; > > And here. > >> + } >> e->senseAddr = ctx->sensePA; >> e->senseLen = SCSI_SENSE_BUFFERSIZE; >> } else { >> @@ -711,7 +736,15 @@ static int pvscsi_queue_ring(struct pvscsi_adapter >> *adapter, >> else >> e->flags = 0; >> >> -
RE: [PATCH 09/10] aacraid: Fix character device re initialization
Hello Johannes, > Hi Raghava, > On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote: > > From: Raghava Aditya Renukunta> > > > During EEH PCI hotplug activity kernel unloads and loads the driver, > > causing character device to be unregistered(aac_remove_one).When the > > driver is loaded back using aac_probe_one the character device needs > > to be registered again for the AIF management tools to work. > > > > Fixed by adding code to register character device in aac_probe_one if > > it is unregistered in aac_remove_one. > > > > Signed-off-by: Raghava Aditya Renukunta > > > > This one is duplicate, isn't it? Yes this one is a duplicate. N�r��yb�X��ǧv�^�){.n�+{���"�{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj"��!�i