06 Oct, 2012

1 commit


31 Jul, 2012

1 commit

  • The last line of vmcoreinfo note does not end with \n. Parsing all the
    lines in note becomes easier if all lines end with \n instead of trying to
    special case the last line.

    I know at least one tool, vmcore-dmesg in kexec-tools tree which made the
    assumption that all lines end with \n. I think it is a good idea to fix
    it.

    Signed-off-by: Vivek Goyal
    Cc: "Eric W. Biederman"
    Cc: Atsushi Kumagai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     

29 Mar, 2012

4 commits

  • Merge third batch of patches from Andrew Morton:
    - Some MM stragglers
    - core SMP library cleanups (on_each_cpu_mask)
    - Some IPI optimisations
    - kexec
    - kdump
    - IPMI
    - the radix-tree iterator work
    - various other misc bits.

    "That'll do for -rc1. I still have ~10 patches for 3.4, will send
    those along when they've baked a little more."

    * emailed from Andrew Morton : (35 commits)
    backlight: fix typo in tosa_lcd.c
    crc32: add help text for the algorithm select option
    mm: move hugepage test examples to tools/testing/selftests/vm
    mm: move slabinfo.c to tools/vm
    mm: move page-types.c from Documentation to tools/vm
    selftests/Makefile: make `run_tests' depend on `all'
    selftests: launch individual selftests from the main Makefile
    radix-tree: use iterators in find_get_pages* functions
    radix-tree: rewrite gang lookup using iterator
    radix-tree: introduce bit-optimized iterator
    fs/proc/namespaces.c: prevent crash when ns_entries[] is empty
    nbd: rename the nbd_device variable from lo to nbd
    pidns: add reboot_pid_ns() to handle the reboot syscall
    sysctl: use bitmap library functions
    ipmi: use locks on watchdog timeout set on reboot
    ipmi: simplify locking
    ipmi: fix message handling during panics
    ipmi: use a tasklet for handling received messages
    ipmi: increase KCS timeouts
    ipmi: decrease the IPMI message transaction time in interrupt mode
    ...

    Linus Torvalds
     
  • When using crashkernel=2M-256M, the kernel doesn't give any warning. This
    is misleading sometimes.

    Signed-off-by: Zhenzhong Duan
    Acked-by: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zhenzhong Duan
     
  • nommu platforms don't have very interesting swapper_pg_dir pointers and
    usually just #define them to NULL, meaning that we can't include them in
    the vmcoreinfo on the kexec crash path.

    This patch only saves the swapper_pg_dir if we have an MMU.

    Signed-off-by: Will Deacon
    Reviewed-by: Simon Horman
    Cc: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Will Deacon
     
  • Remove all #inclusions of asm/system.h preparatory to splitting and killing
    it. Performed with the following command:

    perl -p -i -e 's!^#\s*include\s*.*\n!!' `grep -Irl '^#\s*include\s*' *`

    Signed-off-by: David Howells

    David Howells
     

30 Jan, 2012

1 commit

  • The current device suspend/resume phases during system-wide power
    transitions appear to be insufficient for some platforms that want
    to use the same callback routines for saving device states and
    related operations during runtime suspend/resume as well as during
    system suspend/resume. In principle, they could point their
    .suspend_noirq() and .resume_noirq() to the same callback routines
    as their .runtime_suspend() and .runtime_resume(), respectively,
    but at least some of them require device interrupts to be enabled
    while the code in those routines is running.

    It also makes sense to have device suspend-resume callbacks that will
    be executed with runtime PM disabled and with device interrupts
    enabled in case someone needs to run some special code in that
    context during system-wide power transitions.

    Apart from this, .suspend_noirq() and .resume_noirq() were introduced
    as a workaround for drivers using shared interrupts and failing to
    prevent their interrupt handlers from accessing suspended hardware.
    It appears to be better not to use them for other porposes, or we may
    have to deal with some serious confusion (which seems to be happening
    already).

    For the above reasons, introduce new device suspend/resume phases,
    "late suspend" and "early resume" (and analogously for hibernation)
    whose callback will be executed with runtime PM disabled and with
    device interrupts enabled and whose callback pointers generally may
    point to runtime suspend/resume routines.

    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Mark Brown
    Reviewed-by: Kevin Hilman

    Rafael J. Wysocki
     

13 Jan, 2012

