Re: [RFC v2 01/11] OPP: Don't overwrite rounded clk rate

2019-06-16 Thread Viresh Kumar
On 14-06-19, 10:57, Viresh Kumar wrote: > Hmm, so this patch won't break anything and I am inclined to apply it again :) > > Does anyone see any other issues with it, which I might be missing ? I have updated the commit log a bit more to clarify on things, please let me know if it looks okay.

[PATCH 14/18] sg: rework debug info

2019-06-16 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 18/18] sg: bump version to 4.0.03

2019-06-16 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 12/18] sg: sense buffer rework

2019-06-16 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 09/18] sg: sg_allow_if_err_recovery and renames

2019-06-16 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 . Signed-off-by: Douglas Gilbert --- drivers/sc

[PATCH 03/18] sg: sg_log and is_enabled

2019-06-16 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 11/18] sg: replace rq array with lists

2019-06-16 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 15/18] sg: add 8 byte SCSI LUN to sg_scsi_id

2019-06-16 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 05/18] sg: bitops in sg_device

2019-06-16 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 16/18] sg: expand sg_comm_wr_t

2019-06-16 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 07/18] sg: move header to uapi section

2019-06-16 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. Signed-off-by: Douglas Gilbert --- include/scsi/sg.h | 268 ++--- include/uapi

[PATCH 00/18] sg: add v4 interface

2019-06-16 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 an ioctl() 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.danny.cz/sg/sg_v40

[PATCH 10/18] sg: remove most access_ok functions

2019-06-16 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 | 50 +++

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

2019-06-16 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 17/18] sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls

2019-06-16 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 08/18] sg: speed sg_poll and sg_get_num_waiting

2019-06-16 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. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 5

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

2019-06-16 Thread Douglas Gilbert
Convert sg_device::open_cnt into an atomic. Also rename sg_tablesize into the more descriptive max_sgat_elems. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 39 --- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/sg.c b/dr

[PATCH 01/18] sg: move functions around

2019-06-16 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 04/18] sg: rework sg_poll(), minor changes

