From: Uma Krishnan <hidden> Date: 2016-03-04 21:55:47
The first 5 patches of this series contain fixes to support
the cxlflash driver in a PowerVM guest. For the cxlflash driver
to be functional in a PowerVM guest, a corresponding set of cxl
patches (currently being upstreamed) is required. Note that this
cxlflash patch series does not have any build dependencies on
the new cxl code.
The sixth patch in the series is a fix to dynamically swap between
the AFU's internal LUN and an actual LUN detected on the fabric.
The last patch in the series is a performance enhancement to
improve throughput with cxlflash driver.
This series is intended for 4.6 and is bisectable.
Manoj N. Kumar (3):
cxlflash: Simplify PCI registration
cxlflash: Fix to avoid unnecessary scan with internal LUNs
cxlflash: Increase cmd_per_lun for better throughput
Matthew R. Ochs (2):
cxlflash: Split out context initialization
cxlflash: Simplify attach path error cleanup
Uma Krishnan (2):
cxlflash: Unmap problem state area before detaching master context
cxlflash: Reorder user context initialization
drivers/scsi/cxlflash/common.h | 8 +-
drivers/scsi/cxlflash/main.c | 72 +++-----------
drivers/scsi/cxlflash/superpipe.c | 195 +++++++++++++++++++++-----------------
drivers/scsi/cxlflash/superpipe.h | 1 +
4 files changed, 131 insertions(+), 145 deletions(-)
--
2.1.0
From: Uma Krishnan <hidden> Date: 2016-03-04 21:57:18
From: "Manoj N. Kumar" <redacted>
The calls to pci_request_regions(), pci_resource_start(),
pci_set_dma_mask(), pci_set_master() and pci_save_state() are all
unnecessary for the IBM CXL flash adapter since data buffers
are not required to be mapped to the device's memory.
The use of services such as pci_set_dma_mask() are problematic on
hypervisor managed systems as the IBM CXL flash adapter is operating
under a virtual PCI Host Bridge (virtual PHB) which does not support
these services.
cxlflash 0001:00:00.0: init_pci: Failed to set PCI DMA mask rc=-5
The resolution is to simplify init_pci(), to a point where it does the
bare minimum (pci_enable_device). Similarly, remove the call the
pci_release_regions() from cxlflash_remove().
Signed-off-by: Manoj N. Kumar <redacted>
---
drivers/scsi/cxlflash/main.c | 54 +-------------------------------------------
1 file changed, 1 insertion(+), 53 deletions(-)
@@ -840,15 +839,6 @@ static int init_pci(struct cxlflash_cfg *cfg)structpci_dev*pdev=cfg->dev;intrc=0;-cfg->cxlflash_regs_pci=pci_resource_start(pdev,0);-rc=pci_request_regions(pdev,CXLFLASH_NAME);-if(rc<0){-dev_err(&pdev->dev,-"%s: Couldn't register memory range of registers\n",-__func__);-gotoout;-}-rc=pci_enable_device(pdev);if(rc||pci_channel_offline(pdev)){if(pci_channel_offline(pdev)){
@@ -860,55 +850,13 @@ static int init_pci(struct cxlflash_cfg *cfg)dev_err(&pdev->dev,"%s: Cannot enable adapter\n",__func__);cxlflash_wait_for_pci_err_recovery(cfg);-gotoout_release_regions;-}-}--rc=pci_set_dma_mask(pdev,DMA_BIT_MASK(64));-if(rc<0){-dev_dbg(&pdev->dev,"%s: Failed to set 64 bit PCI DMA mask\n",-__func__);-rc=pci_set_dma_mask(pdev,DMA_BIT_MASK(32));-}--if(rc<0){-dev_err(&pdev->dev,"%s: Failed to set PCI DMA mask\n",-__func__);-gotoout_disable;-}--pci_set_master(pdev);--if(pci_channel_offline(pdev)){-cxlflash_wait_for_pci_err_recovery(cfg);-if(pci_channel_offline(pdev)){-rc=-EIO;-gotoout_msi_disable;+gotoout;}}-rc=pci_save_state(pdev);--if(rc!=PCIBIOS_SUCCESSFUL){-dev_err(&pdev->dev,"%s: Failed to save PCI config space\n",-__func__);-rc=-EIO;-gotocleanup_nolog;-}-out:pr_debug("%s: returning rc=%d\n",__func__,rc);returnrc;--cleanup_nolog:-out_msi_disable:-cxlflash_wait_for_pci_err_recovery(cfg);-out_disable:-pci_disable_device(pdev);-out_release_regions:-pci_release_regions(pdev);-gotoout;-}/**
From: Uma Krishnan <hidden> Date: 2016-03-04 21:57:33
When operating in the PowerVM environment, the cxlflash module can
receive an error from the hypervisor indicating that there are
existing mappings in the page table for the process MMIO space.
This issue exists because term_afu() currently invokes term_mc()
before stop_afu(), allowing for the master context to be detached
first and the problem state area to be unmapped second.
To resolve this issue, stop_afu() should be called before term_mc().
Signed-off-by: Uma Krishnan <redacted>
---
drivers/scsi/cxlflash/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -2492,8 +2492,8 @@ static pci_ers_result_t cxlflash_pci_error_detected(struct pci_dev *pdev,if(unlikely(rc))dev_err(dev,"%s: Failed to mark user contexts!(%d)\n",__func__,rc);-term_mc(cfg,UNDO_START);stop_afu(cfg);+term_mc(cfg,UNDO_START);returnPCI_ERS_RESULT_NEED_RESET;casepci_channel_io_perm_failure:cfg->state=STATE_FAILTERM;
From: Uma Krishnan <hidden> Date: 2016-03-04 21:57:50
From: "Matthew R. Ochs" <redacted>
Presently, context information structures are allocated and
initialized in the same routine, create_context(). This imposes
an ordering restriction such that all pieces of information needed
to initialize a context must be known before the context is even
allocated.
This design point is not flexible when the order of context
creation needs to be modified. Specifically, this can lead to
problems when members of the context information structure are
a part of an ordering dependency (i.e. - the 'work' structure
embedded within the context).
To remedy, the allocation is left as-is, inside of the existing
create_context() routine and the initialization is transitioned
to a new void routine, init_context(). At the same time, in
anticipation of these routines not being called in sequence, a
state boolean is added to the context information structure to
track when the context has been initilized. The context teardown
routine, destroy_context(), is modified to support being called
with a non-initialized context.
Signed-off-by: Matthew R. Ochs <redacted>
---
drivers/scsi/cxlflash/superpipe.c | 92 +++++++++++++++++++++++----------------
drivers/scsi/cxlflash/superpipe.h | 1 +
2 files changed, 56 insertions(+), 37 deletions(-)
@@ -709,27 +709,32 @@ int cxlflash_disk_release(struct scsi_device *sdev,*@cfg:Internalstructureassociatedwiththehost.*@ctxi:Contexttorelease.*-*Notethattherht_lunmemberofthecontextwascutfromasingle-*allocationwhenthecontextwascreatedandthereforedoesnotneed-*tobeexplicitlyfreed.Alsonotethatweconditionallycheckforthe-*existenceofthecontextcontrolmapbeforeclearingtheRHTregisters-*andcontextcapabilitiesbecauseitispossibletodestroyacontext-*whilethecontextisintheerrorstate(previousmappingwasremoved-*[sowedon'thavetoworryaboutclearing]andcontextiswaitingfor-*anewmapping).+*Thisroutineissafetobecalledwithaanon-initializedcontext+*andistolerantofbeingcalledwiththecontext'smutexheld(it+*willbeunlockedifnecessarybeforefreeing).Alsonotethatthe+*routineconditionallychecksfortheexistenceofthecontextcontrol+*mapbeforeclearingtheRHTregistersandcontextcapabilitiesbecause+*itispossibletodestroyacontextwhilethecontextisintheerror+*state(previousmappingwasremoved[sothereisnoneedtoworryabout+*clearing]andcontextiswaitingforanewmapping).*/staticvoiddestroy_context(structcxlflash_cfg*cfg,structctx_info*ctxi){structafu*afu=cfg->afu;-WARN_ON(!list_empty(&ctxi->luns));+if(ctxi->initialized){+WARN_ON(!list_empty(&ctxi->luns));-/* Clear RHT registers and drop all capabilities for this context */-if(afu->afu_map&&ctxi->ctrl_map){-writeq_be(0,&ctxi->ctrl_map->rht_start);-writeq_be(0,&ctxi->ctrl_map->rht_cnt_id);-writeq_be(0,&ctxi->ctrl_map->ctx_cap);+/* Clear RHT registers and drop all capabilities for context */+if(afu->afu_map&&ctxi->ctrl_map){+writeq_be(0,&ctxi->ctrl_map->rht_start);+writeq_be(0,&ctxi->ctrl_map->rht_cnt_id);+writeq_be(0,&ctxi->ctrl_map->ctx_cap);+}++if(mutex_is_locked(&ctxi->mutex))+mutex_unlock(&ctxi->mutex);}/* Free memory associated with context */
From: Uma Krishnan <hidden> Date: 2016-03-04 21:58:03
From: "Matthew R. Ochs" <redacted>
The cxlflash_disk_attach() routine currently uses a cascading error
gate strategy for its error cleanup path. While this strategy is
commonly used to handle cleanup scenarios, it is too restrictive when
function callouts need to be restructured. Problems range from
inserting error path bugs in previously 'good' code to the cleanup
path imposing design changes to how the normal path is structured.
A less restrictive approach is needed to support ordering changes
that come about when operating in different environments.
To overcome this restriction, the error cleanup path is modified to
have a single entrypoint and use conditional logic to cleanup where
necessary. Entities that require multiple cleanup steps must be
carefully vetted to ensure their APIs support state. In cases where
they do not (none as of this commit) additional local variables can
be used to maintain state on their behalf.
Signed-off-by: Matthew R. Ochs <redacted>
---
drivers/scsi/cxlflash/superpipe.c | 55 ++++++++++++++++++++++-----------------
1 file changed, 31 insertions(+), 24 deletions(-)
@@ -1315,9 +1315,9 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,u32perms;intctxid=-1;u64rctxid=0UL;-structfile*file;+structfile*file=NULL;-structcxl_context*ctx;+structcxl_context*ctx=NULL;intfd=-1;
@@ -1371,7 +1371,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,if(unlikely(!lun_access)){dev_err(dev,"%s: Unable to allocate lun_access!\n",__func__);rc=-ENOMEM;-gotoerr0;+gotoerr;}lun_access->lli=lli;
@@ -1391,21 +1391,21 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,dev_err(dev,"%s: Could not initialize context %p\n",__func__,ctx);rc=-ENODEV;-gotoerr1;+gotoerr;}ctxid=cxl_process_element(ctx);if(unlikely((ctxid>=MAX_CONTEXT)||(ctxid<0))){dev_err(dev,"%s: ctxid (%d) invalid!\n",__func__,ctxid);rc=-EPERM;-gotoerr2;+gotoerr;}file=cxl_get_fd(ctx,&cfg->cxl_fops,&fd);if(unlikely(fd<0)){rc=-ENODEV;dev_err(dev,"%s: Could not get file descriptor\n",__func__);-gotoerr2;+gotoerr;}/* Translate read/write O_* flags from fcntl.h to AFU permission bits */
@@ -1415,7 +1415,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,if(unlikely(!ctxi)){dev_err(dev,"%s: Failed to create context! (%d)\n",__func__,ctxid);-gotoerr3;+gotoerr;}/* Context mutex is locked upon return */
@@ -1429,13 +1429,13 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,if(unlikely(rc)){dev_dbg(dev,"%s: Could not start context rc=%d\n",__func__,rc);-gotoerr4;+gotoerr;}rc=afu_attach(cfg,ctxi);if(unlikely(rc)){dev_err(dev,"%s: Could not attach AFU rc %d\n",__func__,rc);-gotoerr5;+gotoerr;}/*
@@ -1471,13 +1471,14 @@ out:__func__,ctxid,fd,attach->block_size,rc,attach->last_lba);returnrc;-err5:-cxl_stop_context(ctx);-err4:-put_context(ctxi);-destroy_context(cfg,ctxi);-ctxi=NULL;-err3:+err:+/* Cleanup CXL context; okay to 'stop' even if it was not started */+if(!IS_ERR_OR_NULL(ctx)){+cxl_stop_context(ctx);+cxl_release_context(ctx);+ctx=NULL;+}+/**Here,we'reoverridingthefopswithadummyall-NULLfopsbecause*fput()callsthereleasefop,whichwillcauseustomistakenly
@@ -1485,15 +1486,21 @@ err3:*tothatroutine(cxlflash_cxl_release)weshouldtrytofixthe*issuehere.*/-file->f_op=&null_fops;-fput(file);-put_unused_fd(fd);-fd=-1;-err2:-cxl_release_context(ctx);-err1:+if(fd>0){+file->f_op=&null_fops;+fput(file);+put_unused_fd(fd);+fd=-1;+file=NULL;+}++/* Cleanup our context; safe to call even with mutex locked */+if(ctxi){+destroy_context(cfg,ctxi);+ctxi=NULL;+}+kfree(lun_access);-err0:scsi_device_put(sdev);gotoout;}
From: Uma Krishnan <hidden> Date: 2016-03-04 21:58:22
In order to support cxlflash in the PowerVM environment, underlying
hypervisor APIs have imposed a kernel API ordering change.
For the superpipe access to LUN, user applications need a context.
The cxlflash module creates this context by making a sequence of
cxl calls. In the current code, a context is initialized via
cxl_dev_context_init() followed by cxl_process_element(), a function
that obtains the process element id. Finally, cxl_start_work()
is called to attach the process element.
In the PowerVM environment, a process element id cannot be obtained
from the hypervisor until the process element is attached. The
cxlflash module is unable to create contexts without a valid
process element id.
To fix this problem, cxl_start_work() is called before obtaining
the process element id.
Signed-off-by: Uma Krishnan <redacted>
---
drivers/scsi/cxlflash/superpipe.c | 56 +++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 28 deletions(-)
@@ -1386,6 +1386,13 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,gotoout_attach;}+ctxi=create_context(cfg);+if(unlikely(!ctxi)){+dev_err(dev,"%s: Failed to create context! (%d)\n",+__func__,ctxid);+gotoerr;+}+ctx=cxl_dev_context_init(cfg->dev);if(IS_ERR_OR_NULL(ctx)){dev_err(dev,"%s: Could not initialize context %p\n",
@@ -1394,6 +1401,17 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,gotoerr;}+work=&ctxi->work;+work->num_interrupts=attach->num_interrupts;+work->flags=CXL_START_WORK_NUM_IRQS;++rc=cxl_start_work(ctx,work);+if(unlikely(rc)){+dev_dbg(dev,"%s: Could not start context rc=%d\n",+__func__,rc);+gotoerr;+}+ctxid=cxl_process_element(ctx);if(unlikely((ctxid>=MAX_CONTEXT)||(ctxid<0))){dev_err(dev,"%s: ctxid (%d) invalid!\n",__func__,ctxid);
@@ -1411,27 +1429,9 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,/* Translate read/write O_* flags from fcntl.h to AFU permission bits */perms=SISL_RHT_PERM(attach->hdr.flags+1);-ctxi=create_context(cfg);-if(unlikely(!ctxi)){-dev_err(dev,"%s: Failed to create context! (%d)\n",-__func__,ctxid);-gotoerr;-}-/* Context mutex is locked upon return */init_context(ctxi,cfg,ctx,ctxid,fd,file,perms);-work=&ctxi->work;-work->num_interrupts=attach->num_interrupts;-work->flags=CXL_START_WORK_NUM_IRQS;--rc=cxl_start_work(ctx,work);-if(unlikely(rc)){-dev_dbg(dev,"%s: Could not start context rc=%d\n",-__func__,rc);-gotoerr;-}-rc=afu_attach(cfg,ctxi);if(unlikely(rc)){dev_err(dev,"%s: Could not attach AFU rc %d\n",__func__,rc);
@@ -1532,24 +1532,24 @@ static int recover_context(struct cxlflash_cfg *cfg, struct ctx_info *ctxi)gotoout;}+rc=cxl_start_work(ctx,&ctxi->work);+if(unlikely(rc)){+dev_dbg(dev,"%s: Could not start context rc=%d\n",+__func__,rc);+gotoerr1;+}+ctxid=cxl_process_element(ctx);if(unlikely((ctxid>=MAX_CONTEXT)||(ctxid<0))){dev_err(dev,"%s: ctxid (%d) invalid!\n",__func__,ctxid);rc=-EPERM;-gotoerr1;+gotoerr2;}file=cxl_get_fd(ctx,&cfg->cxl_fops,&fd);if(unlikely(fd<0)){rc=-ENODEV;dev_err(dev,"%s: Could not get file descriptor\n",__func__);-gotoerr1;-}--rc=cxl_start_work(ctx,&ctxi->work);-if(unlikely(rc)){-dev_dbg(dev,"%s: Could not start context rc=%d\n",-__func__,rc);gotoerr2;}
From: Uma Krishnan <hidden> Date: 2016-03-04 21:58:30
From: "Manoj N. Kumar" <redacted>
When switching to the internal LUN defined on the
IBM CXL flash adapter, there is an unnecessary
scan occurring on the second port. This scan leads
to the following extra lines in the log:
Dec 17 10:09:00 tul83p1 kernel: [ 3708.561134] cxlflash 0008:00:00.0: cxlflash_queuecommand: (scp=c0000000fc1f0f00) 11/1/0/0 cdb=(A0000000-00000000-10000000-00000000)
Dec 17 10:09:00 tul83p1 kernel: [ 3708.561147] process_cmd_err: cmd failed afu_rc=32 scsi_rc=0 fc_rc=0 afu_extra=0xE, scsi_extra=0x0, fc_extra=0x0
By definition, both of the internal LUNs are on the first port/channel.
When the lun_mode is switched to internal LUN the
same value for host->max_channel is retained. This
causes an unnecessary scan over the second port/channel.
This fix alters the host->max_channel to 0 (1 port), if internal
LUNs are configured and switches it back to 1 (2 ports) while
going back to external LUNs.
Signed-off-by: Manoj N. Kumar <redacted>
---
drivers/scsi/cxlflash/main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
From: Uma Krishnan <hidden> Date: 2016-03-04 21:58:44
From: "Manoj N. Kumar" <redacted>
With the current value of cmd_per_lun at 16, the throughput
over a single adapter is limited to around 150kIOPS.
Increase the value of cmd_per_lun to 256 to improve
throughput. With this change a single adapter is able to
attain close to the maximum throughput (380kIOPS).
Also change the number of RRQ entries that can be queued.
Signed-off-by: Manoj N. Kumar <redacted>
---
drivers/scsi/cxlflash/common.h | 8 +++++---
drivers/scsi/cxlflash/main.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
From: Matthew R. Ochs <hidden> Date: 2016-03-07 18:30:16
On Mar 4, 2016, at 3:55 PM, Uma Krishnan [off-list ref] =
wrote:
=20
From: "Manoj N. Kumar" <redacted>
=20
The calls to pci_request_regions(), pci_resource_start(),
pci_set_dma_mask(), pci_set_master() and pci_save_state() are all
unnecessary for the IBM CXL flash adapter since data buffers
are not required to be mapped to the device's memory.
=20
The use of services such as pci_set_dma_mask() are problematic on
hypervisor managed systems as the IBM CXL flash adapter is operating
under a virtual PCI Host Bridge (virtual PHB) which does not support
these services.
=20
cxlflash 0001:00:00.0: init_pci: Failed to set PCI DMA mask rc=3D-5
=20
The resolution is to simplify init_pci(), to a point where it does the
bare minimum (pci_enable_device). Similarly, remove the call the
pci_release_regions() from cxlflash_remove().
=20
Signed-off-by: Manoj N. Kumar <redacted>
From: Matthew R. Ochs <hidden> Date: 2016-03-07 18:33:24
On Mar 4, 2016, at 3:55 PM, Uma Krishnan [off-list ref] =
wrote:
=20
When operating in the PowerVM environment, the cxlflash module can
receive an error from the hypervisor indicating that there are
existing mappings in the page table for the process MMIO space.
=20
This issue exists because term_afu() currently invokes term_mc()
before stop_afu(), allowing for the master context to be detached
first and the problem state area to be unmapped second.
=20
To resolve this issue, stop_afu() should be called before term_mc().
=20
Signed-off-by: Uma Krishnan <redacted>
From: Matthew R. Ochs <hidden> Date: 2016-03-07 18:37:24
On Mar 4, 2016, at 3:55 PM, Uma Krishnan [off-list ref] =
wrote:
=20
In order to support cxlflash in the PowerVM environment, underlying
hypervisor APIs have imposed a kernel API ordering change.
=20
For the superpipe access to LUN, user applications need a context.
The cxlflash module creates this context by making a sequence of
cxl calls. In the current code, a context is initialized via
cxl_dev_context_init() followed by cxl_process_element(), a function
that obtains the process element id. Finally, cxl_start_work()
is called to attach the process element.
=20
In the PowerVM environment, a process element id cannot be obtained
from the hypervisor until the process element is attached. The
cxlflash module is unable to create contexts without a valid
process element id.
=20
To fix this problem, cxl_start_work() is called before obtaining
the process element id.
=20
Signed-off-by: Uma Krishnan <redacted>
From: Matthew R. Ochs <hidden> Date: 2016-03-07 18:45:22
On Mar 4, 2016, at 3:55 PM, Uma Krishnan [off-list ref] =
wrote:
=20
From: "Manoj N. Kumar" <redacted>
=20
When switching to the internal LUN defined on the
IBM CXL flash adapter, there is an unnecessary
scan occurring on the second port. This scan leads
to the following extra lines in the log:
=20
Dec 17 10:09:00 tul83p1 kernel: [ 3708.561134] cxlflash 0008:00:00.0: =
=20
By definition, both of the internal LUNs are on the first =
port/channel.
=20
When the lun_mode is switched to internal LUN the
same value for host->max_channel is retained. This
causes an unnecessary scan over the second port/channel.
=20
This fix alters the host->max_channel to 0 (1 port), if internal
LUNs are configured and switches it back to 1 (2 ports) while
going back to external LUNs.
=20
Signed-off-by: Manoj N. Kumar <redacted>
From: Matthew R. Ochs <hidden> Date: 2016-03-07 18:45:26
On Mar 4, 2016, at 3:55 PM, Uma Krishnan [off-list ref] =
wrote:
=20
From: "Manoj N. Kumar" <redacted>
=20
With the current value of cmd_per_lun at 16, the throughput
over a single adapter is limited to around 150kIOPS.
=20
Increase the value of cmd_per_lun to 256 to improve
throughput. With this change a single adapter is able to
attain close to the maximum throughput (380kIOPS).
Also change the number of RRQ entries that can be queued.
=20
Signed-off-by: Manoj N. Kumar <redacted>
From: Uma Krishnan <hidden> Date: 2016-03-08 17:54:49
On 3/4/2016 3:55 PM, Uma Krishnan wrote:
From: "Manoj N. Kumar" <redacted>
The calls to pci_request_regions(), pci_resource_start(),
pci_set_dma_mask(), pci_set_master() and pci_save_state() are all
unnecessary for the IBM CXL flash adapter since data buffers
are not required to be mapped to the device's memory.
The use of services such as pci_set_dma_mask() are problematic on
hypervisor managed systems as the IBM CXL flash adapter is operating
under a virtual PCI Host Bridge (virtual PHB) which does not support
these services.
cxlflash 0001:00:00.0: init_pci: Failed to set PCI DMA mask rc=-5
The resolution is to simplify init_pci(), to a point where it does the
bare minimum (pci_enable_device). Similarly, remove the call the
pci_release_regions() from cxlflash_remove().
Signed-off-by: Manoj N. Kumar <redacted>
From: Uma Krishnan <hidden> Date: 2016-03-08 17:55:26
On 3/4/2016 3:55 PM, Uma Krishnan wrote:
From: "Matthew R. Ochs" <redacted>
Presently, context information structures are allocated and
initialized in the same routine, create_context(). This imposes
an ordering restriction such that all pieces of information needed
to initialize a context must be known before the context is even
allocated.
This design point is not flexible when the order of context
creation needs to be modified. Specifically, this can lead to
problems when members of the context information structure are
a part of an ordering dependency (i.e. - the 'work' structure
embedded within the context).
To remedy, the allocation is left as-is, inside of the existing
create_context() routine and the initialization is transitioned
to a new void routine, init_context(). At the same time, in
anticipation of these routines not being called in sequence, a
state boolean is added to the context information structure to
track when the context has been initilized. The context teardown
routine, destroy_context(), is modified to support being called
with a non-initialized context.
Signed-off-by: Matthew R. Ochs <redacted>
From: Uma Krishnan <hidden> Date: 2016-03-08 17:55:48
On 3/4/2016 3:55 PM, Uma Krishnan wrote:
From: "Matthew R. Ochs" <redacted>
The cxlflash_disk_attach() routine currently uses a cascading error
gate strategy for its error cleanup path. While this strategy is
commonly used to handle cleanup scenarios, it is too restrictive when
function callouts need to be restructured. Problems range from
inserting error path bugs in previously 'good' code to the cleanup
path imposing design changes to how the normal path is structured.
A less restrictive approach is needed to support ordering changes
that come about when operating in different environments.
To overcome this restriction, the error cleanup path is modified to
have a single entrypoint and use conditional logic to cleanup where
necessary. Entities that require multiple cleanup steps must be
carefully vetted to ensure their APIs support state. In cases where
they do not (none as of this commit) additional local variables can
be used to maintain state on their behalf.
Signed-off-by: Matthew R. Ochs <redacted>
From: Uma Krishnan <hidden> Date: 2016-03-08 17:56:08
On 3/4/2016 3:55 PM, Uma Krishnan wrote:
From: "Manoj N. Kumar" <redacted>
When switching to the internal LUN defined on the
IBM CXL flash adapter, there is an unnecessary
scan occurring on the second port. This scan leads
to the following extra lines in the log:
Dec 17 10:09:00 tul83p1 kernel: [ 3708.561134] cxlflash 0008:00:00.0: cxlflash_queuecommand: (scp=c0000000fc1f0f00) 11/1/0/0 cdb=(A0000000-00000000-10000000-00000000)
Dec 17 10:09:00 tul83p1 kernel: [ 3708.561147] process_cmd_err: cmd failed afu_rc=32 scsi_rc=0 fc_rc=0 afu_extra=0xE, scsi_extra=0x0, fc_extra=0x0
By definition, both of the internal LUNs are on the first port/channel.
When the lun_mode is switched to internal LUN the
same value for host->max_channel is retained. This
causes an unnecessary scan over the second port/channel.
This fix alters the host->max_channel to 0 (1 port), if internal
LUNs are configured and switches it back to 1 (2 ports) while
going back to external LUNs.
Signed-off-by: Manoj N. Kumar <redacted>
From: Uma Krishnan <hidden> Date: 2016-03-08 17:56:46
On 3/4/2016 3:55 PM, Uma Krishnan wrote:
From: "Manoj N. Kumar" <redacted>
With the current value of cmd_per_lun at 16, the throughput
over a single adapter is limited to around 150kIOPS.
Increase the value of cmd_per_lun to 256 to improve
throughput. With this change a single adapter is able to
attain close to the maximum throughput (380kIOPS).
Also change the number of RRQ entries that can be queued.
Signed-off-by: Manoj N. Kumar <redacted>