Re: [PATCH] VMW_PVSCSI: Change to update maintainer details (name, email)
Hi Julian, Thanks for spotting that. We will update that too. I don't really see it as redundant rather as a quick reference instead of digging out the MAINTAINERS file and then search for vmw_pvscsi.c file. Specially for those readers who might not even know about the MAINTAINERS file. Thanks! Arvind From: Julian Calaby <julian.cal...@gmail.com> Sent: Thursday, June 16, 2016 6:48 PM To: Jim Gill Cc: j...@linux.vnet.ibm.com; Martin K. Petersen; Arvind Kumar; pv-driv...@vmware.com; linux-scsi; linux-ker...@vger.kernel.org Subject: Re: [PATCH] VMW_PVSCSI: Change to update maintainer details (name, email) Hi Jim, On Fri, Jun 17, 2016 at 11:05 AM, Jim Gill <jg...@vmware.com> wrote: > From 6a076cc00ec12c6f9cba58ee7e4c3dec49e1e7e5 Mon Sep 17 00:00:00 2001 > From: Jim Gill <jg...@vmware.com> > Date: Thu, 16 Jun 2016 14:10:43 -0700 > Subject: [PATCH] VMW_PVSCSI: Change to update maintainer details (name, > email) > > Signed-off-by: Jim Gill <jg...@vmware.com> > --- > drivers/scsi/vmw_pvscsi.c | 2 +- > drivers/scsi/vmw_pvscsi.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c > index 6164634..4a0d3cd 100644 > --- a/drivers/scsi/vmw_pvscsi.c > +++ b/drivers/scsi/vmw_pvscsi.c > @@ -17,7 +17,7 @@ > * along with this program; if not, write to the Free Software > * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 > USA. > * > - * Maintained by: Arvind Kumar <arvindku...@vmware.com> > + * Maintained by: Jim Gill <jg...@vmware.com> Shouldn't you update MAINTAINERs too? And isn't having this information in these files redundant? Thanks, -- Julian Calaby Email: julian.cal...@gmail.com Profile: https://urldefense.proofpoint.com/v2/url?u=http-3A__www.google.com_profiles_julian.calaby_=CwIBaQ=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs=bUMaNc7nC9xbXtaMJrOvIIPNpPH0chY2kdRsskQn6GY=JibRIMgSBQLffjc5PofQnpJ0k_gawmvafvIKpsEaMzk=CeVpY1FwvY9Qlb0VDeQUXeeL3kuVkcIKTZIC7exS6SM= -- 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] VMW_PVSCSI: Change to update maintainer details (name, email)
Looks fine to me. Acked-by: Arvind Kumar (arvindku...@vmware.com) Thanks! Arvind From: Jim Gill <jg...@vmware.com> Sent: Thursday, June 16, 2016 6:05 PM To: j...@linux.vnet.ibm.com; martin.peter...@oracle.com Cc: Arvind Kumar; pv-driv...@vmware.com; linux-scsi@vger.kernel.org; linux-ker...@vger.kernel.org Subject: [PATCH] VMW_PVSCSI: Change to update maintainer details (name, email) From 6a076cc00ec12c6f9cba58ee7e4c3dec49e1e7e5 Mon Sep 17 00:00:00 2001 From: Jim Gill <jg...@vmware.com> Date: Thu, 16 Jun 2016 14:10:43 -0700 Subject: [PATCH] VMW_PVSCSI: Change to update maintainer details (name, email) Signed-off-by: Jim Gill <jg...@vmware.com> --- drivers/scsi/vmw_pvscsi.c | 2 +- drivers/scsi/vmw_pvscsi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 6164634..4a0d3cd 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * - * Maintained by: Arvind Kumar <arvindku...@vmware.com> + * Maintained by: Jim Gill <jg...@vmware.com> * */ diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h index 12712c9..c097d2c 100644 --- a/drivers/scsi/vmw_pvscsi.h +++ b/drivers/scsi/vmw_pvscsi.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * - * Maintained by: Arvind Kumar <arvindku...@vmware.com> + * Maintained by: Jim Gill <jg...@vmware.com> * */ -- 2.5.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: BLKZEROOUT not zeroing md dev on VMDK
It is possibly some race. We saw a WRITE SAME related issue in past for which Petr sent out a patch but looks like the patch didn't make it. :( https://groups.google.com/forum/#!topic/linux.kernel/1WGDSlyY0y0 Thanks! Arvind From: Sitsofe Wheeler <sits...@gmail.com> Sent: Tuesday, May 31, 2016 10:04 PM To: Tom Yan Cc: Darrick J. Wong; Shaohua Li; Jens Axboe; Arvind Kumar; VMware PV-Drivers; linux-r...@vger.kernel.org; linux-scsi@vger.kernel.org; linux-bl...@vger.kernel.org; linux-ker...@vger.kernel.org Subject: Re: BLKZEROOUT not zeroing md dev on VMDK On 27 May 2016 at 10:30, Tom Yan <tom.t...@gmail.com> wrote: > There seems to be some sort of race condition between > blkdev_issue_zeroout() and the scsi disk driver (disabling write same > after an illegal request). On my UAS drive, sometimes `blkdiscard -z > /dev/sdX` will return right away, even though if I then check > `write_same_max_bytes` it has turned 0. Sometimes it will just write > zero with SCSI WRITE even if `write_same_max_bytes` is 33553920 before > I issue `blkdiscard -z` (`write_same_max_bytes` also turned 0, as > expected). > > Not sure if it is directly related to the case here though. I'm not aware of hitting that particular problem myself directly on the underlying "SCSI" device but the patch on https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_patch_9137311_=CwIBaQ=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs=bUMaNc7nC9xbXtaMJrOvIIPNpPH0chY2kdRsskQn6GY=rx_5ntfhkt2GOpfjpiQjoCb5n4gCY7jKznXO0gKYcVI=W1F45VBu8NDxu2ImcbKM5b3d6UnUCLGgH8xEM9e6JQk= should be able to resolve that issue. Could you test it and follow up on https://urldefense.proofpoint.com/v2/url?u=http-3A__permalink.gmane.org_gmane.linux.kernel_2229377=CwIBaQ=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs=bUMaNc7nC9xbXtaMJrOvIIPNpPH0chY2kdRsskQn6GY=rx_5ntfhkt2GOpfjpiQjoCb5n4gCY7jKznXO0gKYcVI=9ekqmTk18vzcwcY0SSMF8AZnJ_lWezFIM8tDvQqeDHI= ? I'm hoping more testing reports will lead to the patch being reviewed and accepted sooner rather than later as it's currently stalled... -- Sitsofe | https://urldefense.proofpoint.com/v2/url?u=http-3A__sucs.org_-7Esits_=CwIBaQ=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs=bUMaNc7nC9xbXtaMJrOvIIPNpPH0chY2kdRsskQn6GY=rx_5ntfhkt2GOpfjpiQjoCb5n4gCY7jKznXO0gKYcVI=arwniVbdl5KJZfyreWLhq-WUlgvKAf_eW1i6D2GbFGQ= -- 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] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
Thanks Josh! The patch looks good to me. Thanks! Arvind From: Johannes Thumshirn <jthumsh...@suse.de> Sent: Thursday, December 3, 2015 5:35 AM To: Josh Boyer; james.bottom...@hansenpartnership.com; Arvind Kumar; Thomas Hellstrom Cc: linux-scsi@vger.kernel.org; pv-driv...@vmware.com; linux-ker...@vger.kernel.org Subject: Re: [PATCH v2] VMW_PVSCSI: Fix the issue of DMA-API related warnings. On Thu, 2015-12-03 at 08:27 -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 <arvindku...@vmware.com> > Cc: Josh Boyer <jwbo...@fedoraproject.org> > Reviewed-by: Thomas Hellstrom <thellst...@vmware.com> > Signed-off-by: Josh Boyer <jwbo...@fedoraproject.org> > --- > > v2: Use -ENOMEM instead of -1 for the error return code as suggested by > Johannes Thumshirn > > 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..6164634aff18 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 -ENOMEM; > + } 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 -ENOMEM; > + } > 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 -ENOMEM; > + } > 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, >
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.com <jwbo...@gmail.com> on behalf of Josh Boyer <jwbo...@fedoraproject.org> 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 <jthumsh...@suse.de> 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 <arvindku...@vmware.com> >> Cc: Josh Boyer <jwbo...@fedoraproject.org> >> Reviewed-by: Thomas Hellstrom <thellst...@vmware.com> >> Signed-off-by: Josh Boyer <jwbo...@fedoraproject.org> >> --- >> >> - 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); >&g
RE: [Pv-drivers] [PATCH] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
Hi James, Can you help get this patch in now as it has got a review? Thanks! Arvind From: Thomas Hellstrom Sent: Thursday, June 11, 2015 11:11 AM To: Josh Boyer; Arvind Kumar; James Bottomley Cc: VMware PV-Drivers; Linus Torvalds; linux-scsi@vger.kernel.org Subject: Re: [Pv-drivers] [PATCH] VMW_PVSCSI: Fix the issue of DMA-API related warnings. On 06/11/2015 02:32 PM, Josh Boyer wrote: On Fri, Mar 21, 2014 at 2:08 PM, Arvind Kumar arvindku...@vmware.com 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 arvindku...@vmware.com Cc: Josh Boyer jwbo...@fedoraproject.org This patch has been sent and pinged for 3 months now. It's gotten no comments at all. Should we send it to Linus so it actually gets picked up? josh Reviewed-by: Thomas Hellstrom thellst...@vmware.com --- 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 c88e146..9478a00 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; + } 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; + } 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; + } e-dataAddr = ctx-dataPA; } + + return 0; } static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, @@ -712,6 +731,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; + } e-senseAddr = ctx-sensePA; e-senseLen = SCSI_SENSE_BUFFERSIZE
RE: [PATCH] vmw_pvscsi: fixup tagging
Thanks Hannes and Christoph for the answers. The patch to vmw_pvscsi.c looks fine to me. Acked-by: Arvind Kumar arvindku...@vmware.com Thanks! Arvind From: Hannes Reinecke h...@suse.de Sent: Saturday, October 18, 2014 10:42 AM To: Arvind Kumar; Christoph Hellwig Cc: pv-driv...@vmware.com; James Bottomley; linux-scsi@vger.kernel.org Subject: Re: [PATCH] vmw_pvscsi: fixup tagging On 10/17/2014 08:34 PM, Arvind Kumar wrote: Hi Christoph, Thanks for the change. Sorry for the delay. The change looks fine to me. I just have a question. The comment in include/scsi/scsi_cmnd.h says: struct scsi_cmnd { ... unsigned char tag; /* SCSI-II queued command tag */ } Is that comment not right? Should we update that too? The 'tag' field from the scsi_cmnd is indeed meant for the SCSI-II queued command tag. But due to recent changes 'struct request' also contains a tag number which is used to implement a tag map. So the 'tag; field from struct scsi_cmnd is basically obsolete, and we're working on removing it. Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- 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] vmw_pvscsi: fixup tagging
Hi Christoph, Thanks for the change. Sorry for the delay. The change looks fine to me. I just have a question. The comment in include/scsi/scsi_cmnd.h says: struct scsi_cmnd { ... unsigned char tag; /* SCSI-II queued command tag */ } Is that comment not right? Should we update that too? Thanks! Arvind From: Christoph Hellwig h...@infradead.org Sent: Friday, October 17, 2014 6:16 AM To: Hannes Reinecke Cc: Arvind Kumar; pv-driv...@vmware.com; James Bottomley; linux-scsi@vger.kernel.org Subject: Re: [PATCH] vmw_pvscsi: fixup tagging Can I get a review from VMWare for this one, please? On Thu, Oct 02, 2014 at 09:21:41AM +0200, Hannes Reinecke wrote: The request (and SCSI command) tag is the tag number assigned by the generic block-tagging code, not the SCSI-II tag messages. Those are represented by the device flags 'tagged_supported', 'simple_tags', and 'ordered_tags'. (The SCSI midlayer doesn't use HEAD_OF_QUEUE tags). So fixup vmw_pvscsi to assign the correct tag type. Signed-off-by: Hannes Reinecke h...@suse.de --- drivers/scsi/vmw_pvscsi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 598f65e..d18df8c 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -724,9 +724,8 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter, e-tag = SIMPLE_QUEUE_TAG; if (sdev-tagged_supported - (cmd-tag == HEAD_OF_QUEUE_TAG || - cmd-tag == ORDERED_QUEUE_TAG)) - e-tag = cmd-tag; + sdev-ordered_tags) + e-tag = ORDERED_QUEUE_TAG; if (cmd-sc_data_direction == DMA_FROM_DEVICE) e-flags = PVSCSI_FLAG_CMD_DIR_TOHOST; -- 1.8.5.2 -- 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 https://urldefense.proofpoint.com/v1/url?u=http://vger.kernel.org/majordomo-info.htmlk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=5bh61bBshOhAkuAAXcD9BERI%2F4iK5qLrSSxbaPeaJh4%3D%0Am=3T3CxXvbfPAK%2FDIE7aWB7MFmojVqfTOyoVs1VP7639M%3D%0As=97965a758f2187327667f0a727748779fd8dcdd81eb2da9d33f694fe7893e5d3 ---end quoted text--- -- 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 RESEND 23/23] vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()
Hi Alexander, This looks fine to me. Acked-by: Arvind Kumar arvindku...@vmware.com Thanks! Arvind From: Alexander Gordeev agord...@redhat.com Sent: Wednesday, July 16, 2014 11:05 AM To: linux-ker...@vger.kernel.org Cc: Alexander Gordeev; Arvind Kumar; pv-driv...@vmware.com; linux-scsi@vger.kernel.org; linux-...@vger.kernel.org Subject: [PATCH v2 RESEND 23/23] vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix() As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Arvind Kumar arvindku...@vmware.com Cc: pv-driv...@vmware.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org Acked-by: Arvind Kumar arvindku...@vmware.com --- drivers/scsi/vmw_pvscsi.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index c88e146..598f65e 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -1194,7 +1194,7 @@ static int pvscsi_setup_msix(const struct pvscsi_adapter *adapter, struct msix_entry entry = { 0, PVSCSI_VECTOR_COMPLETION }; int ret; - ret = pci_enable_msix(adapter-dev, entry, 1); + ret = pci_enable_msix_exact(adapter-dev, entry, 1); if (ret) return ret; -- 1.7.7.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
Re: [Pv-drivers] [PATCH] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
Hi James, I was wondering if you got time to get to this one. It would be great if you could please help out with getting this patch in. Thanks! Arvind On Mon, 2014-04-14 at 11:17 -0700, Arvind Kumar wrote: Hi James, Could you please help getting this in? Thanks! Arvind - Original Message - From: Arvind Kumar arvindku...@vmware.com To: jbottom...@parallels.com, linux-scsi@vger.kernel.org Cc: pv-driv...@vmware.com, Josh Boyer jwbo...@fedoraproject.org Sent: Friday, March 21, 2014 11:08:32 AM Subject: [Pv-drivers] [PATCH] VMW_PVSCSI: Fix the issue of DMA-API related warnings. 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 arvindku...@vmware.com Cc: Josh Boyer jwbo...@fedoraproject.org --- 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 c88e146..9478a00 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; + } 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; + } 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; + } e-dataAddr = ctx-dataPA; } + + return 0; } static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, @@ -712,6 +731,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; + } e-senseAddr = ctx-sensePA; e-senseLen = SCSI_SENSE_BUFFERSIZE; } else { @@ -737,7 +762,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
Re: [Pv-drivers] [PATCH] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
Hi James, Could you please help getting this in? Thanks! Arvind - Original Message - From: Arvind Kumar arvindku...@vmware.com To: jbottom...@parallels.com, linux-scsi@vger.kernel.org Cc: pv-driv...@vmware.com, Josh Boyer jwbo...@fedoraproject.org Sent: Friday, March 21, 2014 11:08:32 AM Subject: [Pv-drivers] [PATCH] VMW_PVSCSI: Fix the issue of DMA-API related warnings. 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 arvindku...@vmware.com Cc: Josh Boyer jwbo...@fedoraproject.org --- 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 c88e146..9478a00 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; + } 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; + } 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; + } e-dataAddr = ctx-dataPA; } + + return 0; } static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, @@ -712,6 +731,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; + } e-senseAddr = ctx-sensePA; e-senseLen = SCSI_SENSE_BUFFERSIZE; } else { @@ -737,7 +762,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, +SCSI_SENSE_BUFFERSIZE
[PATCH] VMW_PVSCSI: Fix the issue of DMA-API related warnings.
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 arvindku...@vmware.com Cc: Josh Boyer jwbo...@fedoraproject.org --- 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 c88e146..9478a00 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; + } 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; + } 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; + } e-dataAddr = ctx-dataPA; } + + return 0; } static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter, @@ -712,6 +731,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; + } e-senseAddr = ctx-sensePA; e-senseLen = SCSI_SENSE_BUFFERSIZE; } else { @@ -737,7 +762,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, +SCSI_SENSE_BUFFERSIZE, +PCI_DMA_FROMDEVICE); + ctx-sensePA = 0; + } + return -1; + } e-context = pvscsi_map_context(adapter, ctx); diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h index ce45888..fe3b759 100644 --- a/drivers/scsi/vmw_pvscsi.h +++ b/drivers/scsi/vmw_pvscsi.h @@ -26,7 +26,7
Re: DMA-API mapping errors in vmw_pvscsi
It's missing checking in two places: from pci_map_single() and on scsi_dma_map(). In the latter case, pvscsi_map_buffers needs to return an error code and then pvscsi_queue_ring can return -1. Agreed! And in addition to that pvscsi_queue_ring() also calls pci_map_single() to map the sense buffer, which should also have the check. And if pvscsi_map_buffers() fails then we need to unmap the sense buffer too. We already have an internal bug filed and we are working on this. Thanks! Arvind - Original Message - From: James Bottomley bottom...@hansenpartnership.com To: Josh Boyer jwbo...@fedoraproject.org Cc: Arvind Kumar arvindku...@vmware.com, VMware PV-Drivers , linux-scsi@vger.kernel.org, Linux-Kernel@Vger. Kernel. Org vger.kernel.org Sent: Monday, March 17, 2014 10:08:10 AM Subject: Re: DMA-API mapping errors in vmw_pvscsi On Mon, 2014-03-17 at 12:52 -0400, Josh Boyer wrote: Hi All, We've had a few reports[1][2] now on the vmw_pvscsi driver throwing DMA-API mapping errors when the DMA_API_DEBUG option is enabled. I've included one from a recent 3.14-rc6 kernel below. Looking at vmw_pvscsi.c, I can see pvscsi_map_buffers is missing the calls to pci_dma_mapping_error, which is what causes the warnings to be thrown. However, I'm not familiar with this driver and I can't see what the proper error path should be in this case. pvscsi_map_buffers is a void function and doesn't currently have the ability to return an error to the caller. Even if it did, I'm not sure what the proper response to an error should be. Thoughts? It's missing checking in two places: from pci_map_single() and on scsi_dma_map(). In the latter case, pvscsi_map_buffers needs to return an error code and then pvscsi_queue_ring can return -1. James -- 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: [Pv-drivers] [PATCH 2/3] VMW_PVSCSI: Add support for I/O requests coalescing.
Fixed an issue with log message's prefix. Should have been vmw_pvscsi, was pvscsi. Resending. Please consider this one. Thanks! This change allows pvscsi driver to coalesce I/O requests before issuing them. The number of I/O's coalesced can be dynamically configured based on the workload. Signed-off-by: Rishi Mehta rme...@vmware.com Acked-by: Arvind Kumar arvindku...@vmware.com --- drivers/scsi/vmw_pvscsi.c | 49 ++--- drivers/scsi/vmw_pvscsi.h | 17 +--- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 7c5abd7..b92ea94 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -72,6 +72,7 @@ struct pvscsi_adapter { booluse_msi; booluse_msix; booluse_msg; + booluse_req_threshold; spinlock_t hw_lock; @@ -109,6 +110,7 @@ static int pvscsi_cmd_per_lun= PVSCSI_DEFAULT_QUEUE_DEPTH; static bool pvscsi_disable_msi; static bool pvscsi_disable_msix; static bool pvscsi_use_msg = true; +static bool pvscsi_use_req_threshold = true; #define PVSCSI_RW (S_IRUSR | S_IWUSR) @@ -133,6 +135,10 @@ MODULE_PARM_DESC(disable_msix, Disable MSI-X use in driver - (default=0)); module_param_named(use_msg, pvscsi_use_msg, bool, PVSCSI_RW); MODULE_PARM_DESC(use_msg, Use msg ring when available - (default=1)); +module_param_named(use_req_threshold, pvscsi_use_req_threshold, + bool, PVSCSI_RW); +MODULE_PARM_DESC(use_req_threshold, Use driver-based request coalescing if configured - (default=1)); + static const struct pci_device_id pvscsi_pci_tbl[] = { { PCI_VDEVICE(VMWARE, PCI_DEVICE_ID_VMWARE_PVSCSI) }, { 0 } @@ -282,10 +288,15 @@ static int scsi_is_rw(unsigned char op) static void pvscsi_kick_io(const struct pvscsi_adapter *adapter, unsigned char op) { - if (scsi_is_rw(op)) - pvscsi_kick_rw_io(adapter); - else + if (scsi_is_rw(op)) { + struct PVSCSIRingsState *s = adapter-rings_state; + + if (!adapter-use_req_threshold || + s-reqProdIdx - s-reqConsIdx = s-reqCallThreshold) + pvscsi_kick_rw_io(adapter); + } else { pvscsi_process_request_ring(adapter); + } } static void ll_adapter_reset(const struct pvscsi_adapter *adapter) @@ -1077,6 +1088,34 @@ static int pvscsi_setup_msg_workqueue(struct pvscsi_adapter *adapter) return 1; } +static bool pvscsi_setup_req_threshold(struct pvscsi_adapter *adapter, + bool enable) +{ + u32 val; + + if (!pvscsi_use_req_threshold) + return false; + + pvscsi_reg_write(adapter, PVSCSI_REG_OFFSET_COMMAND, +PVSCSI_CMD_SETUP_REQCALLTHRESHOLD); + val = pvscsi_reg_read(adapter, PVSCSI_REG_OFFSET_COMMAND_STATUS); + if (val == -1) { + printk(KERN_INFO vmw_pvscsi: device does not support req_threshold\n); + return false; + } else { + struct PVSCSICmdDescSetupReqCall cmd_msg = { 0 }; + cmd_msg.enable = enable; + printk(KERN_INFO + vmw_pvscsi: %sabling reqCallThreshold\n, + enable ? en : dis); + pvscsi_write_cmd_desc(adapter, + PVSCSI_CMD_SETUP_REQCALLTHRESHOLD, + cmd_msg, sizeof(cmd_msg)); + return pvscsi_reg_read(adapter, + PVSCSI_REG_OFFSET_COMMAND_STATUS) != 0; + } +} + static irqreturn_t pvscsi_isr(int irq, void *devp) { struct pvscsi_adapter *adapter = devp; @@ -1416,6 +1455,10 @@ static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id) flags = IRQF_SHARED; } + adapter-use_req_threshold = pvscsi_setup_req_threshold(adapter, true); + printk(KERN_DEBUG vmw_pvscsi: driver-based request coalescing %sabled\n, + adapter-use_req_threshold ? en : dis); + error = request_irq(adapter-irq, pvscsi_isr, flags, vmw_pvscsi, adapter); if (error) { diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h index a643775..15a9ac6 100644 --- a/drivers/scsi/vmw_pvscsi.h +++ b/drivers/scsi/vmw_pvscsi.h @@ -26,7 +26,7 @@ #include linux/types.h -#define PVSCSI_DRIVER_VERSION_STRING 1.0.3.0-k +#define PVSCSI_DRIVER_VERSION_STRING 1.0.4.0-k #define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128 @@ -117,8 +117,9 @@ enum PVSCSICommands { PVSCSI_CMD_CONFIG= 7, PVSCSI_CMD_SETUP_MSG_RING= 8, PVSCSI_CMD_DEVICE_UNPLUG = 9
[PATCH 1/3] VMW_PVSCSI: Fix pvscsi_abort() function.
This change ensures that pvscsi_abort() function returns SUCCESS only when the command in question was actually completed, otherwise returns FAILURE. The code before change, was causing a bug where driver tries to complete a command to the mid-layer while the mid-layer has already requested the driver to abort that command, in response to which the driver has responded with SUCCESS causing mid-layer to free the command struct. Signed-off-by: Arvind Kumar arvindku...@vmware.com Cc: Ewan Milne emi...@redhat.com --- drivers/scsi/vmw_pvscsi.c | 51 + drivers/scsi/vmw_pvscsi.h |4 ++-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index b9755ec..7c5abd7 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -1,7 +1,7 @@ /* * Linux driver for VMware's para-virtualized SCSI HBA. * - * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. + * Copyright (C) 2008-2014, VMware, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -62,6 +62,7 @@ struct pvscsi_ctx { dma_addr_t dataPA; dma_addr_t sensePA; dma_addr_t sglPA; + struct completion *abort_cmp; }; struct pvscsi_adapter { @@ -177,6 +178,7 @@ static void pvscsi_release_context(struct pvscsi_adapter *adapter, struct pvscsi_ctx *ctx) { ctx-cmd = NULL; + ctx-abort_cmp = NULL; list_add(ctx-list, adapter-cmd_pool); } @@ -496,15 +498,27 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, { struct pvscsi_ctx *ctx; struct scsi_cmnd *cmd; + struct completion *abort_cmp; u32 btstat = e-hostStatus; u32 sdstat = e-scsiStatus; ctx = pvscsi_get_context(adapter, e-context); cmd = ctx-cmd; + abort_cmp = ctx-abort_cmp; pvscsi_unmap_buffers(adapter, ctx); pvscsi_release_context(adapter, ctx); - cmd-result = 0; + if (abort_cmp) { + /* +* The command was requested to be aborted. Just signal that +* the request completed and swallow the actual cmd completion +* here. The abort handler will post a completion for this +* command indicating that it got successfully aborted. +*/ + complete(abort_cmp); + return; + } + cmd-result = 0; if (sdstat != SAM_STAT_GOOD (btstat == BTSTAT_SUCCESS || btstat == BTSTAT_LINKED_COMMAND_COMPLETED || @@ -726,6 +740,8 @@ static int pvscsi_abort(struct scsi_cmnd *cmd) struct pvscsi_adapter *adapter = shost_priv(cmd-device-host); struct pvscsi_ctx *ctx; unsigned long flags; + int result = SUCCESS; + DECLARE_COMPLETION_ONSTACK(abort_cmp); scmd_printk(KERN_DEBUG, cmd, task abort on host %u, %p\n, adapter-host-host_no, cmd); @@ -748,13 +764,40 @@ static int pvscsi_abort(struct scsi_cmnd *cmd) goto out; } + /* +* Mark that the command has been requested to be aborted and issue +* the abort. +*/ + ctx-abort_cmp = abort_cmp; + pvscsi_abort_cmd(adapter, ctx); + spin_unlock_irqrestore(adapter-hw_lock, flags); + /* Wait for 2 secs for the completion. */ + wait_for_completion_timeout(abort_cmp, msecs_to_jiffies(2000)); + spin_lock_irqsave(adapter-hw_lock, flags); - pvscsi_process_completion_ring(adapter); + if (!completion_done(abort_cmp)) { + /* +* Failed to abort the command, unmark the fact that it +* was requested to be aborted. +*/ + ctx-abort_cmp = NULL; + result = FAILED; + scmd_printk(KERN_DEBUG, cmd, + Failed to get completion for aborted cmd %p\n, + cmd); + goto out; + } + + /* +* Successfully aborted the command. +*/ + cmd-result = (DID_ABORT 16); + cmd-scsi_done(cmd); out: spin_unlock_irqrestore(adapter-hw_lock, flags); - return SUCCESS; + return result; } /* diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h index 3546e86..a643775 100644 --- a/drivers/scsi/vmw_pvscsi.h +++ b/drivers/scsi/vmw_pvscsi.h @@ -1,7 +1,7 @@ /* * VMware PVSCSI header file * - * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. + * Copyright (C) 2008-2014, VMware, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -26,7 +26,7
[PATCH 2/3] VMW_PVSCSI: Add support for I/O requests coalescing.
This change allows pvscsi driver to coalesce I/O requests before issuing them. The number of I/O's coalesced can be dynamically configured based on the workload. Signed-off-by: Rishi Mehta rme...@vmware.com Acked-by: Arvind Kumar arvindku...@vmware.com Cc: Rishi Mehta rme...@vmware.com --- drivers/scsi/vmw_pvscsi.c | 49 ++--- drivers/scsi/vmw_pvscsi.h | 17 +--- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 7c5abd7..0591cff 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -72,6 +72,7 @@ struct pvscsi_adapter { booluse_msi; booluse_msix; booluse_msg; + booluse_req_threshold; spinlock_t hw_lock; @@ -109,6 +110,7 @@ static int pvscsi_cmd_per_lun= PVSCSI_DEFAULT_QUEUE_DEPTH; static bool pvscsi_disable_msi; static bool pvscsi_disable_msix; static bool pvscsi_use_msg = true; +static bool pvscsi_use_req_threshold = true; #define PVSCSI_RW (S_IRUSR | S_IWUSR) @@ -133,6 +135,10 @@ MODULE_PARM_DESC(disable_msix, Disable MSI-X use in driver - (default=0)); module_param_named(use_msg, pvscsi_use_msg, bool, PVSCSI_RW); MODULE_PARM_DESC(use_msg, Use msg ring when available - (default=1)); +module_param_named(use_req_threshold, pvscsi_use_req_threshold, + bool, PVSCSI_RW); +MODULE_PARM_DESC(use_req_threshold, Use driver-based request coalescing if configured - (default=1)); + static const struct pci_device_id pvscsi_pci_tbl[] = { { PCI_VDEVICE(VMWARE, PCI_DEVICE_ID_VMWARE_PVSCSI) }, { 0 } @@ -282,10 +288,15 @@ static int scsi_is_rw(unsigned char op) static void pvscsi_kick_io(const struct pvscsi_adapter *adapter, unsigned char op) { - if (scsi_is_rw(op)) - pvscsi_kick_rw_io(adapter); - else + if (scsi_is_rw(op)) { + struct PVSCSIRingsState *s = adapter-rings_state; + + if (!adapter-use_req_threshold || + s-reqProdIdx - s-reqConsIdx = s-reqCallThreshold) + pvscsi_kick_rw_io(adapter); + } else { pvscsi_process_request_ring(adapter); + } } static void ll_adapter_reset(const struct pvscsi_adapter *adapter) @@ -1077,6 +1088,34 @@ static int pvscsi_setup_msg_workqueue(struct pvscsi_adapter *adapter) return 1; } +static bool pvscsi_setup_req_threshold(struct pvscsi_adapter *adapter, + bool enable) +{ + u32 val; + + if (!pvscsi_use_req_threshold) + return false; + + pvscsi_reg_write(adapter, PVSCSI_REG_OFFSET_COMMAND, +PVSCSI_CMD_SETUP_REQCALLTHRESHOLD); + val = pvscsi_reg_read(adapter, PVSCSI_REG_OFFSET_COMMAND_STATUS); + if (val == -1) { + printk(KERN_INFO pvscsi: device does not support req_threshold\n); + return false; + } else { + struct PVSCSICmdDescSetupReqCall cmd_msg = { 0 }; + cmd_msg.enable = enable; + printk(KERN_INFO + pvscsi: %sabling reqCallThreshold\n, + enable ? en : dis); + pvscsi_write_cmd_desc(adapter, + PVSCSI_CMD_SETUP_REQCALLTHRESHOLD, + cmd_msg, sizeof(cmd_msg)); + return pvscsi_reg_read(adapter, + PVSCSI_REG_OFFSET_COMMAND_STATUS) != 0; + } +} + static irqreturn_t pvscsi_isr(int irq, void *devp) { struct pvscsi_adapter *adapter = devp; @@ -1416,6 +1455,10 @@ static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id) flags = IRQF_SHARED; } + adapter-use_req_threshold = pvscsi_setup_req_threshold(adapter, true); + printk(KERN_DEBUG pvscsi: driver-based request coalescing %sabled\n, + adapter-use_req_threshold ? en : dis); + error = request_irq(adapter-irq, pvscsi_isr, flags, vmw_pvscsi, adapter); if (error) { diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h index a643775..15a9ac6 100644 --- a/drivers/scsi/vmw_pvscsi.h +++ b/drivers/scsi/vmw_pvscsi.h @@ -26,7 +26,7 @@ #include linux/types.h -#define PVSCSI_DRIVER_VERSION_STRING 1.0.3.0-k +#define PVSCSI_DRIVER_VERSION_STRING 1.0.4.0-k #define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128 @@ -117,8 +117,9 @@ enum PVSCSICommands { PVSCSI_CMD_CONFIG= 7, PVSCSI_CMD_SETUP_MSG_RING= 8, PVSCSI_CMD_DEVICE_UNPLUG = 9, + PVSCSI_CMD_SETUP_REQCALLTHRESHOLD = 10, - PVSCSI_CMD_LAST = 10 /* has to be last
[PATCH 3/3] VMW_PVSCSI: Some improvements in pvscsi driver.
This change is about the following: (1) If the number of targets is 16+ then default ring_pages to 32. (2) Change default queue depth (per device) to 254. (3) Implement change_queue_depth function so that queue_depth per device can be changed at run time. Honors the request only if coming from sysfs. (4) Clean up the info returned by modinfo. Signed-off-by: Arvind Kumar arvindku...@vmware.com --- drivers/scsi/vmw_pvscsi.c | 142 + drivers/scsi/vmw_pvscsi.h |2 +- 2 files changed, 105 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index 0591cff..8667b8c 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -32,6 +32,7 @@ #include scsi/scsi_host.h #include scsi/scsi_cmnd.h #include scsi/scsi_device.h +#include scsi/scsi_tcq.h #include vmw_pvscsi.h @@ -44,7 +45,7 @@ MODULE_VERSION(PVSCSI_DRIVER_VERSION_STRING); #define PVSCSI_DEFAULT_NUM_PAGES_PER_RING 8 #define PVSCSI_DEFAULT_NUM_PAGES_MSG_RING 1 -#define PVSCSI_DEFAULT_QUEUE_DEPTH 64 +#define PVSCSI_DEFAULT_QUEUE_DEPTH 254 #define SGL_SIZE PAGE_SIZE struct pvscsi_sg_list { @@ -104,7 +105,7 @@ struct pvscsi_adapter { /* Command line parameters */ -static int pvscsi_ring_pages = PVSCSI_DEFAULT_NUM_PAGES_PER_RING; +static int pvscsi_ring_pages; static int pvscsi_msg_ring_pages = PVSCSI_DEFAULT_NUM_PAGES_MSG_RING; static int pvscsi_cmd_per_lun= PVSCSI_DEFAULT_QUEUE_DEPTH; static bool pvscsi_disable_msi; @@ -116,7 +117,10 @@ static bool pvscsi_use_req_threshold = true; module_param_named(ring_pages, pvscsi_ring_pages, int, PVSCSI_RW); MODULE_PARM_DESC(ring_pages, Number of pages per req/cmp ring - (default= -__stringify(PVSCSI_DEFAULT_NUM_PAGES_PER_RING) )); +__stringify(PVSCSI_DEFAULT_NUM_PAGES_PER_RING) +[up to 16 targets], +__stringify(PVSCSI_SETUP_RINGS_MAX_NUM_PAGES) +[for 16+ targets])); module_param_named(msg_ring_pages, pvscsi_msg_ring_pages, int, PVSCSI_RW); MODULE_PARM_DESC(msg_ring_pages, Number of pages for the msg ring - (default= @@ -124,7 +128,7 @@ MODULE_PARM_DESC(msg_ring_pages, Number of pages for the msg ring - (default= module_param_named(cmd_per_lun, pvscsi_cmd_per_lun, int, PVSCSI_RW); MODULE_PARM_DESC(cmd_per_lun, Maximum commands per lun - (default= -__stringify(PVSCSI_MAX_REQ_QUEUE_DEPTH) )); +__stringify(PVSCSI_DEFAULT_QUEUE_DEPTH) )); module_param_named(disable_msi, pvscsi_disable_msi, bool, PVSCSI_RW); MODULE_PARM_DESC(disable_msi, Disable MSI use in driver - (default=0)); @@ -500,6 +504,35 @@ static void pvscsi_setup_all_rings(const struct pvscsi_adapter *adapter) } } +static int pvscsi_change_queue_depth(struct scsi_device *sdev, +int qdepth, +int reason) +{ + int max_depth; + struct Scsi_Host *shost = sdev-host; + + if (reason != SCSI_QDEPTH_DEFAULT) + /* +* We support only changing default. +*/ + return -EOPNOTSUPP; + + max_depth = shost-can_queue; + if (!sdev-tagged_supported) + max_depth = 1; + if (qdepth max_depth) + qdepth = max_depth; + scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); + + if (sdev-inquiry_len 7) + sdev_printk(KERN_INFO, sdev, + qdepth(%d), tagged(%d), simple(%d), ordered(%d), scsi_level(%d), cmd_que(%d)\n, + sdev-queue_depth, sdev-tagged_supported, + sdev-simple_tags, sdev-ordered_tags, + sdev-scsi_level, (sdev-inquiry[7] 2) 1); + return sdev-queue_depth; +} + /* * Pull a completion descriptor off and pass the completion back * to the SCSI mid layer. @@ -965,6 +998,7 @@ static struct scsi_host_template pvscsi_template = { .dma_boundary = UINT_MAX, .max_sectors= 0x, .use_clustering = ENABLE_CLUSTERING, + .change_queue_depth = pvscsi_change_queue_depth, .eh_abort_handler = pvscsi_abort, .eh_device_reset_handler= pvscsi_device_reset, .eh_bus_reset_handler = pvscsi_bus_reset, @@ -1318,11 +1352,12 @@ exit: static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct pvscsi_adapter *adapter; - struct Scsi_Host *host; - struct device *dev; + struct pvscsi_adapter adapter_temp; + struct Scsi_Host *host = NULL; unsigned int i; unsigned long flags = 0; int error; + u32 max_id; error = -ENODEV; @@ -1340,34 +1375,19 @@ static int pvscsi_probe(struct pci_dev
Re: [PATCH v2 23/23] vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()
Hi Alexander, This looks fine to me. Acked-by: Arvind Kumar arvindku...@vmware.com Thanks! Arvind - Original Message - From: Alexander Gordeev agord...@redhat.com To: linux-ker...@vger.kernel.org Cc: Alexander Gordeev agord...@redhat.com, Arvind Kumar arvindku...@vmware.com, pv-driv...@vmware.com, linux-scsi@vger.kernel.org, linux-...@vger.kernel.org Sent: Monday, February 24, 2014 12:02:23 AM Subject: [PATCH v2 23/23] vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix() As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Arvind Kumar arvindku...@vmware.com Cc: pv-driv...@vmware.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/vmw_pvscsi.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c index b9755ec..a046618 100644 --- a/drivers/scsi/vmw_pvscsi.c +++ b/drivers/scsi/vmw_pvscsi.c @@ -1078,7 +1078,7 @@ static int pvscsi_setup_msix(const struct pvscsi_adapter *adapter, struct msix_entry entry = { 0, PVSCSI_VECTOR_COMPLETION }; int ret; - ret = pci_enable_msix(adapter-dev, entry, 1); + ret = pci_enable_msix_exact(adapter-dev, entry, 1); if (ret) return ret; -- 1.7.7.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