1. 21 8月, 2012 1 次提交
    • M
      tcm_vhost: Fix vhost_scsi_target structure alignment · 6de7145c
      Michael S. Tsirkin 提交于
      Here TRANSPORT_IQN_LEN is 224, which is a multiple of 4.
      Since vhost_tpgt is 2 bytes and abi_version is 4, the total size would
      be 230.  But gcc needs struct size be aligned to first field size, which
      is 4 bytes, so it pads the structure by extra 2 bytes to the total of
      232.
      
      This padding is very undesirable in an ABI:
      - it can not be initialized easily
      - it can not be checked easily
      - it can leak information between kernel and userspace
      
      Simplest solution is probably just to make the padding
      explicit.
      
      (v2: Add check for zero'ed backend->reserved field for VHOST_SCSI_SET_ENDPOINT
           and VHOST_SCSI_CLEAR_ENDPOINT ops as requested by MST)
      Reported-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6de7145c
  2. 17 8月, 2012 3 次提交
    • N
      tcm_vhost: Change vhost_scsi_target->vhost_wwpn to char * · 5b7517f8
      Nicholas Bellinger 提交于
      This patch changes the vhost_scsi_target->vhost_wwpn[] type used
      by VHOST_SCSI_* ioctls to 'char *' as requested by Blue Swirl in
      order to match the latest QEMU vhost-scsi RFC-v3 userspace code.
      
      Queuing this up into target-pending/master for a -rc3 PULL.
      Reported-by: NBlue Swirl <blauwirbel@gmail.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5b7517f8
    • N
      tcm_vhost: Post-merge review changes requested by MST · 101998f6
      Nicholas Bellinger 提交于
      This patch contains the post RFC-v5 (post-merge) changes, this includes:
      
      - Add locking comment
      - Move vhost_scsi_complete_cmd ahead of TFO callbacks in order to
        drop forward declarations
      - Drop extra '!= NULL' usage in vhost_scsi_complete_cmd_work()
      - Change vhost_scsi_*_handle_kick() to use pr_debug
      - Fix possible race in vhost_scsi_set_endpoint() for vs->vs_tpg checking
        + assignment.
      - Convert tv_tpg->tpg_vhost_count + ->tv_tpg_port_count from atomic_t ->
        int, and make sure reference is protected by ->tv_tpg_mutex.
      - Drop unnecessary vhost_scsi->vhost_ref_cnt
      - Add 'err:' label for exception path in vhost_scsi_clear_endpoint()
      - Add enum for VQ numbers, add usage in vhost_scsi_open()
      - Add vhost_scsi_flush() + vhost_scsi_flush_vq() following
        drivers/vhost/net.c
      - Add smp_wmb() + vhost_scsi_flush() call during vhost_scsi_set_features()
      - Drop unnecessary copy_from_user() usage with GET_ABI_VERSION ioctl
      - Add missing vhost_scsi_compat_ioctl() caller for vhost_scsi_fops
      - Fix function parameter definition first line to follow existing
        vhost code style
      - Change 'vHost' usage -> 'vhost' in handful of locations
      - Change -EPERM -> -EBUSY usage for two failures in tcm_vhost_drop_nexus()
      - Add comment for tcm_vhost_workqueue in tcm_vhost_init()
      - Make GET_ABI_VERSION return 'int' + add comment in tcm_vhost.h
      Reported-by: NMichael S. Tsirkin <mst@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Cc: Anthony Liguori <aliguori@us.ibm.com>
      Cc: Zhi Yong Wu <wuzhy@cn.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      101998f6
    • F
      tcm_vhost: Fix incorrect IS_ERR() usage in vhost_scsi_map_iov_to_sgl · f0e0e9bb
      Fengguang Wu 提交于
      Fix up a new coccinelle warnings reported by Fengguang Wu + Intel
      0-DAY kernel build testing backend:
      
      drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line
      533 returns NULL not ERR_PTR on failure
      
      vim +537 drivers/vhost/tcm_vhost.c
         534          if (!sg)
         535                  return -ENOMEM;
         536          pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
       > 537                 sg, sgl_count, IS_ERR(sg));
         538          sg_init_table(sg, sgl_count);
         539
         540          tv_cmd->tvc_sgl = sg;
      Signed-off-by: NFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f0e0e9bb
  3. 30 7月, 2012 1 次提交
    • N
      tcm_vhost: Initial merge for vhost level target fabric driver · 057cbf49
      Nicholas Bellinger 提交于
      This patch adds the initial code for tcm_vhost, a Vhost level TCM
      fabric driver for virtio SCSI initiators into KVM guest.
      
      This code is currently up and running on v3.5-rc2 host+guest
      from target-pending/for-next-merge.
      
      Using tcm_vhost requires Zhi's -> Stefan -> nab's qemu vhost-scsi tree here:
      
        http://git.kernel.org/?p=virt/kvm/nab/qemu-kvm.git;a=shortlog;h=refs/heads/vhost-scsi
      
      --
      
      Changelog v4 -> v5:
      
        Expose ABI version via VHOST_SCSI_GET_ABI_VERSION + use Rev 0 as
        starting point for v3.6-rc code (Stefan + ALiguori + nab)
        Convert vhost_scsi_handle_vq() to vq_err() (nab + MST)
        Minor style fixes from checkpatch (nab)
      
      Changelog v3 -> v4:
      
        Rename vhost_vring_target -> vhost_scsi_target (mst + nab)
        Use TRANSPORT_IQN_LEN in vhost_scsi_target->vhost_wwpn[] def (nab)
        Move back to drivers/vhost/, and just use drivers/vhost/Kconfig.tcm (mst)
        Move TCM_VHOST related ioctl defines from include/linux/vhost.h ->
        drivers/vhost/tcm_vhost.h as requested by MST (nab)
        Move Kbuild.tcm include from drivers/staging -> drivers/vhost/, and
        just use 'if STAGING' around 'source drivers/vhost/Kbuild.tcm'
      
      Changelog v2 -> v3:
      
        Unlock on error in tcm_vhost_drop_nexus() (DanC)
        Fix strlen() doesn't count the terminator (DanC)
        Call kfree() on an error path (DanC)
        Convert tcm_vhost_write_pending to use target_execute_cmd (hch + nab)
        Fix another strlen() off by one in tcm_vhost_make_tport (DanC)
        Add option under drivers/staging/Kconfig, and move to drivers/vhost/tcm/
        as requested by MST (nab)
      
      Changelog v1 -> v2:
      
        Fix tv_cmd completion -> release SGL memory leak (nab)
        Fix sparse warnings for static variable usage ((Fengguang Wu)
        Fix sparse warnings for min() typing + printk format specs (Fengguang Wu)
        Convert to cmwq submission for I/O dispatch (nab + hch)
      
      Changelog v0 -> v1:
      
        Merge into single source + header file, and move to drivers/vhost/
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Cc: Anthony Liguori <aliguori@us.ibm.com>
      Cc: Zhi Yong Wu <wuzhy@cn.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      057cbf49
  4. 22 7月, 2012 2 次提交
  5. 27 6月, 2012 1 次提交
  6. 12 5月, 2012 1 次提交
  7. 02 5月, 2012 4 次提交
  8. 14 4月, 2012 1 次提交
  9. 12 4月, 2012 1 次提交
  10. 20 3月, 2012 1 次提交
  11. 28 2月, 2012 2 次提交
    • M
      vhost: fix release path lockdep checks · ea5d4046
      Michael S. Tsirkin 提交于
      We shouldn't hold any locks on release path. Pass a flag to
      vhost_dev_cleanup to use the lockdep info correctly.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Tested-by: NSasha Levin <levinsasha928@gmail.com>
      ea5d4046
    • N
      vhost: don't forget to schedule() · d550dda1
      Nadav Har'El 提交于
      This is a tiny, but important, patch to vhost.
      
      Vhost's worker thread only called schedule() when it had no work to do, and
      it wanted to go to sleep. But if there's always work to do, e.g., the guest
      is running a network-intensive program like netperf with small message sizes,
      schedule() was *never* called. This had several negative implications (on
      non-preemptive kernels):
      
       1. Passing time was not properly accounted to the "vhost" process (ps and
          top would wrongly show it using zero CPU time).
      
       2. Sometimes error messages about RCU timeouts would be printed, if the
          core running the vhost thread didn't schedule() for a very long time.
      
       3. Worst of all, a vhost thread would "hog" the core. If several vhost
          threads need to share the same core, typically one would get most of the
          CPU time (and its associated guest most of the performance), while the
          others hardly get any work done.
      
      The trivial solution is to add
      
      	if (need_resched())
      		schedule();
      
      After doing every piece of work. This will not do the heavy schedule() all
      the time, just when the timer interrupt decided a reschedule is warranted
      (so need_resched returns true).
      
      Thanks to Abel Gordon for this patch.
      Signed-off-by: NNadav Har'El <nyh@il.ibm.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      d550dda1
  12. 14 1月, 2012 1 次提交
  13. 27 7月, 2011 1 次提交
  14. 21 7月, 2011 2 次提交
  15. 19 7月, 2011 5 次提交
  16. 30 5月, 2011 1 次提交
  17. 07 5月, 2011 1 次提交
  18. 14 3月, 2011 2 次提交
  19. 13 3月, 2011 2 次提交
  20. 09 3月, 2011 2 次提交
  21. 01 2月, 2011 1 次提交
    • M
      vhost: rcu annotation fixup · 5e18247b
      Michael S. Tsirkin 提交于
      When built with rcu checks enabled, vhost triggers
      bogus warnings as vhost features are read without
      dev->mutex sometimes, and private pointer is read
      with our kind of rcu where work serves as a
      read side critical section.
      
      Fixing it properly is not trivial.
      Disable the warnings by stubbing out the checks for now.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      5e18247b
  22. 10 1月, 2011 1 次提交
  23. 09 12月, 2010 3 次提交