Commit 187de7c
printk: nbcon: Allow unsafe write_atomic() for panic
There may be console drivers that have not yet figured out a way
to implement safe atomic printing (->write_atomic() callback).
These drivers could choose to only implement threaded printing
(->write_thread() callback), but then it is guaranteed that _no_
output will be printed during panic. Not even attempted.
As a result, developers may be tempted to implement unsafe
->write_atomic() callbacks and/or implement some sort of custom
deferred printing trickery to try to make it work. This goes
against the principle intention of the nbcon API as well as
endangers other nbcon drivers that are doing things correctly
(safely).
As a compromise, allow nbcon drivers to implement unsafe
->write_atomic() callbacks by providing a new console flag
CON_NBCON_ATOMIC_UNSAFE. When specified, the ->write_atomic()
callback for that console will _only_ be called during the
final "hope and pray" flush attempt at the end of a panic:
nbcon_atomic_flush_unsafe().
Signed-off-by: John Ogness <[email protected]>
Link: https://lore.kernel.org/lkml/b2qps3uywhmjaym4mht2wpxul4yqtuuayeoq4iv4k3zf5wdgh3@tocu6c7mj4lt
Reviewed-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/all/swdpckuwwlv3uiessmtnf2jwlx3jusw6u7fpk5iggqo4t2vdws@7rpjso4gr7qp/ [1]
Link: https://lore.kernel.org/all/[email protected]/ [2]
Link: https://patch.msgid.link/[email protected]
[[email protected]: Fix build with rework/nbcon-in-kdb branch.]
Signed-off-by: Petr Mladek <[email protected]>1 parent 62627bf commit 187de7c
2 files changed
+48
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| 202 | + | |
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| |||
608 | 611 | | |
609 | 612 | | |
610 | 613 | | |
| 614 | + | |
611 | 615 | | |
612 | 616 | | |
613 | 617 | | |
| |||
627 | 631 | | |
628 | 632 | | |
629 | 633 | | |
630 | | - | |
631 | | - | |
632 | | - | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
633 | 646 | | |
634 | 647 | | |
635 | 648 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1408 | 1408 | | |
1409 | 1409 | | |
1410 | 1410 | | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
1411 | 1431 | | |
1412 | 1432 | | |
1413 | 1433 | | |
| |||
1478 | 1498 | | |
1479 | 1499 | | |
1480 | 1500 | | |
1481 | | - | |
1482 | 1501 | | |
1483 | 1502 | | |
1484 | 1503 | | |
| |||
1497 | 1516 | | |
1498 | 1517 | | |
1499 | 1518 | | |
1500 | | - | |
1501 | | - | |
| 1519 | + | |
1502 | 1520 | | |
1503 | 1521 | | |
1504 | 1522 | | |
| |||
1507 | 1525 | | |
1508 | 1526 | | |
1509 | 1527 | | |
1510 | | - | |
| 1528 | + | |
1511 | 1529 | | |
1512 | 1530 | | |
1513 | 1531 | | |
| |||
1538 | 1556 | | |
1539 | 1557 | | |
1540 | 1558 | | |
1541 | | - | |
1542 | 1559 | | |
1543 | 1560 | | |
1544 | 1561 | | |
1545 | 1562 | | |
1546 | 1563 | | |
1547 | 1564 | | |
1548 | | - | |
1549 | | - | |
| 1565 | + | |
1550 | 1566 | | |
1551 | 1567 | | |
1552 | 1568 | | |
| |||
1561 | 1577 | | |
1562 | 1578 | | |
1563 | 1579 | | |
1564 | | - | |
| 1580 | + | |
1565 | 1581 | | |
1566 | 1582 | | |
1567 | 1583 | | |
| |||
1593 | 1609 | | |
1594 | 1610 | | |
1595 | 1611 | | |
1596 | | - | |
1597 | 1612 | | |
1598 | | - | |
| 1613 | + | |
1599 | 1614 | | |
1600 | 1615 | | |
1601 | 1616 | | |
| |||
1613 | 1628 | | |
1614 | 1629 | | |
1615 | 1630 | | |
1616 | | - | |
| 1631 | + | |
1617 | 1632 | | |
1618 | 1633 | | |
1619 | 1634 | | |
| |||
1629 | 1644 | | |
1630 | 1645 | | |
1631 | 1646 | | |
1632 | | - | |
| 1647 | + | |
1633 | 1648 | | |
1634 | 1649 | | |
1635 | 1650 | | |
| |||
1641 | 1656 | | |
1642 | 1657 | | |
1643 | 1658 | | |
1644 | | - | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
1645 | 1662 | | |
1646 | 1663 | | |
1647 | 1664 | | |
| |||
1848 | 1865 | | |
1849 | 1866 | | |
1850 | 1867 | | |
1851 | | - | |
| 1868 | + | |
1852 | 1869 | | |
1853 | 1870 | | |
1854 | 1871 | | |
| |||
1918 | 1935 | | |
1919 | 1936 | | |
1920 | 1937 | | |
1921 | | - | |
| 1938 | + | |
1922 | 1939 | | |
0 commit comments