27 Jul, 2018

1 commit

  • When the underlying device is a 4 KiB logical block size device with a
    protection interval exponent of 0, i.e. 4096 bytes data + 8 bytes PI, the
    driver miscalculates the pi_bytes{out,in} by a factor of 8x (64 bytes).

    This leads to errors on all reads and writes on 4 KiB logical block size
    devices when CONFIG_BLK_DEV_INTEGRITY is enabled and the
    VIRTIO_SCSI_F_T10_PI feature bit has been negotiated.

    Fixes: e6dc783a38ec0 ("virtio-scsi: Enable DIF/DIX modes in SCSI host LLD")
    Acked-by: Martin K. Petersen
    Signed-off-by: Greg Edwards
    Signed-off-by: Jens Axboe

    Greg Edwards
     

13 Jun, 2018

1 commit

  • 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
     

15 Mar, 2018

2 commits

  • Now that virtio_scsi uses blk-mq exclusively, we can remove the
    scsi_host_template and associated plumbing for the legacy I/O path.

    [mkp: commit desc]

    Cc: Omar Sandoval ,
    Cc: "Martin K. Petersen" ,
    Cc: James Bottomley ,
    Cc: Christoph Hellwig ,
    Cc: Paolo Bonzini
    Cc: Mike Snitzer
    Cc: Laurence Oberman
    Cc: Hannes Reinecke
    Signed-off-by: Ming Lei
    Suggested-by: Christoph Hellwig ,
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Ming Lei
     
  • Since commit 84676c1f21e8ff5 ("genirq/affinity: assign vectors to all
    possible CPUs") it is possible to end up in a scenario where only
    offline CPUs are mapped to an interrupt vector.

    This is only an issue for the legacy I/O path since with blk-mq/scsi-mq
    an I/O can't be submitted to a hardware queue if the queue isn't mapped
    to an online CPU.

    Fix this issue by forcing virtio-scsi to use blk-mq.

    [mkp: commit desc]

    Cc: Omar Sandoval ,
    Cc: "Martin K. Petersen" ,
    Cc: James Bottomley ,
    Cc: Christoph Hellwig ,
    Cc: Don Brace
    Cc: Kashyap Desai
    Cc: Paolo Bonzini
    Cc: Mike Snitzer
    Cc: Laurence Oberman
    Fixes: 84676c1f21e8 ("genirq/affinity: assign vectors to all possible CPUs")
    Signed-off-by: Ming Lei
    Reviewed-by: Hannes Reinecke
    Acked-by: Paolo Bonzini
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Ming Lei
     

25 Aug, 2017

1 commit

  • Since switching to blk-mq as the default in commit 5c279bd9e406
    ("scsi: default to scsi-mq"), virtio-scsi LUNs consume about 10x as
    much kernel memory.

    qemu currently allocates a fixed 128 entry virtqueue. can_queue
    currently is set to 1024. But with indirect descriptors, each command
    in the queue takes 1 virtqueue entry, so the number of commands which
    can be queued is equal to the length of the virtqueue.

    Note I intend to send a patch to qemu to allow the virtqueue size to be
    configured from the qemu command line.

    Signed-off-by: Richard W.M. Jones
    Acked-by: Paolo Bonzini
    Signed-off-by: Martin K. Petersen

    Richard W.M. Jones
     

13 Jul, 2017

1 commit


27 Jun, 2017

1 commit

  • virtio_scsi tries to do exception handling after the default 30 seconds
    timeout expires. However, it's better to let the host control the
    timeout, otherwise with a heavy I/O load it is likely that an abort will
    also timeout. This leads to fatal errors like filesystems going
    offline.

    Disable the 'sd' timeout and allow the host to do exception handling,
    following the precedent of the storvsc driver.

    Hannes has a proposal to introduce timeouts in virtio, but this provides
    an immediate solution for stable kernels too.

    [mkp: fixed typo]

    Reported-by: Douglas Miller
    Cc: "James E.J. Bottomley"
    Cc: "Martin K. Petersen"
    Cc: Hannes Reinecke
    Cc: linux-scsi@vger.kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Martin K. Petersen

    Paolo Bonzini
     

13 Jun, 2017

1 commit


11 May, 2017

1 commit

  • Pull virtio updates from Michael Tsirkin:
    "Fixes, cleanups, performance

    A bunch of changes to virtio, most affecting virtio net. Also ptr_ring
    batched zeroing - first of batching enhancements that seems ready."

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
    s390/virtio: change maintainership
    tools/virtio: fix spelling mistake: "wakeus" -> "wakeups"
    virtio_net: tidy a couple debug statements
    ptr_ring: support testing different batching sizes
    ringtest: support test specific parameters
    ptr_ring: batch ring zeroing
    virtio: virtio_driver doc
    virtio_net: don't reset twice on XDP on/off
    virtio_net: fix support for small rings
    virtio_net: reduce alignment for buffers
    virtio_net: rework mergeable buffer handling
    virtio_net: allow specifying context for rx
    virtio: allow extra context per descriptor
    tools/virtio: fix build breakage
    virtio: add context flag to find vqs
    virtio: wrap find_vqs
    ringtest: fix an assert statement

    Linus Torvalds
     

03 May, 2017

1 commit


20 Apr, 2017

1 commit

  • Passed through SCSI targets may have transfer limits which come from the
    host SCSI controller or something on the host side other than the target
    itself.

    To make this work properly, the hypervisor can adjust the target's VPD
    information to advertise these limits. But for that to work, the guest
    has to look at the VPD pages, which we won't do by default if it is an
    SPC-2 device, even if it does actually support it.

    This adds a workaround to address this, forcing devices attached to a
    virtio-scsi controller to always check the VPD pages. This is modelled
    on a similar workaround for the storvsc (Hyper-V) SCSI controller,
    although that exists for slightly different reasons.

    A specific case which causes this is a volume from IBM's IPR RAID
    controller (which presents as an SPC-2 device, although it does support
    VPD) passed through with qemu's 'scsi-block' device.

    [mkp: fixed typo]

    Signed-off-by: David Gibson
    Acked-by: Paolo Bonzini
    Signed-off-by: Martin K. Petersen

    David Gibson
     

28 Feb, 2017

2 commits

  • Use automatic IRQ affinity assignment in the virtio layer if available,
    and build the blk-mq queues based on it.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Michael S. Tsirkin

    Christoph Hellwig
     
  • Add a struct irq_affinity pointer to the find_vqs methods, which if set
    is used to tell the PCI layer to create the MSI-X vectors for our I/O
    virtqueues with the proper affinity from the start. Compared to after
    the fact affinity hints this gives us an instantly working setup and
    allows to allocate the irq descritors node-local and avoid interconnect
    traffic. Last but not least this will allow blk-mq queues are created
    based on the interrupt affinity for storage drivers.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Jason Wang
    Signed-off-by: Michael S. Tsirkin

    Christoph Hellwig
     

21 Jan, 2017

1 commit

  • In the case of a graceful set of detaches, where the virtio-scsi-ccw
    disk is removed from the guest prior to the controller, the guest
    behaves quite normally. Specifically, the detach gets us into
    sd_sync_cache to issue a Synchronize Cache(10) command, which
    immediately fails (and is retried a couple of times) because the device
    has been removed. Later, the removal of the controller sees two CRWs
    presented, but there's no further indication of the removal from the
    guest viewpoint.

    [ 17.217458] sd 0:0:0:0: [sda] Synchronizing SCSI cache
    [ 17.219257] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
    [ 21.449400] crw_info : CRW reports slct=0, oflw=0, chn=1, rsc=3, anc=0, erc=4, rsid=2
    [ 21.449406] crw_info : CRW reports slct=0, oflw=0, chn=0, rsc=3, anc=0, erc=4, rsid=0

    However, on s390, the SCSI disks can be removed "by surprise" when an
    entire controller (host) is removed and all associated disks are removed
    via the loop in scsi_forget_host. The same call to sd_sync_cache is
    made, but because the controller has already been removed, the
    Synchronize Cache(10) command is neither issued (and then failed) nor
    rejected.

    That the I/O isn't returned means the guest cannot have other devices
    added nor removed, and other tasks (such as shutdown or reboot) issued
    by the guest will not complete either. The virtio ring has already been
    marked as broken (via virtio_break_device in virtio_ccw_remove), but we
    still attempt to queue the command only to have it remain there. The
    calling sequence provides a bit of distinction for us:

    virtscsi_queuecommand()
    -> virtscsi_kick_cmd()
    -> virtscsi_add_cmd()
    -> virtqueue_add_sgs()
    -> virtqueue_add()
    if success
    return 0
    elseif vq->broken or vring_mapping_error()
    return -EIO
    else
    return -ENOSPC

    A return of ENOSPC is generally a temporary condition, so returning
    "host busy" from virtscsi_queuecommand makes sense here, to have it
    redriven in a moment or two. But the EIO return code is more of a
    permanent error and so it would be wise to return the I/O itself and
    allow the calling thread to finish gracefully. The result is these four
    kernel messages in the guest (the fourth one does not occur prior to
    this patch):

    [ 22.921562] crw_info : CRW reports slct=0, oflw=0, chn=1, rsc=3, anc=0, erc=4, rsid=2
    [ 22.921580] crw_info : CRW reports slct=0, oflw=0, chn=0, rsc=3, anc=0, erc=4, rsid=0
    [ 22.921978] sd 0:0:0:0: [sda] Synchronizing SCSI cache
    [ 22.921993] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK

    I opted to fill in the same response data that is returned from the more
    graceful device detach, where the disk device is removed prior to the
    controller device.

    Signed-off-by: Eric Farman
    Reviewed-by: Fam Zheng
    Signed-off-by: Martin K. Petersen

    Eric Farman
     

08 Oct, 2016

1 commit

  • Pull SCSI updates from James Bottomley:
    "This update includes the usual round of major driver updates (hpsa,
    be2iscsi, hisi_sas, zfcp, cxlflash). There's a new incarnation of hpsa
    called smartpqi for which a driver is added, there's some cleanup work
    of the ibm vscsi target and updates to libfc, plus a whole host of
    minor fixes and updates and finally the removal of several ISA drivers
    which seem not to have been used for years"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (173 commits)
    scsi: mvsas: Mark symbols static where possible
    scsi: pm8001: Mark symbols static where possible
    scsi: arcmsr: Simplify user_len checking
    scsi: fcoe: fix off by one in eth2fc_speed()
    scsi: dtc: remove from tree
    scsi: t128: remove from tree
    scsi: pas16: remove from tree
    scsi: u14-34f: remove from tree
    scsi: ultrastor: remove from tree
    scsi: in2000: remove from tree
    scsi: wd7000: remove from tree
    scsi: scsi_dh_alua: Fix memory leak in alua_rtpg()
    scsi: lpfc: Mark symbols static where possible
    scsi: hpsa: correct call to hpsa_do_reset
    scsi: ufs: Get a TM service response from the correct offset
    scsi: ibmvfc: Fix I/O hang when port is not mapped
    scsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up
    scsi: ipr: Remove redundant messages at adapter init time
    scsi: ipr: Don't log unnecessary 9084 error details
    scsi: smartpqi: raid bypass lba calculation fix
    ...

    Linus Torvalds
     

