Re: [RFC PATCH 2/5] break sd_done sense processing out to own function

2018-08-05 Thread Damien Le Moal
On 2018/08/06 13:51, Douglas Gilbert wrote: > Break out the sense key handling in the sd_done() (response) path into > its own function. Note that the sense key only needs to be inspected > when a SCSI status of Check Condition is returned. It looks like sd_done_sense() is called for any command t

Re: [RFC PATCH 1/5] add tweakable bounds_check flag, now off by default

2018-08-05 Thread Damien Le Moal
Douglas, On 2018/08/06 13:51, Douglas Gilbert wrote: > Add bounds_check "rw" attribute to the sd driver. It controls whether > each read/write operation submission does an "out of range" bounds check > and a LBA/number_of_blocks alignment bounds check. The mainline kernel > currently does both the

Re: [RFC PATCH 3/5] streamline REQ_OP_READ-WRITE access

2018-08-05 Thread Damien Le Moal
On 2018/08/06 13:51, Douglas Gilbert wrote: > Make the two block layer operations most frequently used (REQ_OP_READ > and REQ_OP_WRITE) bypass the switch statements in the submission and > response paths. Assume these two enums are 0 and 1 which allows a > single comparison to select both of them.

Re: [RFC PATCH 4/5] streamline some logical operations

2018-08-05 Thread Damien Le Moal
On 2018/08/06 13:51, Douglas Gilbert wrote: > Re-arrange some logic to lessen the number of checks. With logical > ANDs put the least likely first, with logical ORs put the most > likely first. Also add conditional hints on the assumed fastpath. > > Signed-off-by: Douglas Gilbert > --- > drivers

[RFC PATCH 1/5] add tweakable bounds_check flag, now off by default

2018-08-05 Thread Douglas Gilbert
Add bounds_check "rw" attribute to the sd driver. It controls whether each read/write operation submission does an "out of range" bounds check and a LBA/number_of_blocks alignment bounds check. The mainline kernel currently does both these checks. This patch changes that default to bounds_check=fal

[RFC PATCH 4/5] streamline some logical operations

2018-08-05 Thread Douglas Gilbert
Re-arrange some logic to lessen the number of checks. With logical ANDs put the least likely first, with logical ORs put the most likely first. Also add conditional hints on the assumed fastpath. Signed-off-by: Douglas Gilbert --- drivers/scsi/sd.c | 43 --

[RFC PATCH 5/5] make sd_done() REQ_OP_FLUSH handling explicit

2018-08-05 Thread Douglas Gilbert
REQ_OP_FLUSH appears in the submission path processing but not in the response path processing. Hence it takes the "default" case which seems to be designed for REQ_OP_READ and REQ_OP_WRITE. So add a REQ_OP_FLUSH case to the response path. Signed-off-by: Douglas Gilbert --- Is it correct to trea

[RFC PATCH 3/5] streamline REQ_OP_READ-WRITE access

2018-08-05 Thread Douglas Gilbert
Make the two block layer operations most frequently used (REQ_OP_READ and REQ_OP_WRITE) bypass the switch statements in the submission and response paths. Assume these two enums are 0 and 1 which allows a single comparison to select both of them. Check that assumption at driver start-up. Signed-of

[RFC PATCH 0/5] sd: init_command() and sd_done() speed-ups

2018-08-05 Thread Douglas Gilbert
This patchset is against Martin Petersen's (mkp) repository: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/linux.git branch: 4.19/scsi Note: this is not the repository mkp uses for normal SCSI subsystem submissions (whose url ends with .../mkp/scsi.git). Note 2: even though the branch is c

[RFC PATCH 2/5] break sd_done sense processing out to own function

2018-08-05 Thread Douglas Gilbert
Break out the sense key handling in the sd_done() (response) path into its own function. Note that the sense key only needs to be inspected when a SCSI status of Check Condition is returned. Signed-off-by: Douglas Gilbert --- No speed up here, just a clean up. There could possibly be a speed im

[PATCH v2 7/8] scsi: ufs-bsg: Add support for raw upiu in ufs_bsg_request()

2018-08-05 Thread Avri Altman
Do that for the currently supported UPIUs: query, nop out, and task management. We do not support UPIU of type scsi command yet, while we are using the job's request and reply pointers to hold the payload. We will look into it in later patches. We might need to elaborate the raw upiu api for that

[PATCH v2 8/8] scsi: ufs-bsg: Add support for uic commands in ufs_bsg_request()

2018-08-05 Thread Avri Altman
Add support to those uic commands, that are currently supported by ufshcd api: the variants of dme_{peer}_{set_get}. At this point better not to add any new api, as careless uic command may turn the device into a brick. Signed-off-by: Avri Altman --- drivers/scsi/ufs/ufs_bsg.c | 56

[PATCH v2 5/8] scsi: ufs: Allow ufshcd_issue_tm_cmd accept raw task upius

2018-08-05 Thread Avri Altman
Do that in order to re-use its code if the task request and response UPIUs are given externally. Signed-off-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 35 ++- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/s

[PATCH v2 3/8] scsi: ufs: Instantiate a ufs transport if its available

2018-08-05 Thread Avri Altman
Call the Attach/Probe/Remove APIs. Signed-off-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3560185..c2ae406 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd

[PATCH v2 6/8] scsi: ufs: Add API to execute raw upiu commands

2018-08-05 Thread Avri Altman
The UFS host software uses a combination of a host register set, and Transfer Request Descriptors in system memory to communicate with host controller hardware. In its mmio space, a separate places are assigned to UTP Transfer Request Descriptor ("utrd") list, and to UTP Task Management Request Des

[PATCH v2 2/8] scsi: ufs: Add ufs-bsg module

2018-08-05 Thread Avri Altman
A LLD companion for the ufs scsi transport. For now, just provide an API to instantiate the ufs transport, allocating and removing ufs-ports. As we are attaching the transport template to the scsi host that was already alocated for the ufs hba, we'll need to pay extra attention on where to call th

[PATCH v2 4/8] scsi: ufs: Add fill task management request

2018-08-05 Thread Avri Altman
Do that in preparation to re-use ufshcd_issue_tm_cmd code. Signed-off-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 50 +++ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c2

[PATCH v2 0/8] scsi: scsi transport for ufs devices

2018-08-05 Thread Avri Altman
Here is a proposal to use the scsi transport subsystem to manage ufs devices. scsi transport is a framework that allow to send scsi commands to a non-scsi devices. Still, it is flexible enough to allow sending non-scsi commands as well. We will use this framework to manage ufs devices by sending U

[PATCH v2 1/8] scsi: Add ufs transport class

2018-08-05 Thread Avri Altman
Scsi transport is a framework that allow to send scsi commands to a non-scsi devices. Still, it is flexible enough to allow sending non-scsi commands as well. We will use this framework to manage ufs devices by sending UPIU transactions. In addition to the basic SCSI core objects this transport cl