1. 20 3月, 2013 1 次提交
    • R
      xen-blkback: don't store dev_bus_addr · ffb1dabd
      Roger Pau Monne 提交于
      dev_bus_addr returned in the grant ref map operation is the mfn of the
      passed page, there's no need to store it in the persistent grant
      entry, since we can always get it provided that we have the page.
      
      This reduces the memory overhead of persistent grants in blkback.
      
      While at it, rename the 'seg[i].buf' to be 'seg[i].offset' as
      it makes much more sense - as we use that value in bio_add_page
      which as the fourth argument expects the offset.
      
      We hadn't used the physical address as part of this at all.
      Signed-off-by: NRoger Pau Monné <roger.pau@citrix.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: xen-devel@lists.xen.org
      [v1: s/buf/offset/]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      ffb1dabd
  2. 12 3月, 2013 2 次提交
  3. 30 10月, 2012 2 次提交
    • 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
  4. 31 5月, 2012 1 次提交
  5. 24 3月, 2012 1 次提交
    • K
      xen/blkback: Squash the discard support for 'file' and 'phy' type. · 4dae7670
      Konrad Rzeszutek Wilk 提交于
      The only reason for the distinction was for the special case of
      'file' (which is assumed to be loopback device), was to reach inside
      the loopback device, find the underlaying file, and call fallocate on it.
      Fortunately "xen-blkback: convert hole punching to discard request on
      loop devices" removes that use-case and we now based the discard
      support based on blk_queue_discard(q) and extract all appropriate
      parameters from the 'struct request_queue'.
      
      CC: Li Dongyang <lidongyang@novell.com>
      Acked-by: NJan Beulich <JBeulich@suse.com>
      [v1: Dropping pointless initializer and keeping blank line]
      [v2: Remove the kfree as it is not used anymore]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      4dae7670
  6. 19 11月, 2011 2 次提交
  7. 26 10月, 2011 1 次提交
  8. 13 10月, 2011 3 次提交
  9. 15 9月, 2011 1 次提交
  10. 22 8月, 2011 1 次提交
  11. 13 5月, 2011 9 次提交
  12. 12 5月, 2011 1 次提交
  13. 06 5月, 2011 1 次提交
  14. 20 4月, 2011 2 次提交
  15. 19 4月, 2011 1 次提交
  16. 15 4月, 2011 9 次提交