21 Jul, 2011

1 commit

  • In kexec jump support, jump back address passed to the kexeced
    kernel via function calling ABI, that is, the function call
    return address is the jump back entry.

    Furthermore, jump back entry == 0 should be used to signal that
    the jump back or preserve context is not enabled in the original
    kernel.

    But in the current implementation the stack position used for
    function call return address is not cleared context
    preservation is disabled. The patch fixes this bug.

    Reported-and-tested-by: Yin Kangkai
    Signed-off-by: Huang Ying
    Cc: Eric W. Biederman
    Cc: Vivek Goyal
    Cc:
    Link: http://lkml.kernel.org/r/1310607277-25029-1-git-send-email-ying.huang@intel.com
    Signed-off-by: Ingo Molnar

    Huang Ying
     

11 Mar, 2009

1 commit


14 Feb, 2009

1 commit


31 Oct, 2008

2 commits

  • Impact: change the kexec bootstrap code implementation from assembly to C

    This patch transforms the kexec page tables setup code from assembler
    code to C code in machine_kexec_prepare. This improves readability and
    reduces code line number.

    Signed-off-by: Huang Ying
    Signed-off-by: Ingo Molnar

    Huang Ying
     
  • Impact: save kernel .text by loosening kexec page alignment

    This patch removes PAGE_SIZE alignment from relocate_kernel(). Before
    kexec jump patches are merged, control page is mapped to
    relocate_kernel in kexec page tables, so relocate_kernel must be
    PAGE_SIZE aligned. Now, control page is mapped to identity mapped
    address, so relocate_kernel need not to be PAGE_SIZE aligned any
    more. This can reduce a few KB from kernel text segement.

    Signed-off-by: Huang Ying
    Signed-off-by: Ingo Molnar

    Huang Ying
     

15 Aug, 2008

1 commit

  • Kexec/Kexec-jump require code size in control page is less than
    PAGE_SIZE/2. This patch add link-time checking for this.

    ASSERT() of ld link script is used as the link-time checking mechanism.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Huang Ying
    Cc: Pavel Machek
    Cc: "Rafael J. Wysocki"
    Cc: "Eric W. Biederman"
    Acked-by: Vivek Goyal
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Ying
     

27 Jul, 2008

1 commit

  • 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: Huang Ying
    Acked-by: Vivek Goyal
    Cc: "Eric W. Biederman"
    Cc: Pavel Machek
    Cc: Nigel Cunningham
    Cc: "Rafael J. Wysocki"
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Ying
     

17 Apr, 2008

5 commits


11 Oct, 2007

1 commit