linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 v9 00/40] sg: add v4 interface
Date: Tue, 21 Apr 2020 17:52:18 -0400	[thread overview]
Message-ID: <20200421215258.14348-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. See:
    http://sg.danny.cz/sg/sg_v40.html
for more details.

This patchset is against Martin Petersen's 5.8/scsi-queue branch.
There are some fixes for the original sg driver that are working
their way through various lk 5.7.* and earlier trees that may
upset this patchset. All those fixes (and several others) are
already fixed in this series.

Changes since v8 (sent to linux-scsi list on 20200301)
  - add new patch to ignore the /proc/scsi/sg/allow_dio setting.
    Now direct IO will be attempted whenever the SG_FLAG_DIRECT_IO
    flag is given
  - add new patch to track mmap_sz from previous mmap() call.
    Allows catching mmap-ed requests that exceed that value
  - change warning about using the v3 interface with the write()
    system call from WARN_ONCE() to pr_warn_once()
  - remove __KERNEL__ conditionals in include/scsi/sg.h
  - change struct sg_fd::start_ns from u64 to ktime_t type
  - introduce a new small sg_rq_state_mul2arr array to avoid
    a multiplication at runtime in the state machine engine
  - tweak mempool introduced in v7 for sense buffers
  - rework sg_mk_sgat() to better handle low memory situations;
    similar work on sg_remove_sgat_helper()

Changes since v7 (sent to linux-scsi list on 20200227)
  - improve direct IO code, remove the SG_FRQ_DIO_IN_USE
    sg_request::frq_bm flag as it is no longer needed
  - simplify state changing code. Many state changes (rq_st) do not
    need changes to the xarray "marks"; only lock those that do
    (reviewer queried the locking)
  - remove some misplaced likely()/unlikely() macros. They are gathered
    together in a separate patch (in a second patchset)
  - change a cast that the kbuild robot complained about. It also
    flagged a stack size problem in sg_ioctl_common() for reasons not
    given nor obvious. That function (and its parents) declare only
    simple scalars on the stack.
  - add 'Reviewed-by' where appropriate

Changes since v6 (sent to linux-scsi list on 20200112)
  - based on Martin Petersen's 5.7/scsi-queue branch in his
    linux-scsi repository
  - major work on mmap support: when mmap(2) is used the reserve
    request scatter gather list is rebuilt to have order=0
    elements (i.e. each is PAGE_SIZE bytes).
  - address one kbuild robot issue: add include defining size_t
  - nearly all patches that have been reviewed have been changed,
    usually in minor ways. Those patches have "***" before the
    "Reviewed-by" line.

Changes since v5 (sent to linux-scsi list on 20191008)
  - replace linked lists with xarray mechanism
  - use the locking in the xarray implementation to
    replace several discrete locks
  - some patches that were previously reviewed by
    Hannes Reinecke have had small changes made to
    them usually associated with xarrays. Those have
    been marked with "***" prepended to the
    "Reviewed-by" line
  - bump the driver version number to 4.0.08

Changes since v4 (sent to linux-scsi list on 20190829)
  - remove much of the logic in the previous patchset
    series from and including:
        [PATCH v4 11/22] sg: replace rq array with lists
    to
        [PATCH v4 22/22] sg: bump version to 4.0.03
  - bump the driver version number from 3.5.36 to 3.9.01
    [20190606] reflecting that the v4 interface has not
    been implemented (in this patchset)
  - patches 13/23 through to 22/23 reduce the complexity
    of "[PATCH v4 11/22] sg: replace rq array with lists"
    measured in KiloBytes from about 130 KB to 80 KB.
  - various changes suggested by reviewers of the v4
    patchset have been implemented
  - change all %p descriptors (mainly in SG_LOG() macros)
    to %pK so that the debug output remains useful in
    recent kernels. Evidently sys admins can selectively
    turn on pointer obfuscation on %pK as required on
    secure systems.

