1. 20 2月, 2013 1 次提交
  2. 08 12月, 2012 1 次提交
  3. 27 11月, 2012 1 次提交
  4. 04 11月, 2012 1 次提交
    • R
      xen/blkback: persistent-grants fixes · cb5bd4d1
      Roger Pau Monne 提交于
      This patch contains fixes for persistent grants implementation v2:
      
       * handle == 0 is a valid handle, so initialize grants in blkback
         setting the handle to BLKBACK_INVALID_HANDLE instead of 0. Reported
         by Konrad Rzeszutek Wilk.
      
       * new_map is a boolean, use "true" or "false" instead of 1 and 0.
         Reported by Konrad Rzeszutek Wilk.
      
       * blkfront announces the persistent-grants feature as
         feature-persistent-grants, use feature-persistent instead which is
         consistent with blkback and the public Xen headers.
      
       * Add a consistency check in blkfront to make sure we don't try to
         access segments that have not been set.
      Reported-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NRoger Pau Monne <roger.pau@citrix.com>
      [v1: The new_map int->bool had already been changed]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      cb5bd4d1
  5. 30 10月, 2012 4 次提交
    • R
      xen/blkback: Persistent grant maps for xen blk drivers · 0a8704a5
      Roger Pau Monne 提交于
      This patch implements persistent grants for the xen-blk{front,back}
      mechanism. The effect of this change is to reduce the number of unmap
      operations performed, since they cause a (costly) TLB shootdown. This
      allows the I/O performance to scale better when a large number of VMs
      are performing I/O.
      
      Previously, the blkfront driver was supplied a bvec[] from the request
      queue. This was granted to dom0; dom0 performed the I/O and wrote
      directly into the grant-mapped memory and unmapped it; blkfront then
      removed foreign access for that grant. The cost of unmapping scales
      badly with the number of CPUs in Dom0. An experiment showed that when
      Dom0 has 24 VCPUs, and guests are performing parallel I/O to a
      ramdisk, the IPIs from performing unmap's is a bottleneck at 5 guests
      (at which point 650,000 IOPS are being performed in total). If more
      than 5 guests are used, the performance declines. By 10 guests, only
      400,000 IOPS are being performed.
      
      This patch improves performance by only unmapping when the connection
      between blkfront and back is broken.
      
      On startup blkfront notifies blkback that it is using persistent
      grants, and blkback will do the same. If blkback is not capable of
      persistent mapping, blkfront will still use the same grants, since it
      is compatible with the previous protocol, and simplifies the code
      complexity in blkfront.
      
      To perform a read, in persistent mode, blkfront uses a separate pool
      of pages that it maps to dom0. When a request comes in, blkfront
      transmutes the request so that blkback will write into one of these
      free pages. Blkback keeps note of which grefs it has already
      mapped. When a new ring request comes to blkback, it looks to see if
      it has already mapped that page. If so, it will not map it again. If
      the page hasn't been previously mapped, it is mapped now, and a record
      is kept of this mapping. Blkback proceeds as usual. When blkfront is
      notified that blkback has completed a request, it memcpy's from the
      shared memory, into the bvec supplied. A record that the {gref, page}
      tuple is mapped, and not inflight is kept.
      
      Writes are similar, except that the memcpy is peformed from the
      supplied bvecs, into the shared pages, before the request is put onto
      the ring.
      
      Blkback stores a mapping of grefs=>{page mapped to by gref} in
      a red-black tree. As the grefs are not known apriori, and provide no
      guarantees on their ordering, we have to perform a search
      through this tree to find the page, for every gref we receive. This
      operation takes O(log n) time in the worst case. In blkfront grants
      are stored using a single linked list.
      
      The maximum number of grants that blkback will persistenly map is
      currently set to RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST, to
      prevent a malicios guest from attempting a DoS, by supplying fresh
      grefs, causing the Dom0 kernel to map excessively. If a guest
      is using persistent grants and exceeds the maximum number of grants to
      map persistenly the newly passed grefs will be mapped and unmaped.
      Using this approach, we can have requests that mix persistent and
      non-persistent grants, and we need to handle them correctly.
      This allows us to set the maximum number of persistent grants to a
      lower value than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST, although
      setting it will lead to unpredictable performance.
      
      In writing this patch, the question arrises as to if the additional
      cost of performing memcpys in the guest (to/from the pool of granted
      pages) outweigh the gains of not performing TLB shootdowns. The answer
      to that question is `no'. There appears to be very little, if any
      additional cost to the guest of using persistent grants. There is
      perhaps a small saving, from the reduced number of hypercalls
      performed in granting, and ending foreign access.
      Signed-off-by: NOliver Chick <oliver.chick@citrix.com>
      Signed-off-by: NRoger Pau Monne <roger.pau@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [v1: Fixed up the misuse of bool as int]
      0a8704a5
    • O
      xen/blkback: Change xen_vbd's flush_support and discard_secure to have type... · 1f999572
      Oliver Chick 提交于
      xen/blkback: Change xen_vbd's flush_support and discard_secure to have type unsigned int, rather than bool
      
      Changing the type of bdev parameters to be unsigned int :1, rather than bool.
      This is more consistent with the types of other features in the block drivers.
      Signed-off-by: NOliver Chick <oliver.chick@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      1f999572
    • W
      xen/blkback: use kmem_cache_zalloc instead of kmem_cache_alloc/memset · 654dbef2
      Wei Yongjun 提交于
      Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().
      
      spatch with a semantic match is used to found this problem.
      (http://coccinelle.lip6.fr/)
      Signed-off-by: NWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      654dbef2
    • K
      xen/blkback: Fix compile warning · 2911758f
      Konrad Rzeszutek Wilk 提交于
      drivers/block/xen-blkback/xenbus.c:260:5: warning: symbol 'xenvbd_sysfs_addif' was not declared. Should it be static?
      drivers/block/xen-blkback/xenbus.c:284:6: warning: symbol 'xenvbd_sysfs_delif' was not declared. Should it be static?
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      2911758f
  6. 12 9月, 2012 1 次提交
    • S
      xen/m2p: do not reuse kmap_op->dev_bus_addr · 2fc136ee
      Stefano Stabellini 提交于
      If the caller passes a valid kmap_op to m2p_add_override, we use
      kmap_op->dev_bus_addr to store the original mfn, but dev_bus_addr is
      part of the interface with Xen and if we are batching the hypercalls it
      might not have been written by the hypervisor yet. That means that later
      on Xen will write to it and we'll think that the original mfn is
      actually what Xen has written to it.
      
      Rather than "stealing" struct members from kmap_op, keep using
      page->index to store the original mfn and add another parameter to
      m2p_remove_override to get the corresponding kmap_op instead.
      It is now responsibility of the caller to keep track of which kmap_op
      corresponds to a particular page in the m2p_override (gntdev, the only
      user of this interface that passes a valid kmap_op, is already doing that).
      
      CC: stable@kernel.org
      Reported-and-Tested-By: NSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      2fc136ee
  7. 09 8月, 2012 1 次提交
  8. 31 5月, 2012 1 次提交
  9. 19 4月, 2012 1 次提交
  10. 24 3月, 2012 2 次提交
  11. 20 3月, 2012 2 次提交
  12. 05 1月, 2012 1 次提交
    • J
      Xen: consolidate and simplify struct xenbus_driver instantiation · 73db144b
      Jan Beulich 提交于
      The 'name', 'owner', and 'mod_name' members are redundant with the
      identically named fields in the 'driver' sub-structure. Rather than
      switching each instance to specify these fields explicitly, introduce
      a macro to simplify this.
      
      Eliminate further redundancy by allowing the drvname argument to
      DEFINE_XENBUS_DRIVER() to be blank (in which case the first entry from
      the ID table will be used for .driver.name).
      
      Also eliminate the questionable xenbus_register_{back,front}end()
      wrappers - their sole remaining purpose was the checking of the
      'owner' field, proper setting of which shouldn't be an issue anymore
      when the macro gets used.
      
      v2: Restore DRV_NAME for the driver name in xen-pciback.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      73db144b
  13. 02 12月, 2011 1 次提交
  14. 19 11月, 2011 4 次提交
  15. 26 10月, 2011 1 次提交
  16. 18 10月, 2011 1 次提交
  17. 15 10月, 2011 1 次提交
  18. 13 10月, 2011 6 次提交
  19. 29 9月, 2011 1 次提交
    • S
      xen: modify kernel mappings corresponding to granted pages · 0930bba6
      Stefano Stabellini 提交于
      If we want to use granted pages for AIO, changing the mappings of a user
      vma and the corresponding p2m is not enough, we also need to update the
      kernel mappings accordingly.
      Currently this is only needed for pages that are created for user usages
      through /dev/xen/gntdev. As in, pages that have been in use by the
      kernel and use the P2M will not need this special mapping.
      However there are no guarantees that in the future the kernel won't
      start accessing pages through the 1:1 even for internal usage.
      
      In order to avoid the complexity of dealing with highmem, we allocated
      the pages lowmem.
      We issue a HYPERVISOR_grant_table_op right away in
      m2p_add_override and we remove the mappings using another
      HYPERVISOR_grant_table_op in m2p_remove_override.
      Considering that m2p_add_override and m2p_remove_override are called
      once per page we use multicalls and hypercall batching.
      
      Use the kmap_op pointer directly as argument to do the mapping as it is
      guaranteed to be present up until the unmapping is done.
      Before issuing any unmapping multicalls, we need to make sure that the
      mapping has already being done, because we need the kmap->handle to be
      set correctly.
      Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
      [v1: Removed GRANT_FRAME_BIT usage]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      0930bba6
  20. 15 9月, 2011 1 次提交
  21. 22 8月, 2011 2 次提交
    • J
      xen-blkback: fixed indentation and comments · 1bc05b0a
      Joe Jin 提交于
      This patch fixes belows:
      
      1. Fix code style issue.
      2. Fix incorrect functions name in comments.
      Signed-off-by: NJoe Jin <joe.jin@oracle.com>
      Cc: Jens Axboe <jaxboe@fusionio.com>
      Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      1bc05b0a
    • J
      xen-blkback: Don't disconnect backend until state switched to XenbusStateClosed. · 6f5986bc
      Joe Jin 提交于
      When do block-attach/block-detach test with below steps, umount hangs
      in the guest. Furthermore shutdown ends up being stuck when umounting file-systems.
      
      1. start guest.
      2. attach new block device by xm block-attach in Dom0.
      3. mount new disk in guest.
      4. execute xm block-detach to detach the block device in dom0 until timeout
      5. Any request to the disk will hung.
      
      Root cause:
      This issue is caused when setting backend device's state to
      'XenbusStateClosing', which sends to the frontend the XenbusStateClosing
      notification. When frontend receives the notification it tries to release
      the disk in blkfront_closing(), but at that moment the disk is still in use
      by guest, so frontend refuses to close. Specifically it sets the disk state to
      XenbusStateClosing and sends the notification to backend - when backend receives the
      event, it disconnects the vbd from real device, and sets the vbd device state to
      XenbusStateClosing. The backend disconnects the real device/file, and any IO
      requests to the disk in guest will end up in ether, leaving disk DEAD and set to
      XenbusStateClosing. When the guest wants to disconnect the disk, umount will
      hang on blkif_release()->xlvbd_release_gendisk() as it is unable to send any IO
      to the disk, which prevents clean system shutdown.
      
      Solution:
      Don't disconnect backend until frontend state switched to XenbusStateClosed.
      Signed-off-by: NJoe Jin <joe.jin@oracle.com>
      Cc: Daniel Stodden <daniel.stodden@citrix.com>
      Cc: Jens Axboe <jaxboe@fusionio.com>
      Cc: Annie Li <annie.li@oracle.com>
      Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
      [v1: Modified description a bit]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      6f5986bc
  22. 01 7月, 2011 3 次提交
  23. 01 6月, 2011 2 次提交