28 Aug, 2019

1 commit

  • Move ASPM definitions and function prototypes from include/linux/pci-aspm.h
    to include/linux/pci.h so users only need to include :

    PCIE_LINK_STATE_L0S
    PCIE_LINK_STATE_L1
    PCIE_LINK_STATE_CLKPM
    pci_disable_link_state()
    pci_disable_link_state_locked()
    pcie_no_aspm()

    No functional changes intended.

    Link: https://lore.kernel.org/r/20190827095620.11213-1-kw@linux.com
    Signed-off-by: Krzysztof Wilczynski
    Signed-off-by: Bjorn Helgaas

    Krzysztof Wilczynski
     

21 May, 2019

2 commits

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 or at your option any
    later version this program is distributed in the hope that it will
    be useful but without any warranty without even the implied warranty
    of merchantability or fitness for a particular purpose see the gnu
    general public license for more details you should have received a
    copy of the gnu general public license along with this program see
    the file copying if not write to the free software foundation 675
    mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 52 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Jilayne Lovejoy
    Reviewed-by: Steve Winslow
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190519154042.342335923@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Add SPDX license identifiers to all Make/Kconfig files which:

    - Have no license information of any form

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

26 Mar, 2019

1 commit


17 Mar, 2019

1 commit

  • Pull more SCSI updates from James Bottomley:
    "This is the final round of mostly small fixes and performance
    improvements to our initial submit.

    The main regression fix is the ia64 simscsi build failure which was
    missed in the serial number elimination conversion"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (24 commits)
    scsi: ia64: simscsi: use request tag instead of serial_number
    scsi: aacraid: Fix performance issue on logical drives
    scsi: lpfc: Fix error codes in lpfc_sli4_pci_mem_setup()
    scsi: libiscsi: Hold back_lock when calling iscsi_complete_task
    scsi: hisi_sas: Change SERDES_CFG init value to increase reliability of HiLink
    scsi: hisi_sas: Send HARD RESET to clear the previous affiliation of STP target port
    scsi: hisi_sas: Set PHY linkrate when disconnected
    scsi: hisi_sas: print PHY RX errors count for later revision of v3 hw
    scsi: hisi_sas: Fix a timeout race of driver internal and SMP IO
    scsi: hisi_sas: Change return variable type in phy_up_v3_hw()
    scsi: qla2xxx: check for kstrtol() failure
    scsi: lpfc: fix 32-bit format string warning
    scsi: lpfc: fix unused variable warning
    scsi: target: tcmu: Switch to bitmap_zalloc()
    scsi: libiscsi: fall back to sendmsg for slab pages
    scsi: qla2xxx: avoid printf format warning
    scsi: lpfc: resolve static checker warning in lpfc_sli4_hba_unset
    scsi: lpfc: Correct __lpfc_sli_issue_iocb_s4 lockdep check
    scsi: ufs: hisi: fix ufs_hba_variant_ops passing
    scsi: qla2xxx: Fix panic in qla_dfs_tgt_counters_show
    ...

    Linus Torvalds
     

14 Mar, 2019

1 commit

  • Fix performance issue where the queue depth for SmartIOC logical volumes is
    set to 1, and allow the usual logical volume code to be executed

    Fixes: a052865fe287 (aacraid: Set correct Queue Depth for HBA1000 RAW disks)
    Cc: stable@vger.kernel.org
    Signed-off-by: Sagar Biradar
    Reviewed-by: Dave Carroll
    Signed-off-by: Martin K. Petersen

    Sagar Biradar
     