Changes since v3 (sent to linux-scsi list on 20190807):
  - move __must_hold attributes into separate patch
  - move procfs and debugfs file scope definitions toward
    the end of sg.c to avoid forward declarations
  - move module_param* and MODULE_* macros to end of sg.c
  - expand debugfs support with snapshot_devs which allows
    filtering of snapshot output by sg device(s)
  - add a WARN_ONCE when write(2) is used with the sg v3
    interface. Suggest using SG_IOSUBMIT_V3 instead.
  - address more of the review comments from Hannes Reinecke
    and Christoph Hellwig
  - add various reviewed-by tags where appropriate

Changes since v2 (sent to linux-scsi list on 20190727):
  - address issues "Reported-by: kbuild test robot <lkp@intel.com>".
    The main one was to change the bsg header included to:
    include/uapi/linux/bsg.h rather than include/linux/bsg.h
  - address some of the review comments from Hannes Reinecke;
    email responses have been sent for review comments that
    did not result in code changes

Changes since v1 (sent to linux-scsi list on 20190616):
  - change ktime_get_boot_ns() to ktime_get_boottime_ns() to reflect
    kernel API change first seen in lk 5.3.0-rc1

Douglas Gilbert (40):
  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 lists
  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: bump version to 4.0.09

 drivers/scsi/sg.c      | 5183 +++++++++++++++++++++++++++-------------
 include/scsi/sg.h      |  273 +--
 include/uapi/scsi/sg.h |  374 +++
 3 files changed, 3917 insertions(+), 1913 deletions(-)
 create mode 100644 include/uapi/scsi/sg.h

-- 
2.26.1


             reply	other threads:[~2020-04-21 21:53 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 21:52 Douglas Gilbert [this message]
2020-04-21 21:52 ` [PATCH v9 01/40] sg: move functions around Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 02/40] sg: remove typedefs, type+formatting cleanup Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 03/40] sg: sg_log and is_enabled Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 04/40] sg: rework sg_poll(), minor changes Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 05/40] sg: bitops in sg_device Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 06/40] sg: make open count an atomic Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 07/40] sg: move header to uapi section Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 08/40] sg: speed sg_poll and sg_get_num_waiting Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 09/40] sg: sg_allow_if_err_recovery and renames Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 10/40] sg: improve naming Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 11/40] sg: change rwlock to spinlock Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 12/40] sg: ioctl handling Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 13/40] sg: split sg_read Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 14/40] sg: sg_common_write add structure for arguments Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 15/40] sg: rework sg_vma_fault Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 16/40] sg: rework sg_mmap Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 17/40] sg: replace sg_allow_access Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 18/40] sg: rework scatter gather handling Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 19/40] sg: introduce request state machine Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 20/40] sg: sg_find_srp_by_id Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 21/40] sg: sg_fill_request_element Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 22/40] sg: printk change %p to %pK Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 23/40] sg: xarray for fds in device Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 24/40] sg: xarray for reqs in fd Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 25/40] sg: replace rq array with lists Douglas Gilbert
2020-04-24 15:21   ` kbuild test robot
2020-04-21 21:52 ` [PATCH v9 26/40] sg: sense buffer rework Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 27/40] sg: add sg v4 interface support Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 28/40] sg: rework debug info Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 29/40] sg: add 8 byte SCSI LUN to sg_scsi_id Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 30/40] sg: expand sg_comm_wr_t Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 31/40] sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 32/40] sg: add some __must_hold macros Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 33/40] sg: move procfs objects to avoid forward decls Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 34/40] sg: protect multiple receivers Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 35/40] sg: first debugfs support Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 36/40] sg: rework mmap support Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 37/40] sg: defang allow_dio Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 38/40] sg: warn v3 write system call users Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 39/40] sg: add mmap_sz tracking Douglas Gilbert
2020-04-21 21:52 ` [PATCH v9 40/40] sg: bump version to 4.0.09 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=20200421215258.14348-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;
as well as URLs for NNTP newsgroup(s).