14 Nov, 2018

1 commit

  • commit 277fcdb2cfee38ccdbe07e705dbd4896ba0c9930 upstream.

    log_buf_len_setup does not check input argument before passing it to
    simple_strtoull. The argument would be a NULL pointer if "log_buf_len",
    without its value, is set in command line and thus causes the following
    panic.

    PANIC: early exception 0xe3 IP 10:ffffffffaaeacd0d error 0 cr2 0x0
    [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.0-rc4-yocto-standard+ #1
    [ 0.000000] RIP: 0010:_parse_integer_fixup_radix+0xd/0x70
    ...
    [ 0.000000] Call Trace:
    [ 0.000000] simple_strtoull+0x29/0x70
    [ 0.000000] memparse+0x26/0x90
    [ 0.000000] log_buf_len_setup+0x17/0x22
    [ 0.000000] do_early_param+0x57/0x8e
    [ 0.000000] parse_args+0x208/0x320
    [ 0.000000] ? rdinit_setup+0x30/0x30
    [ 0.000000] parse_early_options+0x29/0x2d
    [ 0.000000] ? rdinit_setup+0x30/0x30
    [ 0.000000] parse_early_param+0x36/0x4d
    [ 0.000000] setup_arch+0x336/0x99e
    [ 0.000000] start_kernel+0x6f/0x4ee
    [ 0.000000] x86_64_start_reservations+0x24/0x26
    [ 0.000000] x86_64_start_kernel+0x6f/0x72
    [ 0.000000] secondary_startup_64+0xa4/0xb0

    This patch adds a check to prevent the panic.

    Link: http://lkml.kernel.org/r/1538239553-81805-1-git-send-email-zhe.he@windriver.com
    Cc: stable@vger.kernel.org
    Cc: rostedt@goodmis.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: He Zhe
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek
    Signed-off-by: Greg Kroah-Hartman

    He Zhe
     

14 Sep, 2018

1 commit


11 Sep, 2018

1 commit

  • This reverts commit 375899cddcbb26881b03cb3fbdcfd600e4e67f4a.

    The visibility of early messages did not longer take into account
    "quiet", "debug", and "loglevel" early parameters.

    It would be possible to invalidate and recompute LOG_NOCONS flag
    for the affected messages. But it would be hairy.

    Instead this patch just reverts the problematic commit. We could
    come up with a better solution for the original problem. For example,
    we could simplify the logic and just mark messages that should always
    be visible or always invisible on the console.

    Also this patch reverts the related build fix commit ffaa619af1b06
    ("printk: Fix warning about unused suppress_message_printing").

    Finally, this patch does not put back the unused LOG_NOCONS flag.

    Link: http://lkml.kernel.org/r/20180910145747.emvfzv4mzlk5dfqk@pathway.suse.cz
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H . Peter Anvin"
    Cc: x86@kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Steven Rostedt
    Cc: Maninder Singh
    Reported-by: Hans de Goede
    Acked-by: Hans de Goede
    Acked-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     

06 Sep, 2018

1 commit

  • I hit the following splat in my tests:

    ------------[ cut here ]------------
    IRQs not enabled as expected
    WARNING: CPU: 3 PID: 0 at kernel/time/tick-sched.c:982 tick_nohz_idle_enter+0x44/0x8c
    Modules linked in: ip6t_REJECT nf_reject_ipv6 ip6table_filter ip6_tables ipv6
    CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.19.0-rc2-test+ #2
    Hardware name: MSI MS-7823/CSM-H87M-G43 (MS-7823), BIOS V1.6 02/22/2014
    EIP: tick_nohz_idle_enter+0x44/0x8c
    Code: ec 05 00 00 00 75 26 83 b8 c0 05 00 00 00 75 1d 80 3d d0 36 3e c1 00
    75 14 68 94 63 12 c1 c6 05 d0 36 3e c1 01 e8 04 ee f8 ff 0b 58 fa bb a0
    e5 66 c1 e8 25 0f 04 00 64 03 1d 28 31 52 c1 8b
    EAX: 0000001c EBX: f26e7f8c ECX: 00000006 EDX: 00000007
    ESI: f26dd1c0 EDI: 00000000 EBP: f26e7f40 ESP: f26e7f38
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010296
    CR0: 80050033 CR2: 0813c6b0 CR3: 2f342000 CR4: 001406f0
    Call Trace:
    do_idle+0x33/0x202
    cpu_startup_entry+0x61/0x63
    start_secondary+0x18e/0x1ed
    startup_32_smp+0x164/0x168
    irq event stamp: 18773830
    hardirqs last enabled at (18773829): [] trace_hardirqs_on_thunk+0xc/0x10
    hardirqs last disabled at (18773830): [] trace_hardirqs_off_thunk+0xc/0x10
    softirqs last enabled at (18773824): [] __do_softirq+0x25f/0x2bf
    softirqs last disabled at (18773767): [] call_on_stack+0x45/0x4b
    ---[ end trace b7c64aa79e17954a ]---

    After a bit of debugging, I found what was happening. This would trigger
    when performing "perf" with a high NMI interrupt rate, while enabling and
    disabling function tracer. Ftrace uses breakpoints to convert the nops at
    the start of functions to calls to the function trampolines. The breakpoint
    traps disable interrupts and this makes calls into lockdep via the
    trace_hardirqs_off_thunk in the entry.S code. What happens is the following:

    do_idle {

    [interrupts enabled]

    [interrupts disabled]
    TRACE_IRQS_OFF [lockdep says irqs off]
    [...]
    TRACE_IRQS_IRET
    test if pt_regs say return to interrupts enabled [yes]
    TRACE_IRQS_ON [lockdep says irqs are on]


    nmi_enter() {
    printk_nmi_enter() [traced by ftrace]
    [ hit ftrace breakpoint ]

    TRACE_IRQS_OFF [lockdep says irqs off]
    [...]
    TRACE_IRQS_IRET [return from breakpoint]
    test if pt_regs say interrupts enabled [no]
    [iret back to interrupt]
    [iret back to code]

    tick_nohz_idle_enter() {

    lockdep_assert_irqs_enabled() [lockdep say no!]

    Although interrupts are indeed enabled, lockdep thinks it is not, and since
    we now do asserts via lockdep, it gives a false warning. The issue here is
    that printk_nmi_enter() is called before lockdep_off(), which disables
    lockdep (for this reason) in NMIs. By simply not allowing ftrace to see
    printk_nmi_enter() (via notrace annotation) we keep lockdep from getting
    confused.

    Cc: stable@vger.kernel.org
    Fixes: 42a0bb3f71383 ("printk/nmi: generic solution for safe printk in NMI")
    Acked-by: Sergey Senozhatsky
    Acked-by: Petr Mladek
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

30 Aug, 2018

1 commit


24 Aug, 2018

1 commit

  • Pull fbdev updates from Bartlomiej Zolnierkiewicz:
    "Mostly small fixes and cleanups for fb drivers (the biggest updates
    are for udlfb and pxafb drivers). This also adds deferred console
    takeover support to the console code and efifb driver.

    Summary:

    - add support for deferred console takeover, when enabled defers
    fbcon taking over the console from the dummy console until the
    first text is displayed on the console - together with the "quiet"
    kernel commandline option this allows fbcon to still be used
    together with a smooth graphical bootup (Hans de Goede)

    - improve console locking debugging code (Thomas Zimmermann)

    - copy the ACPI BGRT boot graphics to the framebuffer when deferred
    console takeover support is used in efifb driver (Hans de Goede)

    - update udlfb driver - fix lost console when the user unplugs a USB
    adapter, fix the screen corruption issue, fix locking and add some
    performance optimizations (Mikulas Patocka)

    - update pxafb driver - fix using uninitialized memory, switch to
    devm_* API, handle initialization errors and add support for
    lcd-supply regulator (Daniel Mack)

    - add support for boards booted with a DeviceTree in pxa3xx_gcu
    driver (Daniel Mack)

    - rename omap2 module to omap2fb.ko to avoid conflicts with omap1
    driver (Arnd Bergmann)

    - enable ACPI-based enumeration for goldfishfb driver (Yu Ning)

    - fix goldfishfb driver to make user space Android code use 60 fps
    (Christoffer Dall)

    - print big fat warning when nomodeset kernel parameter is used in
    vgacon driver (Lyude Paul)

    - remove VLA usage from fsl-diu-fb driver (Kees Cook)

    - misc fixes (Julia Lawall, Geert Uytterhoeven, Fredrik Noring,
    Yisheng Xie, Dan Carpenter, Daniel Vetter, Anton Vasilyev, Randy
    Dunlap, Gustavo A. R. Silva, Colin Ian King, Fengguang Wu)

    - misc cleanups (Roman Kiryanov, Yisheng Xie, Colin Ian King)"

    * tag 'fbdev-v4.19' of https://github.com/bzolnier/linux: (54 commits)
    Documentation/fb: corrections for fbcon.txt
    fbcon: Do not takeover the console from atomic context
    dummycon: Stop exporting dummycon_[un]register_output_notifier
    fbcon: Only defer console takeover if the current console driver is the dummycon
    fbcon: Only allow FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER if fbdev is builtin
    fbdev: omap2: omapfb: fix ifnullfree.cocci warnings
    fbdev: omap2: omapfb: fix bugon.cocci warnings
    fbdev: omap2: omapfb: fix boolreturn.cocci warnings
    fb: amifb: fix build warnings when not builtin
    fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
    console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
    udlfb: use spin_lock_irq instead of spin_lock_irqsave
    udlfb: avoid prefetch
    udlfb: optimization - test the backing buffer
    udlfb: allow reallocating the framebuffer
    udlfb: set line_length in dlfb_ops_set_par
    udlfb: handle allocation failure
    udlfb: set optimal write delay
    udlfb: make a local copy of fb_ops
    udlfb: don't switch if we are switching to the same videomode
    ...

    Linus Torvalds
     

23 Aug, 2018

1 commit

  • Allow the initcall tables to be emitted using relative references that
    are only half the size on 64-bit architectures and don't require fixups
    at runtime on relocatable kernels.

    Link: http://lkml.kernel.org/r/20180704083651.24360-5-ard.biesheuvel@linaro.org
    Acked-by: James Morris
    Acked-by: Sergey Senozhatsky
    Acked-by: Petr Mladek
    Acked-by: Michael Ellerman
    Acked-by: Ingo Molnar
    Signed-off-by: Ard Biesheuvel
    Cc: Arnd Bergmann
    Cc: Benjamin Herrenschmidt
    Cc: Bjorn Helgaas
    Cc: Catalin Marinas
    Cc: James Morris
    Cc: Jessica Yu
    Cc: Josh Poimboeuf
    Cc: Kees Cook
    Cc: Nicolas Pitre
    Cc: Paul Mackerras
    Cc: Russell King
    Cc: "Serge E. Hallyn"
    Cc: Steven Rostedt
    Cc: Thomas Garnier
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ard Biesheuvel
     

16 Aug, 2018

1 commit

  • Pull drm updates from Dave Airlie:
    "This is the main drm pull request for 4.19.

    Rob has some new hardware support for new qualcomm hw that I'll send
    along separately. This has the display part of it, the remaining pull
    is for the acceleration engine.

    This also contains a wound-wait/wait-die mutex rework, Peter has acked
    it for merging via my tree.

    Otherwise mostly the usual level of activity. Summary:

    core:
    - Wound-wait/wait-die mutex rework
    - Add writeback connector type
    - Add "content type" property for HDMI
    - Move GEM bo to drm_framebuffer
    - Initial gpu scheduler documentation
    - GPU scheduler fixes for dying processes
    - Console deferred fbcon takeover support
    - Displayport support for CEC tunneling over AUX

    panel:
    - otm8009a panel driver fixes
    - Innolux TV123WAM and G070Y2-L01 panel driver
    - Ilitek ILI9881c panel driver
    - Rocktech RK070ER9427 LCD
    - EDT ETM0700G0EDH6 and EDT ETM0700G0BDH6
    - DLC DLC0700YZG-1
    - BOE HV070WSA-100
    - newhaven, nhd-4.3-480272ef-atxl LCD
    - DataImage SCF0700C48GGU18
    - Sharp LQ035Q7DB03
    - p079zca: Refactor to support multiple panels

    tinydrm:
    - ILI9341 display panel

    New driver:
    - vkms - virtual kms driver to testing.

    i915:
    - Icelake:
    Display enablement
    DSI support
    IRQ support
    Powerwell support
    - GPU reset fixes and improvements
    - Full ppgtt support refactoring
    - PSR fixes and improvements
    - Execlist improvments
    - GuC related fixes

    amdgpu:
    - Initial amdgpu documentation
    - JPEG engine support on VCN
    - CIK uses powerplay by default
    - Move to using core PCIE functionality for gens/lanes
    - DC/Powerplay interface rework
    - Stutter mode support for RV
    - Vega12 Powerplay updates
    - GFXOFF fixes
    - GPUVM fault debugging
    - Vega12 GFXOFF
    - DC improvements
    - DC i2c/aux changes
    - UVD 7.2 fixes
    - Powerplay fixes for Polaris12, CZ/ST
    - command submission bo_list fixes

    amdkfd:
    - Raven support
    - Power management fixes

    udl:
    - Cleanups and fixes

    nouveau:
    - misc fixes and cleanups.

    msm:
    - DPU1 support display controller in sdm845
    - GPU coredump support.

    vmwgfx:
    - Atomic modesetting validation fixes
    - Support for multisample surfaces

    armada:
    - Atomic modesetting support completed.

    exynos:
    - IPPv2 fixes
    - Move g2d to component framework
    - Suspend/resume support cleanups
    - Driver cleanups

    imx:
    - CSI configuration improvements
    - Driver cleanups
    - Use atomic suspend/resume helpers
    - ipu-v3 V4L2 XRGB32/XBGR32 support

    pl111:
    - Add Nomadik LCDC variant

    v3d:
    - GPU scheduler jobs management

    sun4i:
    - R40 display engine support
    - TCON TOP driver

    mediatek:
    - MT2712 SoC support

    rockchip:
    - vop fixes

    omapdrm:
    - Workaround for DRA7 errata i932
    - Fix mm_list locking

    mali-dp:
    - Writeback implementation
    PM improvements
    - Internal error reporting debugfs

    tilcdc:
    - Single fix for deferred probing

    hdlcd:
    - Teardown fixes

    tda998x:
    - Converted to a bridge driver.

    etnaviv:
    - Misc fixes"

    * tag 'drm-next-2018-08-15' of git://anongit.freedesktop.org/drm/drm: (1506 commits)
    drm/amdgpu/sriov: give 8s for recover vram under RUNTIME
    drm/scheduler: fix param documentation
    drm/i2c: tda998x: correct PLL divider calculation
    drm/i2c: tda998x: get rid of private fill_modes function
    drm/i2c: tda998x: move mode_valid() to bridge
    drm/i2c: tda998x: register bridge outside of component helper
    drm/i2c: tda998x: cleanup from previous changes
    drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create()
    drm/i2c: tda998x: convert to bridge driver
    drm/scheduler: fix timeout worker setup for out of order job completions
    drm/amd/display: display connected to dp-1 does not light up
    drm/amd/display: update clk for various HDMI color depths
    drm/amd/display: program display clock on cache match
    drm/amd/display: Add NULL check for enabling dp ss
    drm/amd/display: add vbios table check for enabling dp ss
    drm/amd/display: Don't share clk source between DP and HDMI
    drm/amd/display: Fix DP HBR2 Eye Diagram Pattern on Carrizo
    drm/amd/display: Use calculated disp_clk_khz value for dce110
    drm/amd/display: Implement custom degamma lut on dcn
    drm/amd/display: Destroy aux_engines only once
    ...

    Linus Torvalds
     

14 Aug, 2018

1 commit


31 Jul, 2018

1 commit

  • The macro WARN_CONSOLE_UNLOCKED prints a warning when a thread enters
    the console's critical section without having acquired the console
    lock. The console lock can be ignored when debugging the console using
    printk, but this makes WARN_CONSOLE_UNLOCKED generate unnecessary
    warnings.

    The variable ignore_console_lock_warning temporarily disables
    WARN_CONSOLE_UNLOCKED. Developers interested in debugging the console's
    critical sections should increment it before entering the CS and
    decrement it after leaving the CS. Setting ignore_console_lock_warning
    is only for debugging. Regular operation should not manipulate it.

    Acknoledgements: This patch is based on an earlier version by Steven
    Rostedt. The use of atomic increment/decrement was suggested by Petr
    Mladek.

    Link: http://lkml.kernel.org/r/717e6337-e7a6-7a92-1c1b-8929a25696b5@suse.de
    Signed-off-by: Thomas Zimmermann
    Acked-by: Hans de Goede
    Acked-by: Petr Mladek
    Reviewed-by: Sergey Senozhatsky
    Cc: Steven Rostedt (VMware)
    Cc: Andrew Morton
    [b.zolnierkie: use ]
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Thomas Zimmermann
     

11 Jul, 2018

1 commit

  • suppress_message_printing() is not longer called in console_unlock().
    Therefore it is not longer needed with disabled CONFIG_PRINTK.

    This fixes the warning:

    kernel/printk/printk.c:2033:13: warning: ‘suppress_message_printing’ defined but not used [-Wunused-function]
    static bool suppress_message_printing(int level) { return false; }

    Reported-by: Stephen Rothwell
    Reported-by: Arnd Bergmann
    Suggested-by: Maninder Singh
    Acked-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     

09 Jul, 2018

4 commits

  • The commit 719f6a7040f1bdaf96 ("printk: Use the main logbuf in NMI
    when logbuf_lock is available") brought back the possible deadlocks
    in printk() and NMI.

    The check of logbuf_lock is done only in printk_nmi_enter() to prevent
    mixed output. But another CPU might take the lock later, enter NMI, and:

    + Both NMIs might be serialized by yet another lock, for example,
    the one in nmi_cpu_backtrace().

    + The other CPU might get stopped in NMI, see smp_send_stop()
    in panic().

    The only safe solution is to use trylock when storing the message
    into the main log-buffer. It might cause reordering when some lines
    go to the main lock buffer directly and others are delayed via
    the per-CPU buffer. It means that it is not useful in general.

    This patch replaces the problematic NMI deferred context with NMI
    direct context. It can be used to mark a code that might produce
    many messages in NMI and the risk of losing them is more critical
    than problems with eventual reordering.

    The context is then used when dumping trace buffers on oops. It was
    the primary motivation for the original fix. Also the reordering is
    even smaller issue there because some traces have their own time stamps.

    Finally, nmi_cpu_backtrace() need not longer be serialized because
    it will always us the per-CPU buffers again.

    Fixes: 719f6a7040f1bdaf96 ("printk: Use the main logbuf in NMI when logbuf_lock is available")
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20180627142028.11259-1-pmladek@suse.com
    To: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Tetsuo Handa
    Cc: Sergey Senozhatsky
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Acked-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     
  • It is just a preparation step. The patch does not change
    the existing behavior.

    Link: http://lkml.kernel.org/r/20180627140817.27764-3-pmladek@suse.com
    To: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Tetsuo Handa
    Cc: Sergey Senozhatsky
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Acked-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     
  • It is just a preparation step. The patch does not change
    the existing behavior.

    Link: http://lkml.kernel.org/r/20180627140817.27764-2-pmladek@suse.com
    To: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Tetsuo Handa
    Cc: Sergey Senozhatsky
    Cc: linux-kernel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Acked-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     
  • syslog_print_all() is called twice. Once with a valid buffer
    and once just to set the indexes.

    Both variants are already handled separately. This patch just
    makes it more obvious. It does not change the existing behavior.

    Link: http://lkml.kernel.org/r/20180627150641.p56xyy6mdzvnfpig@pathway.suse.cz
    Cc: Sergey Senozhatsky
    Cc: Namit Gupta
    Cc: linux-kernel@vger.kernel.org
    Cc: pankaj.m@samsung.com
    Cc: a.sahrawat@samsung.com
    Cc: himanshu.m@samsung.com
    Signed-off-by: Petr Mladek

    Petr Mladek
     

28 Jun, 2018

1 commit

  • This is a preparation patch for adding a number of WARN_CONSOLE_UNLOCKED()
    calls to the fbcon code, which may be built as a module (event though
    usually it is not).

    Acked-by: Steven Rostedt (VMware)
    Acked-by: Sergey Senozhatsky
    Acked-by: Petr Mladek
    Reviewed-by: Daniel Vetter
    Signed-off-by: Hans de Goede
    Signed-off-by: Bartlomiej Zolnierkiewicz

    Hans de Goede
     

27 Jun, 2018

2 commits

  • When the request is only for clearing logs, there is no need for
    allocation/deallocation. Only the indexes need to be reset and returned.
    Rest of the patch is mostly made up of changes because of indention.

    Link: http://lkml.kernel.org/r/20180620135951epcas5p3bd2a8f25ec689ca333bce861b527dba2~54wyKcT0_3155531555epcas5p3y@epcas5p3.samsung.com
    Cc: linux-kernel@vger.kernel.org
    Cc: pankaj.m@samsung.com
    Cc: a.sahrawat@samsung.com
    Signed-off-by: Namit Gupta
    Signed-off-by: Himanshu Maithani
    Reviewed-by: Steven Rostedt (VMware)
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Namit Gupta
     
  • This patch make sure printing of log on console if loglevel
    at time of storing log is less than current console loglevel.

    @why
    In SMP printk can work asynchronously, logs can be missed on console
    because it checks current log level at time of console_unlock,
    not at time of storing logs.

    func()
    {
    ....
    ....
    console_verbose(); // user wants to have all the logs on console.
    pr_alert();
    dump_backtrace(); //prints with default loglevel.
    ...
    console_silent(); // stop all logs from printing on console.
    }

    Now if console_lock was owned by another process, the messages might
    be handled after the consoles were silenced.

    Reused flag LOG_NOCONS as its usage is gone long back by the commit
    5c2992ee7fd8a29d0412 ("printk: remove console flushing special cases
    for partial buffered lines").

    Note that there are still some corner cases where this patch is not enough.
    For example, when the messages are flushed later from printk_safe buffers
    or when there are races between console_verbose() and console_silent()
    callers.

    Link: http://lkml.kernel.org/r/20180601090029epcas5p3cc93d4bfbebb3199f0a2684058da7e26~z-a_jkmrI2993329933epcas5p3q@epcas5p3.samsung.com
    Cc: linux-kernel@vger.kernel.org
    Cc: a.sahrawat@samsung.com
    Cc: pankaj.m@samsung.com
    Cc: v.narang@samsung.com
    Cc:
    Signed-off-by: Vaneet Narang
    Signed-off-by: Maninder Singh
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Maninder Singh
     

07 Jun, 2018

1 commit

  • Pull printk updates from Petr Mladek:

    - Help userspace log daemons to catch up with a flood of messages. They
    will get woken after each message even if the console is far behind
    and handled by another process.

    - Flush printk safe buffers safely even when panic() happens in the
    normal context.

    - Fix possible va_list reuse when race happened in printk_safe().

    - Remove %pCr printf format to prevent sleeping in the atomic context.

    - Misc vsprintf code cleanup.

    * tag 'printk-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk:
    printk: drop in_nmi check from printk_safe_flush_on_panic()
    lib/vsprintf: Remove atomic-unsafe support for %pCr
    serial: sh-sci: Stop using printk format %pCr
    thermal: bcm2835: Stop using printk format %pCr
    clk: renesas: cpg-mssr: Stop using printk format %pCr
    printk: fix possible reuse of va_list variable
    printk: wake up klogd in vprintk_emit
    vsprintf: Tweak pF/pf comment
    lib/vsprintf: Mark expected switch fall-through
    lib/vsprintf: Replace space with '_' before crng is ready
    lib/vsprintf: Deduplicate pointer_string()
    lib/vsprintf: Move pointer_string() upper
    lib/vsprintf: Make flag_spec global
    lib/vsprintf: Make strspec global
    lib/vsprintf: Make dec_spec global
    lib/test_printf: Mark big constant with UL

    Linus Torvalds
     

05 Jun, 2018

1 commit

  • Drop the in_nmi() check from printk_safe_flush_on_panic()
    and attempt to re-init (IOW unlock) locked logbuf spinlock
    from panic CPU regardless of its context.

    Otherwise, theoretically, we can deadlock on logbuf trying to flush
    per-CPU buffers:

    a) Panic CPU is running in non-NMI context
    b) Panic CPU sends out shutdown IPI via reboot vector
    c) Panic CPU fails to stop all remote CPUs
    d) Panic CPU sends out shutdown IPI via NMI vector
    One of the CPUs that we bring down via NMI vector can hold
    logbuf spin lock (theoretically).

    Link: http://lkml.kernel.org/r/20180530070350.10131-1-sergey.senozhatsky@gmail.com
    To: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Sergey Senozhatsky
     

16 May, 2018

1 commit

  • I noticed that there is a possibility that printk_safe_log_store() causes
    kernel oops because "args" parameter is passed to vsnprintf() again when
    atomic_cmpxchg() detected that we raced. Fix this by using va_copy().

    Link: http://lkml.kernel.org/r/201805112002.GIF21216.OFVHFOMLJtQFSO@I-love.SAKURA.ne.jp
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: dvyukov@google.com
    Cc: syzkaller@googlegroups.com
    Cc: fengguang.wu@intel.com
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Tetsuo Handa
    Fixes: 42a0bb3f71383b45 ("printk/nmi: generic solution for safe printk in NMI")
    Cc: 4.7+ # v4.7+
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Tetsuo Handa
     

25 Apr, 2018

1 commit

  • We wake up klogd very late - only when current console_sem owner
    is done pushing pending kernel messages to the serial/net consoles.
    In some cases this results in lost syslog messages, because kernel
    log buffer is a circular buffer and if we don't wakeup syslog long
    enough there are chances that logbuf simply will wrap around.

    The patch moves the klogd wake up call to vprintk_emit(), which is
    the only legit way for a kernel message to appear in the logbuf,
    right after the attempt to handle consoles. As a result, klogd
    will get waken either after flushing the new message to consoles
    or immediately when consoles are still busy with older messages.

    Link: http://lkml.kernel.org/r/20180419014250.5692-1-sergey.senozhatsky@gmail.com
    To: Steven Rostedt
    Cc: Andrew Morton
    Cc: Peter Zijlstra
    Cc: Tejun Heo
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Sergey Senozhatsky
     

11 Apr, 2018

1 commit

  • Pull tracing updates from Steven Rostedt:
    "New features:

    - Tom Zanussi's extended histogram work.

    This adds the synthetic events to have histograms from multiple
    event data Adds triggers "onmatch" and "onmax" to call the
    synthetic events Several updates to the histogram code from this

    - Allow way to nest ring buffer calls in the same context

    - Allow absolute time stamps in ring buffer

    - Rewrite of filter code parsing based on Al Viro's suggestions

    - Setting of trace_clock to global if TSC is unstable (on boot)

    - Better OOM handling when allocating large ring buffers

    - Added initcall tracepoints (consolidated initcall_debug code with
    them)

    And other various fixes and clean ups"

    * tag 'trace-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (68 commits)
    init: Have initcall_debug still work without CONFIG_TRACEPOINTS
    init, tracing: Have printk come through the trace events for initcall_debug
    init, tracing: instrument security and console initcall trace events
    init, tracing: Add initcall trace events
    tracing: Add rcu dereference annotation for test func that touches filter->prog
    tracing: Add rcu dereference annotation for filter->prog
    tracing: Fixup logic inversion on setting trace_global_clock defaults
    tracing: Hide global trace clock from lockdep
    ring-buffer: Add set/clear_current_oom_origin() during allocations
    ring-buffer: Check if memory is available before allocation
    lockdep: Add print_irqtrace_events() to __warn
    vsprintf: Do not preprocess non-dereferenced pointers for bprintf (%px and %pK)
    tracing: Uninitialized variable in create_tracing_map_fields()
    tracing: Make sure variable string fields are NULL-terminated
    tracing: Add action comparisons when testing matching hist triggers
    tracing: Don't add flag strings when displaying variable references
    tracing: Fix display of hist trigger expressions containing timestamps
    ftrace: Drop a VLA in module_exists()
    tracing: Mention trace_clock=global when warning about unstable clocks
    tracing: Default to using trace_global_clock if sched_clock is unstable
    ...

    Linus Torvalds
     

06 Apr, 2018

2 commits


23 Mar, 2018

1 commit

  • To allow userspace to prevent this message from appearing in the
    console by changing the log priority.

    This matches other informative messages that the power subsystem emits
    when the system changes power states.

    Link: http://lkml.kernel.org/r/20180322135833.16602-1-tomeu.vizoso@collabora.com
    To: linux-kernel@vger.kernel.org
    Cc: kernel@collabora.com
    Cc: Steven Rostedt
    Signed-off-by: Tomeu Vizoso
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Tomeu Vizoso
     

15 Mar, 2018

1 commit

  • dump_stack related stuff should belong to lib/dump_stack.c thus move them
    there. Also conditionally compile lib/dump_stack.c since dump_stack code
    does not make sense if printk is disabled.

    Link: http://lkml.kernel.org/r/20180213072834.GA24784@dhcp-128-65.nay.redhat.com
    To: Steven Rostedt
    Cc: linux-kernel@vger.kernel.org
    Cc: akpm@linux-foundation.org
    Cc: Andi Kleen
    Signed-off-by: Dave Young
    Suggested-by: Steven Rostedt
    Suggested-by: Sergey Senozhatsky
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Dave Young
     

02 Mar, 2018

1 commit


27 Feb, 2018

1 commit

  • wake_klogd is a local variable in console_unlock(). The information
    is lost when the console_lock owner using the busy wait added by
    the commit dbdda842fe96f8932 ("printk: Add console owner and waiter
    logic to load balance console writes"). The following race is
    possible:

    CPU0 CPU1
    console_unlock()

    for (;;)
    /* calling console for last message */

    printk()
    log_store()
    log_next_seq++;

    /* see new message */
    if (seen_seq != log_next_seq) {
    wake_klogd = true;
    seen_seq = log_next_seq;
    }

    console_lock_spinning_enable();

    if (console_trylock_spinning())
    /* spinning */

    if (console_lock_spinning_disable_and_check()) {
    printk_safe_exit_irqrestore(flags);
    return;

    console_unlock()
    if (seen_seq != log_next_seq) {
    /* already seen */
    /* nothing to do */

    Result: Nobody would wakeup klogd.

    One solution would be to make a global variable from wake_klogd.
    But then we would need to manipulate it under a lock or so.

    This patch wakes klogd also when console_lock is passed to the
    spinning waiter. It looks like the right way to go. Also userspace
    should have a chance to see and store any "flood" of messages.

    Note that the very late klogd wake up was a historic solution.
    It made sense on single CPU systems or when sys_syslog() operations
    were synchronized using the big kernel lock like in v2.1.113.
    But it is questionable these days.

    Fixes: dbdda842fe96f8932 ("printk: Add console owner and waiter logic to load balance console writes")
    Link: http://lkml.kernel.org/r/20180226155734.dzwg3aovqnwtvkoy@pathway.suse.cz
    Cc: Steven Rostedt
    Cc: linux-kernel@vger.kernel.org
    Cc: Tejun Heo
    Suggested-by: Sergey Senozhatsky
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     

12 Feb, 2018

1 commit

  • This is the mindless scripted replacement of kernel use of POLL*
    variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
    L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
    for f in $L; do sed -i "-es/^\([^\"]*\)\(\\)/\\1E\\2/" $f; done
    done

    with de-mangling cleanups yet to come.

    NOTE! On almost all architectures, the EPOLL* constants have the same
    values as the POLL* constants do. But they keyword here is "almost".
    For various bad reasons they aren't the same, and epoll() doesn't
    actually work quite correctly in some cases due to this on Sparc et al.

    The next patch from Al will sort out the final differences, and we
    should be all done.

    Scripted-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

08 Feb, 2018

1 commit

  • It is useful to print kdump kernel loaded status in dump_stack()
    especially when panic happens so that we can differenciate
    kdump kernel early hang and a normal panic in a bug report.

    Link: http://lkml.kernel.org/r/20180127041129.GA29016@dhcp-128-65.nay.redhat.com
    To: Steven Rostedt
    To: Andi Kleen
    To: kexec@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Cc: akpm@linux-foundation.org
    Cc: kexec@lists.infradead.org
    Signed-off-by: Dave Young
    Reviewed-by: Sergey Senozhatsky
    Reviewed-by: Simon Horman
    Signed-off-by: Petr Mladek

    Dave Young
     

02 Feb, 2018

1 commit

  • Pull printk updates from Petr Mladek:

    - Add a console_msg_format command line option:

    The value "default" keeps the old "[time stamp] text\n" format. The
    value "syslog" allows to see the syslog-like "[timestamp] text" format.

    This feature was requested by people doing regression tests, for
    example, 0day robot. They want to have both filtered and full logs
    at hands.

    - Reduce the risk of softlockup:

    Pass the console owner in a busy loop.

    This is a new approach to the old problem. It was first proposed by
    Steven Rostedt on Kernel Summit 2017. It marks a context in which
    the console_lock owner calls console drivers and could not sleep.
    On the other side, printk() callers could detect this state and use
    a busy wait instead of a simple console_trylock(). Finally, the
    console_lock owner checks if there is a busy waiter at the end of
    the special context and eventually passes the console_lock to the
    waiter.

    The hand-off works surprisingly well and helps in many situations.
    Well, there is still a possibility of the softlockup, for example,
    when the flood of messages stops and the last owner still has too
    much to flush.

    There is increasing number of people having problems with
    printk-related softlockups. We might eventually need to get better
    solution. Anyway, this looks like a good start and promising
    direction.

    - Do not allow to schedule in console_unlock() called from printk():

    This reverts an older controversial commit. The reschedule helped
    to avoid softlockups. But it also slowed down the console output.
    This patch is obsoleted by the new console waiter logic described
    above. In fact, the reschedule made the hand-off less effective.

    - Deprecate "%pf" and "%pF" format specifier:

    It was needed on ia64, ppc64 and parisc64 to dereference function
    descriptors and show the real function address. It is done
    transparently by "%ps" and "pS" format specifier now.

    Sergey Senozhatsky found that all the function descriptors were in
    a special elf section and could be easily detected.

    - Remove printk_symbol() API:

    It has been obsoleted by "%pS" format specifier, and this change
    helped to remove few continuous lines and a less intuitive old API.

    - Remove redundant memsets:

    Sergey removed unnecessary memset when processing printk.devkmsg
    command line option.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk: (27 commits)
    printk: drop redundant devkmsg_log_str memsets
    printk: Never set console_may_schedule in console_trylock()
    printk: Hide console waiter logic into helpers
    printk: Add console owner and waiter logic to load balance console writes
    kallsyms: remove print_symbol() function
    checkpatch: add pF/pf deprecation warning
    symbol lookup: introduce dereference_symbol_descriptor()
    parisc64: Add .opd based function descriptor dereference
    powerpc64: Add .opd based function descriptor dereference
    ia64: Add .opd based function descriptor dereference
    sections: split dereference_function_descriptor()
    openrisc: Fix conflicting types for _exext and _stext
    lib: do not use print_symbol()
    irq debug: do not use print_symbol()
    sysfs: do not use print_symbol()
    drivers: do not use print_symbol()
    x86: do not use print_symbol()
    unicore32: do not use print_symbol()
    sh: do not use print_symbol()
    mn10300: do not use print_symbol()
    ...

    Linus Torvalds
     

31 Jan, 2018

1 commit

  • Pull poll annotations from Al Viro:
    "This introduces a __bitwise type for POLL### bitmap, and propagates
    the annotations through the tree. Most of that stuff is as simple as
    'make ->poll() instances return __poll_t and do the same to local
    variables used to hold the future return value'.

    Some of the obvious brainos found in process are fixed (e.g. POLLIN
    misspelled as POLL_IN). At that point the amount of sparse warnings is
    low and most of them are for genuine bugs - e.g. ->poll() instance
    deciding to return -EINVAL instead of a bitmap. I hadn't touched those
    in this series - it's large enough as it is.

    Another problem it has caught was eventpoll() ABI mess; select.c and
    eventpoll.c assumed that corresponding POLL### and EPOLL### were
    equal. That's true for some, but not all of them - EPOLL### are
    arch-independent, but POLL### are not.

    The last commit in this series separates userland POLL### values from
    the (now arch-independent) kernel-side ones, converting between them
    in the few places where they are copied to/from userland. AFAICS, this
    is the least disruptive fix preserving poll(2) ABI and making epoll()
    work on all architectures.

    As it is, it's simply broken on sparc - try to give it EPOLLWRNORM and
    it will trigger only on what would've triggered EPOLLWRBAND on other
    architectures. EPOLLWRBAND and EPOLLRDHUP, OTOH, are never triggered
    at all on sparc. With this patch they should work consistently on all
    architectures"

    * 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (37 commits)
    make kernel-side POLL... arch-independent
    eventpoll: no need to mask the result of epi_item_poll() again
    eventpoll: constify struct epoll_event pointers
    debugging printk in sg_poll() uses %x to print POLL... bitmap
    annotate poll(2) guts
    9p: untangle ->poll() mess
    ->si_band gets POLL... bitmap stored into a user-visible long field
    ring_buffer_poll_wait() return value used as return value of ->poll()
    the rest of drivers/*: annotate ->poll() instances
    media: annotate ->poll() instances
    fs: annotate ->poll() instances
    ipc, kernel, mm: annotate ->poll() instances
    net: annotate ->poll() instances
    apparmor: annotate ->poll() instances
    tomoyo: annotate ->poll() instances
    sound: annotate ->poll() instances
    acpi: annotate ->poll() instances
    crypto: annotate ->poll() instances
    block: annotate ->poll() instances
    x86: annotate ->poll() instances
    ...

    Linus Torvalds
     

22 Jan, 2018

2 commits


17 Jan, 2018

3 commits

  • This patch, basically, reverts commit 6b97a20d3a79 ("printk:
    set may_schedule for some of console_trylock() callers").
    That commit was a mistake, it introduced a big dependency
    on the scheduler, by enabling preemption under console_sem
    in printk()->console_unlock() path, which is rather too
    critical. The patch did not significantly reduce the
    possibilities of printk() lockups, but made it possible to
    stall printk(), as has been reported by Tetsuo Handa [1].

    Another issues is that preemption under console_sem also
    messes up with Steven Rostedt's hand off scheme, by making
    it possible to sleep with console_sem both in console_unlock()
    and in vprintk_emit(), after acquiring the console_sem
    ownership (anywhere between printk_safe_exit_irqrestore() in
    console_trylock_spinning() and printk_safe_enter_irqsave()
    in console_unlock()). This makes hand off less likely and,
    at the same time, may result in a significant amount of
    pending logbuf messages. Preempted console_sem owner makes
    it impossible for other CPUs to emit logbuf messages, but
    does not make it impossible for other CPUs to append new
    messages to the logbuf.

    Reinstate the old behavior and make printk() non-preemptible.
    Should any printk() lockup reports arrive they must be handled
    in a different way.

    [1] http://lkml.kernel.org/r/201603022101.CAH73907.OVOOMFHFFtQJSL%20()%20I-love%20!%20SAKURA%20!%20ne%20!%20jp
    Fixes: 6b97a20d3a79 ("printk: set may_schedule for some of console_trylock() callers")
    Link: http://lkml.kernel.org/r/20180116044716.GE6607@jagdpanzerIV
    To: Tetsuo Handa
    Cc: Sergey Senozhatsky
    Cc: Tejun Heo
    Cc: akpm@linux-foundation.org
    Cc: linux-mm@kvack.org
    Cc: Cong Wang
    Cc: Dave Hansen
    Cc: Johannes Weiner
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Cc: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Jan Kara
    Cc: Mathieu Desnoyers
    Cc: Byungchul Park
    Cc: Pavel Machek
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Sergey Senozhatsky
    Reported-by: Tetsuo Handa
    Reviewed-by: Steven Rostedt (VMware)
    Signed-off-by: Petr Mladek

    Sergey Senozhatsky
     
  • The commit ("printk: Add console owner and waiter logic to load balance
    console writes") made vprintk_emit() and console_unlock() even more
    complicated.

    This patch extracts the new code into 3 helper functions. They should
    help to keep it rather self-contained. It will be easier to use and
    maintain.

    This patch just shuffles the existing code. It does not change
    the functionality.

    Link: http://lkml.kernel.org/r/20180112160837.GD24497@linux.suse
    Cc: akpm@linux-foundation.org
    Cc: linux-mm@kvack.org
    Cc: Cong Wang
    Cc: Dave Hansen
    Cc: Johannes Weiner
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Cc: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Jan Kara
    Cc: Mathieu Desnoyers
    Cc: Tetsuo Handa
    Cc: rostedt@home.goodmis.org
    Cc: Byungchul Park
    Cc: Tejun Heo
    Cc: Pavel Machek
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: Steven Rostedt (VMware)
    Acked-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Petr Mladek
     
  • This patch implements what I discussed in Kernel Summit. I added
    lockdep annotation (hopefully correctly), and it hasn't had any splats
    (since I fixed some bugs in the first iterations). It did catch
    problems when I had the owner covering too much. But now that the owner
    is only set when actively calling the consoles, lockdep has stayed
    quiet.

    Here's the design again:

    I added a "console_owner" which is set to a task that is actively
    writing to the consoles. It is *not* the same as the owner of the
    console_lock. It is only set when doing the calls to the console
    functions. It is protected by a console_owner_lock which is a raw spin
    lock.

    There is a console_waiter. This is set when there is an active console
    owner that is not current, and waiter is not set. This too is protected
    by console_owner_lock.

    In printk() when it tries to write to the consoles, we have:

    if (console_trylock())
    console_unlock();

    Now I added an else, which will check if there is an active owner, and
    no current waiter. If that is the case, then console_waiter is set, and
    the task goes into a spin until it is no longer set.

    When the active console owner finishes writing the current message to
    the consoles, it grabs the console_owner_lock and sees if there is a
    waiter, and clears console_owner.

    If there is a waiter, then it breaks out of the loop, clears the waiter
    flag (because that will release the waiter from its spin), and exits.
    Note, it does *not* release the console semaphore. Because it is a
    semaphore, there is no owner. Another task may release it. This means
    that the waiter is guaranteed to be the new console owner! Which it
    becomes.

    Then the waiter calls console_unlock() and continues to write to the
    consoles.

    If another task comes along and does a printk() it too can become the
    new waiter, and we wash rinse and repeat!

    By Petr Mladek about possible new deadlocks:

    The thing is that we move console_sem only to printk() call
    that normally calls console_unlock() as well. It means that
    the transferred owner should not bring new type of dependencies.
    As Steven said somewhere: "If there is a deadlock, it was
    there even before."

    We could look at it from this side. The possible deadlock would
    look like:

    CPU0 CPU1

    console_unlock()

    console_owner = current;

    spin_lockA()
    printk()
    spin = true;
    while (...)

    call_console_drivers()
    spin_lockA()

    This would be a deadlock. CPU0 would wait for the lock A.
    While CPU1 would own the lockA and would wait for CPU0
    to finish calling the console drivers and pass the console_sem
    owner.

    But if the above is true than the following scenario was
    already possible before:

    CPU0

    spin_lockA()
    printk()
    console_unlock()
    call_console_drivers()
    spin_lockA()

    By other words, this deadlock was there even before. Such
    deadlocks are prevented by using printk_deferred() in
    the sections guarded by the lock A.

    By Steven Rostedt:

    To demonstrate the issue, this module has been shown to lock up a
    system with 4 CPUs and a slow console (like a serial console). It is
    also able to lock up a 8 CPU system with only a fast (VGA) console, by
    passing in "loops=100". The changes in this commit prevent this module
    from locking up the system.

    #include
    #include
    #include
    #include
    #include
    #include

    static bool stop_testing;
    static unsigned int loops = 1;

    static void preempt_printk_workfn(struct work_struct *work)
    {
    int i;

    while (!READ_ONCE(stop_testing)) {
    for (i = 0; i < loops && !READ_ONCE(stop_testing); i++) {
    preempt_disable();
    pr_emerg("%5d%-75s\n", smp_processor_id(),
    " XXX NOPREEMPT");
    preempt_enable();
    }
    msleep(1);
    }
    }

    static struct work_struct __percpu *works;

    static void finish(void)
    {
    int cpu;

    WRITE_ONCE(stop_testing, true);
    for_each_online_cpu(cpu)
    flush_work(per_cpu_ptr(works, cpu));
    free_percpu(works);
    }

    static int __init test_init(void)
    {
    int cpu;

    works = alloc_percpu(struct work_struct);
    if (!works)
    return -ENOMEM;

    /*
    * This is just a test module. This will break if you
    * do any CPU hot plugging between loading and
    * unloading the module.
    */

    for_each_online_cpu(cpu) {
    struct work_struct *work = per_cpu_ptr(works, cpu);

    INIT_WORK(work, &preempt_printk_workfn);
    schedule_work_on(cpu, work);
    }

    return 0;
    }

    static void __exit test_exit(void)
    {
    finish();
    }

    module_param(loops, uint, 0);
    module_init(test_init);
    module_exit(test_exit);
    MODULE_LICENSE("GPL");

    Link: http://lkml.kernel.org/r/20180110132418.7080-2-pmladek@suse.com
    Cc: akpm@linux-foundation.org
    Cc: linux-mm@kvack.org
    Cc: Cong Wang
    Cc: Dave Hansen
    Cc: Johannes Weiner
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Cc: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Jan Kara
    Cc: Mathieu Desnoyers
    Cc: Tetsuo Handa
    Cc: Byungchul Park
    Cc: Tejun Heo
    Cc: Pavel Machek
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Steven Rostedt (VMware)
    [pmladek@suse.com: Commit message about possible deadlocks]
    Acked-by: Sergey Senozhatsky
    Signed-off-by: Petr Mladek

    Steven Rostedt (VMware)
     

04 Jan, 2018

1 commit

  • 0day and kernelCI automatically parse kernel log - basically some sort
    of grepping using the pre-defined text patterns - in order to detect
    and report regressions/errors. There are several sources they get the
    kernel logs from:

    a) dmesg or /proc/ksmg

    This is the preferred way. Because `dmesg --raw' (see later Note)
    and /proc/kmsg output contains facility and log level, which greatly
    simplifies grepping for EMERG/ALERT/CRIT/ERR messages.

    b) serial consoles

    This option is harder to maintain, because serial console messages
    don't contain facility and log level.

    This patch introduces a `console_msg_format=' command line option,
    to switch between different message formatting on serial consoles.
    For the time being we have just two options - default and syslog.
    The "default" option just keeps the existing format. While the
    "syslog" option makes serial console messages to appear in syslog
    format [syslog() syscall], matching the `dmesg -S --raw' and
    `cat /proc/kmsg' output formats:

    - facility and log level
    - time stamp (depends on printk_time/PRINTK_TIME)
    - message

    [time stamp] text\n

    NOTE: while Kevin and Fengguang talk about "dmesg --raw", it's actually
    "dmesg -S --raw" that always prints messages in syslog format [per
    Petr Mladek]. Running "dmesg --raw" may produce output in non-syslog
    format sometimes. console_msg_format=syslog enables syslog format,
    thus in documentation we mention "dmesg -S --raw", not "dmesg --raw".

    Per Kevin Hilman:

    : Right now we can get this info from a "dmesg --raw" after bootup,
    : but it would be really nice in certain automation frameworks to
    : have a kernel command-line option to enable printing of loglevels
    : in default boot log.
    :
    : This is especially useful when ingesting kernel logs into advanced
    : search/analytics frameworks (I'm playing with and ELK stack: Elastic
    : Search, Logstash, Kibana).
    :
    : The other important reason for having this on the command line is that
    : for testing linux-next (and other bleeding edge developer branches),
    : it's common that we never make it to userspace, so can't even run
    : "dmesg --raw" (or equivalent.) So we really want this on the primary
    : boot (serial) console.

    Per Fengguang Wu, 0day scripts should quickly benefit from that
    feature, because they will be able to switch to a more reliable
    parsing, based on messages' facility and log levels [1]:

    `#{grep} -a -E -e '^' -e '^kern :(err |crit |alert |emerg )'

    instead of doing text pattern matching

    `#{grep} -a -F -f /lkp/printk-error-messages #{kmsg_file} |
    grep -a -v -E -f #{LKP_SRC}/etc/oops-pattern |
    grep -a -v -F -f #{LKP_SRC}/etc/kmsg-blacklist`

    [1] https://github.com/fengguang/lkp-tests/blob/master/lib/dmesg.rb

    Link: http://lkml.kernel.org/r/20171221054149.4398-1-sergey.senozhatsky@gmail.com
    To: Steven Rostedt
    Cc: Linus Torvalds
    Cc: Fengguang Wu
    Cc: Kevin Hilman
    Cc: Mark Brown
    Cc: Greg Kroah-Hartman
    Cc: Andrew Morton
    Cc: LKML
    Signed-off-by: Sergey Senozhatsky
    Reviewed-by: Fengguang Wu
    Reviewed-by: Kevin Hilman
    Tested-by: Kevin Hilman
    Signed-off-by: Petr Mladek

    Sergey Senozhatsky
     

06 Dec, 2017

1 commit

  • Geert Uytterhoeven reported a NFS oops, and pointed out that some of the
    numbers were hashed and useless.

    We could just turn them from '%p' into '%px', but those numbers are
    really just legacy, and useless even when not hashed.

    So just remove them entirely.

    Reported-by: Geert Uytterhoeven
    Signed-off-by: Linus Torvalds

    Linus Torvalds