2019-06-16 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 Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 65 ++- 1 file changed, 30 insertions(+

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

2019-06-16 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. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 394

Re: [PATCH V4 11/16] scsi: aha152x: use sg helper to operate scatterlist

2019-06-16 Thread Finn Thain
On Mon, 17 Jun 2019, Ming Lei wrote: > Use the scatterlist iterators and remove direct indexing of the > scatterlist array. > > This way allows us to pre-allocate one small scatterlist, which can be > chained with one runtime allocated scatterlist if the pre-allocated one > isn't enough for the w

[PATCH V4 14/16] scsi: ppa: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Signed-off-by: Ming Lei --- drive

[PATCH V4 16/16] NCR5380: Support chained sg lists

2019-06-16 Thread Ming Lei
From: Finn Thain My understanding is that support for chained scatterlists is to become mandatory for LLDs. Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocate

[PATCH V4 15/16] scsi: wd33c93: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Signed-off-by: Ming Lei --- drive

[PATCH V4 12/16] scsi: imm: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Signed-off-by: Ming Lei --- drive

[PATCH V4 13/16] scsi: pcmcia: nsp_cs: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Signed-off-by: Ming Lei --- drive

[PATCH V4 11/16] scsi: aha152x: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Finn added the change to replace SC

[PATCH V4 09/16] staging: rtsx: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Cc: Kim Bradley Cc: de...@driverde

[PATCH V4 10/16] s390: zfcp_fc: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Cc: Steffen Maier Cc: Benjamin Blo

[PATCH V4 08/16] staging: unisys: visorhba: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Cc: de...@driverdev.osuosl.org Cc:

[PATCH V4 07/16] usb: image: microtek: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Cc: Oliver Neukum Cc: Greg Kroah-H

[PATCH V4 06/16] scsi: pmcraid: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Signed-off-by: Ming Lei --- drive

[PATCH V4 05/16] scsi: ipr: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Signed-off-by: Ming Lei --- drive

[PATCH V4 03/16] scsi: lpfc: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Reviewed by: Ewan D. Milne Signed-

[PATCH V4 02/16] scsi: advansys: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Reviewed-by: Ewan D. Milne Signed-

[PATCH V4 01/16] scsi: vmw_pscsi: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Reviewed-by: Ewan D. Milne Signed-

[PATCH V4 04/16] scsi: mvumi: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Use the scatterlist iterators and remove direct indexing of the scatterlist array. This way allows us to pre-allocate one small scatterlist, which can be chained with one runtime allocated scatterlist if the pre-allocated one isn't enough for the whole request. Reviewed-by: Ewan D. Milne Signed-

[PATCH V4 00/16] use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
Hi, Scsi MQ makes a large static allocation for the first scatter gather list chunk for the driver to use. This is a performance headache we'd like to fix by reducing the size of the allocation to a 2 element array. Doing this will break the current guarantee that any driver using SG_ALL doesn't

[PATCH v3 4/7] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva In order to support additional features in hex_dump_to_buffer, replace the ascii bool parameter with flags. Signed-off-by: Alastair D'Silva --- drivers/gpu/drm/i915/intel_engine_cs.c| 2 +- drivers/isdn/hardware/mISDN/mISDNisar.c | 6 -- drive

[PATCH v3 3/7] lib/hexdump.c: Optionally suppress lines of repeated bytes

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva Some buffers may only be partially filled with useful data, while the rest is padded (typically with 0x00 or 0xff). This patch introduces a flag to allow the supression of lines of repeated bytes, which are replaced with '** Skipped %u bytes of value 0x%x **' An inline wr

[PATCH v3 0/7] Hexdump Enhancements

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva Apologies for the large CC list, it's a heads up for those responsible for subsystems where a prototype change in generic code causes a change in those subsystems. This series enhances hexdump. These improve the readability of the dumped data in certain situations (eg. wi

[PATCH v3 2/7] lib/hexdump.c: Relax rowsize checks in hex_dump_to_buffer

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva This patch removes the hardcoded row limits and allows for other lengths. These lengths must still be a multiple of groupsize. This allows structs that are not 16/32 bytes to display on a single line. This patch also expands the self-tests to test row sizes up to 64 bytes

[PATCH v3 1/7] lib/hexdump.c: Fix selftests

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva The overflow tests did not account for the situation where no overflow occurs and len < rowsize. This patch renames the cryptic variables and accounts for the above case. The selftests now pass. Signed-off-by: Alastair D'Silva --- lib/test_hexdump.c | 47 ++

[PATCH v3 5/7] lib/hexdump.c: Allow multiple groups to be separated by lines '|'

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva With the wider display format, it can become hard to identify how many bytes into the line you are looking at. The patch adds new flags to hex_dump_to_buffer() and print_hex_dump() to print vertical lines to separate every N groups of bytes. eg. buf:: 454d414e 434

[PATCH v3 6/7] lib/hexdump.c: Allow multiple groups to be separated by spaces

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva Similar to the previous patch, this patch separates groups by 2 spaces for the hex fields, and 1 space for the ASCII field. eg. buf:: 454d414e 43415053 4e495f45 00584544 NAMESPAC E_INDEX. buf:0010: 0002 Sign

[PATCH v3 7/7] lib/hexdump.c: Optionally retain byte ordering

2019-06-16 Thread Alastair D'Silva
From: Alastair D'Silva The behaviour of hexdump groups is to print the data out as if it was a native-endian number. This patch tweaks the documentation to make this clear, and also adds the HEXDUMP_RETAIN_BYTE_ORDER flag to allow groups of multiple bytes to be printed without affecting the orde

Re: [PATCH V3 10/15] scsi: aha152x: use sg helper to operate scatterlist

2019-06-16 Thread Ming Lei
On Fri, Jun 14, 2019 at 08:36:38PM +1000, Finn Thain wrote: > On Fri, 14 Jun 2019, Ming Lei wrote: > > > > > Follows the fixed version, could you review again? > > > > From f03484d4bac083c39d70665cfbadb641093b63de Mon Sep 17 00:00:00 2001 > > From: Ming Lei > > Date: Wed, 12 Jun 2019 20:37:35 +

Re: [PATCH 1/1] qla2xxx: move IO flush to the front of NVME rport unregistration

2019-06-16 Thread Bart Van Assche
On 6/16/19 8:05 AM, Himanshu Madhani wrote: + INIT_WORK(&sess->free_work, qlt_free_session_done); + schedule_work(&sess->free_work); Since you are touching this code and since there are multiple schedule_work() and flush_work() calls in the qla2xxx driver code for this work item:

Re: [PATCH V3 09/15] s390: zfcp_fc: use sg helper to operate scatterlist

2019-06-16 Thread Benjamin Block
On Fri, Jun 14, 2019 at 10:53:10AM +0800, Ming Lei wrote: > Use the scatterlist iterators and remove direct indexing of the > scatterlist array. > > This way allows us to pre-allocate one small scatterlist, which can be > chained with one runtime allocated scatterlist if the pre-allocated one > is

[PATCH 1/1] qla2xxx: move IO flush to the front of NVME rport unregistration

2019-06-16 Thread Himanshu Madhani
From: Quinn Tran On session deletion, current qla code would unregister an NVMe session before flushing IOs. This patch would move the unregistration of NVMe session after IO flush. This way FC-NVMe layer would not have to wait for stuck IOs. In addition, qla2xxx would stop accepting new IOs duri