Re: [PATCH] lpfc: Remove bg debugfs buffers

2019-08-28 Thread Hannes Reinecke
On 8/27/19 11:28 PM, James Smart wrote: Capturing and downloading dif command data and dif data was done a dozen years ago and no longer being used. Also creates a potential security hole. Remove the debugfs buffer for dif debugging. Signed-off-by: Dick Kennedy Signed-off-by: James Smart CC:

Re: [PATCH] lpfc: Raise config max for lpfc_fcp_mq_threshold variable

2019-08-28 Thread Hannes Reinecke
On 8/27/19 11:28 PM, James Smart wrote: Raise the config max for lpfc_fcp_mq_threshold variable to 256. Signed-off-by: Dick Kennedy Signed-off-by: James Smart CC: Hannes Reinecke --- Martin, this fix applies 5.3/scsi-fixes patch: scsi: lpfc: Mitigate high memory pre-allocation by SCSI-MQ

ufshcd_abort: Device abort task at tag 7

2019-08-28 Thread Marc Gonzalez
Hello, Someone posted a bug report for UFS on an sdm850 tablet: https://bugzilla.kernel.org/show_bug.cgi?id=204685 If I'm reading the boot logs right, this board is EFI rather than DT. (Lee: EFI on qcom is one of your areas, right? The UFSHC driver is DT-aware, but is it EFI-aware?) [0.0

Re: ufshcd_abort: Device abort task at tag 7

2019-08-28 Thread Bjorn Andersson
On Wed 28 Aug 02:09 PDT 2019, Marc Gonzalez wrote: > Hello, > > Someone posted a bug report for UFS on an sdm850 tablet: > https://bugzilla.kernel.org/show_bug.cgi?id=204685 > > If I'm reading the boot logs right, this board is EFI rather than DT. It's UEFI-based and Linux will either operate b

[PATCH] lpfc: fix 12.4.0.0 GPF at boot

2019-08-28 Thread James Smart
The 12.4.0.0 patch that merged WQ/CQ pairs into single per-cpu pair contained a bug: a local variable was set to the queue pair by index. This should have allowed the local variable to be natively used. Instead, the code reused the index relative to the local variable, obtaining a random pointer va

[PATCH v4 12/22] sg: sense buffer rework

2019-08-28 Thread Douglas Gilbert
The biggest single item in the sg_request object is the sense buffer array which is SCSI_SENSE_BUFFERSIZE bytes long. That constant started out at 18 bytes 20 years ago and is 96 bytes now and might grow in the future. On the other hand the sense buffer is only used by a small number of SCSI comman

[PATCH v4 15/22] sg: add 8 byte SCSI LUN to sg_scsi_id

