1. 19 5月, 2010 1 次提交
  2. 22 4月, 2010 1 次提交
  3. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  4. 24 2月, 2010 3 次提交
    • R
      virtio: fix balloon without VIRTIO_BALLOON_F_STATS_VQ · 169c246a
      Rusty Russell 提交于
      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: NRusty Russell <rusty@rustcorp.com.au>
      Acked-by: NAdam Litke <agl@us.ibm.com>
      169c246a
    • A
      virtio: Fix scheduling while atomic in virtio_balloon stats · 1f34c71a
      Adam Litke 提交于
      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: NAdam 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: NRusty Russell <rusty@rustcorp.com.au>
      1f34c71a
    • A
      virtio: Add memory statistics reporting to the balloon driver (V4) · 9564e138
      Adam Litke 提交于
      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: NAdam 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
  5. 17 1月, 2010 1 次提交
  6. 22 10月, 2009 2 次提交
  7. 23 9月, 2009 2 次提交
  8. 12 6月, 2009 2 次提交
  9. 19 4月, 2009 1 次提交
  10. 30 12月, 2008 1 次提交
  11. 25 8月, 2008 1 次提交
    • A
      virtio_balloon: fix towards_target when deflating balloon · 532a6086
      Anthony Liguori 提交于
      Both v and vb->num_pages are u32 and unsigned int respectively.  If v is less
      than vb->num_pages (and it is, when deflating the balloon), the result is a
      very large 32-bit number.  Since we're returning a s64, instead of getting the
      same negative number we desire, we get a very large positive number.
      
      This handles the case where v < vb->num_pages and ensures we get a small,
      negative, s64 as the result.
      
      Rusty: please push this for 2.6.27-rc4.  It's probably appropriate for the
      stable tree too as it will cause an unexpected OOM when ballooning.
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (simplified)
      532a6086
  12. 02 5月, 2008 2 次提交
    • R
      virtio: explicit advertisement of driver features · c45a6816
      Rusty Russell 提交于
      A recent proposed feature addition to the virtio block driver revealed
      some flaws in the API: in particular, we assume that feature
      negotiation is complete once a driver's probe function returns.
      
      There is nothing in the API to require this, however, and even I
      didn't notice when it was violated.
      
      So instead, we require the driver to specify what features it supports
      in a table, we can then move the feature negotiation into the virtio
      core.  The intersection of device and driver features are presented in
      a new 'features' bitmap in the struct virtio_device.
      
      Note that this highlights the difference between Linux unsigned-long
      bitmaps where each unsigned long is in native endian, and a
      straight-forward little-endian array of bytes.
      
      Drivers can still remove feature bits in their probe routine if they
      really have to.
      
      API changes:
      - dev->config->feature() no longer gets and acks a feature.
      - drivers should advertise their features in the 'feature_table' field
      - use virtio_has_feature() for extra sanity when checking feature bits
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      c45a6816
    • R
      virtio: change config to guest endian. · 72e61eb4
      Rusty Russell 提交于
      A recent proposed feature addition to the virtio block driver revealed
      some flaws in the API, in particular how easy it is to break big
      endian machines.
      
      The virtio config space was originally chosen to be little-endian,
      because we thought the config might be part of the PCI config space
      for virtio_pci.  It's actually a separate mmio region, so that
      argument holds little water; as only x86 is currently using the virtio
      mechanism, we can change this (but must do so now, before the
      impending s390 merge).
      
      API changes:
      - __virtio_config_val() just becomes a striaght vdev->config_get() call.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      72e61eb4
  13. 17 3月, 2008 1 次提交
  14. 07 2月, 2008 2 次提交
  15. 04 2月, 2008 1 次提交
    • R
      virtio: balloon driver · 6b35e407
      Rusty Russell 提交于
      After discussions with Anthony Liguori, it seems that the virtio
      balloon can be made even simpler.  Here's my attempt.
      
      The device configuration tells the driver how much memory it should
      take from the guest (ie. balloon size).  The guest feeds the page
      numbers it has taken via one virtqueue.
      
      A second virtqueue feeds the page numbers the driver wants back: if
      the device has the VIRTIO_BALLOON_F_MUST_TELL_HOST bit, then this
      queue is compulsory, otherwise it's advisory (and the guest can simply
      fault the pages back in).
      
      This driver can be enhanced later to deflate the balloon via a
      shrinker, oom callback or we could even go for a complete set of
      in-guest regulators.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      6b35e407