10 Mar, 2019

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly update of the usual drivers: arcmsr, qla2xxx, lpfc,
    hisi_sas, target/iscsi and target/core.

    Additionally Christoph refactored gdth as part of the dma changes. The
    major mid-layer change this time is the removal of bidi commands and
    with them the whole of the osd/exofs driver and filesystem. This is a
    major simplification for block and mq in particular"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (240 commits)
    scsi: cxgb4i: validate tcp sequence number only if chip version pf
    scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c
    scsi: mpt3sas: Add missing breaks in switch statements
    scsi: aacraid: Fix missing break in switch statement
    scsi: kill command serial number
    scsi: csiostor: drop serial_number usage
    scsi: mvumi: use request tag instead of serial_number
    scsi: dpt_i2o: remove serial number usage
    scsi: st: osst: Remove negative constant left-shifts
    scsi: ufs-bsg: Allow reading descriptors
    scsi: ufs: Allow reading descriptor via raw upiu
    scsi: ufs-bsg: Change the calling convention for write descriptor
    scsi: ufs: Remove unused device quirks
    Revert "scsi: ufs: disable vccq if it's not needed by UFS device"
    scsi: megaraid_sas: Remove a bunch of set but not used variables
    scsi: clean obsolete return values of eh_timed_out
    scsi: sd: Optimal I/O size should be a multiple of physical block size
    scsi: MAINTAINERS: SCSI initiator and target tweaks
    scsi: fcoe: make use of fip_mode enum complete
    ...

    Linus Torvalds
     

27 Feb, 2019

1 commit


09 Feb, 2019

1 commit

  • Clang warns several times in the scsi subsystem (trimmed for brevity):

    drivers/scsi/hpsa.c:6209:7: warning: overflow converting case value to
    switch condition type (2147762695 to 18446744071562347015) [-Wswitch]
    case CCISS_GETBUSTYPES:
    ^
    drivers/scsi/hpsa.c:6208:7: warning: overflow converting case value to
    switch condition type (2147762694 to 18446744071562347014) [-Wswitch]
    case CCISS_GETHEARTBEAT:
    ^

    The root cause is that the _IOC macro can generate really large numbers,
    which don't fit into type 'int', which is used for the cmd parameter in
    the ioctls in scsi_host_template. My research into how GCC and Clang are
    handling this at a low level didn't prove fruitful. However, looking at
    the rest of the kernel tree, all ioctls use an 'unsigned int' for the
    cmd parameter, which will fit all of the _IOC values in the scsi/ata
    subsystems.

    Make that change because none of the ioctls expect a negative value for
    any command, it brings the ioctls inline with the reset of the kernel,
    and it removes ambiguity, which is never good when dealing with compilers.

    Link: https://github.com/ClangBuiltLinux/linux/issues/85
    Link: https://github.com/ClangBuiltLinux/linux/issues/154
    Link: https://github.com/ClangBuiltLinux/linux/issues/157
    Signed-off-by: Nathan Chancellor
    Acked-by: Bradley Grove
    Acked-by: Don Brace
    Reviewed-by: Bart Van Assche
    Tested-by: Nick Desaulniers
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Nathan Chancellor
     

05 Feb, 2019

1 commit


29 Jan, 2019

1 commit

  • I was able to build without these extra header search paths.

    Especially, the header search path -I. in kernel Makefiles is always
    suspicious; it allows the compiler to search for headers in the top of
    $(srctree), where obviously no header file exists.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Martin K. Petersen

    Masahiro Yamada
     

23 Jan, 2019

1 commit

  • When a host driver sets a maximum segment size we should not only propagate
    that setting to the block layer, which can merge segments, but also to the
    DMA mapping layer which can merge segments as well.

    Fixes: 50c2e9107f ("scsi: introduce a max_segment_size host_template parameters")
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

19 Dec, 2018

1 commit

  • Most SCSI drivers want to enable "clustering", that is merging of
    segments so that they might span more than a single page. Remove the
    ENABLE_CLUSTERING define, and require drivers to explicitly set
    DISABLE_CLUSTERING to disable this feature.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

13 Dec, 2018

2 commits


29 Nov, 2018

2 commits