2019-08-28 Thread Douglas Gilbert
The existing ioctl(SG_GET_SCSI_ID) fills a object of type struct sg_scsi_id whose last field is int unused[2]. Add an anonymous union with u8 scsi_lun[8] sharing those last 8 bytes. This patch will place the current device's full LUN in the scsi_lun array using T10's preferred LUN format (i.e. an a

[PATCH v4 22/22] sg: bump version to 4.0.03

2019-08-28 Thread Douglas Gilbert
Now that the sg version 4 interface is supported: - with ioctl(SG_IO) for synchronous/blocking use - with ioctl(SG_IOSUBMIT) and ioctl(SG_IORECEIVE) for async/non-blocking use Plus new ioctl(SG_IOSUBMIT_V3) and ioctl(SG_IORECEIVE_V3) potentially replace write() and read() for the sg version

[PATCH v4 09/22] sg: sg_allow_if_err_recovery and renames

2019-08-28 Thread Douglas Gilbert
Add sg_allow_if_err_recover() to do checks common to several entry points. Replace retval with either res or ret. Rename sg_finish_rem_req() to sg_finish_scsi_blk_rq(). Rename sg_new_write() to sg_submit(). Other cleanups triggered by checkpatch.pl . Reviewed-by: Hannes Reinecke Signed-off-by: Do

[PATCH v4 20/22] sg: first debugfs support

2019-08-28 Thread Douglas Gilbert
Duplicate the semantics of 'cat /proc/scsi/sg/debug' on 'cat /sys/kernel/debug/scsi_generic/snapshot'. Make code that generates the snapshot conditional on either CONFIG_SCSI_PROC_FS or CONFIG_DEBUG_FS being defined. Also add snapshot_devs which can be written with a list of comma separated intege

[PATCH v4 11/22] sg: replace rq array with lists

2019-08-28 Thread Douglas Gilbert
Remove the fixed size array of 16 request elements per file descriptor and replace with two linked lists per file descriptor. One list is for active commands, the other list is a free list. sg_request objects are now kept, available for re-use, until their owning file descriptor is closed. The sg_r

[PATCH v4 01/22] sg: move functions around

2019-08-28 Thread Douglas Gilbert
Move main entry point functions around so submission code comes before completion code. Prior to this, the driver used the traditional open(), close(), read(), write(), ioctl() ordering however in this case that places completion code (i.e. sg_read()) before submission code (i.e. sg_write()). The m

[PATCH v4 17/22] sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls

2019-08-28 Thread Douglas Gilbert
Add ioctl(SG_IOSUBMIT_V3) and ioctl(SG_IORECEIVE_V3). These ioctls are meant to be (almost) drop-in replacements for the write()/read() async version 3 interface. They only accept the version 3 interface. See the webpage at: http://sg.danny.cz/sg/sg_v40.html specifically the table in the section t

[PATCH v4 16/22] sg: expand sg_comm_wr_t

2019-08-28 Thread Douglas Gilbert
The internal struct sg_comm_wr_t was added when the number of arguments to sg_common_write() became excessive. Expand this idea so multiple calls to sg_fetch_cmnd() can be deferred until a scsi_request object is ready to receive the command. This saves a 252 byte stack allocation on every submit pa

[PATCH v4 14/22] sg: rework debug info

2019-08-28 Thread Douglas Gilbert
Since the version 2 driver, the state of the driver can be found with 'cat /proc/scsi/sg/debug'. As the driver becomes more threaded and IO faster (e.g. scsi_debug with a command timer of 5 microseconds), the existing state dump can become misleading as the state can change during the "snapshot". T

[PATCH v4 13/22] sg: add sg v4 interface support

2019-08-28 Thread Douglas Gilbert
Add support for the sg v4 interface based on struct sg_io_v4 found in include/uapi/linux/bsg.h and only previously supported by the bsg driver. Add ioctl(SG_IOSUBMIT) and ioctl(SG_IORECEIVE) for async (non-blocking) usage of the sg v4 interface. Do not accept the v3 interface with these ioctls. Do

[PATCH v4 18/22] sg: add some __must_hold macros

2019-08-28 Thread Douglas Gilbert
In the case of sg_wait_open_event() which calls mutex_unlock on sdp->open_rel_lock and later calls mutex_lock on the same lock; this macro is needed to stop sparse complaining. In other cases it is a reminder to the coder (a precondition). Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 7

[PATCH v4 07/22] sg: move header to uapi section

2019-08-28 Thread Douglas Gilbert
Move user interface part of scsi/sg.h into the new header file: include/uapi/scsi/sg.h . Since scsi/sg.h includes the new header, other code including scsi/sg.h should not be impacted. Reviewed-by: Hannes Reinecke Reported-by: kbuild test robot Signed-off-by: Douglas Gilbert --- include/scsi/s

[PATCH v4 00/22] sg: add v4 interface

2019-08-28 Thread Douglas Gilbert
This patchset extends the SCSI generic (sg) driver found in lk 5.3 . The sg driver has a version number which is visible via ioctl(SG_GET_VERSION_NUM) and is bumped from 3.5.36 to 4.0.03 by this patchset. The additions and changes are described in some detail in this long webpage: http://sg.da

[PATCH v4 03/22] sg: sg_log and is_enabled

2019-08-28 Thread Douglas Gilbert
Replace SCSI_LOG_TIMEOUT macros with SG_LOG macros across the driver. The definition of SG_LOG calls SCSI_LOG_TIMEOUT if given and derived pointers are non-zero, calls pr_info otherwise. SG_LOGS additionally prints the sg device name and the thread id. The thread id is very useful, even in single t

[PATCH v4 08/22] sg: speed sg_poll and sg_get_num_waiting

2019-08-28 Thread Douglas Gilbert
Track the number of submitted and waiting (for read/receive) requests on each file descriptor with two atomic integers. This speeds sg_poll() and ioctl(SG_GET_NUM_WAITING) which are oft used with the asynchronous (non-blocking) interfaces. Reviewed-by: Hannes Reinecke Signed-off-by: Douglas Gilbe

[PATCH v4 10/22] sg: remove access_ok functions

2019-08-28 Thread Douglas Gilbert
Since access_ok() has lost it direction (3rd) parameter there seems to be no benefit in calling access_ok() before __copy_{to|from}_user(). Simplify code by using the variant of these functions that do not start with "__". Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 85 +++

[PATCH v4 05/22] sg: bitops in sg_device

2019-08-28 Thread Douglas Gilbert
Introduce bitops in sg_device to replace an atomic, a bool and a char. That char (sgdebug) had been reduced to only two states. Add some associated macros to make the code a little clearer. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 104 +++---

[PATCH v4 02/22] sg: remove typedefs, type+formatting cleanup

2019-08-28 Thread Douglas Gilbert
Typedefs for structure types are discouraged so those structures that are private to the driver have had their typedefs removed. This also means that most "camel" type variable names (i.e. mixed case) have been removed. Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by:

[PATCH v4 19/22] sg: move procfs objects to avoid forward decls

2019-08-28 Thread Douglas Gilbert
Move the procfs related file_operations and seq_operations definitions toward the end of the source file to minimize the need for foward declarations of the functions they name. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 133 +- 1 file chan

[PATCH v4 21/22] sg: warn v3 write system call users

2019-08-28 Thread Douglas Gilbert
Should generate one log message per kernel run when the write() system call is used with the sg interface version 3. Due to security concerns suggest that they use ioctl(SG_SUBMIT_v3) instead. Sg interface version 1 or 2 based code may also be calling write() in this context. There is no easy solu

[PATCH v4 04/22] sg: rework sg_poll(), minor changes

2019-08-28 Thread Douglas Gilbert
Re-arrange code in sg_poll(). Rename sg_read_oxfer() to sg_rd_append(). In sg_start_req() rename rw to r0w. Plus associated changes demanded by checkpatch.pl Reviewed-by: Hannes Reinecke Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 65 ++- 1

[PATCH v4 06/22] sg: make open count an atomic

2019-08-28 Thread Douglas Gilbert
Convert sg_device::open_cnt into an atomic. Also rename sg_tablesize into the more descriptive max_sgat_elems. Reviewed-by: Hannes Reinecke Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 39 --- 1 file changed, 20 insertions(+), 19 deletions(-) diff