3 commits

  • Currently it is possible to set the crash_size via the sysfs
    /sys/kernel/kexec_crash_size even if no crash kernel memory has been
    defined with the "crashkernel" parameter. In this case "crashk_res" is
    not initialized and crashk_res.start = crashk_res.end = 0. Unfortunately
    resource_size(&crashk_res) returns 1 in this case. This breaks the s390
    implementation of crash_(un)map_reserved_pages().

    To fix the problem the correct "old_size" is now calculated in
    crash_shrink_memory(). "old_size is set to "0" if crashk_res is not
    initialized. With this change crash_shrink_memory() will do nothing, when
    "crashk_res" is not initialized. It will return "0" for "echo 0 >
    /sys/kernel/kexec_crash_size" and -EINVAL for "echo [not zero] >
    /sys/kernel/kexec_crash_size".

    In addition to that this patch also simplifies the "ret = -EINVAL" vs.
    "ret = 0" logic as suggested by Simon Horman.

    Signed-off-by: Michael Holzheu
    Reviewed-by: Dave Young
    Reviewed-by: WANG Cong
    Reviewed-by: Simon Horman
    Cc: Vivek Goyal
    Cc: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Holzheu
     
  • When shrinking crashkernel memory using /sys/kernel/kexec_crash_size for
    the newly added memory no RAM resource is created at the moment.

    Example:

    $ cat /proc/iomem
    00000000-bfffffff : System RAM
    00000000-005b7ac3 : Kernel code
    005b7ac4-009743bf : Kernel data
    009bb000-00a85c33 : Kernel bss
    c0000000-cfffffff : Crash kernel
    d0000000-ffffffff : System RAM

    $ echo 0 > /sys/kernel/kexec_crash_size
    $ cat /proc/iomem
    00000000-bfffffff : System RAM
    00000000-005b7ac3 : Kernel code
    005b7ac4-009743bf : Kernel data
    009bb000-00a85c33 : Kernel bss
    < /sys/kernel/kexec_crash_size
    $ cat /proc/iomem
    00000000-bfffffff : System RAM
    00000000-005b7ac3 : Kernel code
    005b7ac4-009743bf : Kernel data
    009bb000-00a85c33 : Kernel bss
    c0000000-cfffffff : System RAM <
    Cc: Vivek Goyal
    Cc: "Eric W. Biederman"
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Holzheu
     
  • KMSG_DUMP_KEXEC is useless because we already save kernel messages inside
    /proc/vmcore, and it is unsafe to allow modules to do other stuffs in a
    crash dump scenario.

    [akpm@linux-foundation.org: fix powerpc build]
    Signed-off-by: WANG Cong
    Reported-by: Vivek Goyal
    Acked-by: Vivek Goyal
    Acked-by: Jarod Wilson
    Cc: "Eric W. Biederman"
    Cc: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    WANG Cong
     

09 Dec, 2011

1 commit


30 Oct, 2011

3 commits

  • This patch introduces a mechanism that allows architecture backends to
    remove page tables for the crashkernel memory. This can protect the loaded
    kdump kernel from being overwritten by broken kernel code. Two new
    functions crash_map_reserved_pages() and crash_unmap_reserved_pages() are
    added that can be implemented by architecture code. The
    crash_map_reserved_pages() function is called before and
    crash_unmap_reserved_pages() after the crashkernel segments are loaded. The
    functions are also called in crash_shrink_memory() to create/remove page
    tables when the crashkernel memory size is reduced.

    To support architectures that have large pages this patch also introduces
    a new define KEXEC_CRASH_MEM_ALIGN. The crashkernel start and size must
    always be aligned with KEXEC_CRASH_MEM_ALIGN.

    Cc: Andrew Morton
    Acked-by: Vivek Goyal
    Signed-off-by: Michael Holzheu
    Signed-off-by: Martin Schwidefsky

    Michael Holzheu
     
  • Currently the vmcoreinfo note is only initialized in case of kdump. On s390
    it is possible to create kernel dumps with other dump mechanisms than kdump
    (e.g. via hypervisor dump or stand-alone dump tools). For those dumps it
    would also be desirable to include the vmcoreinfo data. To accomplish this,
    with this patch the vmcoreinfo ELF note is always initialized, not only in
    case of a (kdump) crash. On s390 we will add an ABI defined pointer at
    a well known address to vmcoreinfo so that dump analysis tools are able to
    find this information.

    In particular on s390 we have a tool named zgetdump. With this tool it is
    possible to convert dump formats on the fly using fuse. E.g. you can mount a
    s390 stand-alone dump as ELF dump. When this is done, the tool finds the
    vmcoreinfo in the stand-alone dump via the well known ABI defined address and
    it creates the respective VMCOREINFO ELF note in the output ELF dump. This then
    can be used e.g. by makedumpfile for dump filtering. No more need for a
    vmlinux file with debug information.

    So this will look like the following:
    $ zgetdump --mount standalone.dump -f elf /mnt
    $ ls /mnt
    dump.elf
    $ readelf -n /mnt/dump.elf
    $ ...
    VMCOREINFO 0x00000474 Unknown note type: (0x00000000)
    $ makedumpfile -c -d 31 /mnt/dump.elf dump.kdump

    Cc: Andrew Morton
    Acked-by: Vivek Goyal
    Signed-off-by: Michael Holzheu
    Signed-off-by: Martin Schwidefsky

    Michael Holzheu
     
  • On s390 there is a different KEXEC_CONTROL_MEMORY_LIMIT for the normal and
    the kdump kexec case. Therefore this patch introduces a new macro
    KEXEC_CRASH_CONTROL_MEMORY_LIMIT. This is set to
    KEXEC_CONTROL_MEMORY_LIMIT for all architectures that do not define
    KEXEC_CRASH_CONTROL_MEMORY_LIMIT.

    Acked-by: Vivek Goyal
    Acked-by: Andrew Morton
    Signed-off-by: Michael Holzheu
    Signed-off-by: Martin Schwidefsky

    Michael Holzheu
     

