1. 27 7月, 2008 2 次提交
    • H
      kexec jump: save/restore device state · 89081d17
      Huang Ying 提交于
      This patch implements devices state save/restore before after kexec.
      
      This patch together with features in kexec_jump patch can be used for
      following:
      
      - A simple hibernation implementation without ACPI support.  You can kexec a
        hibernating kernel, save the memory image of original system and shutdown
        the system.  When resuming, you restore the memory image of original system
        via ordinary kexec load then jump back.
      
      - Kernel/system debug through making system snapshot.  You can make system
        snapshot, jump back, do some thing and make another system snapshot.
      
      - Cooperative multi-kernel/system.  With kexec jump, you can switch between
        several kernels/systems quickly without boot process except the first time.
        This appears like swap a whole kernel/system out/in.
      
      - A general method to call program in physical mode (paging turning
        off). This can be used to invoke BIOS code under Linux.
      
      The following user-space tools can be used with kexec jump:
      
      - kexec-tools needs to be patched to support kexec jump. The patches
        and the precompiled kexec can be download from the following URL:
             source: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-src_git_kh10.tar.bz2
             patches: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-patches_git_kh10.tar.bz2
             binary: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec_git_kh10
      
      - makedumpfile with patches are used as memory image saving tool, it
        can exclude free pages from original kernel memory image file. The
        patches and the precompiled makedumpfile can be download from the
        following URL:
             source: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile-src_cvs_kh10.tar.bz2
             patches: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile-patches_cvs_kh10.tar.bz2
             binary: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile_cvs_kh10
      
      - An initramfs image can be used as the root file system of kexeced
        kernel. An initramfs image built with "BuildRoot" can be downloaded
        from the following URL:
             initramfs image: http://khibernation.sourceforge.net/download/release_v10/initramfs/rootfs_cvs_kh10.gz
        All user space tools above are included in the initramfs image.
      
      Usage example of simple hibernation:
      
      1. Compile and install patched kernel with following options selected:
      
      CONFIG_X86_32=y
      CONFIG_RELOCATABLE=y
      CONFIG_KEXEC=y
      CONFIG_CRASH_DUMP=y
      CONFIG_PM=y
      CONFIG_HIBERNATION=y
      CONFIG_KEXEC_JUMP=y
      
      2. Build an initramfs image contains kexec-tool and makedumpfile, or
         download the pre-built initramfs image, called rootfs.gz in
         following text.
      
      3. Prepare a partition to save memory image of original kernel, called
         hibernating partition in following text.
      
      4. Boot kernel compiled in step 1 (kernel A).
      
      5. In the kernel A, load kernel compiled in step 1 (kernel B) with
         /sbin/kexec. The shell command line can be as follow:
      
         /sbin/kexec --load-preserve-context /boot/bzImage --mem-min=0x100000
           --mem-max=0xffffff --initrd=rootfs.gz
      
      6. Boot the kernel B with following shell command line:
      
         /sbin/kexec -e
      
      7. The kernel B will boot as normal kexec. In kernel B the memory
         image of kernel A can be saved into hibernating partition as
         follow:
      
         jump_back_entry=`cat /proc/cmdline | tr ' ' '\n' | grep kexec_jump_back_entry | cut -d '='`
         echo $jump_back_entry > kexec_jump_back_entry
         cp /proc/vmcore dump.elf
      
         Then you can shutdown the machine as normal.
      
      8. Boot kernel compiled in step 1 (kernel C). Use the rootfs.gz as
         root file system.
      
      9. In kernel C, load the memory image of kernel A as follow:
      
         /sbin/kexec -l --args-none --entry=`cat kexec_jump_back_entry` dump.elf
      
      10. Jump back to the kernel A as follow:
      
         /sbin/kexec -e
      
         Then, kernel A is resumed.
      
      Implementation point:
      
      To support jumping between two kernels, before jumping to (executing)
      the new kernel and jumping back to the original kernel, the devices
      are put into quiescent state, and the state of devices and CPU is
      saved. After jumping back from kexeced kernel and jumping to the new
      kernel, the state of devices and CPU are restored accordingly. The
      devices/CPU state save/restore code of software suspend is called to
      implement corresponding function.
      
      Known issues:
      
      - Because the segment number supported by sys_kexec_load is limited,
        hibernation image with many segments may not be load. This is
        planned to be eliminated by adding a new flag to sys_kexec_load to
        make a image can be loaded with multiple sys_kexec_load invoking.
      
      Now, only the i386 architecture is supported.
      Signed-off-by: NHuang Ying <ying.huang@intel.com>
      Acked-by: NVivek Goyal <vgoyal@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      89081d17
    • D
      pm selftest: rtc paranoia · a2e2e357
      David Brownell 提交于
      Cope with a quirk of some RTCs (notably ACPI ones) which aren't guaranteed
      to implement oneshot behavior when they woke the system from sleeep:
      forcibly disable the alarm, just in case.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a2e2e357
  2. 25 7月, 2008 4 次提交
  3. 18 7月, 2008 1 次提交
  4. 17 7月, 2008 3 次提交
  5. 16 7月, 2008 2 次提交
  6. 13 6月, 2008 1 次提交
    • R
      Suspend-related patches for 2.6.27 · d8f3de0d
      Rafael J. Wysocki 提交于
      ACPI PM: Add possibility to change suspend sequence
      
      There are some systems out there that don't work correctly with
      our current suspend/hibernation code ordering.  Provide a workaround
      for these systems allowing them to pass 'acpi_sleep=old_ordering' in
      the kernel command line so that it will use the pre-ACPI 2.0 ("old")
      suspend code ordering.
      
      Unfortunately, this requires us to add a platform hook to the
      resuming of devices for recovering the platform in case one of the
      device drivers' .suspend() routines returns error code.  Namely,
      ACPI 1.0 specifies that _PTS should be called before suspending
      devices, but _WAK still should be called before resuming them in
      order to undo the changes made by _PTS.  However, if there is an
      error during suspending devices, they are automatically resumed
      without returning control to the PM core, so the _WAK has to be
      called from within device_resume() in that cases.
      
      The patch also reorders and refactors the ACPI suspend/hibernation
      code to avoid duplication as far as reasonably possible.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@suse.cz>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      d8f3de0d
  7. 11 6月, 2008 1 次提交
    • R
      Introduce new top level suspend and hibernation callbacks · 1eede070
      Rafael J. Wysocki 提交于
      Introduce 'struct pm_ops' and 'struct pm_ext_ops' ('ext' meaning
      'extended') representing suspend and hibernation operations for bus
      types, device classes, device types and device drivers.
      
      Modify the PM core to use 'struct pm_ops' and 'struct pm_ext_ops'
      objects, if defined, instead of the ->suspend(), ->resume(),
      ->suspend_late(), and ->resume_early() callbacks (the old callbacks
      will be considered as legacy and gradually phased out).
      
      The main purpose of doing this is to separate suspend (aka S2RAM and
      standby) callbacks from hibernation callbacks in such a way that the
      new callbacks won't take arguments and the semantics of each of them
      will be clearly specified.  This has been requested for multiple
      times by many people, including Linus himself, and the reason is that
      within the current scheme if ->resume() is called, for example, it's
      difficult to say why it's been called (ie. is it a resume from RAM or
      from hibernation or a suspend/hibernation failure etc.?).
      
      The second purpose is to make the suspend/hibernation callbacks more
      flexible so that device drivers can handle more than they can within
      the current scheme.  For example, some drivers may need to prevent
      new children of the device from being registered before their
      ->suspend() callbacks are executed or they may want to carry out some
      operations requiring the availability of some other devices, not
      directly bound via the parent-child relationship, in order to prepare
      for the execution of ->suspend(), etc.
      
      Ultimately, we'd like to stop using the freezing of tasks for suspend
      and therefore the drivers' suspend/hibernation code will have to take
      care of the handling of the user space during suspend/hibernation.
      That, in turn, would be difficult within the current scheme, without
      the new ->prepare() and ->complete() callbacks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      1eede070
  8. 28 4月, 2008 1 次提交
    • A
      PM/gxfb: add hook to PM console layer that allows disabling of suspend VT switch · b6f448e9
      Andres Salomon 提交于
      Prior to suspend, we allocate and switch to a new VT; after suspend, we switch
      back to the original VT.  This can be slow, and is completely unnecessary if
      the framebuffer we're using can restore video properly.
      
      This adds a hook that allows drivers to select whether or not to do this vt
      switch, and changes the gxfb driver to call this hook.  It also adds a module
      param to gxfb to allow controlling of the vt switch (defaulting to no switch).
      
      (Note: I'm not convinced that console_sem is the best way to protect this, but
      we should probably have some form of locking..)
      
      [akpm@linux-foundation.org: build fix]
      Signed-off-by: NAndres Salomon <dilinger@debian.org>
      Cc: Jordan Crouse <jordan.crouse@amd.com>
      Cc: "Antonino A. Daplas" <adaplas@pol.net>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b6f448e9
  9. 15 4月, 2008 1 次提交
  10. 13 3月, 2008 1 次提交
  11. 12 3月, 2008 1 次提交
    • R
      Hibernation: Fix mark_nosave_pages() · a82f7119
      Rafael J. Wysocki 提交于
      There is a problem in the hibernation code that triggers on some NUMA
      systems on which pfn_valid() returns 'true' for some PFNs that don't
      belong to any zone.  Namely, there is a BUG_ON() in
      memory_bm_find_bit() that triggers for PFNs not belonging to any
      zone and passing the pfn_valid() test.  On the affected systems it
      triggers when we mark PFNs reported by the platform as not saveable,
      because the PFNs in question belong to a region mapped directly using
      iorepam() (i.e. the ACPI data area) and they pass the pfn_valid()
      test.
      
      Modify memory_bm_find_bit() so that it returns an error if given PFN
      doesn't belong to any zone instead of crashing the kernel and ignore
      the result returned by it in mark_nosave_pages(), while marking the
      "nosave" memory regions.
      
      This doesn't affect the hibernation functionality, as we won't touch
      the PFNs in question anyway.
      
      http://bugzilla.kernel.org/show_bug.cgi?id=9966 .
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      a82f7119
  12. 04 3月, 2008 1 次提交
    • R
      freezer vs stopped or traced · 13b1c3d4
      Roland McGrath 提交于
      This changes the "freezer" code used by suspend/hibernate in its treatment
      of tasks in TASK_STOPPED (job control stop) and TASK_TRACED (ptrace) states.
      
      As I understand it, the intent of the "freezer" is to hold all tasks
      from doing anything significant.  For this purpose, TASK_STOPPED and
      TASK_TRACED are "frozen enough".  It's possible the tasks might resume
      from ptrace calls (if the tracer were unfrozen) or from signals
      (including ones that could come via timer interrupts, etc).  But this
      doesn't matter as long as they quickly block again while "freezing" is
      in effect.  Some minor adjustments to the signal.c code make sure that
      try_to_freeze() very shortly follows all wakeups from both kinds of
      stop.  This lets the freezer code safely leave stopped tasks unmolested.
      
      Changing this fixes the longstanding bug of seeing after resuming from
      suspend/hibernate your shell report "[1] Stopped" and the like for all
      your jobs stopped by ^Z et al, as if you had freshly fg'd and ^Z'd them.
      It also removes from the freezer the arcane special case treatment for
      ptrace'd tasks, which relied on intimate knowledge of ptrace internals.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      13b1c3d4
  13. 24 2月, 2008 1 次提交
    • R
      PM: Introduce PM_EVENT_HIBERNATE callback state · 3a2d5b70
      Rafael J. Wysocki 提交于
      During the last step of hibernation in the "platform" mode (with the
      help of ACPI) we use the suspend code, including the devices'
      ->suspend() methods, to prepare the system for entering the ACPI S4
      system sleep state.
      
      But at least for some devices the operations performed by the
      ->suspend() callback in that case must be different from its operations
      during regular suspend.
      
      For this reason, introduce the new PM event type PM_EVENT_HIBERNATE and
      pass it to the device drivers' ->suspend() methods during the last phase
      of hibernation, so that they can distinguish this case and handle it as
      appropriate.  Modify the drivers that handle PM_EVENT_SUSPEND in a
      special way and need to handle PM_EVENT_HIBERNATE in the same way.
      
      These changes are necessary to fix a hibernation regression related
      to the i915 driver (ref. http://lkml.org/lkml/2008/2/22/488).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Tested-by: NJeff Chua <jeff.chua.linux@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3a2d5b70
  14. 21 2月, 2008 1 次提交
  15. 07 2月, 2008 1 次提交
  16. 06 2月, 2008 2 次提交
  17. 02 2月, 2008 16 次提交