15 May, 2019

1 commit

  • Allow specifying reboot_mode for panic only. This is needed on systems
    where ramoops is used to store panic logs, and user wants to use warm
    reset to preserve those, while still having cold reset on normal
    reboots.

    Link: http://lkml.kernel.org/r/20190322004735.27702-1-aaro.koskinen@iki.fi
    Signed-off-by: Aaro Koskinen
    Reviewed-by: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Aaro Koskinen
     

18 Nov, 2017

1 commit

  • Add devm_* wrapper around register_reboot_notifier to simplify device
    specific reboot notifier registration/unregistration.

    [akpm@linux-foundation.org: move `struct device' forward decl to top-of-file]
    Link: http://lkml.kernel.org/r/20170320171753.1705-1-andrew.smirnov@gmail.com
    Signed-off-by: Andrey Smirnov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Smirnov
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

16 Apr, 2015

1 commit

  • The kernel has orderly_poweroff which allows the kernel to initiate a
    graceful shutdown of userspace, by running /sbin/poweroff. This adds
    orderly_reboot that will cause userspace to shut itself down by calling
    /sbin/reboot.

    This will be used for shutdown initiated by a system controller on
    platforms that do not use ACPI.

    orderly_reboot() should be used when the system wants to allow userspace
    to gracefully shut itself down. For cases where the system may imminently
    catch on fire, the existing emergency_restart() provides an immediate
    reboot without involving userspace.

    Signed-off-by: Joel Stanley
    Cc: Fabian Frederick
    Cc: Benjamin Herrenschmidt
    Cc: Michael Ellerman
    Cc: Rusty Russell
    Cc: Jeremy Kerr
    Cc: David S. Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joel Stanley
     

26 Sep, 2014

1 commit

  • Various drivers implement architecture and/or device specific means to
    restart (reset) the system. Various mechanisms have been implemented to
    support those schemes. The best known mechanism is arm_pm_restart, which
    is a function pointer to be set either from platform specific code or from
    drivers. Another mechanism is to use hardware watchdogs to issue a reset;
    this mechanism is used if there is no other method available to reset a
    board or system. Two examples are alim7101_wdt, which currently uses the
    reboot notifier to trigger a reset, and moxart_wdt, which registers the
    arm_pm_restart function.

    The existing mechanisms have a number of drawbacks. Typically only one
    scheme to restart the system is supported (at least if arm_pm_restart is
    used). At least in theory there can be multiple means to restart the
    system, some of which may be less desirable (for example one mechanism may
    only reset the CPU, while another may reset the entire system). Using
    arm_pm_restart can also be racy if the function pointer is set from a
    driver, as the driver may be in the process of being unloaded when
    arm_pm_restart is called. Using the reboot notifier is always racy, as it
    is unknown if and when other functions using the reboot notifier have
    completed execution by the time the watchdog fires.

    Introduce a system restart handler call chain to solve the described
    problems. This call chain is expected to be executed from the
    architecture specific machine_restart() function. Drivers providing
    system restart functionality (such as the watchdog drivers mentioned
    above) are expected to register with this call chain. By using the
    priority field in the notifier block, callers can control restart handler
    execution sequence and thus ensure that the restart handler with the
    optimal restart capabilities for a given system is called first.

    Signed-off-by: Guenter Roeck
    Acked-by: Catalin Marinas
    Acked-by: Heiko Stuebner
    Cc: Russell King
    Cc: Wim Van Sebroeck
    Cc: Maxime Ripard
    Cc: Will Deacon
    Cc: Arnd Bergmann
    Cc: Jonas Jensen
    Cc: Randy Dunlap
    Cc: Steven Rostedt
    Cc: Ingo Molnar
    Cc: Dmitry Eremin-Solenikov
    Cc: David Woodhouse
    Cc: Tomasz Figa
    Signed-off-by: Andrew Morton

    Guenter Roeck
     

16 Apr, 2014

1 commit

  • Steve reported a reboot hang and bisected it back to this commit:

    a4f1987e4c54 x86, reboot: Add EFI and CF9 reboot methods into the default list

    He heroically tested all reboot methods and found the following:

    reboot=t # triple fault ok
    reboot=k # keyboard ctrl FAIL
    reboot=b # BIOS ok
    reboot=a # ACPI FAIL
    reboot=e # EFI FAIL [system has no EFI]
    reboot=p # PCI 0xcf9 FAIL

    And I think it's pretty obvious that we should only try PCI 0xcf9 as a
    last resort - if at all.

    The other observation is that (on this box) we should never try
    the PCI reboot method, but close with either the 'triple fault'
    or the 'BIOS' (terminal!) reboot methods.

    Thirdly, CF9_COND is a total misnomer - it should be something like
    CF9_SAFE or CF9_CAREFUL, and 'CF9' should be 'CF9_FORCE' ...

    So this patch fixes the worst problems:

    - it orders the actual reboot logic to follow the reboot ordering
    pattern - it was in a pretty random order before for no good
    reason.

    - it fixes the CF9 misnomers and uses BOOT_CF9_FORCE and
    BOOT_CF9_SAFE flags to make the code more obvious.

    - it tries the BIOS reboot method before the PCI reboot method.
    (Since 'BIOS' is a terminal reboot method resulting in a hang
    if it does not work, this is essentially equivalent to removing
    the PCI reboot method from the default reboot chain.)

    - just for the miraculous possibility of terminal (resulting
    in hang) reboot methods of triple fault or BIOS returning
    without having done their job, there's an ordering between
    them as well.

    Reported-and-bisected-and-tested-by: Steven Rostedt
    Cc: Li Aubrey
    Cc: Linus Torvalds
    Cc: Matthew Garrett
    Link: http://lkml.kernel.org/r/20140404064120.GB11877@gmail.com
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

19 Dec, 2013

1 commit

  • Commit 1b3a5d02ee07 ("reboot: move arch/x86 reboot= handling to generic
    kernel") moved reboot= handling to generic code. In the process it also
    removed the code in native_machine_shutdown() which are moving reboot
    process to reboot_cpu/cpu0.

    I guess that thought must have been that all reboot paths are calling
    migrate_to_reboot_cpu(), so we don't need this special handling. But
    kexec reboot path (kernel_kexec()) is not calling
    migrate_to_reboot_cpu() so above change broke kexec. Now reboot can
    happen on non-boot cpu and when INIT is sent in second kerneo to bring
    up BP, it brings down the machine.

    So start calling migrate_to_reboot_cpu() in kexec reboot path to avoid
    this problem.

    Bisected by WANG Chao.

    Reported-by: Matthew Whitehead
    Reported-by: Dave Young
    Signed-off-by: Vivek Goyal
    Tested-by: Baoquan He
    Tested-by: WANG Chao
    Acked-by: H. Peter Anvin
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vivek Goyal
     

10 Jul, 2013

5 commits


13 Oct, 2012

1 commit


26 Jul, 2011

1 commit

  • It is not necessary to share the same notifier.h.

    This patch already moves register_reboot_notifier() and
    unregister_reboot_notifier() from kernel/notifier.c to kernel/sys.c.

    [amwang@redhat.com: make allyesconfig succeed on ppc64]
    Signed-off-by: WANG Cong
    Cc: David Miller
    Cc: "Rafael J. Wysocki"
    Cc: Greg KH
    Signed-off-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Amerigo Wang
     

13 Mar, 2010

1 commit

  • Extern declarations in sysctl.c should be moved to their own header file,
    and then include them in relavant .c files.

    Move C_A_D extern variable declaration to linux/reboot.h

    Signed-off-by: Dave Young
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Young
     

15 Aug, 2008

1 commit

  • Call kernel_restart_prepare() in kernel_kexec() instead of duplicating the
    code.

    Signed-off-by: Huang Ying
    Acked-by: Pavel Machek
    Acked-by: Vivek Goyal
    Cc: Pavel Machek
    Cc: "Rafael J. Wysocki"
    Cc: "Eric W. Biederman"
    Cc: Vivek Goyal
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Ying
     

06 Feb, 2008

1 commit


18 Jul, 2007

1 commit

  • Various pieces of code around the kernel want to be able to trigger an
    orderly poweroff. This pulls them together into a single
    implementation.

    By default the poweroff command is /sbin/poweroff, but it can be set
    via sysctl: kernel/poweroff_cmd. This is split at whitespace, so it
    can include command-line arguments.

    This patch replaces four other instances of invoking either "poweroff"
    or "shutdown -h now": two sbus drivers, and acpi thermal
    management.

    sparc64 has its own "powerd"; still need to determine whether it should
    be replaced by orderly_poweroff().

    Signed-off-by: Jeremy Fitzhardinge
    Acked-by: Len Brown
    Signed-off-by: Chris Wright
    Cc: Andrew Morton
    Cc: Randy Dunlap
    Cc: Andi Kleen
    Cc: Al Viro
    Cc: Arnd Bergmann
    Cc: David S. Miller

    Jeremy Fitzhardinge
     

26 Jun, 2006

1 commit

  • - proper prototypes for the following functions:
    - ctrl_alt_del() (in include/linux/reboot.h)
    - getrusage() (in include/linux/resource.h)
    - make the following needlessly global functions static:
    - kernel_restart_prepare()
    - kernel_kexec()

    [akpm@osdl.org: compile fix]
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

16 Dec, 2005

1 commit


23 Sep, 2005

1 commit

  • In the lead up to 2.6.13 I fixed a large number of reboot problems by
    making the calling conventions consistent. Despite checking and double
    checking my work it appears I missed an obvious one.

    This first patch simply refactors the reboot routines so all of the
    preparation for various kinds of reboots are in their own functions.
    Making it very hard to get the various kinds of reboot out of sync.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

27 Jul, 2005

2 commits

  • When the kernel is working well and we want to restart cleanly
    kernel_restart is the function to use. But in many instances
    the kernel wants to reboot when thing are expected to be working
    very badly such as from panic or a software watchdog handler.

    This patch adds the function emergency_restart() so that
    callers can be clear what semantics they expect when calling
    restart. emergency_restart() is expected to be callable
    from interrupt context and possibly reliable in even more
    trying circumstances.

    This is an initial generic implementation for all architectures.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     
  • Because the factors of sys_reboot don't exist people calling
    into the reboot path duplicate the code badly, leading to
    inconsistent expectations of code in the reboot path.

    This patch should is just code motion.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

26 Jun, 2005

2 commits

  • Makes kexec_crashdump() take a pt_regs * as an argument. This allows to
    get exact register state at the point of the crash. If we come from direct
    panic assertion NULL will be passed and the current registers saved before
    crashdump.

    This hooks into two places:
    die(): check the conditions under which we will panic when calling
    do_exit and go there directly with the pt_regs that caused the fatal
    fault.

    die_nmi(): If we receive an NMI lockup while in the kernel use the
    pt_regs and go directly to crash_kexec(). We're probably nested up badly
    at this point so this might be the only chance to escape with proper
    information.

    Signed-off-by: Alexander Nyberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Nyberg
     
  • This patch introduces the architecture independent implementation the
    sys_kexec_load, the compat_sys_kexec_load system calls.

    Kexec on panic support has been integrated into the core patch and is
    relatively clean.

    In addition the hopefully architecture independent option
    crashkernel=size@location has been docuemented. It's purpose is to reserve
    space for the panic kernel to live, and where no DMA transfer will ever be
    setup to access.

    Signed-off-by: Eric Biederman
    Signed-off-by: Alexander Nyberg
    Signed-off-by: Adrian Bunk
    Signed-off-by: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds