1. 24 Feb, 2010 10 commits
    • Amit Shah's avatar
      virtio: Initialize vq->data entries to NULL · 3b870624
      Amit Shah authored
      vq operations depend on vq->data[i] being NULL to figure out if the vq
      entry is in use (since the previous patch).
      
      We have to initialize them to NULL to ensure we don't work with junk
      data and trigger false BUG_ONs.
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Shirley Ma <xma@us.ibm.com>
      3b870624
    • Shirley Ma's avatar
      virtio: Add ability to detach unused buffers from vrings · c021eac4
      Shirley Ma authored
      There's currently no way for a virtio driver to ask for unused
      buffers, so it has to keep a list itself to reclaim them at shutdown.
      This is redundant, since virtio_ring stores that information.  So
      add a new hook to do this.
      Signed-off-by: default avatarShirley Ma <xma@us.ibm.com>
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c021eac4
    • Christoph Hellwig's avatar
      virtio_blk: add block topology support · 69740c8b
      Christoph Hellwig authored
      Allow reading various alignment values from the config page.  This
      allows the guest to much better align I/O requests depending on the
      storage topology.
      
      Note that the formats for the config values appear a bit messed up,
      but we follow the formats used by ATA and SCSI so they are expected in
      the storage world.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      69740c8b
    • Michael S. Tsirkin's avatar
      virtio: use smp_XX barriers on SMP · d57ed95d
      Michael S. Tsirkin authored
      virtio is communicating with a virtual "device" that actually runs on
      another host processor. Thus SMP barriers can be used to control
      memory access ordering.
      
      Where possible, we should use SMP barriers which are more lightweight than
      mandatory barriers, because mandatory barriers also control MMIO effects on
      accesses through relaxed memory I/O windows (which virtio does not use)
      (compare specifically smp_rmb and rmb on x86_64).
      
      We can't just use smp_mb and friends though, because
      we must force memory ordering even if guest is UP since host could be
      running on another CPU, but SMP barriers are defined to barrier() in
      that configuration. So, for UP fall back to mandatory barriers instead.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      d57ed95d
    • Rusty Russell's avatar
      virtio: remove bogus barriers from DEBUG version of virtio_ring.c · 97a545ab
      Rusty Russell authored
      With DEBUG defined, we add an ->in_use flag to detect if the caller
      invokes two virtio methods in parallel.  The barriers attempt to ensure
      timely update of the ->in_use flag.
      
      But they're voodoo: if we need these barriers it implies that the
      calling code doesn't have sufficient synchronization to ensure the
      code paths aren't invoked at the same time anyway, and we want to
      detect it.
      
      Also, adding barriers changes timing, so turning on debug has more
      chance of hiding real problems.
      
      Thanks to MST for drawing my attention to this code...
      
      CC: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      97a545ab
    • Rusty Russell's avatar
      lguest: remove unneeded zlib.h include in example launcher · 28ff4ef7
      Rusty Russell authored
      Two years ago 5bbf89fc removed the horrible bzImage unpacking code.
      Now it's time to remove the unneeded zlib.h include, too.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      28ff4ef7
    • Rusty Russell's avatar
      virtio: fix balloon without VIRTIO_BALLOON_F_STATS_VQ · 169c246a
      Rusty Russell authored
      When running under qemu-kvm-0.11.0:
      
      	BUG: unable to handle kernel paging request at 56e58955
      	...
      	Process vballoon (pid: 1297, ti=c7976000 task=c70a6ca0 task.ti=c7
      	...
      	Call Trace:
      	 [<c88253a3>] ? balloon+0x1b3/0x440 [virtio_balloon]
      	 [<c041c2d7>] ? schedule+0x327/0x9d0
      	 [<c88251f0>] ? balloon+0x0/0x440 [virtio_balloon]
      	 [<c014a2d4>] ? kthread+0x74/0x80
      	 [<c014a260>] ? kthread+0x0/0x80
      	 [<c0103b36>] ? kernel_thread_helper+0x6/0x30
      
      need_stats_update should be zero-initialized.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Acked-by: default avatarAdam Litke <agl@us.ibm.com>
      169c246a
    • Adam Litke's avatar
      virtio: Fix scheduling while atomic in virtio_balloon stats · 1f34c71a
      Adam Litke authored
      This is a fix for my earlier patch: "virtio: Add memory statistics reporting to
      the balloon driver (V4)".
      
      I discovered that all_vm_events() can sleep and therefore stats collection
      cannot be done in interrupt context.  One solution is to handle the interrupt
      by noting that stats need to be collected and waking the existing vballoon
      kthread which will complete the work via stats_handle_request().  Rusty, is
      this a saner way of doing business?
      
      There is one issue that I would like a broader opinion on.  In stats_request, I
      update vb->need_stats_update and then wake up the kthread.  The kthread uses
      vb->need_stats_update as a condition variable.  Do I need a memory barrier
      between the update and wake_up to ensure that my kthread sees the correct
      value?  My testing suggests that it is not needed but I would like some
      confirmation from the experts.
      Signed-off-by: default avatarAdam Litke <agl@us.ibm.com>
      To: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Anthony Liguori <aliguori@linux.vnet.ibm.com>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      1f34c71a
    • Adam Litke's avatar
      virtio: Add memory statistics reporting to the balloon driver (V4) · 9564e138
      Adam Litke authored
      Changes since V3:
       - Do not do endian conversions as they will be done in the host
       - Report stats that reference a quantity of memory in bytes
       - Minor coding style updates
      
      Changes since V2:
       - Increase stat field size to 64 bits
       - Report all sizes in kb (not pages)
       - Drop anon_pages stat and fix endianness conversion
      
      Changes since V1:
       - Use a virtqueue instead of the device config space
      
      When using ballooning to manage overcommitted memory on a host, a system for
      guests to communicate their memory usage to the host can provide information
      that will minimize the impact of ballooning on the guests.  The current method
      employs a daemon running in each guest that communicates memory statistics to a
      host daemon at a specified time interval.  The host daemon aggregates this
      information and inflates and/or deflates balloons according to the level of
      host memory pressure.  This approach is effective but overly complex since a
      daemon must be installed inside each guest and coordinated to communicate with
      the host.  A simpler approach is to collect memory statistics in the virtio
      balloon driver and communicate them directly to the hypervisor.
      
      This patch enables the guest-side support by adding stats collection and
      reporting to the virtio balloon driver.
      Signed-off-by: default avatarAdam Litke <agl@us.ibm.com>
      Cc: Anthony Liguori <anthony@codemonkey.ws>
      Cc: virtualization@lists.linux-foundation.org
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (minor fixes)
      9564e138
    • Jamie Lokier's avatar
      Add __devexit_p around reference to virtio_pci_remove · 1f08b833
      Jamie Lokier authored
      This is needed to compile with CONFIG_VIRTIO_PCI=y,
      because virtio_pci_remove is marked __devexit.
      Signed-off-by: default avatarJamie Lokier <jamie@shareable.org>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      1f08b833
  2. 23 Feb, 2010 8 commits
  3. 22 Feb, 2010 10 commits
  4. 21 Feb, 2010 7 commits
  5. 20 Feb, 2010 5 commits