10 Jun, 2011

1 commit


12 May, 2011

1 commit

  • Since suspend, resume and shutdown operations in struct sysdev_class
    and struct sysdev_driver are not used any more, remove them. Also
    drop sysdev_suspend(), sysdev_resume() and sysdev_shutdown() used
    for executing those operations and modify all of their users
    accordingly. This reduces kernel code size quite a bit and reduces
    its complexity.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

20 Apr, 2011

1 commit

  • Device suspend/resume infrastructure is used not only by the suspend
    and hibernate code in kernel/power, but also by APM, Xen and the
    kexec jump feature. However, commit 40dc166cb5dddbd36aa4ad11c03915ea
    (PM / Core: Introduce struct syscore_ops for core subsystems PM)
    failed to add syscore_suspend() and syscore_resume() calls to that
    code, which generally leads to breakage when the features in question
    are used.

    To fix this problem, add the missing syscore_suspend() and
    syscore_resume() calls to arch/x86/kernel/apm_32.c, kernel/kexec.c
    and drivers/xen/manage.c.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Acked-by: Ian Campbell

    Rafael J. Wysocki
     

08 Apr, 2011

1 commit


01 Apr, 2011

1 commit

  • On ppc64 the crashkernel region almost always overlaps an area of firmware.
    This works fine except when using the sysfs interface to reduce the kdump
    region. If we free the firmware area we are guaranteed to crash.

    Rename free_reserved_phys_range to crash_free_reserved_phys_range and make
    it a weak function so we can override it.

    Signed-off-by: Anton Blanchard
    Signed-off-by: Benjamin Herrenschmidt

    Anton Blanchard
     

31 Mar, 2011

1 commit


02 Nov, 2010

1 commit

  • "gadget", "through", "command", "maintain", "maintain", "controller", "address",
    "between", "initiali[zs]e", "instead", "function", "select", "already",
    "equal", "access", "management", "hierarchy", "registration", "interest",
    "relative", "memory", "offset", "already",

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Jiri Kosina

    Uwe Kleine-König
     

27 Oct, 2010

1 commit


11 Aug, 2010

1 commit

  • copy_to/from_user() returns the number of bytes remaining to be copied.
    It never returns a negative value. The correct return code is -EFAULT and
    not -EIO.

    All the callers check for non-zero returns so that's Ok, but the return
    code is passed to the user so we should fix this.

    Signed-off-by: Dan Carpenter
    Cc: Hidetoshi Seto
    Cc: "Paul E. McKenney"
    Cc: "Eric W. Biederman"
    Cc: Simon Kagstrom
    Acked-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Carpenter
     

30 Jun, 2010

1 commit

  • When crashkernel is not enabled, "echo 0 > /sys/kernel/kexec_crash_size"
    OOPSes the kernel in crash_shrink_memory. This happens when
    crash_shrink_memory tries to release the 'crashk_res' resource which are
    not reserved. Also value of "/sys/kernel/kexec_crash_size" shows as 1,
    which should be 0.

    This patch fixes the OOPS in crash_shrink_memory and shows
    "/sys/kernel/kexec_crash_size" as 0 when crash kernel memory is not
    reserved.

    Signed-off-by: Pavan Naregundi
    Reviewed-by: WANG Cong
    Cc: Simon Horman
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pavan Naregundi
     

12 May, 2010

