Skip to content
Snippets Groups Projects
  1. Jan 02, 2024
  2. Dec 11, 2023
    • Dongmin Lee's avatar
      kernel/reboot: explicitly notify if halt occurred instead of power off · a9a1d6ad
      Dongmin Lee authored
      When kernel_can_power_off() returns false, and reboot has called with
      LINUX_REBOOT_CMD_POWER_OFF, kernel_halt() will be initiated instead of
      actual power off function.
      
      However, in this situation, Kernel never explicitly notifies user that
      system halted instead of requested power off.
      
      Since halt and power off perform different behavior, and user initiated
      reboot call with power off command, not halt, This could be unintended
      behavior to user, like this:
      
      ~ # poweroff -f
      [    3.581482] reboot: System halted
      
      Therefore, this explicitly notifies user that poweroff is not available,
      and halting has been occured as an alternative behavior instead:
      
      ~ # poweroff -f
      [    4.123668] reboot: Power off not available: System halted instead
      
      [akpm@linux-foundation.org: tweak comment text]
      Link: https://lkml.kernel.org/r/20231104113320.72440-1-ldmldm05@gmail.com
      
      
      Signed-off-by: default avatarDongmin Lee <ldmldm05@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      a9a1d6ad
  3. Jul 28, 2023
  4. Oct 04, 2022
  5. Jun 23, 2022
  6. Jun 15, 2022
  7. Jun 07, 2022
  8. Jun 02, 2022
  9. May 25, 2022
  10. May 19, 2022
  11. May 09, 2022
  12. Apr 22, 2022
    • John Ogness's avatar
      printk: add functions to prefer direct printing · 2bb2b7b5
      John Ogness authored
      
      Once kthread printing is available, console printing will no longer
      occur in the context of the printk caller. However, there are some
      special contexts where it is desirable for the printk caller to
      directly print out kernel messages. Using pr_flush() to wait for
      threaded printers is only possible if the caller is in a sleepable
      context and the kthreads are active. That is not always the case.
      
      Introduce printk_prefer_direct_enter() and printk_prefer_direct_exit()
      functions to explicitly (and globally) activate/deactivate preferred
      direct console printing. The term "direct console printing" refers to
      printing to all enabled consoles from the context of the printk
      caller. The term "prefer" is used because this type of printing is
      only best effort. If the console is currently locked or other
      printers are already actively printing, the printk caller will need
      to rely on the other contexts to handle the printing.
      
      This preferred direct printing is how all printing has been handled
      until now (unless it was explicitly deferred).
      
      When kthread printing is introduced, there may be some unanticipated
      problems due to kthreads being unable to flush important messages.
      In order to minimize such risks, preferred direct printing is
      activated for the primary important messages when the system
      experiences general types of major errors. These are:
      
       - emergency reboot/shutdown
       - cpu and rcu stalls
       - hard and soft lockups
       - hung tasks
       - warn
       - sysrq
      
      Note that since kthread printing does not yet exist, no behavior
      changes result from this commit. This is only implementing the
      counter and marking the various places where preferred direct
      printing is active.
      
      Signed-off-by: default avatarJohn Ogness <john.ogness@linutronix.de>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Acked-by: Paul E. McKenney <paulmck@kernel.org> # for RCU
      Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Link: https://lore.kernel.org/r/20220421212250.565456-13-john.ogness@linutronix.de
      2bb2b7b5
  13. Apr 06, 2022
    • tangmeng's avatar
      kernel/reboot: move reboot sysctls to its own file · 06d17766
      tangmeng authored
      
      kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
      dishes, this makes it very difficult to maintain.
      
      To help with this maintenance let's start by moving sysctls to places
      where they actually belong.  The proc sysctl maintainers do not want to
      know what sysctl knobs you wish to add for your own piece of code, we
      just care about the core logic.
      
      All filesystem syctls now get reviewed by fs folks. This commit
      follows the commit of fs, move the poweroff_cmd and ctrl-alt-del
      sysctls to its own file, kernel/reboot.c.
      
      Signed-off-by: default avatartangmeng <tangmeng@uniontech.com>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      06d17766
  14. Oct 20, 2021
  15. Oct 17, 2021
  16. Jun 21, 2021
  17. Mar 18, 2021
  18. Dec 16, 2020
  19. Nov 14, 2020
    • Matteo Croce's avatar
      reboot: fix overflow parsing reboot cpu number · df5b0ab3
      Matteo Croce authored
      
      Limit the CPU number to num_possible_cpus(), because setting it to a
      value lower than INT_MAX but higher than NR_CPUS produces the following
      error on reboot and shutdown:
      
          BUG: unable to handle page fault for address: ffffffff90ab1bb0
          #PF: supervisor read access in kernel mode
          #PF: error_code(0x0000) - not-present page
          PGD 1c09067 P4D 1c09067 PUD 1c0a063 PMD 0
          Oops: 0000 [#1] SMP
          CPU: 1 PID: 1 Comm: systemd-shutdow Not tainted 5.9.0-rc8-kvm #110
          Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
          RIP: 0010:migrate_to_reboot_cpu+0xe/0x60
          Code: ea ea 00 48 89 fa 48 c7 c7 30 57 f1 81 e9 fa ef ff ff 66 2e 0f 1f 84 00 00 00 00 00 53 8b 1d d5 ea ea 00 e8 14 33 fe ff 89 da <48> 0f a3 15 ea fc bd 00 48 89 d0 73 29 89 c2 c1 e8 06 65 48 8b 3c
          RSP: 0018:ffffc90000013e08 EFLAGS: 00010246
          RAX: ffff88801f0a0000 RBX: 0000000077359400 RCX: 0000000000000000
          RDX: 0000000077359400 RSI: 0000000000000002 RDI: ffffffff81c199e0
          RBP: ffffffff81c1e3c0 R08: ffff88801f41f000 R09: ffffffff81c1e348
          R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
          R13: 00007f32bedf8830 R14: 00000000fee1dead R15: 0000000000000000
          FS:  00007f32bedf8980(0000) GS:ffff88801f480000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: ffffffff90ab1bb0 CR3: 000000001d057000 CR4: 00000000000006a0
          DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
          DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
          Call Trace:
            __do_sys_reboot.cold+0x34/0x5b
            do_syscall_64+0x2d/0x40
      
      Fixes: 1b3a5d02 ("reboot: move arch/x86 reboot= handling to generic kernel")
      Signed-off-by: default avatarMatteo Croce <mcroce@microsoft.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Fabian Frederick <fabf@skynet.be>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Robin Holt <robinmholt@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20201103214025.116799-3-mcroce@linux.microsoft.com
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      df5b0ab3
    • Matteo Croce's avatar
      Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint" · 8b92c4ff
      Matteo Croce authored
      
      Patch series "fix parsing of reboot= cmdline", v3.
      
      The parsing of the reboot= cmdline has two major errors:
      
       - a missing bound check can crash the system on reboot
      
       - parsing of the cpu number only works if specified last
      
      Fix both.
      
      This patch (of 2):
      
      This reverts commit 616feab7.
      
      kstrtoint() and simple_strtoul() have a subtle difference which makes
      them non interchangeable: if a non digit character is found amid the
      parsing, the former will return an error, while the latter will just
      stop parsing, e.g.  simple_strtoul("123xyx") = 123.
      
      The kernel cmdline reboot= argument allows to specify the CPU used for
      rebooting, with the syntax `s####` among the other flags, e.g.
      "reboot=warm,s31,force", so if this flag is not the last given, it's
      silently ignored as well as the subsequent ones.
      
      Fixes: 616feab7 ("kernel/reboot.c: convert simple_strtoul to kstrtoint")
      Signed-off-by: default avatarMatteo Croce <mcroce@microsoft.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Robin Holt <robinmholt@gmail.com>
      Cc: Fabian Frederick <fabf@skynet.be>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20201103214025.116799-2-mcroce@linux.microsoft.com
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8b92c4ff
  20. Nov 10, 2020
  21. Jul 01, 2020
    • Mike Rapoport's avatar
      arch: remove unicore32 port · fb37409a
      Mike Rapoport authored
      
      The unicore32 port do not seem maintained for a long time now, there is no
      upstream toolchain that can create unicore32 binaries and all the links to
      prebuilt toolchains for unicore32 are dead. Even compilers that were
      available are not supported by the kernel anymore.
      
      Guenter Roeck says:
      
        I have stopped building unicore32 images since v4.19 since there is no
        available compiler that is still supported by the kernel. I am surprised
        that support for it has not been removed from the kernel.
      
      Remove unicore32 port.
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
      fb37409a
  22. May 30, 2020
  23. May 21, 2019
  24. May 15, 2019
Loading