25 Oct, 2018

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly updates of the usual drivers: UFS, esp_scsi, NCR5380,
    qla2xxx, lpfc, libsas, hisi_sas.

    In addition there's a set of mostly small updates to the target
    subsystem a set of conversions to the generic DMA API, which do have
    some potential for issues in the older drivers but we'll handle those
    as case by case fixes.

    A new myrs driver for the DAC960/mylex raid controllers to replace the
    block based DAC960 which is also being removed by Jens in this merge
    window.

    Plus the usual slew of trivial changes"

    [ "myrs" stands for "MYlex Raid Scsi". Obviously. Silly of me to even
    wonder. There's also a "myrb" driver, where the 'b' stands for
    'block'. Truly, somebody has got mad naming skillz. - Linus ]

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (237 commits)
    scsi: myrs: Fix the processor absent message in processor_show()
    scsi: myrs: Fix a logical vs bitwise bug
    scsi: hisi_sas: Fix NULL pointer dereference
    scsi: myrs: fix build failure on 32 bit
    scsi: fnic: replace gross legacy tag hack with blk-mq hack
    scsi: mesh: switch to generic DMA API
    scsi: ips: switch to generic DMA API
    scsi: smartpqi: fully convert to the generic DMA API
    scsi: vmw_pscsi: switch to generic DMA API
    scsi: snic: switch to generic DMA API
    scsi: qla4xxx: fully convert to the generic DMA API
    scsi: qla2xxx: fully convert to the generic DMA API
    scsi: qla1280: switch to generic DMA API
    scsi: qedi: fully convert to the generic DMA API
    scsi: qedf: fully convert to the generic DMA API
    scsi: pm8001: switch to generic DMA API
    scsi: nsp32: switch to generic DMA API
    scsi: mvsas: fully convert to the generic DMA API
    scsi: mvumi: switch to generic DMA API
    scsi: mpt3sas: switch to generic DMA API
    ...

    Linus Torvalds
     

21 Oct, 2018

1 commit

  • - Remove unused Netronome NFP32xx Device IDs (Jakub Kicinski)

    - Use bitmap_zalloc() for dma_alias_mask (Andy Shevchenko)

    - Add switch fall-through annotations (Gustavo A. R. Silva)

    - Remove unused Switchtec quirk variable (Joshua Abraham)

    - Fix pci.c kernel-doc warning (Randy Dunlap)

    - Remove trivial PCI wrappers for DMA APIs (Christoph Hellwig)

    - Add Intel GPU device IDs to spurious interrupt quirk (Bin Meng)

    - Run Switchtec DMA aliasing quirk only on NTB endpoints to avoid useless
    dmesg errors (Logan Gunthorpe)

    - Update Switchtec NTB documentation (Wesley Yung)

    - Remove redundant "default n" from Kconfig (Bartlomiej Zolnierkiewicz)

    * pci/misc:
    PCI: pcie: Remove redundant 'default n' from Kconfig
    NTB: switchtec_ntb: Update switchtec documentation with prerequisites for NTB
    PCI: Fix Switchtec DMA aliasing quirk dmesg noise
    PCI: Add macro for Switchtec quirk declarations
    PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk
    PCI: Remove pci_set_dma_max_seg_size()
    PCI: Remove pci_set_dma_seg_boundary()
    PCI: Remove pci_unmap_addr() wrappers for DMA API
    PCI / ACPI: Mark expected switch fall-through
    PCI: Remove set but unused variable
    PCI: Fix pci.c kernel-doc parameter warning
    PCI: Allocate dma_alias_mask with bitmap_zalloc()
    PCI: Remove unused NFP32xx IDs

    Bjorn Helgaas
     

11 Oct, 2018

1 commit


03 Oct, 2018

1 commit

  • After bfcb79fca19d ("PCI/ERR: Run error recovery callbacks for all affected
    devices"), AER errors are always cleared by the PCI core and drivers don't
    need to do it themselves.

    Remove calls to pci_cleanup_aer_uncorrect_error_status() from device
    driver error recovery functions.

    Signed-off-by: Oza Pawandeep
    [bhelgaas: changelog, remove PCI core changes, remove unused variables]
    Signed-off-by: Bjorn Helgaas

    Oza Pawandeep
     

30 Aug, 2018

1 commit

  • Variables dev and cpu are not being used and are redundant and hence can
    be removed.

    Cleans up clang warnings:
    warning: variable 'dev' set but not used [-Wunused-but-set-variable]
    warning: variable 'cpu' set but not used [-Wunused-but-set-variable]

    Signed-off-by: Colin Ian King
    Signed-off-by: Martin K. Petersen

    Colin Ian King
     

28 Aug, 2018

1 commit

  • The problem is that ->reset_state is a u8 but it can be set to -1 or -2 in
    aac_tmf_callback() and the error handling in aac_eh_target_reset() relies
    on it to be signed.

    [mkp: fixed typo]

    Fixes: 0d643ff3c353 ("scsi: aacraid: use aac_tmf_callback for reset fib")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Martin K. Petersen

    Dan Carpenter
     

16 Aug, 2018

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly updates to the usual drivers: mpt3sas, lpfc, qla2xxx,
    hisi_sas, smartpqi, megaraid_sas, arcmsr.

    In addition, with the continuing absence of Nic we have target updates
    for tcmu and target core (all with reviews and acks).

    The biggest observable change is going to be that we're (again) trying
    to switch to mulitqueue as the default (a user can still override the
    setting on the kernel command line).

    Other major core stuff is the removal of the remaining Microchannel
    drivers, an update of the internal timers and some reworks of
    completion and result handling"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (203 commits)
    scsi: core: use blk_mq_run_hw_queues in scsi_kick_queue
    scsi: ufs: remove unnecessary query(DM) UPIU trace
    scsi: qla2xxx: Fix issue reported by static checker for qla2x00_els_dcmd2_sp_done()
    scsi: aacraid: Spelling fix in comment
    scsi: mpt3sas: Fix calltrace observed while running IO & reset
    scsi: aic94xx: fix an error code in aic94xx_init()
    scsi: st: remove redundant pointer STbuffer
    scsi: qla2xxx: Update driver version to 10.00.00.08-k
    scsi: qla2xxx: Migrate NVME N2N handling into state machine
    scsi: qla2xxx: Save frame payload size from ICB
    scsi: qla2xxx: Fix stalled relogin
    scsi: qla2xxx: Fix race between switch cmd completion and timeout
    scsi: qla2xxx: Fix Management Server NPort handle reservation logic
    scsi: qla2xxx: Flush mailbox commands on chip reset
    scsi: qla2xxx: Fix unintended Logout
    scsi: qla2xxx: Fix session state stuck in Get Port DB
    scsi: qla2xxx: Fix redundant fc_rport registration
    scsi: qla2xxx: Silent erroneous message
    scsi: qla2xxx: Prevent sysfs access when chip is down
    scsi: qla2xxx: Add longer window for chip reset
    ...

    Linus Torvalds
     

09 Aug, 2018

1 commit


11 Jul, 2018

1 commit

  • Remove the AAC_STAT_GOOD definition and open code it in the places it was
    used.

    This will make subsequent refactoring in this area easier.

    Signed-off-by: Johannes Thumshirn
    Cc: Dave Carroll
    Cc: Raghava Aditya Renukunta
    Reviewed-by: Dave Carroll
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn
     

27 Jun, 2018

1 commit

  • The driver fails to set the correct queue depth for native devices, due to
    failing to set the device type prior to calling aac_set_safw_target_qd().
    This results in slave configure setting the queue depth to 1.

    This causes around 30% performance degradation. Fixed by setting the dev
    type before trying to set queue depth.

    Reported-by: Steve Best
    Fixes: 0bcb45fb20c21 ("scsi: aacraid: Add helper function to set queue depth")
    cc: stable@vger.kernel.org
    Signed-off-by: Raghava Aditya Renukunta
    Reviewed-by: David Carroll
    Reviewed-by: Ewan D. Milne
    Signed-off-by: Martin K. Petersen

    Raghava Aditya Renukunta
     

26 Jun, 2018

1 commit

  • get_seconds() can overflow on 32-bit architectures and is deprecated
    because of that. The use in the aacraid driver has the same problem due to
    a limited firmware interface, it also overflows in the year 2106.

    This changes all calls to get_seconds() to the non-deprecated
    ktime_get_real_seconds(), which unfortunately doesn't solve that problem
    but gets rid of one user of the deprecated interface.

    [mkp: checkpatch]

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Raghava Aditya Renukunta
    Signed-off-by: Martin K. Petersen

    Arnd Bergmann
     

14 Jun, 2018

1 commit

  • Pull SCSI fixes from James Bottomley:
    "This is a set of minor (and safe changes) that didn't make the initial
    pull request plus some bug fixes"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: qla2xxx: Mask off Scope bits in retry delay
    scsi: qla2xxx: Fix crash on qla2x00_mailbox_command
    scsi: aic7xxx: aic79xx: fix potential null pointer dereference on ahd
    scsi: mpt3sas: Add an I/O barrier
    scsi: qla2xxx: Fix setting lower transfer speed if GPSC fails
    scsi: hpsa: disable device during shutdown
    scsi: sd_zbc: Fix sd_zbc_check_zone_size() error path
    scsi: aacraid: remove bogus GFP_DMA32 specifies

    Linus Torvalds
     

13 Jun, 2018

2 commits

  • The kzalloc() function has a 2-factor argument form, kcalloc(). This
    patch replaces cases of:

    kzalloc(a * b, gfp)

    with:
    kcalloc(a * b, gfp)

    as well as handling cases of:

    kzalloc(a * b * c, gfp)

    with:

    kzalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kzalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kzalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc
    + kcalloc
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc(sizeof(THING) * C2, ...)
    |
    kzalloc(sizeof(TYPE) * C2, ...)
    |
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(C1 * C2, ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     
  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

06 Jun, 2018

1 commit

  • For one GFP_DMA32 does not actually work with kmalloc, as we only have
    GFP_DMA and GFP_KERNEL caches, but not GFP_DMA32. Second the memory
    is mapped using the proper DMA API anyway, which would include proper
    bounce buffering if needed by the device.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

02 May, 2018

1 commit

  • commit b60710ec7d7a ("scsi: aacraid: enable sending of TMFs from
    aac_hba_send()") allows aac_hba_send() to send scsi commands, and TMF
    requests, but the existing code only updates the iu_type for scsi
    commands. For TMF requests we are sending an unknown iu_type to
    firmware, which causes a fault.

    Include iu_type prior to determining the validity of the command

    Reported-by: Noah Misner
    Fixes: b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")
    Fixes: 423400e64d377 ("aacraid: Include HBA direct interface")
    Tested-by: Noah Misner
    cc: stable@vger.kernel.org
    Signed-off-by: Dave Carroll
    Reviewed-by: Raghava Aditya Renukunta
    Reviewed-by: Brian King
    Signed-off-by: Martin K. Petersen

    Dave Carroll
     

10 Apr, 2018

1 commit

  • If a recursive IOP_RESET is invoked, usually due to the eh_thread
    handling errors after the first reset, be sure we flag that the command
    thread has been stopped to avoid an Oops of the form;

    [ 336.620256] CPU: 28 PID: 1193 Comm: scsi_eh_0 Kdump: loaded Not tainted 4.14.0-49.el7a.ppc64le #1
    [ 336.620297] task: c000003fd630b800 task.stack: c000003fd61a4000
    [ 336.620326] NIP: c000000000176794 LR: c00000000013038c CTR: c00000000024bc10
    [ 336.620361] REGS: c000003fd61a7720 TRAP: 0300 Not tainted (4.14.0-49.el7a.ppc64le)
    [ 336.620395] MSR: 9000000000009033 CR: 22084022 XER: 20040000
    [ 336.620435] CFAR: c000000000130388 DAR: 0000000000000000 DSISR: 40000000 SOFTE: 1
    [ 336.620435] GPR00: c00000000013038c c000003fd61a79a0 c0000000014c7e00 0000000000000000
    [ 336.620435] GPR04: 000000000000000c 000000000000000c 9000000000009033 0000000000000477
    [ 336.620435] GPR08: 0000000000000477 0000000000000000 0000000000000000 c008000010f7d940
    [ 336.620435] GPR12: c00000000024bc10 c000000007a33400 c0000000001708a8 c000003fe3b881d8
    [ 336.620435] GPR16: c000003fe3b88060 c000003fd61a7d10 fffffffffffff000 000000000000001e
    [ 336.620435] GPR20: 0000000000000001 c000000000ebf1a0 0000000000000001 c000003fe3b88000
    [ 336.620435] GPR24: 0000000000000003 0000000000000002 c000003fe3b88840 c000003fe3b887e8
    [ 336.620435] GPR28: c000003fe3b88000 c000003fc8181788 0000000000000000 c000003fc8181700
    [ 336.620750] NIP [c000000000176794] exit_creds+0x34/0x160
    [ 336.620775] LR [c00000000013038c] __put_task_struct+0x8c/0x1f0
    [ 336.620804] Call Trace:
    [ 336.620817] [c000003fd61a79a0] [c000003fe3b88000] 0xc000003fe3b88000 (unreliable)
    [ 336.620853] [c000003fd61a79d0] [c00000000013038c] __put_task_struct+0x8c/0x1f0
    [ 336.620889] [c000003fd61a7a00] [c000000000171418] kthread_stop+0x1e8/0x1f0
    [ 336.620922] [c000003fd61a7a40] [c008000010f7448c] aac_reset_adapter+0x14c/0x8d0 [aacraid]
    [ 336.620959] [c000003fd61a7b00] [c008000010f60174] aac_eh_host_reset+0x84/0x100 [aacraid]
    [ 336.621010] [c000003fd61a7b30] [c000000000864f24] scsi_try_host_reset+0x74/0x180
    [ 336.621046] [c000003fd61a7bb0] [c000000000867ac0] scsi_eh_ready_devs+0xc00/0x14d0
    [ 336.625165] [c000003fd61a7ca0] [c0000000008699e0] scsi_error_handler+0x550/0x730
    [ 336.632101] [c000003fd61a7dc0] [c000000000170a08] kthread+0x168/0x1b0
    [ 336.639031] [c000003fd61a7e30] [c00000000000b528] ret_from_kernel_thread+0x5c/0xb4
    [ 336.645971] Instruction dump:
    [ 336.648743] 384216a0 7c0802a6 fbe1fff8 f8010010 f821ffd1 7c7f1b78 60000000 60000000
    [ 336.657056] 39400000 e87f0838 f95f0838 7c0004ac 314affff 7d40192d 40c2fff4
    [ 336.663997] -[ end trace 4640cf8d4945ad95 ]-

    So flag when the thread is stopped by setting the thread pointer to NULL.

    Signed-off-by: Dave Carroll
    Reviewed-by: Raghava Aditya Renukunta
    Signed-off-by: Martin K. Petersen

    Dave Carroll
     

06 Apr, 2018

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly updates of the usual drivers: arcmsr, qla2xx, lpfc,
    ufs, mpt3sas, hisi_sas.

    In addition we have removed several really old drivers: sym53c416,
    NCR53c406a, fdomain, fdomain_cs and removed the old scsi_module.c
    initialization from all remaining drivers.

    Plus an assortment of bug fixes, initialization errors and other minor
    fixes"

    * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (168 commits)
    scsi: ufs: Add support for Auto-Hibernate Idle Timer
    scsi: ufs: sysfs: reworking of the rpm_lvl and spm_lvl entries
    scsi: qla2xxx: fx00 copypaste typo
    scsi: qla2xxx: fix error message on <qla2400
    scsi: smartpqi: update driver version
    scsi: smartpqi: workaround fw bug for oq deletion
    scsi: arcmsr: Change driver version to v1.40.00.05-20180309
    scsi: arcmsr: Sleep to avoid CPU stuck too long for waiting adapter ready
    scsi: arcmsr: Handle adapter removed due to thunderbolt cable disconnection.
    scsi: arcmsr: Rename ACB_F_BUS_HANG_ON to ACB_F_ADAPTER_REMOVED for adapter hot-plug
    scsi: qla2xxx: Update driver version to 10.00.00.06-k
    scsi: qla2xxx: Fix Async GPN_FT for FCP and FC-NVMe scan
    scsi: qla2xxx: Cleanup code to improve FC-NVMe error handling
    scsi: qla2xxx: Fix FC-NVMe IO abort during driver reset
    scsi: qla2xxx: Fix retry for PRLI RJT with reason of BUSY
    scsi: qla2xxx: Remove nvme_done_list
    scsi: qla2xxx: Return busy if rport going away
    scsi: qla2xxx: Fix n2n_ae flag to prevent dev_loss on PDB change
    scsi: qla2xxx: Add FC-NVMe abort processing
    scsi: qla2xxx: Add changes for devloss timeout in driver
    ...

    Linus Torvalds
     

04 Apr, 2018

1 commit

  • Somewhat nasty merge due to conflicts between "33b28357dd00 scsi:
    qla2xxx: Fix Async GPN_FT for FCP and FC-NVMe scan" and "2b5b96473efc
    scsi: qla2xxx: Fix FC-NVMe LUN discovery"

    Merge is non-trivial and has been verified by Qlogic (Cavium)

    Signed-off-by: James E.J. Bottomley

    James Bottomley
     

27 Mar, 2018

1 commit


24 Feb, 2018

1 commit

  • Pull SCSI fixes from James Bottomley:
    "These are mostly fixes for problems with merge window code.

    In addition we have one doc update (alua) and two dead code removals
    (aiclib and octogon) a spurious assignment removal (csiostor) and a
    performance improvement for storvsc involving better interrupt
    spreading and increasing the command per lun handling"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: qla4xxx: skip error recovery in case of register disconnect.
    scsi: aacraid: fix shutdown crash when init fails
    scsi: qedi: Cleanup local str variable
    scsi: qedi: Fix truncation of CHAP name and secret
    scsi: qla2xxx: Fix incorrect handle for abort IOCB
    scsi: qla2xxx: Fix double free bug after firmware timeout
    scsi: storvsc: Increase cmd_per_lun for higher speed devices
    scsi: qla2xxx: Fix a locking imbalance in qlt_24xx_handle_els()
    scsi: scsi_dh: Document alua_rtpg_queue() arguments
    scsi: Remove Makefile entry for oktagon files
    scsi: aic7xxx: remove aiclib.c
    scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()
    scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo()
    scsi: sym53c8xx_2: iterator underflow in sym_getsync()
    scsi: bnx2fc: Fix check in SCSI completion handler for timed out request
    scsi: csiostor: remove redundant assignment to pointer 'ln'
    scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
    scsi: ibmvfc: fix misdefined reserved field in ibmvfc_fcp_rsp_info
    scsi: qla2xxx: Fix memory corruption during hba reset test
    scsi: mpt3sas: fix an out of bound write

    Linus Torvalds
     

14 Feb, 2018

2 commits