<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/printk/printk.c, branch linux-6.7.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-04-03T13:11:43Z</updated>
<entry>
<title>printk: Update @console_may_schedule in console_trylock_spinning()</title>
<updated>2024-04-03T13:11:43Z</updated>
<author>
<name>John Ogness</name>
</author>
<published>2024-02-26T12:01:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=de70fa0ae001084b80e2f8872f0c965e1ee1fce9'/>
<id>urn:sha1:de70fa0ae001084b80e2f8872f0c965e1ee1fce9</id>
<content type='text'>
[ Upstream commit 8076972468584d4a21dab9aa50e388b3ea9ad8c7 ]

console_trylock_spinning() may takeover the console lock from a
schedulable context. Update @console_may_schedule to make sure it
reflects a trylock acquire.

Reported-by: Mukesh Ojha &lt;quic_mojha@quicinc.com&gt;
Closes: https://lore.kernel.org/lkml/20240222090538.23017-1-quic_mojha@quicinc.com
Fixes: dbdda842fe96 ("printk: Add console owner and waiter logic to load balance console writes")
Signed-off-by: John Ogness &lt;john.ogness@linutronix.de&gt;
Reviewed-by: Mukesh Ojha &lt;quic_mojha@quicinc.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/875xybmo2z.fsf@jogness.linutronix.de
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>serial: Lock console when calling into driver before registration</title>
<updated>2024-04-03T13:11:17Z</updated>
<author>
<name>Peter Collingbourne</name>
</author>
<published>2024-03-04T21:43:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=23174ac8990b6e31fdf1843617cdc0c7078e738f'/>
<id>urn:sha1:23174ac8990b6e31fdf1843617cdc0c7078e738f</id>
<content type='text'>
[ Upstream commit 801410b26a0e8b8a16f7915b2b55c9528b69ca87 ]

During the handoff from earlycon to the real console driver, we have
two separate drivers operating on the same device concurrently. In the
case of the 8250 driver these concurrent accesses cause problems due
to the driver's use of banked registers, controlled by LCR.DLAB. It is
possible for the setup(), config_port(), pm() and set_mctrl() callbacks
to set DLAB, which can cause the earlycon code that intends to access
TX to instead access DLL, leading to missed output and corruption on
the serial line due to unintended modifications to the baud rate.

In particular, for setup() we have:

univ8250_console_setup()
-&gt; serial8250_console_setup()
-&gt; uart_set_options()
-&gt; serial8250_set_termios()
-&gt; serial8250_do_set_termios()
-&gt; serial8250_do_set_divisor()

For config_port() we have:

serial8250_config_port()
-&gt; autoconfig()

For pm() we have:

serial8250_pm()
-&gt; serial8250_do_pm()
-&gt; serial8250_set_sleep()

For set_mctrl() we have (for some devices):

serial8250_set_mctrl()
-&gt; omap8250_set_mctrl()
-&gt; __omap8250_set_mctrl()

To avoid such problems, let's make it so that the console is locked
during pre-registration calls to these callbacks, which will prevent
the earlycon driver from running concurrently.

Remove the partial solution to this problem in the 8250 driver
that locked the console only during autoconfig_irq(), as this would
result in a deadlock with the new approach. The console continues
to be locked during autoconfig_irq() because it can only be called
through uart_configure_port().

Although this patch introduces more locking than strictly necessary
(and in particular it also locks during the call to rs485_config()
which is not affected by this issue as far as I can tell), it follows
the principle that it is the responsibility of the generic console
code to manage the earlycon handoff by ensuring that earlycon and real
console driver code cannot run concurrently, and not the individual
drivers.

Signed-off-by: Peter Collingbourne &lt;pcc@google.com&gt;
Reviewed-by: John Ogness &lt;john.ogness@linutronix.de&gt;
Link: https://linux-review.googlesource.com/id/I7cf8124dcebf8618e6b2ee543fa5b25532de55d8
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240304214350.501253-1-pcc@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>printk: Disable passing console lock owner completely during panic()</title>
<updated>2024-03-26T22:18:11Z</updated>
<author>
<name>Petr Mladek</name>
</author>
<published>2024-02-07T13:41:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ec02b3eb4100be20c565962e5651a1a252529173'/>
<id>urn:sha1:ec02b3eb4100be20c565962e5651a1a252529173</id>
<content type='text'>
[ Upstream commit d04d5882cd678b898a9d7c5aee6afbe9e6e77fcd ]

