1. 01 Sep, 2022 4 commits
    • Daniel Vetter's avatar
      tty/vt: Add console_lock check to vt_console_print() · b74dbbe1
      Daniel Vetter authored
      I'm scratching my head why we have this printing_lock. Digging through
      historical git trees shows that:
      - Added in 1.1.73, and I found absolutely no reason why.
      - Converted to atomic bitops in 2.1.125pre2, I guess as part of SMP
        enabling/bugfixes.
      - Converted to a proper spinlock in b0940003 ("vt: bitlock fix")
        because the hand-rolled atomic version lacked necessary memory
        barriers.
      
      Digging around in lore for that time period did also not shed further
      light.
      
      The only reason I think this might still be relevant today is that (to
      my understanding at least, ymmv) during an oops we might be printing
      without console_lock held. See console_flush_on_panic() and the
      comments in there - we flush out the console buffers irrespective of
      whether we managed to acquire the right locks.
      
      The strange thing is that this reason is fairly recent, because the
      console flushing was historically done without oops_in_progress set.
      This only changed in c7c3f05e ("panic: avoid deadlocks in
      re-entrant console drivers"), which removed the call to
      bust_spinlocks(0) (which decrements oops_in_progress again) before
      flushing out the console (which back then was open coded as a
      console_trylock/unlock pair).
      
      Note that this entire mess should be properly fixed in the
      printk/console layer, and not inflicted on each implementation.
      
      For now just document what's going on and check that in all other
      cases callers obey the locking rules.
      
      v2: WARN_CONSOLE_UNLOCKED already checks for oops_in_progress
      (something else that should be fixed I guess), hence remove the
      open-coded check I've had.
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jirislaby@kernel.org>
      Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
      Cc: Yangxi Xiang <xyangxi5@gmail.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: nick black <dankamongmen@gmail.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: John Ogness <john.ogness@linutronix.de>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://lore.kernel.org/r/20220830144945.430528-1-daniel.vetter@ffwll.chSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b74dbbe1
    • Daniel Vetter's avatar
      kernel/panic: Drop unblank_screen call · 0a64ce6e
      Daniel Vetter authored
      console_unblank() does this too (called in both places right after),
      and with a lot more confidence inspiring approach to locking.
      
      Reconstructing this story is very strange:
      
      In b61312d3 ("oops handling: ensure that any oops is flushed to
      the mtdoops console") it is claimed that a printk(" "); flushed out
      the console buffer, which was removed in e3e8a75d ("[PATCH]
      Extract and use wake_up_klogd()"). In todays kernels this is done way
      earlier in console_flush_on_panic with some really nasty tricks. I
      didn't bother to fully reconstruct this all, least because the call to
      bust_spinlock(0); gets moved every few years, depending upon how the
      wind blows (or well, who screamed loudest about the various issue each
      call site caused).
      
      Before that commit the only calls to console_unblank() where in s390
      arch code.
      
      The other side here is the console->unblank callback, which was
      introduced in 2.1.31 for the vt driver. Which predates the
      console_unblank() function by a lot, which was added (without users)
      in 2.4.14.3. So pretty much impossible to guess at any motivation
      here. Also afaict the vt driver is the only (and always was the only)
      console driver implementing the unblank callback, so no idea why a
      call to console_unblank() was added for the mtdooops driver - the
      action actually flushing out the console buffers is done from
      console_unlock() only.
      
      Note that as prep for the s390 users the locking was adjusted in
      2.5.22 (I couldn't figure out how to properly reference the BK commit
      from the historical git trees) from a normal semaphore to a trylock.
      
      Note that a copy of the direct unblank_screen() call was added to
      panic() in c7c3f05e ("panic: avoid deadlocks in re-entrant console
      drivers"), which partially inlined the bust_spinlocks(0); call.
      
      Long story short, I have no idea why the direct call to unblank_screen
      survived for so long (the infrastructure to do it properly existed for
      years), nor why it wasn't removed when the console_unblank() call was
      finally added. But it makes a ton more sense to finally do that than
      not - it's just better encapsulation to go through the console
      functions instead of doing a direct call, so let's dare. Plus it
      really does not make much sense to call the only unblank
      implementation there is twice, once without, and once with appropriate
      locking.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jirislaby@kernel.org>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
      Cc: Yangxi Xiang <xyangxi5@gmail.com>
      Cc: nick black <dankamongmen@gmail.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
      Cc: Marco Elver <elver@google.com>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: David Gow <davidgow@google.com>
      Cc: tangmeng <tangmeng@uniontech.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Link: https://lore.kernel.org/r/20220830145004.430545-1-daniel.vetter@ffwll.chSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0a64ce6e
    • Shaomin Deng's avatar
      serial: Fix double word · bf98ef69
      Shaomin Deng authored
      Fix double word "start start" in comments.
      Signed-off-by: default avatarShaomin Deng <dengshaomin@cdjrlc.com>
      Link: https://lore.kernel.org/r/20220831160934.7986-1-dengshaomin@cdjrlc.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bf98ef69
    • Andy Shevchenko's avatar
      serial: 8250_men_mcb: Remove duplicate UAPI:serial_core inclusion · 18417b01
      Andy Shevchenko authored
      The UAPI serial_core.h is guaranteed to be included by in-kernel
      one (with the same name). Individual drivers do not need to include
      it explicitly. Remove it from the driver.
      
      Note, it's a single driver in the entire kernel that does this.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20220830152313.14650-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      18417b01
  2. 30 Aug, 2022 36 commits