1 commit

  • Two "echo 0 > /sys/kernel/kexec_crash_size" OOPSes kernel. Also content
    of this file is invalid after first shrink to zero: it shows 1 instead of
    0.

    This scenario is unlikely to happen often (root privs, valid crashkernel=
    in cmdline, dump-capture kernel not loaded), I hit it only by chance.

    This patch fixes it.

    Signed-off-by: Vitaly Mayatskikh
    Cc: Cong Wang
    Cc: Neil Horman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vitaly Mayatskikh
     

17 Feb, 2010

1 commit

  • Add __percpu sparse annotations to core subsystems.

    These annotations are to make sparse consider percpu variables to be
    in a different address space and warn if accessed without going
    through percpu accessors. This patch doesn't affect normal builds.

    Signed-off-by: Tejun Heo
    Reviewed-by: Christoph Lameter
    Acked-by: Paul E. McKenney
    Cc: Jens Axboe
    Cc: linux-mm@kvack.org
    Cc: Rusty Russell
    Cc: Dipankar Sarma
    Cc: Peter Zijlstra
    Cc: Andrew Morton
    Cc: Eric Biederman

    Tejun Heo
     

25 Jan, 2010

1 commit


01 Jan, 2010

1 commit

  • crash_kexec gets called before kmsg_dump(KMSG_DUMP_OOPS) if
    panic_on_oops is set, so the kernel log buffer is not stored
    for this case.

    This patch adds a KMSG_DUMP_KEXEC dump type which gets called
    when crash_kexec() is invoked. To avoid getting double dumps,
    the old KMSG_DUMP_PANIC is moved below crash_kexec(). The
    mtdoops driver is modified to handle KMSG_DUMP_KEXEC in the
    same way as a panic.

    Signed-off-by: KOSAKI Motohiro
    Acked-by: Simon Kagstrom
    Signed-off-by: David Woodhouse

    KOSAKI Motohiro
     

17 Dec, 2009

1 commit

  • * 'for-33' of git://repo.or.cz/linux-kbuild: (29 commits)
    net: fix for utsrelease.h moving to generated
    gen_init_cpio: fixed fwrite warning
    kbuild: fix make clean after mismerge
    kbuild: generate modules.builtin
    genksyms: properly consider EXPORT_UNUSED_SYMBOL{,_GPL}()
    score: add asm/asm-offsets.h wrapper
    unifdef: update to upstream revision 1.190
    kbuild: specify absolute paths for cscope
    kbuild: create include/generated in silentoldconfig
    scripts/package: deb-pkg: use fakeroot if available
    scripts/package: add KBUILD_PKG_ROOTCMD variable
    scripts/package: tar-pkg: use tar --owner=root
    Kbuild: clean up marker
    net: add net_tstamp.h to headers_install
    kbuild: move utsrelease.h to include/generated
    kbuild: move autoconf.h to include/generated
    drop explicit include of autoconf.h
    kbuild: move compile.h to include/generated
    kbuild: drop include/asm
    kbuild: do not check for include/asm-$ARCH
    ...

    Fixed non-conflicting clean merge of modpost.c as per comments from
    Stephen Rothwell (modpost.c had grown an include of linux/autoconf.h
    that needed to be changed to generated/autoconf.h)

    Linus Torvalds
     

16 Dec, 2009

1 commit

  • Implement shrinking the reserved memory for crash kernel, if it is more
    than enough.

    For example, if you have already reserved 128M, now you just want 100M,
    you can do:

    # echo $((100*1024*1024)) > /sys/kernel/kexec_crash_size

    Note, you can only do this before loading the crash kernel.

    Signed-off-by: WANG Cong
    Cc: Neil Horman
    Acked-by: Eric W. Biederman
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Amerigo Wang
     

12 Dec, 2009

1 commit


30 Jul, 2009

1 commit

  • Setting
    "crashkernel=512M-2G:64M,2G-:128M"
    does not work but it turns to work if it has a trailing-whitespace,
    like
    "crashkernel=512M-2G:64M,2G-:128M ".

    It was because of a bug in the parser, running over the cmdline.

    This patch adds a check of the termination.

    Reported-by: Jin Dongming
    Signed-off-by: Hidetoshi Seto
    Tested-by: Jin Dongming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hidetoshi Seto
     

13 Jun, 2009

