Skip to content

Commit 4d38b88

Browse files
committed
Merge tag 'printk-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek: - Allow creaing nbcon console drivers with an unsafe write_atomic() callback that can only be called by the final nbcon_atomic_flush_unsafe(). Otherwise, the driver would rely on the kthread. It is going to be used as the-best-effort approach for an experimental nbcon netconsole driver, see https://lore.kernel.org/r/[email protected] Note that a safe .write_atomic() callback is supposed to work in NMI context. But some networking drivers are not safe even in IRQ context: https://lore.kernel.org/r/oc46gdpmmlly5o44obvmoatfqo5bhpgv7pabpvb6sjuqioymcg@gjsma3ghoz35 In an ideal world, all networking drivers would be fixed first and the atomic flush would be blocked only in NMI context. But it brings the question how reliable networking drivers are when the system is in a bad state. They might block flushing more reliable serial consoles which are more suitable for serious debugging anyway. - Allow to use the last 4 bytes of the printk ring buffer. - Prevent queuing IRQ work and block printk kthreads when consoles are suspended. Otherwise, they create non-necessary churn or even block the suspend. - Release console_lock() between each record in the kthread used for legacy consoles on RT. It might significantly speed up the boot. - Release nbcon context between each record in the atomic flush. It prevents stalls of the related printk kthread after it has lost the ownership in the middle of a record - Add support for NBCON consoles into KDB - Add %ptsP modifier for printing struct timespec64 and use it where possible - Misc code clean up * tag 'printk-for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: (48 commits) printk: Use console_is_usable on console_unblank arch: um: kmsg_dump: Use console_is_usable drivers: serial: kgdboc: Drop checks for CON_ENABLED and CON_BOOT lib/vsprintf: Unify FORMAT_STATE_NUM handlers printk: Avoid irq_work for printk_deferred() on suspend printk: Avoid scheduling irq_work on suspend printk: Allow printk_trigger_flush() to flush all types tracing: Switch to use %ptSp scsi: snic: Switch to use %ptSp scsi: fnic: Switch to use %ptSp s390/dasd: Switch to use %ptSp ptp: ocp: Switch to use %ptSp pps: Switch to use %ptSp PCI: epf-test: Switch to use %ptSp net: dsa: sja1105: Switch to use %ptSp mmc: mmc_test: Switch to use %ptSp media: av7110: Switch to use %ptSp ipmi: Switch to use %ptSp igb: Switch to use %ptSp e1000e: Switch to use %ptSp ...
2 parents 4a4e019 + 5cae92e commit 4d38b88

File tree

39 files changed

+678
-387
lines changed

39 files changed

+678
-387
lines changed

Documentation/core-api/printk-formats.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,13 @@ Time and date
547547
%pt[RT]s YYYY-mm-dd HH:MM:SS
548548
%pt[RT]d YYYY-mm-dd
549549
%pt[RT]t HH:MM:SS
550-
%pt[RT][dt][r][s]
550+
%ptSp <seconds>.<nanoseconds>
551+
%pt[RST][dt][r][s]
551552

552553
For printing date and time as represented by::
553554

554-
R struct rtc_time structure
555+
R content of struct rtc_time
556+
S content of struct timespec64
555557
T time64_t type
556558

557559
in human readable format.
@@ -563,6 +565,11 @@ The %pt[RT]s (space) will override ISO 8601 separator by using ' ' (space)
563565
instead of 'T' (Capital T) between date and time. It won't have any effect
564566
when date or time is omitted.
565567

568+
The %ptSp is equivalent to %lld.%09ld for the content of the struct timespec64.
569+
When the other specifiers are given, it becomes the respective equivalent of
570+
%ptT[dt][r][s].%09ld. In other words, the seconds are being printed in
571+
the human readable format followed by a dot and nanoseconds.
572+
566573
Passed by reference.
567574

568575
struct clk

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20608,6 +20608,7 @@ R: John Ogness <[email protected]>
2060820608
R: Sergey Senozhatsky <[email protected]>
2060920609
S: Maintained
2061020610
T: git git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
20611+
F: Documentation/core-api/printk-basics.rst
2061120612
F: include/linux/printk.h
2061220613
F: kernel/printk/
2061320614

arch/um/kernel/kmsg_dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,
3131
* expected to output the crash information.
3232
*/
3333
if (strcmp(con->name, "ttynull") != 0 &&
34-
(console_srcu_read_flags(con) & CON_ENABLED)) {
34+
console_is_usable(con, console_srcu_read_flags(con), true)) {
3535
break;
3636
}
3737
}

drivers/char/ipmi/ipmi_si_intf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,7 @@ void debug_timestamp(struct smi_info *smi_info, char *msg)
275275
struct timespec64 t;
276276

277277
ktime_get_ts64(&t);
278-
dev_dbg(smi_info->io.dev, "**%s: %lld.%9.9ld\n",
279-
msg, t.tv_sec, t.tv_nsec);
278+
dev_dbg(smi_info->io.dev, "**%s: %ptSp\n", msg, &t);
280279
}
281280
#else
282281
#define debug_timestamp(smi_info, x)

drivers/char/ipmi/ipmi_ssif.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,10 +1083,8 @@ static int sender(void *send_info, struct ipmi_smi_msg *msg)
10831083
struct timespec64 t;
10841084

10851085
ktime_get_real_ts64(&t);
1086-
dev_dbg(&ssif_info->client->dev,
1087-
"**Enqueue %02x %02x: %lld.%6.6ld\n",
1088-
msg->data[0], msg->data[1],
1089-
(long long)t.tv_sec, (long)t.tv_nsec / NSEC_PER_USEC);
1086+
dev_dbg(&ssif_info->client->dev, "**Enqueue %02x %02x: %ptSp\n",
1087+
msg->data[0], msg->data[1], &t);
10901088
}
10911089
return IPMI_CC_NO_ERROR;
10921090
}

drivers/dma-buf/sync_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void sync_print_fence(struct seq_file *s,
5959
struct timespec64 ts64 =
6060
ktime_to_timespec64(fence->timestamp);
6161

62-
seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec);
62+
seq_printf(s, "@%ptSp", &ts64);
6363
}
6464

6565
seq_printf(s, ": %lld", fence->seqno);

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
217217
drm_printf(&p, "version: " AMDGPU_COREDUMP_VERSION "\n");
218218
drm_printf(&p, "kernel: " UTS_RELEASE "\n");
219219
drm_printf(&p, "module: " KBUILD_MODNAME "\n");
220-
drm_printf(&p, "time: %lld.%09ld\n", coredump->reset_time.tv_sec,
221-
coredump->reset_time.tv_nsec);
220+
drm_printf(&p, "time: %ptSp\n", &coredump->reset_time);
222221

223222
if (coredump->reset_task_info.task.pid)
224223
drm_printf(&p, "process_name: %s PID: %d\n",

drivers/gpu/drm/drm_vblank.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,10 +794,8 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(
794794
ts_vblank_time = ktime_to_timespec64(*vblank_time);
795795

796796
drm_dbg_vbl(dev,
797-
"crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
798-
pipe, hpos, vpos,
799-
(u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
800-
(u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
797+
"crtc %u : v p(%d,%d)@ %ptSp -> %ptSp [e %d us, %d rep]\n",
798+
pipe, hpos, vpos, &ts_etime, &ts_vblank_time,
801799
duration_ns / 1000, i);
802800

803801
return true;

drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ void msm_disp_state_print(struct msm_disp_state *state, struct drm_printer *p)
8282
drm_printf(p, "kernel: " UTS_RELEASE "\n");
8383
drm_printf(p, "module: " KBUILD_MODNAME "\n");
8484
drm_printf(p, "dpu devcoredump\n");
85-
drm_printf(p, "time: %lld.%09ld\n",
86-
state->time.tv_sec, state->time.tv_nsec);
85+
drm_printf(p, "time: %ptSp\n", &state->time);
8786

8887
list_for_each_entry_safe(block, tmp, &state->blocks, node) {
8988
drm_printf(p, "====================%s================\n", block->name);

drivers/gpu/drm/msm/msm_gpu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ static ssize_t msm_gpu_devcoredump_read(char *buffer, loff_t offset,
197197
drm_printf(&p, "---\n");
198198
drm_printf(&p, "kernel: " UTS_RELEASE "\n");
199199
drm_printf(&p, "module: " KBUILD_MODNAME "\n");
200-
drm_printf(&p, "time: %lld.%09ld\n",
201-
state->time.tv_sec, state->time.tv_nsec);
200+
drm_printf(&p, "time: %ptSp\n", &state->time);
202201
if (state->comm)
203202
drm_printf(&p, "comm: %s\n", state->comm);
204203
if (state->cmd)

0 commit comments

Comments
 (0)