1. 08 8月, 2010 1 次提交
    • D
      xenbus: Make xenbus_switch_state transactional · 5b61cb90
      Daniel Stodden 提交于
      According to the comments, this was how it's been done years ago, but
      apparently took an xbt pointer from elsewhere back then. The code was
      removed because of consistency issues: cancellation wont't roll back
      the saved xbdev->state.
      
      Still, unsolicited writes to the state field remain an issue,
      especially if device shutdown takes thread synchronization, and subtle
      races cause accidental recreation of the device node.
      
      Fixed by reintroducing the transaction. An internal one is sufficient,
      so the xbdev->state value remains consistent.
      
      Also fixes the original hack to prevent infinite recursion. Instead of
      bailing out on the first attempt to switch to Closing, checks call
      depth now.
      Signed-off-by: NDaniel Stodden <daniel.stodden@citrix.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      5b61cb90
  2. 05 8月, 2010 1 次提交
  3. 30 7月, 2010 1 次提交
  4. 29 7月, 2010 1 次提交
    • I
      xen: Do not suspend IPI IRQs. · 4877c737
      Ian Campbell 提交于
      In general the semantics of IPIs are that they are are expected to
      continue functioning after dpm_suspend_noirq().
      
      Specifically I have seen a deadlock between the callfunc IPI and the
      stop machine used by xen's do_suspend() routine. If one CPU has already
      called dpm_suspend_noirq() then there is a window where it can be sent
      a callfunc IPI before all the other CPUs have entered stop_cpu().
      
      If this happens then the first CPU ends up spinning in stop_cpu()
      waiting for the other to rendezvous in state STOPMACHINE_PREPARE while
      the other is spinning in csd_lock_wait().
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: xen-devel@lists.xensource.com
      LKML-Reference: <1280398595-29708-4-git-send-email-ian.campbell@citrix.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      4877c737
  5. 27 7月, 2010 4 次提交
  6. 23 7月, 2010 5 次提交
  7. 08 6月, 2010 1 次提交
  8. 03 6月, 2010 1 次提交
  9. 25 5月, 2010 1 次提交
  10. 07 5月, 2010 1 次提交
    • T
      stop_machine: reimplement using cpu_stop · 3fc1f1e2
      Tejun Heo 提交于
      Reimplement stop_machine using cpu_stop.  As cpu stoppers are
      guaranteed to be available for all online cpus,
      stop_machine_create/destroy() are no longer necessary and removed.
      
      With resource management and synchronization handled by cpu_stop, the
      new implementation is much simpler.  Asking the cpu_stop to execute
      the stop_cpu() state machine on all online cpus with cpu hotplug
      disabled is enough.
      
      stop_machine itself doesn't need to manage any global resources
      anymore, so all per-instance information is rolled into struct
      stop_machine_data and the mutex and all static data variables are
      removed.
      
      The previous implementation created and destroyed RT workqueues as
      necessary which made stop_machine() calls highly expensive on very
      large machines.  According to Dimitri Sivanich, preventing the dynamic
      creation/destruction makes booting faster more than twice on very
      large machines.  cpu_stop resources are preallocated for all online
      cpus and should have the same effect.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Dimitri Sivanich <sivanich@sgi.com>
      3fc1f1e2
  11. 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
  12. 08 3月, 2010 1 次提交
  13. 07 3月, 2010 1 次提交
  14. 19 2月, 2010 1 次提交
  15. 13 1月, 2010 1 次提交
    • I
      xen: fix hang on suspend. · c5cae661
      Ian Campbell 提交于
      In 65f63384 "xen: improve error handling in do_suspend" I said:
          - xs_suspend()/xs_resume() and dpm_suspend_noirq()/dpm_resume_noirq() were not
            nested in the obvious way.
      and changed the ordering of the calls as so:
          BEFORE		AFTER
          xs_suspend		dpm_suspend_noirq
          dpm_suspend_noirq	xs_suspend
          *SUSPEND*		*SUSPEND*
          dpm_resume_noirq	dpm_resume_noirq
          xs_resume		xs_resume
      Clearly this is not an improvement and I was talking rubbish.
      
      In particular the new ordering is susceptible to a hang if a xenstore write is
      in progress at the point at which the suspend kicks in. When the suspend
      process calls xs_suspend it tries to take the request_mutex but if a write is
      in progress it could be looping in xenbus_xs.c:read_reply() waiting for
      something to arrive on &xs_state.reply_list while holding the request_mutex
      (taken in the caller of read_reply).
      
      However if we have done dpm_suspend_noirq before xs_suspend then we won't get
      any more xenstore interrupts and process_msg() will never be woken up to add
      anything to the reply_list.
      
      Fix this by calling xs_suspend before dpm_suspend_noirq. If dpm_suspend_noirq
      fails then make sure we go through the xs_suspend_cancel() code path.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Acked-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Stable Kernel <stable@kernel.org>
      c5cae661
  16. 05 12月, 2009 2 次提交
    • I
      xen: try harder to balloon up under memory pressure. · bc2c0303
      Ian Campbell 提交于
      Currently if the balloon driver is unable to increase the guest's
      reservation it assumes the failure was due to reaching its full
      allocation, gives up on the ballooning operation and records the limit
      it reached as the "hard limit". The driver will not try again until
      the target is set again (even to the same value).
      
      However it is possible that ballooning has in fact failed due to
      memory pressure in the host and therefore it is desirable to keep
      attempting to reach the target in case memory becomes available. The
      most likely scenario is that some guests are ballooning down while
      others are ballooning up and therefore there is temporary memory
      pressure while things stabilise. You would not expect a well behaved
      toolstack to ask a domain to balloon to more than its allocation nor
      would you expect it to deliberately over-commit memory by setting
      balloon targets which exceed the total host memory.
      
      This patch drops the concept of a hard limit and causes the balloon
      driver to retry increasing the reservation on a timer in the same
      manner as when decreasing the reservation.
      
      Also if we partially succeed in increasing the reservation
      (i.e. receive less pages than we asked for) then we may as well keep
      those pages rather than returning them to Xen.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Cc: Stable Kernel <stable@kernel.org>
      bc2c0303
    • G
      Xen balloon: fix totalram_pages counting. · 3d65c948
      Gianluca Guida 提交于
      Change totalram_pages when a single page is added/removed to the
      ballooned list. This avoid totalram_pages to be set erroneously to
      max_pfn at boot.
      Signed-off-by: NGianluca Guida <gianluca.guida@citrix.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Stable Kernel <stable@kernel.org>
      3d65c948
  17. 04 12月, 2009 8 次提交
  18. 05 11月, 2009 1 次提交
  19. 04 11月, 2009 2 次提交
  20. 05 10月, 2009 1 次提交
  21. 22 9月, 2009 1 次提交
  22. 21 9月, 2009 1 次提交
  23. 20 9月, 2009 1 次提交
  24. 10 9月, 2009 1 次提交
    • J
      xen: make -fstack-protector work under Xen · 577eebea
      Jeremy Fitzhardinge 提交于
      -fstack-protector uses a special per-cpu "stack canary" value.
      gcc generates special code in each function to test the canary to make
      sure that the function's stack hasn't been overrun.
      
      On x86-64, this is simply an offset of %gs, which is the usual per-cpu
      base segment register, so setting it up simply requires loading %gs's
      base as normal.
      
      On i386, the stack protector segment is %gs (rather than the usual kernel
      percpu %fs segment register).  This requires setting up the full kernel
      GDT and then loading %gs accordingly.  We also need to make sure %gs is
      initialized when bringing up secondary cpus too.
      
      To keep things consistent, we do the full GDT/segment register setup on
      both architectures.
      
      Because we need to avoid -fstack-protected code before setting up the GDT
      and because there's no way to disable it on a per-function basis, several
      files need to have stack-protector inhibited.
      
      [ Impact: allow Xen booting with stack-protector enabled ]
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      577eebea