From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, jejb@linux.vnet.ibm.com, hare@suse.de
Subject: [PATCH v17 00/45] sg: add v4 interface
Date: Wed, 7 Apr 2021 21:44:46 -0400 [thread overview]
Message-ID: <20210408014531.248890-1-dgilbert@interlog.com> (raw)
This patchset is the first stage of a two stage rewrite of the scsi
generic (sg) driver. The main goal of the first stage is to introduce
the sg v4 interface that uses 'struct sg_io_v4' as well as keeping and
modernizing the sg v3 interface (based on 'struct sg_io_hdr'). The
async interface formerly requiring the use of write() and read()
system calls now have ioctl(SG_IOSUBMIT) and ioctl(SG_IORECEIVE)
replacements.
After a two day outing in the 5.13/scsi-staging branch various
Coverity and one KASAN reports highlighted issued that needed to
be addressed. That has now been done plus ongoing testing.
A recent patch to fio allows its sg engine to issue iopoll requests
by using hipri=1 in the fio script. When testing sg device nodes
with fio this option must be set: direct=0. The sync option may
be set to 0 (use sg's write/read async interface) or 1 (uses
ioctl(SG_IO) interface).
For documentation see:
http://sg.danny.cz/sg/sg_v40.html
for more details. If accessing http pages is a problem, a temporary
rendering of this page can be found here:
https://doug-gilbert.github.io/sg_v40.html
This patchset is against Martin Petersen's 5.13/scsi-queue branch.
Changes since v16 (sent to linux-scsi list on 20210208)
- sg_start_req() fix double free on error path [KASAN]
- sg_rq_map_kern() fix uninitialized variable [coverity]
- sg_add_sfp() fix use after free [coverity]
- sg_remove_sfp_usercontext(): remove pointless NULL check [coverity]
- fix misuse of WARN_ONCE in sg_rq_end_io_usercontext() [D. Carpenter]
- remove unused error checks: tracking blk_put_request() calls and
multiple SG_XA_RQ_FREE calls
- hipri: as blk_poll() can return > 0 for requests other than the one
that is being checked for, need to re-check that request is ready
- rebased on MKP's 5.13/scsi-queue
Changes since v15 (sent to linux-scsi list on 20210125)
- tweak state machine which sets INFLIGHT state _before_
blk_execute_rq_nowait() is called. Add a bit flag that indicates
the logic flow has returned from that call. This guards against
blk_poll() being called before the block layer has really
launched the request.
- fix bug clearing SG_FFD_HIPRI_SEEN bit as
atomic_dec_and_test() returns true when the post-decrement value
is zero, the opposite of what a C conditional does.
Changes since v14 (sent to linux-scsi list on 20210124)
- two fixes based on report from Dan Carpenter and kernel test
robot
- fix Johannes Thumshirn's email address
- separate patch issued on fio to add 'hipri' option to its sg
engine. Enables fio to test new sg driver blk_poll() support
Changes since v13 (sent to linux-scsi list on 20210113)
- fix obscure compile error reported by "kernel test robot
<lkp@intel.com>"
- harden code around blk_poll() invocation; needed based on
fio testing
- remove SG_FFD_MMAP_CALLED bit code after Hannes Reinecke pointed
out it was redundant
Changes since v12 (sent to linux-scsi list on 20201115)
- add blk_poll() support, prefix that patch's subject with 'RFC'
Changes since v11 (sent to linux-scsi list on 20201014)
- no author originated changes since v11
- port from lk 5.9.0-rc1 to lk 5.10.0-rc1 picks up a change to
the import_iovec() which requires a change to patch 25/44
- only publish this cover letter and v12 of patch 25/44 to
the linux-scsi list. The other 43 patches remain as published
on 20201014.
Changes since v10 (sent to linux-scsi list on 20200823)
- unchanged: 0001 to 0009, 0010 to 0017
- rename sg_add_req() to sg_setup_req() [0010]
- patches 40,41,42 and 43 are new, see their commit messages
- remove SG_RS_RCV_DONE request state leaving 3.5 states
[the 0.5 state is SG_RS_BUSY]
- rework sg_rq_chg_state() code that enforces request
state changes and associated xarray marks
- track lowest used and unused indexes in the request arrays so
iterations over the request xarray are efficient. This is a
significant saving when the iodepth queue length is large
Changes since v9 (sent to linux-scsi list on 20200421)
- rebase on MKP's 5.10/scsi-queue branch
- remove some master/slave terminology that had bled in from
the part 2 patchset
- change sg_request::start_ns type from ktime_t to u64
- pick up several error path correction fixes applied to the
sg driver by other authors
Changes since v8 to v1 in earlier patchsets
- see: the v10 patchset sent to linux-scsi on 20200823
Douglas Gilbert (45):
sg: move functions around
sg: remove typedefs, type+formatting cleanup
sg: sg_log and is_enabled
sg: rework sg_poll(), minor changes
sg: bitops in sg_device
sg: make open count an atomic
sg: move header to uapi section
sg: speed sg_poll and sg_get_num_waiting
sg: sg_allow_if_err_recovery and renames
sg: improve naming
sg: change rwlock to spinlock
sg: ioctl handling
sg: split sg_read
sg: sg_common_write add structure for arguments
sg: rework sg_vma_fault
sg: rework sg_mmap
sg: replace sg_allow_access
sg: rework scatter gather handling
sg: introduce request state machine
sg: sg_find_srp_by_id
sg: sg_fill_request_element
sg: printk change %p to %pK
sg: xarray for fds in device
sg: xarray for reqs in fd
sg: replace rq array with xarray
sg: sense buffer rework
sg: add sg v4 interface support
sg: rework debug info
sg: add 8 byte SCSI LUN to sg_scsi_id
sg: expand sg_comm_wr_t
sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls
sg: add some __must_hold macros
sg: move procfs objects to avoid forward decls
sg: protect multiple receivers
sg: first debugfs support
sg: rework mmap support
sg: defang allow_dio
sg: warn v3 write system call users
sg: add mmap_sz tracking
sg: remove rcv_done request state
sg: track lowest inactive and await indexes
sg: remove unit attention check for device changed
sg: no_dxfer: move to/from kernel buffers
sg: add blk_poll support
sg: bump version to 4.0.12
drivers/scsi/sg.c | 5395 +++++++++++++++++++++++++++-------------
include/scsi/sg.h | 273 +-
include/uapi/scsi/sg.h | 375 +++
3 files changed, 4107 insertions(+), 1936 deletions(-)
create mode 100644 include/uapi/scsi/sg.h
--
2.25.1
next reply other threads:[~2021-04-08 1:45 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 1:44 Douglas Gilbert [this message]
2021-04-08 1:44 ` [PATCH v17 01/45] sg: move functions around Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 02/45] sg: remove typedefs, type+formatting cleanup Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 03/45] sg: sg_log and is_enabled Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 04/45] sg: rework sg_poll(), minor changes Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 05/45] sg: bitops in sg_device Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 06/45] sg: make open count an atomic Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 07/45] sg: move header to uapi section Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 08/45] sg: speed sg_poll and sg_get_num_waiting Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 09/45] sg: sg_allow_if_err_recovery and renames Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 10/45] sg: improve naming Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 11/45] sg: change rwlock to spinlock Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 12/45] sg: ioctl handling Douglas Gilbert
2021-04-08 1:44 ` [PATCH v17 13/45] sg: split sg_read Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 14/45] sg: sg_common_write add structure for arguments Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 15/45] sg: rework sg_vma_fault Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 16/45] sg: rework sg_mmap Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 17/45] sg: replace sg_allow_access Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 18/45] sg: rework scatter gather handling Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 19/45] sg: introduce request state machine Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 20/45] sg: sg_find_srp_by_id Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 21/45] sg: sg_fill_request_element Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 22/45] sg: printk change %p to %pK Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 23/45] sg: xarray for fds in device Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 24/45] sg: xarray for reqs in fd Douglas Gilbert
2021-04-08 8:05 ` Hannes Reinecke
2021-04-08 1:45 ` [PATCH v17 25/45] sg: replace rq array with xarray Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 26/45] sg: sense buffer rework Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 27/45] sg: add sg v4 interface support Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 28/45] sg: rework debug info Douglas Gilbert
2021-04-08 8:06 ` Hannes Reinecke
2021-04-08 1:45 ` [PATCH v17 29/45] sg: add 8 byte SCSI LUN to sg_scsi_id Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 30/45] sg: expand sg_comm_wr_t Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 31/45] sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 32/45] sg: add some __must_hold macros Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 33/45] sg: move procfs objects to avoid forward decls Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 34/45] sg: protect multiple receivers Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 35/45] sg: first debugfs support Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 36/45] sg: rework mmap support Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 37/45] sg: defang allow_dio Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 38/45] sg: warn v3 write system call users Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 39/45] sg: add mmap_sz tracking Douglas Gilbert
2021-04-08 8:07 ` Hannes Reinecke
2021-04-08 1:45 ` [PATCH v17 40/45] sg: remove rcv_done request state Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 41/45] sg: track lowest inactive and await indexes Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 42/45] sg: remove unit attention check for device changed Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 43/45] sg: no_dxfer: move to/from kernel buffers Douglas Gilbert
2021-04-08 8:07 ` Hannes Reinecke
2021-04-08 1:45 ` [PATCH v17 44/45] sg: add blk_poll support Douglas Gilbert
2021-04-08 8:14 ` Hannes Reinecke
2021-04-08 16:28 ` Douglas Gilbert
2021-04-09 6:00 ` Douglas Gilbert
2021-04-08 1:45 ` [PATCH v17 45/45] sg: bump version to 4.0.12 Douglas Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210408014531.248890-1-dgilbert@interlog.com \
--to=dgilbert@interlog.com \
--cc=hare@suse.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox