1. 12 11月, 2014 1 次提交
    • C
      scsi: don't set tagging state from scsi_adjust_queue_depth · c8b09f6f
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMike Christie <michaelc@cs.wisc.edu>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c8b09f6f
  2. 15 10月, 2014 5 次提交
  3. 26 7月, 2014 2 次提交
  4. 25 6月, 2014 2 次提交
  5. 03 6月, 2014 1 次提交
    • N
      virtio-scsi: Enable DIF/DIX modes in SCSI host LLD · e6dc783a
      Nicholas Bellinger 提交于
      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 <linux/blkdev.h> for blk_integrity - sfr + nab)
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@dev.mellanox.co.il>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e6dc783a
  6. 21 5月, 2014 1 次提交
    • R
      virtio_scsi: don't call virtqueue_add_sgs(... GFP_NOIO) holding spinlock. · c77fba9a
      Rusty Russell 提交于
      This triggers every time we do a SCSI abort:
      
      virtscsi_tmf -> virtscsi_kick_cmd (grab lock and call) -> virtscsi_add_cmd
      	-> virtqueue_add_sgs (GFP_NOIO)
      
      Logs look like this:
       sd 0:0:0:0: [sda] abort
       BUG: sleeping function called from invalid context at mm/slub.c:966
       in_atomic(): 1, irqs_disabled(): 1, pid: 6, name: kworker/u2:0
       3 locks held by kworker/u2:0/6:
        #0:  ("scsi_tmf_%d"shost->host_no){......}, at: [<c0153180>] process_one_work+0xe0/0x3d0
        #1:  ((&(&cmd->abort_work)->work)){......}, at: [<c0153180>] process_one_work+0xe0/0x3d0
        #2:  (&(&virtscsi_vq->vq_lock)->rlock){......}, at: [<c043f508>] virtscsi_kick_cmd+0x18/0x1b0
       CPU: 0 PID: 6 Comm: kworker/u2:0 Not tainted 3.15.0-rc5+ #110
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-rc1-0-gb1d4dc9-20140515_140003-nilsson.home.kraxel.org 04/01/2014
       Workqueue: scsi_tmf_0 scmd_eh_abort_handler
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      c77fba9a
  7. 20 5月, 2014 2 次提交
  8. 29 4月, 2014 1 次提交
    • F
      [SCSI] virtio-scsi: Skip setting affinity on uninitialized vq · 0c8482ac
      Fam Zheng 提交于
      virtscsi_init calls virtscsi_remove_vqs on err, even before initializing
      the vqs. The latter calls virtscsi_set_affinity, so let's check the
      pointer there before setting affinity on it.
      
      This fixes a panic when setting device's num_queues=2 on RHEL 6.5:
      
      qemu-system-x86_64 ... \
      -device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
      -drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
      -device scsi-hd,drive=drive-scsi-disk,...
      
      [    0.354734] scsi0 : Virtio SCSI HBA
      [    0.379504] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
      [    0.380141] IP: [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
      [    0.380141] PGD 0
      [    0.380141] Oops: 0000 [#1] SMP
      [    0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5
      [    0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
      [    0.380141] task: ffff88003c9f0000 ti: ffff88003c9f8000 task.ti: ffff88003c9f8000
      [    0.380141] RIP: 0010:[<ffffffff814741ef>]  [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
      [    0.380141] RSP: 0000:ffff88003c9f9c08  EFLAGS: 00010256
      [    0.380141] RAX: 0000000000000000 RBX: ffff88003c3a9d40 RCX: 0000000000001070
      [    0.380141] RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
      [    0.380141] RBP: ffff88003c9f9c28 R08: 00000000000136c0 R09: ffff88003c801c00
      [    0.380141] R10: ffffffff81475229 R11: 0000000000000008 R12: 0000000000000000
      [    0.380141] R13: ffffffff81cc7ca8 R14: ffff88003cac3d40 R15: ffff88003cac37a0
      [    0.380141] FS:  0000000000000000(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000
      [    0.380141] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [    0.380141] CR2: 0000000000000020 CR3: 0000000001c0e000 CR4: 00000000000006f0
      [    0.380141] Stack:
      [    0.380141]  ffff88003c3a9d40 0000000000000000 ffff88003cac3d80 ffff88003cac3d40
      [    0.380141]  ffff88003c9f9c48 ffffffff814742e8 ffff88003c26d000 ffff88003c26d000
      [    0.380141]  ffff88003c9f9c68 ffffffff81474321 ffff88003c26d000 ffff88003c3a9d40
      [    0.380141] Call Trace:
      [    0.380141]  [<ffffffff814742e8>] virtscsi_set_affinity+0x28/0x40
      [    0.380141]  [<ffffffff81474321>] virtscsi_remove_vqs+0x21/0x50
      [    0.380141]  [<ffffffff81475231>] virtscsi_init+0x91/0x240
      [    0.380141]  [<ffffffff81365290>] ? vp_get+0x50/0x70
      [    0.380141]  [<ffffffff81475544>] virtscsi_probe+0xf4/0x280
      [    0.380141]  [<ffffffff81363ea5>] virtio_dev_probe+0xe5/0x140
      [    0.380141]  [<ffffffff8144c669>] driver_probe_device+0x89/0x230
      [    0.380141]  [<ffffffff8144c8ab>] __driver_attach+0x9b/0xa0
      [    0.380141]  [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230
      [    0.380141]  [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230
      [    0.380141]  [<ffffffff8144ac1c>] bus_for_each_dev+0x8c/0xb0
      [    0.380141]  [<ffffffff8144c499>] driver_attach+0x19/0x20
      [    0.380141]  [<ffffffff8144bf28>] bus_add_driver+0x198/0x220
      [    0.380141]  [<ffffffff8144ce9f>] driver_register+0x5f/0xf0
      [    0.380141]  [<ffffffff81d27c91>] ? spi_transport_init+0x79/0x79
      [    0.380141]  [<ffffffff8136403b>] register_virtio_driver+0x1b/0x30
      [    0.380141]  [<ffffffff81d27d19>] init+0x88/0xd6
      [    0.380141]  [<ffffffff81d27c18>] ? scsi_init_procfs+0x5b/0x5b
      [    0.380141]  [<ffffffff81ce88a7>] do_one_initcall+0x7f/0x10a
      [    0.380141]  [<ffffffff81ce8aa7>] kernel_init_freeable+0x14a/0x1de
      [    0.380141]  [<ffffffff81ce8b3b>] ? kernel_init_freeable+0x1de/0x1de
      [    0.380141]  [<ffffffff817dec20>] ? rest_init+0x80/0x80
      [    0.380141]  [<ffffffff817dec29>] kernel_init+0x9/0xf0
      [    0.380141]  [<ffffffff817e68fc>] ret_from_fork+0x7c/0xb0
      [    0.380141]  [<ffffffff817dec20>] ? rest_init+0x80/0x80
      [    0.380141] RIP  [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
      [    0.380141]  RSP <ffff88003c9f9c08>
      [    0.380141] CR2: 0000000000000020
      [    0.380141] ---[ end trace 8074b70c3d5e1d73 ]---
      [    0.475018] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
      [    0.475018]
      [    0.475068] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
      [    0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
      
      [jejb: checkpatch fixes]
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      0c8482ac
  9. 16 1月, 2014 1 次提交
  10. 11 11月, 2013 1 次提交
  11. 17 10月, 2013 1 次提交
  12. 23 9月, 2013 1 次提交
  13. 01 8月, 2013 1 次提交
    • A
      virtio-scsi: Fix virtqueue affinity setup · aa52aeea
      Asias He 提交于
      vscsi->num_queues counts the number of request virtqueue which does not
      include the control and event virtqueue. It is wrong to subtract
      VIRTIO_SCSI_VQ_BASE from vscsi->num_queues.
      
      This patch fixes the following panic.
      
      (qemu) device_del scsi0
      
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
       IP: [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120
       PGD 0
       Oops: 0000 [#1] SMP
       Modules linked in:
       CPU: 0 PID: 659 Comm: kworker/0:1 Not tainted 3.11.0-rc2+ #1172
       Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
       Workqueue: kacpi_hotplug _handle_hotplug_event_func
       task: ffff88007bee1cc0 ti: ffff88007bfe4000 task.ti: ffff88007bfe4000
       RIP: 0010:[<ffffffff8179b29f>]  [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120
       RSP: 0018:ffff88007bfe5a38  EFLAGS: 00010202
       RAX: 0000000000000010 RBX: ffff880077fd0d28 RCX: 0000000000000050
       RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000000
       RBP: ffff88007bfe5a58 R08: ffff880077f6ff00 R09: 0000000000000001
       R10: ffffffff8143e673 R11: 0000000000000001 R12: 0000000000000001
       R13: ffff880077fd0800 R14: 0000000000000000 R15: ffff88007bf489b0
       FS:  0000000000000000(0000) GS:ffff88007ea00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
       CR2: 0000000000000020 CR3: 0000000079f8b000 CR4: 00000000000006f0
       Stack:
        ffff880077fd0d28 0000000000000000 ffff880077fd0800 0000000000000008
        ffff88007bfe5a78 ffffffff8179b37d ffff88007bccc800 ffff88007bccc800
        ffff88007bfe5a98 ffffffff8179b3b6 ffff88007bccc800 ffff880077fd0d28
       Call Trace:
        [<ffffffff8179b37d>] virtscsi_set_affinity+0x2d/0x40
        [<ffffffff8179b3b6>] virtscsi_remove_vqs+0x26/0x50
        [<ffffffff8179c7d2>] virtscsi_remove+0x82/0xa0
        [<ffffffff814cb6b2>] virtio_dev_remove+0x22/0x70
        [<ffffffff8167ca49>] __device_release_driver+0x69/0xd0
        [<ffffffff8167cb9d>] device_release_driver+0x2d/0x40
        [<ffffffff8167bb96>] bus_remove_device+0x116/0x150
        [<ffffffff81679936>] device_del+0x126/0x1e0
        [<ffffffff81679a06>] device_unregister+0x16/0x30
        [<ffffffff814cb889>] unregister_virtio_device+0x19/0x30
        [<ffffffff814cdad6>] virtio_pci_remove+0x36/0x80
        [<ffffffff81464ae7>] pci_device_remove+0x37/0x70
        [<ffffffff8167ca49>] __device_release_driver+0x69/0xd0
        [<ffffffff8167cb9d>] device_release_driver+0x2d/0x40
        [<ffffffff8167bb96>] bus_remove_device+0x116/0x150
        [<ffffffff81679936>] device_del+0x126/0x1e0
        [<ffffffff8145edfc>] pci_stop_bus_device+0x9c/0xb0
        [<ffffffff8145f036>] pci_stop_and_remove_bus_device+0x16/0x30
        [<ffffffff81474a9e>] acpiphp_disable_slot+0x8e/0x150
        [<ffffffff81474f6a>] hotplug_event_func+0xba/0x1a0
        [<ffffffff814906c8>] ? acpi_os_release_object+0xe/0x12
        [<ffffffff81475911>] _handle_hotplug_event_func+0x31/0x70
        [<ffffffff810b5333>] process_one_work+0x183/0x500
        [<ffffffff810b66e2>] worker_thread+0x122/0x400
        [<ffffffff810b65c0>] ? manage_workers+0x2d0/0x2d0
        [<ffffffff810bc5de>] kthread+0xce/0xe0
        [<ffffffff810bc510>] ? kthread_freezable_should_stop+0x70/0x70
        [<ffffffff81ca045c>] ret_from_fork+0x7c/0xb0
        [<ffffffff810bc510>] ? kthread_freezable_should_stop+0x70/0x70
       Code: 01 00 00 00 74 59 45 31 e4 83 bb c8 01 00 00 02 74 46 66 2e 0f 1f 84 00 00 00 00 00 49 63 c4 48 c1 e0 04 48 8b bc 0
      3 10 02 00 00 <48> 8b 47 20 48 8b 80 d0 01 00 00 48 8b 40 50 48 85 c0 74 07 be
       RIP  [<ffffffff8179b29f>] __virtscsi_set_affinity+0x6f/0x120
        RSP <ffff88007bfe5a38>
       CR2: 0000000000000020
       ---[ end trace 99679331a3775f48 ]---
      
      CC: stable@vger.kernel.org
      Signed-off-by: NAsias He <asias@redhat.com>
      Reviewed-by: NWanlong Gao <gaowanlong@cn.fujitsu.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      aa52aeea
  14. 08 4月, 2013 5 次提交
  15. 20 3月, 2013 2 次提交
  16. 12 3月, 2013 1 次提交
  17. 04 1月, 2013 1 次提交
    • G
      Drivers: scsi: remove __dev* attributes. · 6f039790
      Greg Kroah-Hartman 提交于
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      
      This change removes the use of __devinit, __devexit_p, __devinitdata,
      __devinitconst, and __devexit from these drivers.
      
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Adam Radford <linuxraid@lsi.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f039790
  18. 18 12月, 2012 1 次提交
  19. 27 11月, 2012 1 次提交
  20. 09 10月, 2012 3 次提交
  21. 14 9月, 2012 1 次提交
    • W
      [SCSI] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list · 27e99ade
      Wang Sen 提交于
      When using the commands below to write some data to a virtio-scsi LUN of the
      QEMU guest(32-bit) with 1G physical memory(qemu -m 1024), the qemu will crash.
      
              # sudo mkfs.ext4 /dev/sdb  (/dev/sdb is the virtio-scsi LUN.)
              # sudo mount /dev/sdb /mnt
              # dd if=/dev/zero of=/mnt/file bs=1M count=1024
      
      In current implementation, sg_set_buf is called to add buffers to sg list which
      is put into the virtqueue eventually. But if there are some HighMem pages in
      table->sgl you can not get virtual address by sg_virt. So, sg_virt(sg_elem) may
      return NULL value. This will cause QEMU exit when virtqueue_map_sg is called
      in QEMU because an invalid GPA is passed by virtqueue.
      
      Two solutions are discussed here:
      http://lkml.indiana.edu/hypermail/linux/kernel/1207.3/00675.html
      
      Finally, value assignment approach was adopted because:
      
      Value assignment creates a well-formed scatterlist, because the termination
      marker in source sg_list has been set in blk_rq_map_sg(). The last entry of the
      source sg_list is just copied to the the last entry in destination list.  Note
      that, for now, virtio_ring does not care about the form of the scatterlist and
      simply processes the first out_num + in_num consecutive elements of the sg[]
      array.
      
      I have tested the patch on my workstation. QEMU would not crash any more.
      
      Cc: <stable@vger.kernel.org> # 3.4: 4fe74b1c: [SCSI] virtio-scsi: SCSI driver
      Signed-off-by: NWang Sen <senwang@linux.vnet.ibm.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      27e99ade
  22. 20 7月, 2012 5 次提交