20 Sep, 2016

1 commit

  • Install the callbacks via the state machine. It uses the multi instance
    infrastructure of the hotplug code to handle each interface.

    virtscsi_set_affinity() is removed from virtscsi_init() because
    virtscsi_cpu_notif_add() (the function which registers the instance) is invoked
    right after it and the cpuhp_state_add_instance() functions invokes the startup
    callback on all online CPUs.

    The same thing can not be applied virtscsi_cpu_notif_remove() because
    virtscsi_remove_vqs() invokes virtscsi_set_affinity() with affinity = false as
    argument but the old CPU_DEAD state invoked the function with affinity = true
    (which does not match the DEAD callback).

    Signed-off-by: Sebastian Andrzej Siewior
    Cc: "James E.J. Bottomley"
    Cc: linux-scsi@vger.kernel.org
    Cc: "Martin K. Petersen"
    Cc: "Michael S. Tsirkin"
    Cc: Peter Zijlstra
    Cc: virtualization@lists.linux-foundation.org
    Cc: rt@linutronix.de
    Link: http://lkml.kernel.org/r/20160906170457.32393-11-bigeasy@linutronix.de
    Signed-off-by: Thomas Gleixner

    Sebastian Andrzej Siewior
     

15 Sep, 2016

1 commit

  • There is only one waiter for the completion, therefore there is no need
    to use complete_all(). Let's make that clear by using complete() instead
    of complete_all().

    The usage pattern of the completion is:

    waiter context waker context

    virtscsi_tmf()
    DECLARE_COMPLETION_ONSTACK()
    virtscsi_kick_cmd()
    wait_for_completion()

    virtscsi_complete_free()
    complete()

    Signed-off-by: Daniel Wagner
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Daniel Wagner
     

24 Jul, 2015

1 commit

  • Pull virtio/vhost fixes from Michael Tsirkin:
    "Bugfixes and documentation fixes.

    Igor's patch that allows users to tweak memory table size is
    borderline, but it does fix known crashes, so I merged it"

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
    vhost: add max_mem_regions module parameter
    vhost: extend memory regions allocation to vmalloc
    9p/trans_virtio: reset virtio device on remove
    virtio/s390: rename drivers/s390/kvm -> drivers/s390/virtio
    MAINTAINERS: separate section for s390 virtio drivers
    virtio: define virtio_pci_cfg_cap in header.
    virtio: Fix typecast of pointer in vring_init()
    virtio scsi: fix unused variable warning
    vhost: use binary search instead of linear in find_region()
    virtio_net: document VIRTIO_NET_CTRL_GUEST_OFFLOADS

    Linus Torvalds
     

07 Jul, 2015

1 commit

  • drivers/scsi/virtio_scsi.c: In function 'virtscsi_probe':
    drivers/scsi/virtio_scsi.c:952:11: warning: unused variable 'host_prot' [-Wunused-variable]
    int err, host_prot;
    ^

    Signed-off-by: Stephen Rothwell
    Reviewed-by: Michael S. Tsirkin
    Signed-off-by: Michael S. Tsirkin

    Stephen Rothwell
     

26 May, 2015

1 commit


21 Jan, 2015

1 commit


12 Dec, 2014

1 commit

  • Pull virtio updates from Michael Tsirkin:
    "virtio: virtio 1.0 support, misc patches

    This adds a lot of infrastructure for virtio 1.0 support. Notable
    missing pieces: virtio pci, virtio balloon (needs spec extension),
    vhost scsi.

    Plus, there are some minor fixes in a couple of places.

    Note: some net drivers are affected by these patches. David said he's
    fine with merging these patches through my tree.

    Rusty's on vacation, he acked using my tree for these, too"

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (70 commits)
    virtio_ccw: finalize_features error handling
    virtio_ccw: future-proof finalize_features
    virtio_pci: rename virtio_pci -> virtio_pci_common
    virtio_pci: update file descriptions and copyright
    virtio_pci: split out legacy device support
    virtio_pci: setup config vector indirectly
    virtio_pci: setup vqs indirectly
    virtio_pci: delete vqs indirectly
    virtio_pci: use priv for vq notification
    virtio_pci: free up vq->priv
    virtio_pci: fix coding style for structs
    virtio_pci: add isr field
    virtio: drop legacy_only driver flag
    virtio_balloon: drop legacy_only driver flag
    virtio_ccw: rev 1 devices set VIRTIO_F_VERSION_1
    virtio: allow finalize_features to fail
    virtio_ccw: legacy: don't negotiate rev 1/features
    virtio: add API to detect legacy devices
    virtio_console: fix sparse warnings
    vhost: remove unnecessary forward declarations in vhost.h
    ...

    Linus Torvalds
     

09 Dec, 2014

2 commits


24 Nov, 2014

2 commits

  • Drop the now unused reason argument from the ->change_queue_depth method.
    Also add a return value to scsi_adjust_queue_depth, and rename it to
    scsi_change_queue_depth now that it can be used as the default
    ->change_queue_depth implementation.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Hannes Reinecke

    Christoph Hellwig
     
  • All drivers use the implementation for ramping the queue up and down, so
    instead of overloading the change_queue_depth method call the
    implementation diretly if the driver opts into it by setting the
    track_queue_depth flag in the host template.

    Note that a few drivers validated the new queue depth in their
    change_queue_depth method, but as we never go over the queue depth
    set during slave_configure or the sysfs file this isn't nessecary
    and can safely be removed.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Venkatesh Srinivas

    Christoph Hellwig
     

20 Nov, 2014

1 commit


12 Nov, 2014

1 commit

  • Remove the tagged argument from scsi_adjust_queue_depth, and just let it
    handle the queue depth. For most drivers those two are fairly separate,
    given that most modern drivers don't care about the SCSI "tagged" status
    of a command at all, and many old drivers allow queuing of multiple
    untagged commands in the driver.

    Instead we start out with the ->simple_tags flag set before calling
    ->slave_configure, which is how all drivers actually looking at
    ->simple_tags except for one worke anyway. The one other case looks
    broken, but I've kept the behavior as-is for now.

    Except for that we only change ->simple_tags from the ->change_queue_type,
    and when rejecting a tag message in a single driver, so keeping this
    churn out of scsi_adjust_queue_depth is a clear win.

    Now that the usage of scsi_adjust_queue_depth is more obvious we can
    also remove all the trivial instances in ->slave_alloc or ->slave_configure
    that just set it to the cmd_per_lun default.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Martin K. Petersen

    Christoph Hellwig
     

15 Oct, 2014

5 commits

  • Enable VQs early like we do for restore.
    This makes it possible to drop the scan callback,
    moving scanning into the probe function, and making
    code simpler.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • We cancel event work on device removal, but an interrupt
    could trigger immediately after this, and queue it
    again.

    To fix, set a flag.

    Loosely based on patch by Paolo Bonzini

    Signed-off-by: Paolo Bonzini
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • Michael S. Tsirkin noticed a race condition:
    we reset device on freeze, but system WQ is still
    running so it might try adding bufs to a VQ meanwhile.

    To fix, switch to handling events from the freezable WQ.

    Reported-by: Michael S. Tsirkin
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Paolo Bonzini
     
  • virtio spec requires drivers to set DRIVER_OK before using VQs.
    This is set automatically after restore returns, virtio scsi violated
    this rule on restore by kicking event vq within restore.

    To fix, call virtio_device_ready before using event queue.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     
  • We currently kick event within virtscsi_init,
    before host is fully initialized.

    This can in theory confuse guest if device
    consumes the buffers immediately.

    To fix, move virtscsi_kick_event_all out to scan/restore.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Michael S. Tsirkin
     

26 Jul, 2014

2 commits

  • change_queue_depth allows changing per-target queue depth via sysfs.

    It also allows the SCSI midlayer to ramp down the number of concurrent
    inflight requests in response to a SCSI BUSY status response and allows
    the midlayer to ramp the count back up to the device maximum when the
    BUSY condition has resolved.

    Signed-off-by: Venkatesh Srinivas
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Christoph Hellwig

    Venkatesh Srinivas
     
  • The spinlock of tgt_lock is only for serializing read and write
    req_vq, one lockless seqcount is enough for the purpose.

    On one 16core VM with vhost-scsi backend, the patch can improve
    IOPS with 3% on random read test.

    Signed-off-by: Ming Lei
    [Add initialization in virtscsi_target_alloc. - Paolo]
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Christoph Hellwig

    Ming Lei
     

25 Jun, 2014

2 commits

  • Even though the virtio-scsi spec guarantees that all requests related
    to the TMF will have been completed by the time the TMF itself completes,
    the request queue's callback might not have run yet. This causes requests
    to be completed more than once, and as a result triggers a variety of
    BUGs or oopses.

    Signed-off-by: Paolo Bonzini
    Reviewed-by: Venkatesh Srinivas
    Cc: stable@vger.kernel.org
    Signed-off-by: Christoph Hellwig

    Paolo Bonzini
     
  • Calling the workqueue interface on uninitialized work items isn't a
    good idea even if they're zeroed. It's not failing catastrophically only
    through happy accidents.

    Signed-off-by: Paolo Bonzini
    Reviewed-by: Stefan Hajnoczi
    Cc: stable@vger.kernel.org
    Signed-off-by: Christoph Hellwig

    Paolo Bonzini
     

13 Jun, 2014

1 commit

  • Pull SCSI target updates from Nicholas Bellinger:
    "The highlights this round include:

    - Add support for T10 PI pass-through between vhost-scsi +
    virtio-scsi (MST + Paolo + MKP + nab)
    - Add support for T10 PI in qla2xxx target mode (Quinn + MKP + hch +
    nab, merged through scsi.git)
    - Add support for percpu-ida pre-allocation in qla2xxx target code
    (Quinn + nab)
    - A number of iser-target fixes related to hardening the network
    portal shutdown path (Sagi + Slava)
    - Fix response length residual handling for a number of control CDBs
    (Roland + Christophe V.)
    - Various iscsi RFC conformance fixes in the CHAP authentication path
    (Tejas and Calsoft folks + nab)
    - Return TASK_SET_FULL status for tcm_fc(FCoE) DataIn + Response
    failures (Vasu + Jun + nab)
    - Fix long-standing ABORT_TASK + session reset hang (nab)
    - Convert iser-initiator + iser-target to include T10 bytes into EDTL
    (Sagi + Or + MKP + Mike Christie)
    - Fix NULL pointer dereference regression related to XCOPY introduced
    in v3.15 + CC'ed to v3.12.y (nab)"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (34 commits)
    target: Fix NULL pointer dereference for XCOPY in target_put_sess_cmd
    vhost-scsi: Include prot_bytes into expected data transfer length
    TARGET/sbc,loopback: Adjust command data length in case pi exists on the wire
    libiscsi, iser: Adjust data_length to include protection information
    scsi_cmnd: Introduce scsi_transfer_length helper
    target: Report correct response length for some commands
    target/sbc: Check that the LBA and number of blocks are correct in VERIFY
    target/sbc: Remove sbc_check_valid_sectors()
    Target/iscsi: Fix sendtargets response pdu for iser transport
    Target/iser: Fix a wrong dereference in case discovery session is over iser
    iscsi-target: Fix ABORT_TASK + connection reset iscsi_queue_req memory leak
    target: Use complete_all for se_cmd->t_transport_stop_comp
    target: Set CMD_T_ACTIVE bit for Task Management Requests
    target: cleanup some boolean tests
    target/spc: Simplify INQUIRY EVPD=0x80
    tcm_fc: Generate TASK_SET_FULL status for response failures
    tcm_fc: Generate TASK_SET_FULL status for DataIN failures
    iscsi-target: Reject mutual authentication with reflected CHAP_C
    iscsi-target: Remove no-op from iscsit_tpg_del_portal_group
    iscsi-target: Fix CHAP_A parameter list handling
    ...

    Linus Torvalds
     

12 Jun, 2014

1 commit

  • Pull virtio updates from Rusty Russell:
    "Main excitement is a virtio_scsi fix for alloc holding spinlock on the
    abort path, which I refuse to CC stable since (1) I discovered it
    myself, and (2) it's been there forever with no reports"

    * tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
    virtio_scsi: don't call virtqueue_add_sgs(... GFP_NOIO) holding spinlock.
    virtio-rng: fixes for device registration/unregistration
    virtio-rng: fix boot with virtio-rng device
    virtio-rng: support multiple virtio-rng devices
    virtio_ccw: introduce device_lost in virtio_ccw_device
    virtio: virtio_break_device() to mark all virtqueues broken.

    Linus Torvalds
     

03 Jun, 2014

1 commit

  • This patch updates virtscsi_probe() to setup necessary Scsi_Host
    level protection resources. (currently hardcoded to 1)

    It changes virtscsi_add_cmd() to attach outgoing / incoming
    protection SGLs preceeding the data payload, and is using the
    new virtio_scsi_cmd_req_pi->pi_bytes[out,in] field to signal
    to signal to vhost/scsi bytes to expect for protection data.

    (Add missing #include for blk_integrity - sfr + nab)

    Acked-by: Paolo Bonzini
    Cc: Michael S. Tsirkin
    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: H. Peter Anvin
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger