1. 29 8月, 2017 1 次提交
    • Y
      smp: Avoid using two cache lines for struct call_single_data · 966a9671
      Ying Huang 提交于
      struct call_single_data is used in IPIs to transfer information between
      CPUs.  Its size is bigger than sizeof(unsigned long) and less than
      cache line size.  Currently it is not allocated with any explicit alignment
      requirements.  This makes it possible for allocated call_single_data to
      cross two cache lines, which results in double the number of the cache lines
      that need to be transferred among CPUs.
      
      This can be fixed by requiring call_single_data to be aligned with the
      size of call_single_data. Currently the size of call_single_data is the
      power of 2.  If we add new fields to call_single_data, we may need to
      add padding to make sure the size of new definition is the power of 2
      as well.
      
      Fortunately, this is enforced by GCC, which will report bad sizes.
      
      To set alignment requirements of call_single_data to the size of
      call_single_data, a struct definition and a typedef is used.
      
      To test the effect of the patch, I used the vm-scalability multiple
      thread swap test case (swap-w-seq-mt).  The test will create multiple
      threads and each thread will eat memory until all RAM and part of swap
      is used, so that huge number of IPIs are triggered when unmapping
      memory.  In the test, the throughput of memory writing improves ~5%
      compared with misaligned call_single_data, because of faster IPIs.
      Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NHuang, Ying <ying.huang@intel.com>
      [ Add call_single_data_t and align with size of call_single_data. ]
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Aaron Lu <aaron.lu@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/87bmnqd6lz.fsf@yhuang-mobile.sh.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      966a9671
  2. 26 8月, 2017 2 次提交
    • A
      xen-blkback: stop blkback thread of every queue in xen_blkif_disconnect · dc52d783
      Annie Li 提交于
      In xen_blkif_disconnect, before checking inflight I/O, following code
      stops the blkback thread,
      if (ring->xenblkd) {
      	kthread_stop(ring->xenblkd);
      	wake_up(&ring->shutdown_wq);
      }
      If there is inflight I/O in any non-last queue, blkback returns -EBUSY
      directly, and above code would not be called to stop thread of remaining
      queue and processs them. When removing vbd device with lots of disk I/O
      load, some queues with inflight I/O still have blkback thread running even
      though the corresponding vbd device or guest is gone.
      And this could cause some problems, for example, if the backend device type
      is file, some loop devices and blkback thread always lingers there forever
      after guest is destroyed, and this causes failure of umounting repositories
      unless rebooting the dom0.
      This patch allows thread of every queue has the chance to get stopped.
      Otherwise, only thread of queue previous to(including) first busy one get
      stopped, blkthread of remaining queue will still run.  So stop all threads
      properly and return -EBUSY if any queue has inflight I/O.
      Signed-off-by: NAnnie Li <annie.li@oracle.com>
      Reviewed-by: NHerbert van den Bergh <herbert.van.den.bergh@oracle.com>
      Reviewed-by: NBhavesh Davda <bhavesh.davda@oracle.com>
      Reviewed-by: NAdnan Misherfi <adnan.misherfi@oracle.com>
      Acked-by: NRoger Pau Monné <roger.pau@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      dc52d783
    • S
      virtio_blk: fix incorrect message when disk is resized · 1046d304
      Stefan Hajnoczi 提交于
      The message printed on disk resize is incorrect.  The following is
      printed when resizing to 2 GiB:
      
        $ truncate -s 1G test.img
        $ qemu -device virtio-blk-pci,logical_block_size=4096,...
        (qemu) block_resize drive1 2G
      
        virtio_blk virtio0: new size: 4194304 4096-byte logical blocks (17.2 GB/16.0 GiB)
      
      The virtio_blk capacity config field is in 512-byte sector units
      regardless of logical_block_size as per the VIRTIO specification.
      Therefore the message should read:
      
        virtio_blk virtio0: new size: 524288 4096-byte logical blocks (2.15 GB/2.0 GiB)
      
      Note that this only affects the printed message.  Thankfully the actual
      block device has the correct size because the block layer expects
      capacity in sectors.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      1046d304
  3. 24 8月, 2017 2 次提交
  4. 15 8月, 2017 1 次提交
    • M
      xen-blkfront: use a right index when checking requests · b15bd8cb
      Munehisa Kamata 提交于
      Since commit d05d7f40 ("Merge branch 'for-4.8/core' of
      git://git.kernel.dk/linux-block") and 3fc9d690 ("Merge branch
      'for-4.8/drivers' of git://git.kernel.dk/linux-block"), blkfront_resume()
      has been using an index for iterating ring_info to check request when
      iterating blk_shadow in an inner loop. This seems to have been
      accidentally introduced during the massive rewrite of the block layer
      macros in the commits.
      
      This may cause crash like this:
      
      [11798.057074] BUG: unable to handle kernel NULL pointer dereference at 0000000000000048
      [11798.058832] IP: [<ffffffff814411fa>] blkfront_resume+0x10a/0x610
      ....
      [11798.061063] Call Trace:
      [11798.061063]  [<ffffffff8139ce93>] xenbus_dev_resume+0x53/0x140
      [11798.061063]  [<ffffffff8139ce40>] ? xenbus_dev_probe+0x150/0x150
      [11798.061063]  [<ffffffff813f359e>] dpm_run_callback+0x3e/0x110
      [11798.061063]  [<ffffffff813f3a08>] device_resume+0x88/0x190
      [11798.061063]  [<ffffffff813f4cc0>] dpm_resume+0x100/0x2d0
      [11798.061063]  [<ffffffff813f5221>] dpm_resume_end+0x11/0x20
      [11798.061063]  [<ffffffff813950a8>] do_suspend+0xe8/0x1a0
      [11798.061063]  [<ffffffff813954bd>] shutdown_handler+0xfd/0x130
      [11798.061063]  [<ffffffff8139aba0>] ? split+0x110/0x110
      [11798.061063]  [<ffffffff8139ac26>] xenwatch_thread+0x86/0x120
      [11798.061063]  [<ffffffff810b4570>] ? prepare_to_wait_event+0x110/0x110
      [11798.061063]  [<ffffffff8108fe57>] kthread+0xd7/0xf0
      [11798.061063]  [<ffffffff811da811>] ? kfree+0x121/0x170
      [11798.061063]  [<ffffffff8108fd80>] ? kthread_park+0x60/0x60
      [11798.061063]  [<ffffffff810863b0>] ?  call_usermodehelper_exec_work+0xb0/0xb0
      [11798.061063]  [<ffffffff810864ea>] ?  call_usermodehelper_exec_async+0x13a/0x140
      [11798.061063]  [<ffffffff81534a45>] ret_from_fork+0x25/0x30
      
      Use the right index in the inner loop.
      
      Fixes: d05d7f40 ("Merge branch 'for-4.8/core' of git://git.kernel.dk/linux-block")
      Fixes: 3fc9d690 ("Merge branch 'for-4.8/drivers' of git://git.kernel.dk/linux-block")
      Signed-off-by: NMunehisa Kamata <kamatam@amazon.com>
      Reviewed-by: NThomas Friebel <friebelt@amazon.de>
      Reviewed-by: NEduardo Valentin <eduval@amazon.com>
      Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NRoger Pau Monne <roger.pau@citrix.com>
      Cc: xen-devel@lists.xenproject.org
      Cc: stable@vger.kernel.org
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      b15bd8cb
  5. 11 8月, 2017 1 次提交
  6. 10 8月, 2017 1 次提交
  7. 26 7月, 2017 1 次提交
    • J
      nbd: clear disconnected on reconnect · 7a362ea9
      Josef Bacik 提交于
      If our device loses its connection for longer than the dead timeout we
      will set NBD_DISCONNECTED in order to quickly fail any pending IO's that
      flood in after the IO's that were waiting during the dead timer.
      However if we re-connect at some point in the future we'll still see
      this DISCONNECTED flag set if we then lose our connection again after
      that, which means we won't get notifications for our newly lost
      connections.  Fix this by just clearing the DISCONNECTED flag on
      reconnect in order to make sure everything works as it's supposed to.
      Reported-by: NDan Melnic <dmm@fb.com>
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      7a362ea9
  8. 25 7月, 2017 3 次提交
  9. 24 7月, 2017 1 次提交
    • B
      xen-blkfront: Fix handling of non-supported operations · 31c4ccc3
      Bart Van Assche 提交于
      This patch fixes the following sparse warnings:
      
      drivers/block/xen-blkfront.c:916:45: warning: incorrect type in argument 2 (different base types)
      drivers/block/xen-blkfront.c:916:45:    expected restricted blk_status_t [usertype] error
      drivers/block/xen-blkfront.c:916:45:    got int [signed] error
      drivers/block/xen-blkfront.c:1599:47: warning: incorrect type in assignment (different base types)
      drivers/block/xen-blkfront.c:1599:47:    expected int [signed] error
      drivers/block/xen-blkfront.c:1599:47:    got restricted blk_status_t [usertype] <noident>
      drivers/block/xen-blkfront.c:1607:55: warning: incorrect type in assignment (different base types)
      drivers/block/xen-blkfront.c:1607:55:    expected int [signed] error
      drivers/block/xen-blkfront.c:1607:55:    got restricted blk_status_t [usertype] <noident>
      drivers/block/xen-blkfront.c:1625:55: warning: incorrect type in assignment (different base types)
      drivers/block/xen-blkfront.c:1625:55:    expected int [signed] error
      drivers/block/xen-blkfront.c:1625:55:    got restricted blk_status_t [usertype] <noident>
      drivers/block/xen-blkfront.c:1628:62: warning: restricted blk_status_t degrades to integer
      
      Compile-tested only.
      
      Fixes: commit 2a842aca ("block: introduce new block status code type")
      Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Roger Pau Monné <roger.pau@citrix.com>
      Cc: <xen-devel@lists.xenproject.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      31c4ccc3
  10. 23 7月, 2017 3 次提交
  11. 13 7月, 2017 1 次提交
  12. 11 7月, 2017 3 次提交
  13. 07 7月, 2017 2 次提交
  14. 06 7月, 2017 5 次提交
  15. 30 6月, 2017 3 次提交
  16. 28 6月, 2017 6 次提交
  17. 23 6月, 2017 1 次提交
    • J
      mtip32xx: fix up the checking for internal command failure · 8c66ac6a
      Jens Axboe 提交于
      This fixes up two commits that have touched this driver. The
      command status field is now a blk_status_t, so we can't check
      for < 0 and we definitely can't assume it's holding -Exxxx error
      values. All we care about here is whether ->status is zero or not.
      Check for that, and remove the various attempts at smart error
      reporting. Just log to dmesg what command failed, and the
      blk_status_t value.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Fixes: 2a842aca ("block: introduce new block status code type")
      Fixes: 3f5e6a35 ("mtip32xx: convert internal command issue to block IO path")
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      8c66ac6a
  18. 21 6月, 2017 2 次提交
    • B
      block: Make most scsi_req_init() calls implicit · ca18d6f7
      Bart Van Assche 提交于
      Instead of explicitly calling scsi_req_init() after blk_get_request(),
      call that function from inside blk_get_request(). Add an
      .initialize_rq_fn() callback function to the block drivers that need
      it. Merge the IDE .init_rq_fn() function into .initialize_rq_fn()
      because it is too small to keep it as a separate function. Keep the
      scsi_req_init() call in ide_prep_sense() because it follows a
      blk_rq_init() call.
      
      References: commit 82ed4db4 ("block: split scsi_request out of struct request")
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Omar Sandoval <osandov@fb.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      ca18d6f7
    • J
      null_blk: add support for shared tags · 82f402fe
      Jens Axboe 提交于
      Some storage drivers need to share tag sets between devices. It's
      useful to be able to model that with null_blk, to find hangs or
      performance issues.
      
      Add a 'shared_tags' bool module parameter that. If that is set to
      true and nr_devices is bigger than 1, all devices allocated will
      share the same tag set.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      82f402fe
  19. 19 6月, 2017 1 次提交