1. 15 8月, 2008 3 次提交
  2. 27 7月, 2008 3 次提交
    • 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
    • H
      kexec jump · 3ab83521
      Huang Ying 提交于
      This patch provides an enhancement to kexec/kdump.  It implements the
      following features:
      
      - Backup/restore memory used by the original kernel before/after
        kexec.
      
      - Save/restore CPU state before/after kexec.
      
      The features of this patch can be used as a general method to call program in
      physical mode (paging turning off).  This can be used to call BIOS code under
      Linux.
      
      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
      
      Usage example of calling some physical mode code and return:
      
      1. Compile and install patched kernel with following options selected:
      
      CONFIG_X86_32=y
      CONFIG_KEXEC=y
      CONFIG_PM=y
      CONFIG_KEXEC_JUMP=y
      
      2. Build patched kexec-tool or download the pre-built one.
      
      3. Build some physical mode executable named such as "phy_mode"
      
      4. Boot kernel compiled in step 1.
      
      5. Load physical mode executable with /sbin/kexec. The shell command
         line can be as follow:
      
         /sbin/kexec --load-preserve-context --args-none phy_mode
      
      6. Call physical mode executable with following shell command line:
      
         /sbin/kexec -e
      
      Implementation point:
      
      To support jumping without reserving memory.  One shadow backup page (source
      page) is allocated for each page used by kexeced code image (destination
      page).  When do kexec_load, the image of kexeced code is loaded into source
      pages, and before executing, the destination pages and the source pages are
      swapped, so the contents of destination pages are backupped.  Before jumping
      to the kexeced code image and after jumping back to the original kernel, the
      destination pages and the source pages are swapped too.
      
      C ABI (calling convention) is used as communication protocol between
      kernel and called code.
      
      A flag named KEXEC_PRESERVE_CONTEXT for sys_kexec_load is added to
      indicate that the loaded kernel image is used for jumping back.
      
      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>
      3ab83521
    • W
      kernel/kexec.c: make 'kimage_terminate' void · 7fccf032
      WANG Cong 提交于
      Since kimage_terminate() always returns 0, make it void.
      Signed-off-by: NWANG Cong <wangcong@zeuux.org>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7fccf032
  3. 01 5月, 2008 1 次提交
  4. 28 4月, 2008 1 次提交
  5. 19 4月, 2008 1 次提交
  6. 08 2月, 2008 2 次提交
  7. 09 1月, 2008 1 次提交
  8. 20 10月, 2007 2 次提交
    • B
      Extended crashkernel command line · cba63c30
      Bernhard Walle 提交于
      This patch adds a extended crashkernel syntax that makes the value of reserved
      system RAM dependent on the system RAM itself:
      
          crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
          range=start-[end]
      
      For example:
      
          crashkernel=512M-2G:64M,2G-:128M
      
      The motivation comes from distributors that configure their crashkernel
      command line automatically with some configuration tool (YaST, you know ;)).
      Of course that tool knows the value of System RAM, but if the user removes
      RAM, then the system becomes unbootable or at least unusable and error
      handling is very difficult.
      
      This series implements this change for i386, x86_64, ia64, ppc64 and sh.  That
      should be all platforms that support kdump in current mainline.  I tested all
      platforms except sh due to the lack of a sh processor.
      
      This patch:
      
      This is the generic part of the patch.  It adds a parse_crashkernel() function
      in kernel/kexec.c that is called by the architecture specific code that
      actually reserves the memory.  That function takes the whole command line and
      looks itself for "crashkernel=" in it.
      
      If there are multiple occurrences, then the last one is taken.  The advantage
      is that if you have a bootloader like lilo or elilo which allows you to append
      a command line parameter but not to remove one (like in GRUB), then you can
      add another crashkernel value for testing at the boot command line and this
      one overwrites the command line in the configuration then.
      Signed-off-by: NBernhard Walle <bwalle@suse.de>
      Cc: Andi Kleen <ak@suse.de>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Vivek Goyal <vgoyal@in.ibm.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cba63c30
    • S
      pid namespaces: define is_global_init() and is_container_init() · b460cbc5
      Serge E. Hallyn 提交于
      is_init() is an ambiguous name for the pid==1 check.  Split it into
      is_global_init() and is_container_init().
      
      A cgroup init has it's tsk->pid == 1.
      
      A global init also has it's tsk->pid == 1 and it's active pid namespace
      is the init_pid_ns.  But rather than check the active pid namespace,
      compare the task structure with 'init_pid_ns.child_reaper', which is
      initialized during boot to the /sbin/init process and never changes.
      
      Changelog:
      
      	2.6.22-rc4-mm2-pidns1:
      	- Use 'init_pid_ns.child_reaper' to determine if a given task is the
      	  global init (/sbin/init) process. This would improve performance
      	  and remove dependence on the task_pid().
      
      	2.6.21-mm2-pidns2:
      
      	- [Sukadev Bhattiprolu] Changed is_container_init() calls in {powerpc,
      	  ppc,avr32}/traps.c for the _exception() call to is_global_init().
      	  This way, we kill only the cgroup if the cgroup's init has a
      	  bug rather than force a kernel panic.
      
      [akpm@linux-foundation.org: fix comment]
      [sukadev@us.ibm.com: Use is_global_init() in arch/m32r/mm/fault.c]
      [bunk@stusta.de: kernel/pid.c: remove unused exports]
      [sukadev@us.ibm.com: Fix capability.c to work with threaded init]
      Signed-off-by: NSerge E. Hallyn <serue@us.ibm.com>
      Signed-off-by: NSukadev Bhattiprolu <sukadev@us.ibm.com>
      Acked-by: NPavel Emelianov <xemul@openvz.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Cedric Le Goater <clg@fr.ibm.com>
      Cc: Dave Hansen <haveblue@us.ibm.com>
      Cc: Herbert Poetzel <herbert@13thfloor.at>
      Cc: Kirill Korotaev <dev@sw.ru>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b460cbc5
  9. 19 10月, 2007 1 次提交
  10. 17 10月, 2007 5 次提交
  11. 09 5月, 2007 1 次提交
    • S
      kdump/kexec: calculate note size at compile time · 6672f76a
      Simon Horman 提交于
      Currently the size of the per-cpu region reserved to save crash notes is
      set by the per-architecture value MAX_NOTE_BYTES.  Which in turn is
      currently set to 1024 on all supported architectures.
      
      While testing ia64 I recently discovered that this value is in fact too
      small.  The particular setup I was using actually needs 1172 bytes.  This
      lead to very tedious failure mode where the tail of one elf note would
      overwrite the head of another if they ended up being alocated sequentially
      by kmalloc, which was often the case.
      
      It seems to me that a far better approach is to caclculate the size that
      the area needs to be.  This patch does just that.
      
      If a simpler stop-gap patch for ia64 to be squeezed into 2.6.21(.X) is
      needed then this should be as easy as making MAX_NOTE_BYTES larger in
      arch/asm-ia64/kexec.h.  Perhaps 2048 would be a good choice.  However, I
      think that the approach in this patch is a much more robust idea.
      Acked-by: NVivek Goyal <vgoyal@in.ibm.com>
      Signed-off-by: NSimon Horman <horms@verge.net.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6672f76a
  12. 08 12月, 2006 3 次提交
  13. 30 9月, 2006 2 次提交
  14. 28 6月, 2006 1 次提交
    • D
      [POWERPC] Add the use of the firmware soft-reset-nmi to kdump. · c0ce7d08
      David Wilder 提交于
      With this patch, kdump uses the firmware soft-reset NMI for two purposes:
      1) Initiate the kdump (take a crash dump) by issuing a soft-reset.
      2) Break a CPU out of a deadlock condition that is detected during kdump
      processing.
      
      When a soft-reset is initiated each CPU will enter
      system_reset_exception() and set its corresponding bit in the global
      bit-array cpus_in_sr then call die(). When die() finds the CPU's bit set
      in cpu_in_sr crash_kexec() is called to initiate a crash dump. The first
      CPU to enter crash_kexec() is called the "crashing CPU". All other CPUs
      are "secondary CPUs". The secondary CPU's pass through to
      crash_kexec_secondary() and sleep. The crashing CPU waits for all CPUs
      to enter via soft-reset then boots the kdump kernel (see
      crash_soft_reset_check())
      
      When the system crashes due to a panic or exception, crash_kexec() is
      called by panic() or die(). The crashing CPU sends an IPI to all other
      CPUs to notify them of the pending shutdown. If a CPU is in a deadlock
      or hung state with interrupts disabled, the IPI will not be delivered.
      The result being, that the kdump kernel is not booted. This problem is
      solved with the use of a firmware generated soft-reset. After the
      crashing_cpu has issued the IPI, it waits for 10 sec for all CPUs to
      enter crash_ipi_callback(). A CPU signifies its entry to
      crash_ipi_callback() by setting its corresponding bit in the
      cpus_in_crash bit array. After 10 sec, if one or more CPUs have not set
      their bit in cpus_in_crash we assume that the CPU(s) is deadlocked. The
      operator is then prompted to generate a soft-reset to break the
      deadlock. Each CPU enters the soft reset handler as described above.
      
      Two conditions must be handled at this point:
      1) The system crashed because the operator generated a soft-reset. See
      2) The system had crashed before the soft-reset was generated ( in the
      case of a Panic or oops).
      
      The first CPU to enter crash_kexec() uses the state of the kexec_lock to
      determine this state. If kexec_lock is already held then condition 2 is
      true and crash_kexec_secondary() is called, else; this CPU is flagged as
      the crashing CPU, the kexec_lock is acquired and crash_kexec() proceeds
      as described above.
      
      Each additional CPUs responding to the soft-reset will pass through
      crash_kexec() to kexec_secondary(). All secondary CPUs call
      crash_ipi_callback() readying them self's for the shutdown. When ready
      they clear their bit in cpus_in_sr. The crashing CPU waits in
      kexec_secondary() until all other CPUs have cleared their bits in
      cpus_in_sr. The kexec kernel boot is then started.
      Signed-off-by: NHaren Myneni <haren@us.ibm.com>
      Signed-off-by: NDavid Wilder <dwilder@us.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      c0ce7d08
  15. 23 6月, 2006 1 次提交
  16. 12 1月, 2006 1 次提交
  17. 11 1月, 2006 2 次提交
    • V
      [PATCH] kdump: save registers early (inline functions) · e996e581
      Vivek Goyal 提交于
      - If system panics then cpu register states are captured through funciton
        crash_get_current_regs().  This is not a inline function hence a stack frame
        is pushed on to the stack and then cpu register state is captured.  Later
        this frame is popped and new frames are pushed (machine_kexec).
      
      - In theory this is not very right as we are capturing register states for a
        frame and that frame is no more valid.  This seems to have created back
        trace problems for ppc64.
      
      - This patch fixes it up.  The very first thing it does after entering
        crash_kexec() is to capture the register states.  Anyway we don't want the
        back trace beyond crash_kexec().  crash_get_current_regs() has been made
        inline
      
      - crash_setup_regs() is the top architecture dependent function which should
        be responsible for capturing the register states as well as to do some
        architecture dependent tricks.  For ex.  fixing up ss and esp for i386.
        crash_setup_regs() has also been made inline to ensure no new call frame is
        pushed onto stack.
      Signed-off-by: NVivek Goyal <vgoyal@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e996e581
    • V
      [PATCH] kdump: dynamic per cpu allocation of memory for saving cpu registers · cc571658
      Vivek Goyal 提交于
      - In case of system crash, current state of cpu registers is saved in memory
        in elf note format.  So far memory for storing elf notes was being allocated
        statically for NR_CPUS.
      
      - This patch introduces dynamic allocation of memory for storing elf notes.
        It uses alloc_percpu() interface.  This should lead to better memory usage.
      
      - Introduced based on Andi Kleen's and Eric W. Biederman's suggestions.
      
      - This patch also moves memory allocation for elf notes from architecture
        dependent portion to architecture independent portion.  Now crash_notes is
        architecture independent.  The whole idea is that size of memory to be
        allocated per cpu (MAX_NOTE_BYTES) can be architecture dependent and
        allocation of this memory can be architecture independent.
      Signed-off-by: NVivek Goyal <vgoyal@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      cc571658
  18. 30 10月, 2005 1 次提交
    • H
      [PATCH] mm: split page table lock · 4c21e2f2
      Hugh Dickins 提交于
      Christoph Lameter demonstrated very poor scalability on the SGI 512-way, with
      a many-threaded application which concurrently initializes different parts of
      a large anonymous area.
      
      This patch corrects that, by using a separate spinlock per page table page, to
      guard the page table entries in that page, instead of using the mm's single
      page_table_lock.  (But even then, page_table_lock is still used to guard page
      table allocation, and anon_vma allocation.)
      
      In this implementation, the spinlock is tucked inside the struct page of the
      page table page: with a BUILD_BUG_ON in case it overflows - which it would in
      the case of 32-bit PA-RISC with spinlock debugging enabled.
      
      Splitting the lock is not quite for free: another cacheline access.  Ideally,
      I suppose we would use split ptlock only for multi-threaded processes on
      multi-cpu machines; but deciding that dynamically would have its own costs.
      So for now enable it by config, at some number of cpus - since the Kconfig
      language doesn't support inequalities, let preprocessor compare that with
      NR_CPUS.  But I don't think it's worth being user-configurable: for good
      testing of both split and unsplit configs, split now at 4 cpus, and perhaps
      change that to 8 later.
      
      There is a benefit even for singly threaded processes: kswapd can be attacking
      one part of the mm while another part is busy faulting.
      Signed-off-by: NHugh Dickins <hugh@veritas.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4c21e2f2
  19. 28 10月, 2005 1 次提交
  20. 29 6月, 2005 1 次提交
  21. 26 6月, 2005 4 次提交