The commit d51507098ff91 ("printk: disable optimistic spin
during panic") added checks to avoid becoming a console waiter
if a panic is in progress.

However, the transition to panic can occur while there is
already a waiter. The current owner should not pass the lock to
the waiter because it might get stopped or blocked anytime.

Also the panic context might pass the console lock owner to an
already stopped waiter by mistake. It might happen when
console_flush_on_panic() ignores the current lock owner, for
example:

CPU0                                CPU1
----                                ----
console_lock_spinning_enable()
                                    console_trylock_spinning()
                                      [CPU1 now console waiter]
NMI: panic()
  panic_other_cpus_shutdown()
                                    [stopped as console waiter]
  console_flush_on_panic()
    console_lock_spinning_enable()
    [print 1 record]
    console_lock_spinning_disable_and_check()
      [handover to stopped CPU1]

This results in panic() not flushing the panic messages.

Fix these problems by disabling all spinning operations
completely during panic().

Another advantage is that it prevents possible deadlocks caused
by "console_owner_lock". The panic() context does not need to
take it any longer. The lockless checks are safe because the
functions become NOPs when they see the panic in progress. All
operations manipulating the state are still synchronized by the
lock even when non-panic CPUs would notice the panic
synchronously.

The current owner might stay spinning. But non-panic() CPUs
would get stopped anyway and the panic context will never start
spinning.

Fixes: dbdda842fe96 ("printk: Add console owner and waiter logic to load balance console writes")
Signed-off-by: John Ogness &lt;john.ogness@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240207134103.1357162-12-john.ogness@linutronix.de
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>printk: Add this_cpu_in_panic()</title>
<updated>2024-03-26T22:18:10Z</updated>
<author>
<name>John Ogness</name>
</author>
<published>2024-02-07T13:40:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=70af619b69b351342b50a9a83627fcb908a82dce'/>
<id>urn:sha1:70af619b69b351342b50a9a83627fcb908a82dce</id>
<content type='text'>
[ Upstream commit 36652d0f3bf34899e82d31a5fa9e2bdd02fd6381 ]

There is already panic_in_progress() and other_cpu_in_panic(),
but checking if the current CPU is the panic CPU must still be
open coded.

Add this_cpu_in_panic() to complete the set.

Signed-off-by: John Ogness &lt;john.ogness@linutronix.de&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20240207134103.1357162-8-john.ogness@linutronix.de
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
Stable-dep-of: b1c4c67a5e90 ("printk: ringbuffer: Skip non-finalized records in panic")
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>printk: Wait for all reserved records with pr_flush()</title>
<updated>2024-03-26T22:18:10Z</updated>
<author>
<name>John Ogness</name>
</author>
<published>2024-02-07T13:40:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1d11c8e3e189c80f40dbc091a2da05b490291c0'/>
<id>urn:sha1:a1d11c8e3e189c80f40dbc091a2da05b490291c0</id>
<content type='text'>
[ Upstream commit ac7d7844c64d15603daa3e905a311ddcfbb4bc91 ]

Currently pr_flush() will only wait for records that were
available to readers at the time of the call (using
prb_next_seq()). But there may be more records (non-finalized)
that have following finalized records. pr_flush() should wait
for these to print as well. Particularly because any trailing
finalized records may be the messages that the calling context
wants to ensure are printed.

Add a new ringbuffer function prb_next_reserve_seq() to return
the sequence number following the most recently reserved record.
This guarantees that pr_flush() will wait until all current
printk() messages (completed or in progress) have been printed.

Fixes: 3b604ca81202 ("printk: add pr_flush()")
Signed-off-by: John Ogness &lt;john.ogness@linutronix.de&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20240207134103.1357162-10-john.ogness@linutronix.de
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'tty-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty</title>
<updated>2023-11-04T01:44:25Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2023-11-04T01:44:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1f24458a1071f006e3f7449c08ae0f12af493923'/>
<id>urn:sha1:1f24458a1071f006e3f7449c08ae0f12af493923</id>
<content type='text'>
Pull tty and serial updates from Greg KH:
 "Here is the big set of tty/serial driver changes for 6.7-rc1. Included
  in here are:

   - console/vgacon cleanups and removals from Arnd

   - tty core and n_tty cleanups from Jiri

   - lots of 8250 driver updates and cleanups

   - sc16is7xx serial driver updates

   - dt binding updates

   - first set of port lock wrapers from Thomas for the printk fixes
     coming in future releases

   - other small serial and tty core cleanups and updates

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'tty-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (193 commits)
  serdev: Replace custom code with device_match_acpi_handle()
  serdev: Simplify devm_serdev_device_open() function
  serdev: Make use of device_set_node()
  tty: n_gsm: add copyright Siemens Mobility GmbH
  tty: n_gsm: fix race condition in status line change on dead connections
  serial: core: Fix runtime PM handling for pending tx
  vgacon: fix mips/sibyte build regression
  dt-bindings: serial: drop unsupported samsung bindings
  tty: serial: samsung: drop earlycon support for unsupported platforms
  tty: 8250: Add note for PX-835
  tty: 8250: Fix IS-200 PCI ID comment
  tty: 8250: Add Brainboxes Oxford Semiconductor-based quirks
  tty: 8250: Add support for Intashield IX cards
  tty: 8250: Add support for additional Brainboxes PX cards
  tty: 8250: Fix up PX-803/PX-857
  tty: 8250: Fix port count of PX-257
  tty: 8250: Add support for Intashield IS-100
  tty: 8250: Add support for Brainboxes UP cards
  tty: 8250: Add support for additional Brainboxes UC cards
  tty: 8250: Remove UC-257 and UC-431
  ...
</content>
</entry>
<entry>
<title>Merge branch 'rework/nbcon-base' into for-linus</title>
<updated>2023-11-02T12:04:59Z</updated>
<author>
<name>Petr Mladek</name>
</author>
<published>2023-11-02T12:04:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2966bd3698451a2172a57e7e97eebb4adbfc48a2'/>
<id>urn:sha1:2966bd3698451a2172a57e7e97eebb4adbfc48a2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge branch 'rework/misc-cleanups' into for-linus</title>
<updated>2023-11-02T12:00:34Z</updated>
<author>
<name>Petr Mladek</name>
</author>
<published>2023-11-02T12:00:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=86098bcddeb10ae7975d701c3440d912bd2ebe12'/>
<id>urn:sha1:86098bcddeb10ae7975d701c3440d912bd2ebe12</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge branch 'for-6.7' into for-linus</title>
<updated>2023-11-02T12:00:20Z</updated>
<author>
<name>Petr Mladek</name>
</author>
<published>2023-11-02T12:00:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=adb982ad4b9d691f707061fbe90eff80d391a0ef'/>
<id>urn:sha1:adb982ad4b9d691f707061fbe90eff80d391a0ef</id>
<content type='text'>
</content>
</entry>
<entry>
<title>printk: printk: Remove unnecessary statements＇len = 0;＇</title>
<updated>2023-10-24T08:19:48Z</updated>
<author>
<name>Li kunyu</name>
</author>
<published>2023-10-23T06:23:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3f6074cf467f6c2beb7db0b0d685fb53f25ae9aa'/>
<id>urn:sha1:3f6074cf467f6c2beb7db0b0d685fb53f25ae9aa</id>
<content type='text'>
In the following two functions, len has already been assigned a value of
0 when defining the variable, so remove 'len=0;'.

Signed-off-by: Li kunyu &lt;kunyu@nfschina.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20231023062359.130633-1-kunyu@nfschina.com
</content>
</entry>
</feed>