2 commits

  • This patch (as1241) renames a bunch of functions in the PM core.
    Rather than go through a boring list of name changes, suffice it to
    say that in the end we have a bunch of pairs of functions:

    device_resume_noirq dpm_resume_noirq
    device_resume dpm_resume
    device_complete dpm_complete
    device_suspend_noirq dpm_suspend_noirq
    device_suspend dpm_suspend
    device_prepare dpm_prepare

    in which device_X does the X operation on a single device and dpm_X
    invokes device_X for all devices in the dpm_list.

    In addition, the old dpm_power_up and device_resume_noirq have been
    combined into a single function (dpm_resume_noirq).

    Lastly, dpm_suspend_start and dpm_resume_end are the renamed versions
    of the former top-level device_suspend and device_resume routines.

    Signed-off-by: Alan Stern
    Acked-by: Magnus Damm
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     
  • Rename the functions performing "_noirq" dev_pm_ops
    operations from device_power_down() and device_power_up()
    to device_suspend_noirq() and device_resume_noirq().

    The new function names are chosen to show that the functions
    are responsible for calling the _noirq() versions to finalize
    the suspend/resume operation. The current function names do
    not perform power down/up anymore so the names may be misleading.

    Global function renames:
    - device_power_down() -> device_suspend_noirq()
    - device_power_up() -> device_resume_noirq()

    Static function renames:
    - suspend_device_noirq() -> __device_suspend_noirq()
    - resume_device_noirq() -> __device_resume_noirq()

    Signed-off-by: Magnus Damm
    Acked-by: Greg Kroah-Hartman
    Acked-by: Len Brown
    Signed-off-by: Rafael J. Wysocki

    Magnus Damm
     

25 May, 2009

1 commit

  • We shouldn't hold dpm_list_mtx while executing
    [disable|enable]_nonboot_cpus(), because theoretically this may lead
    to a deadlock as shown by the following example (provided by Johannes
    Berg):

    CPU 3 CPU 2 CPU 1
    suspend/hibernate
    something:
    rtnl_lock() device_pm_lock()
    -> mutex_lock(&dpm_list_mtx)

    mutex_lock(&dpm_list_mtx)

    linkwatch_work
    -> rtnl_lock()
    disable_nonboot_cpus()
    -> flush CPU 3 workqueue

    Fortunately, device drivers are supposed to stop any activities that
    might lead to the registration of new device objects way before
    disable_nonboot_cpus() is called, so it shouldn't be necessary to
    hold dpm_list_mtx over the entire late part of device suspend and
    early part of device resume.

    Thus, during the late suspend and the early resume of devices acquire
    dpm_list_mtx only when dpm_list is going to be traversed and release
    it right after that.

    This patch is reported to fix the regressions tracked as
    http://bugzilla.kernel.org/show_bug.cgi?id=13245.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Alan Stern
    Reported-by: Miles Lane
    Tested-by: Ming Lei

    Rafael J. Wysocki
     

03 Apr, 2009

2 commits

  • The vmcoreinfo_data[] array is not used outside of kernel/kexec.c, and
    can therefore become static. This patch adds the relevant keyword to the
    definition of the array.

    Noticed by sparse.

    Signed-off-by: Dmitri Vorobiev
    Cc: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitri Vorobiev
     
  • It would be nice to be able to extract the dmesg log from a vmcore file
    without needing to keep the debug symbols for the running kernel handy all
    the time. We have a facility to do this in /proc/vmcore. This patch adds
    the log_buf and log_end symbols to the vmcoreinfo area so that tools (like
    makedumpfile) can easily extract the dmesg logs from a vmcore image.

    [akpm@linux-foundation.org: several fixes and cleanups]
    [akpm@linux-foundation.org: fix unused log_buf_kexec_setup()]
    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Neil Horman
    Cc: Simon Horman
    Acked-by: Vivek Goyal
    Cc: Neil Horman
    Cc: Simon Horman
    Cc: Vivek Goyal
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Neil Horman
     

31 Mar, 2009

2 commits

  • Change the ordering of the kexec jump code so that the nonboot CPUs
    are disabled after calling device drivers' "late suspend" methods.

    This change reflects the recent modifications of the power management
    code that is also used by kexec jump.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Ingo Molnar

    Rafael J. Wysocki
     
  • Use the functions introduced in by the previous patch,
    suspend_device_irqs(), resume_device_irqs() and check_wakeup_irqs(),
    to rework the handling of interrupts during suspend (hibernation) and
    resume. Namely, interrupts will only be disabled on the CPU right
    before suspending sysdevs, while device drivers will be prevented
    from receiving interrupts, with the help of the new helper function,
    before their "late" suspend callbacks run (and analogously during
    resume).

    In addition, since the device interrups are now disabled before the
    CPU has turned all interrupts off and the CPU will ACK the interrupts
    setting the IRQ_PENDING bit for them, check in sysdev_suspend() if
    any wake-up interrupts are pending and abort suspend if that's the
    case.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Ingo Molnar

    Rafael J. Wysocki
     

23 Feb, 2009

1 commit