Merge branch 'for-6.19-vsprintf-timespec64' into for-linus

This commit is contained in:
Petr Mladek 2025-12-01 14:14:34 +01:00
commit 3869e431b5
29 changed files with 132 additions and 154 deletions

View File

@ -547,11 +547,13 @@ Time and date
%pt[RT]s YYYY-mm-dd HH:MM:SS %pt[RT]s YYYY-mm-dd HH:MM:SS
%pt[RT]d YYYY-mm-dd %pt[RT]d YYYY-mm-dd
%pt[RT]t HH:MM:SS %pt[RT]t HH:MM:SS
%pt[RT][dt][r][s] %ptSp <seconds>.<nanoseconds>
%pt[RST][dt][r][s]
For printing date and time as represented by:: For printing date and time as represented by::
R struct rtc_time structure R content of struct rtc_time
S content of struct timespec64
T time64_t type T time64_t type
in human readable format. in human readable format.
@ -563,6 +565,11 @@ The %pt[RT]s (space) will override ISO 8601 separator by using ' ' (space)
instead of 'T' (Capital T) between date and time. It won't have any effect instead of 'T' (Capital T) between date and time. It won't have any effect
when date or time is omitted. when date or time is omitted.
The %ptSp is equivalent to %lld.%09ld for the content of the struct timespec64.
When the other specifiers are given, it becomes the respective equivalent of
%ptT[dt][r][s].%09ld. In other words, the seconds are being printed in
the human readable format followed by a dot and nanoseconds.
Passed by reference. Passed by reference.
struct clk struct clk

View File

@ -275,8 +275,7 @@ void debug_timestamp(struct smi_info *smi_info, char *msg)
struct timespec64 t; struct timespec64 t;
ktime_get_ts64(&t); ktime_get_ts64(&t);
dev_dbg(smi_info->io.dev, "**%s: %lld.%9.9ld\n", dev_dbg(smi_info->io.dev, "**%s: %ptSp\n", msg, &t);
msg, t.tv_sec, t.tv_nsec);
} }
#else #else
#define debug_timestamp(smi_info, x) #define debug_timestamp(smi_info, x)

View File

@ -1083,10 +1083,8 @@ static int sender(void *send_info, struct ipmi_smi_msg *msg)
struct timespec64 t; struct timespec64 t;
ktime_get_real_ts64(&t); ktime_get_real_ts64(&t);
dev_dbg(&ssif_info->client->dev, dev_dbg(&ssif_info->client->dev, "**Enqueue %02x %02x: %ptSp\n",
"**Enqueue %02x %02x: %lld.%6.6ld\n", msg->data[0], msg->data[1], &t);
msg->data[0], msg->data[1],
(long long)t.tv_sec, (long)t.tv_nsec / NSEC_PER_USEC);
} }
return IPMI_CC_NO_ERROR; return IPMI_CC_NO_ERROR;
} }

View File

@ -59,7 +59,7 @@ static void sync_print_fence(struct seq_file *s,
struct timespec64 ts64 = struct timespec64 ts64 =
ktime_to_timespec64(fence->timestamp); ktime_to_timespec64(fence->timestamp);
seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec); seq_printf(s, "@%ptSp", &ts64);
} }
seq_printf(s, ": %lld", fence->seqno); seq_printf(s, ": %lld", fence->seqno);

View File

@ -217,8 +217,7 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
drm_printf(&p, "version: " AMDGPU_COREDUMP_VERSION "\n"); drm_printf(&p, "version: " AMDGPU_COREDUMP_VERSION "\n");
drm_printf(&p, "kernel: " UTS_RELEASE "\n"); drm_printf(&p, "kernel: " UTS_RELEASE "\n");
drm_printf(&p, "module: " KBUILD_MODNAME "\n"); drm_printf(&p, "module: " KBUILD_MODNAME "\n");
drm_printf(&p, "time: %lld.%09ld\n", coredump->reset_time.tv_sec, drm_printf(&p, "time: %ptSp\n", &coredump->reset_time);
coredump->reset_time.tv_nsec);
if (coredump->reset_task_info.task.pid) if (coredump->reset_task_info.task.pid)
drm_printf(&p, "process_name: %s PID: %d\n", drm_printf(&p, "process_name: %s PID: %d\n",

View File

@ -794,10 +794,8 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(
ts_vblank_time = ktime_to_timespec64(*vblank_time); ts_vblank_time = ktime_to_timespec64(*vblank_time);
drm_dbg_vbl(dev, drm_dbg_vbl(dev,
"crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n", "crtc %u : v p(%d,%d)@ %ptSp -> %ptSp [e %d us, %d rep]\n",
pipe, hpos, vpos, pipe, hpos, vpos, &ts_etime, &ts_vblank_time,
(u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
(u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
duration_ns / 1000, i); duration_ns / 1000, i);
return true; return true;

View File

@ -82,8 +82,7 @@ void msm_disp_state_print(struct msm_disp_state *state, struct drm_printer *p)
drm_printf(p, "kernel: " UTS_RELEASE "\n"); drm_printf(p, "kernel: " UTS_RELEASE "\n");
drm_printf(p, "module: " KBUILD_MODNAME "\n"); drm_printf(p, "module: " KBUILD_MODNAME "\n");
drm_printf(p, "dpu devcoredump\n"); drm_printf(p, "dpu devcoredump\n");
drm_printf(p, "time: %lld.%09ld\n", drm_printf(p, "time: %ptSp\n", &state->time);
state->time.tv_sec, state->time.tv_nsec);
list_for_each_entry_safe(block, tmp, &state->blocks, node) { list_for_each_entry_safe(block, tmp, &state->blocks, node) {
drm_printf(p, "====================%s================\n", block->name); drm_printf(p, "====================%s================\n", block->name);

View File

@ -197,8 +197,7 @@ static ssize_t msm_gpu_devcoredump_read(char *buffer, loff_t offset,
drm_printf(&p, "---\n"); drm_printf(&p, "---\n");
drm_printf(&p, "kernel: " UTS_RELEASE "\n"); drm_printf(&p, "kernel: " UTS_RELEASE "\n");
drm_printf(&p, "module: " KBUILD_MODNAME "\n"); drm_printf(&p, "module: " KBUILD_MODNAME "\n");
drm_printf(&p, "time: %lld.%09ld\n", drm_printf(&p, "time: %ptSp\n", &state->time);
state->time.tv_sec, state->time.tv_nsec);
if (state->comm) if (state->comm)
drm_printf(&p, "comm: %s\n", state->comm); drm_printf(&p, "comm: %s\n", state->comm);
if (state->cmd) if (state->cmd)

View File

@ -106,9 +106,9 @@ static ssize_t __xe_devcoredump_read(char *buffer, ssize_t count,
drm_puts(&p, "module: " KBUILD_MODNAME "\n"); drm_puts(&p, "module: " KBUILD_MODNAME "\n");
ts = ktime_to_timespec64(ss->snapshot_time); ts = ktime_to_timespec64(ss->snapshot_time);
drm_printf(&p, "Snapshot time: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec); drm_printf(&p, "Snapshot time: %ptSp\n", &ts);
ts = ktime_to_timespec64(ss->boot_time); ts = ktime_to_timespec64(ss->boot_time);
drm_printf(&p, "Uptime: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec); drm_printf(&p, "Uptime: %ptSp\n", &ts);
drm_printf(&p, "Process: %s [%d]\n", ss->process_name, ss->pid); drm_printf(&p, "Process: %s [%d]\n", ss->process_name, ss->pid);
xe_device_snapshot_print(xe, &p); xe_device_snapshot_print(xe, &p);

View File

@ -586,14 +586,11 @@ static void mmc_test_print_avg_rate(struct mmc_test_card *test, uint64_t bytes,
rate = mmc_test_rate(tot, &ts); rate = mmc_test_rate(tot, &ts);
iops = mmc_test_rate(count * 100, &ts); /* I/O ops per sec x 100 */ iops = mmc_test_rate(count * 100, &ts); /* I/O ops per sec x 100 */
pr_info("%s: Transfer of %u x %u sectors (%u x %u%s KiB) took " pr_info("%s: Transfer of %u x %u sectors (%u x %u%s KiB) took %ptSp seconds (%u kB/s, %u KiB/s, %u.%02u IOPS, sg_len %d)\n",
"%llu.%09u seconds (%u kB/s, %u KiB/s, " mmc_hostname(test->card->host), count, sectors, count,
"%u.%02u IOPS, sg_len %d)\n", sectors >> 1, (sectors & 1 ? ".5" : ""), &ts,
mmc_hostname(test->card->host), count, sectors, count, rate / 1000, rate / 1024, iops / 100, iops % 100,
sectors >> 1, (sectors & 1 ? ".5" : ""), test->area.sg_len);
(u64)ts.tv_sec, (u32)ts.tv_nsec,
rate / 1000, rate / 1024, iops / 100, iops % 100,
test->area.sg_len);
mmc_test_save_transfer_result(test, count, sectors, ts, rate, iops); mmc_test_save_transfer_result(test, count, sectors, ts, rate, iops);
} }
@ -3074,10 +3071,9 @@ static int mtf_test_show(struct seq_file *sf, void *data)
seq_printf(sf, "Test %d: %d\n", gr->testcase + 1, gr->result); seq_printf(sf, "Test %d: %d\n", gr->testcase + 1, gr->result);
list_for_each_entry(tr, &gr->tr_lst, link) { list_for_each_entry(tr, &gr->tr_lst, link) {
seq_printf(sf, "%u %d %llu.%09u %u %u.%02u\n", seq_printf(sf, "%u %d %ptSp %u %u.%02u\n",
tr->count, tr->sectors, tr->count, tr->sectors, &tr->ts, tr->rate,
(u64)tr->ts.tv_sec, (u32)tr->ts.tv_nsec, tr->iops / 100, tr->iops % 100);
tr->rate, tr->iops / 100, tr->iops % 100);
} }
} }

View File

@ -775,9 +775,8 @@ static void sja1105_tas_state_machine(struct work_struct *work)
base_time_ts = ns_to_timespec64(base_time); base_time_ts = ns_to_timespec64(base_time);
now_ts = ns_to_timespec64(now); now_ts = ns_to_timespec64(now);
dev_dbg(ds->dev, "OPER base time %lld.%09ld (now %lld.%09ld)\n", dev_dbg(ds->dev, "OPER base time %ptSp (now %ptSp)\n",
base_time_ts.tv_sec, base_time_ts.tv_nsec, &base_time_ts, &now_ts);
now_ts.tv_sec, now_ts.tv_nsec);
break; break;
@ -798,8 +797,7 @@ static void sja1105_tas_state_machine(struct work_struct *work)
if (now < tas_data->oper_base_time) { if (now < tas_data->oper_base_time) {
/* TAS has not started yet */ /* TAS has not started yet */
diff = ns_to_timespec64(tas_data->oper_base_time - now); diff = ns_to_timespec64(tas_data->oper_base_time - now);
dev_dbg(ds->dev, "time to start: [%lld.%09ld]", dev_dbg(ds->dev, "time to start: [%ptSp]", &diff);
diff.tv_sec, diff.tv_nsec);
break; break;
} }

View File

@ -229,14 +229,11 @@ static void e1000e_systim_overflow_work(struct work_struct *work)
systim_overflow_work.work); systim_overflow_work.work);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct timespec64 ts; struct timespec64 ts;
u64 ns;
/* Update the timecounter */ /* Update the timecounter */
ns = timecounter_read(&adapter->tc); ts = ns_to_timespec64(timecounter_read(&adapter->tc));
ts = ns_to_timespec64(ns); e_dbg("SYSTIM overflow check at %ptSp\n", &ts);
e_dbg("SYSTIM overflow check at %lld.%09lu\n",
(long long) ts.tv_sec, ts.tv_nsec);
schedule_delayed_work(&adapter->systim_overflow_work, schedule_delayed_work(&adapter->systim_overflow_work,
E1000_SYSTIM_OVERFLOW_PERIOD); E1000_SYSTIM_OVERFLOW_PERIOD);

View File

@ -840,14 +840,11 @@ static void igb_ptp_overflow_check(struct work_struct *work)
struct igb_adapter *igb = struct igb_adapter *igb =
container_of(work, struct igb_adapter, ptp_overflow_work.work); container_of(work, struct igb_adapter, ptp_overflow_work.work);
struct timespec64 ts; struct timespec64 ts;
u64 ns;
/* Update the timecounter */ /* Update the timecounter */
ns = timecounter_read(&igb->tc); ts = ns_to_timespec64(timecounter_read(&igb->tc));
ts = ns_to_timespec64(ns); pr_debug("igb overflow check at %ptSp\n", &ts);
pr_debug("igb overflow check at %lld.%09lu\n",
(long long) ts.tv_sec, ts.tv_nsec);
schedule_delayed_work(&igb->ptp_overflow_work, schedule_delayed_work(&igb->ptp_overflow_work,
IGB_SYSTIM_OVERFLOW_PERIOD); IGB_SYSTIM_OVERFLOW_PERIOD);

View File

@ -326,9 +326,8 @@ static void pci_epf_test_print_rate(struct pci_epf_test *epf_test,
rate = div64_u64(size * NSEC_PER_SEC, ns * 1000); rate = div64_u64(size * NSEC_PER_SEC, ns * 1000);
dev_info(&epf_test->epf->dev, dev_info(&epf_test->epf->dev,
"%s => Size: %llu B, DMA: %s, Time: %llu.%09u s, Rate: %llu KB/s\n", "%s => Size: %llu B, DMA: %s, Time: %ptSp s, Rate: %llu KB/s\n",
op, size, dma ? "YES" : "NO", op, size, dma ? "YES" : "NO", &ts, rate);
(u64)ts.tv_sec, (u32)ts.tv_nsec, rate);
} }
static void pci_epf_test_copy(struct pci_epf_test *epf_test, static void pci_epf_test_copy(struct pci_epf_test *epf_test,

View File

@ -80,8 +80,7 @@ static enum hrtimer_restart hrtimer_event(struct hrtimer *timer)
/* check if we are late */ /* check if we are late */
if (expire_time.tv_sec != ts1.tv_sec || ts1.tv_nsec > lim) { if (expire_time.tv_sec != ts1.tv_sec || ts1.tv_nsec > lim) {
local_irq_restore(flags); local_irq_restore(flags);
pr_err("we are late this time %lld.%09ld\n", pr_err("we are late this time %ptSp\n", &ts1);
(s64)ts1.tv_sec, ts1.tv_nsec);
goto done; goto done;
} }

View File

@ -166,8 +166,7 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event,
/* check event type */ /* check event type */
BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0);
dev_dbg(&pps->dev, "PPS event at %lld.%09ld\n", dev_dbg(&pps->dev, "PPS event at %ptSp\n", &ts->ts_real);
(s64)ts->ts_real.tv_sec, ts->ts_real.tv_nsec);
timespec_to_pps_ktime(&ts_real, ts->ts_real); timespec_to_pps_ktime(&ts_real, ts->ts_real);

View File

@ -4287,11 +4287,9 @@ ptp_ocp_summary_show(struct seq_file *s, void *data)
ns += (s64)bp->utc_tai_offset * NSEC_PER_SEC; ns += (s64)bp->utc_tai_offset * NSEC_PER_SEC;
sys_ts = ns_to_timespec64(ns); sys_ts = ns_to_timespec64(ns);
seq_printf(s, "%7s: %lld.%ld == %ptT TAI\n", "PHC", seq_printf(s, "%7s: %ptSp == %ptS TAI\n", "PHC", &ts, &ts);
ts.tv_sec, ts.tv_nsec, &ts); seq_printf(s, "%7s: %ptSp == %ptS UTC offset %d\n", "SYS",
seq_printf(s, "%7s: %lld.%ld == %ptT UTC offset %d\n", "SYS", &sys_ts, &sys_ts, bp->utc_tai_offset);
sys_ts.tv_sec, sys_ts.tv_nsec, &sys_ts,
bp->utc_tai_offset);
seq_printf(s, "%7s: PHC:SYS offset: %lld window: %lld\n", "", seq_printf(s, "%7s: PHC:SYS offset: %lld window: %lld\n", "",
timespec64_to_ns(&ts) - ns, timespec64_to_ns(&ts) - ns,
post_ns - pre_ns); post_ns - pre_ns);
@ -4499,9 +4497,8 @@ ptp_ocp_phc_info(struct ptp_ocp *bp)
ptp_clock_index(bp->ptp)); ptp_clock_index(bp->ptp));
if (!ptp_ocp_gettimex(&bp->ptp_info, &ts, NULL)) if (!ptp_ocp_gettimex(&bp->ptp_info, &ts, NULL))
dev_info(&bp->pdev->dev, "Time: %lld.%ld, %s\n", dev_info(&bp->pdev->dev, "Time: %ptSp, %s\n",
ts.tv_sec, ts.tv_nsec, &ts, bp->sync ? "in-sync" : "UNSYNCED");
bp->sync ? "in-sync" : "UNSYNCED");
} }
static void static void

View File

@ -974,8 +974,7 @@ static void dasd_stats_array(struct seq_file *m, unsigned int *array)
static void dasd_stats_seq_print(struct seq_file *m, static void dasd_stats_seq_print(struct seq_file *m,
struct dasd_profile_info *data) struct dasd_profile_info *data)
{ {
seq_printf(m, "start_time %lld.%09ld\n", seq_printf(m, "start_time %ptSp\n", &data->starttod);
(s64)data->starttod.tv_sec, data->starttod.tv_nsec);
seq_printf(m, "total_requests %u\n", data->dasd_io_reqs); seq_printf(m, "total_requests %u\n", data->dasd_io_reqs);
seq_printf(m, "total_sectors %u\n", data->dasd_io_sects); seq_printf(m, "total_sectors %u\n", data->dasd_io_sects);
seq_printf(m, "total_pav %u\n", data->dasd_io_alias); seq_printf(m, "total_pav %u\n", data->dasd_io_alias);

View File

@ -138,9 +138,8 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt)
*/ */
len += scnprintf(fnic_dbgfs_prt->buffer + len, len += scnprintf(fnic_dbgfs_prt->buffer + len,
(trace_max_pages * PAGE_SIZE * 3) - len, (trace_max_pages * PAGE_SIZE * 3) - len,
"%16llu.%09lu %-50s %8x %8x %16llx %16llx " "%ptSp %-50s %8x %8x %16llx %16llx %16llx %16llx %16llx\n",
"%16llx %16llx %16llx\n", (u64)val.tv_sec, &val, str, tbp->host_no, tbp->tag,
val.tv_nsec, str, tbp->host_no, tbp->tag,
tbp->data[0], tbp->data[1], tbp->data[2], tbp->data[0], tbp->data[1], tbp->data[2],
tbp->data[3], tbp->data[4]); tbp->data[3], tbp->data[4]);
rd_idx++; rd_idx++;
@ -180,9 +179,8 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt)
*/ */
len += scnprintf(fnic_dbgfs_prt->buffer + len, len += scnprintf(fnic_dbgfs_prt->buffer + len,
(trace_max_pages * PAGE_SIZE * 3) - len, (trace_max_pages * PAGE_SIZE * 3) - len,
"%16llu.%09lu %-50s %8x %8x %16llx %16llx " "%ptSp %-50s %8x %8x %16llx %16llx %16llx %16llx %16llx\n",
"%16llx %16llx %16llx\n", (u64)val.tv_sec, &val, str, tbp->host_no, tbp->tag,
val.tv_nsec, str, tbp->host_no, tbp->tag,
tbp->data[0], tbp->data[1], tbp->data[2], tbp->data[0], tbp->data[1], tbp->data[2],
tbp->data[3], tbp->data[4]); tbp->data[3], tbp->data[4]);
rd_idx++; rd_idx++;
@ -215,32 +213,29 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
{ {
int len = 0; int len = 0;
int buf_size = debug->buf_size; int buf_size = debug->buf_size;
struct timespec64 val1, val2; struct timespec64 val, val1, val2;
int i = 0; int i = 0;
ktime_get_real_ts64(&val1); ktime_get_real_ts64(&val);
len = scnprintf(debug->debug_buffer + len, buf_size - len, len = scnprintf(debug->debug_buffer + len, buf_size - len,
"------------------------------------------\n" "------------------------------------------\n"
"\t\tTime\n" "\t\tTime\n"
"------------------------------------------\n"); "------------------------------------------\n");
val1 = timespec64_sub(val, stats->stats_timestamps.last_reset_time);
val2 = timespec64_sub(val, stats->stats_timestamps.last_read_time);
len += scnprintf(debug->debug_buffer + len, buf_size - len, len += scnprintf(debug->debug_buffer + len, buf_size - len,
"Current time : [%lld:%ld]\n" "Current time : [%ptSp]\n"
"Last stats reset time: [%lld:%09ld]\n" "Last stats reset time: [%ptSp]\n"
"Last stats read time: [%lld:%ld]\n" "Last stats read time: [%ptSp]\n"
"delta since last reset: [%lld:%ld]\n" "delta since last reset: [%ptSp]\n"
"delta since last read: [%lld:%ld]\n", "delta since last read: [%ptSp]\n",
(s64)val1.tv_sec, val1.tv_nsec, &val,
(s64)stats->stats_timestamps.last_reset_time.tv_sec, &stats->stats_timestamps.last_reset_time,
stats->stats_timestamps.last_reset_time.tv_nsec, &stats->stats_timestamps.last_read_time,
(s64)stats->stats_timestamps.last_read_time.tv_sec, &val1, &val2);
stats->stats_timestamps.last_read_time.tv_nsec,
(s64)timespec64_sub(val1, stats->stats_timestamps.last_reset_time).tv_sec,
timespec64_sub(val1, stats->stats_timestamps.last_reset_time).tv_nsec,
(s64)timespec64_sub(val1, stats->stats_timestamps.last_read_time).tv_sec,
timespec64_sub(val1, stats->stats_timestamps.last_read_time).tv_nsec);
stats->stats_timestamps.last_read_time = val1; stats->stats_timestamps.last_read_time = val;
len += scnprintf(debug->debug_buffer + len, buf_size - len, len += scnprintf(debug->debug_buffer + len, buf_size - len,
"------------------------------------------\n" "------------------------------------------\n"
@ -416,8 +411,8 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
jiffies_to_timespec64(stats->misc_stats.last_ack_time, &val2); jiffies_to_timespec64(stats->misc_stats.last_ack_time, &val2);
len += scnprintf(debug->debug_buffer + len, buf_size - len, len += scnprintf(debug->debug_buffer + len, buf_size - len,
"Last ISR time: %llu (%8llu.%09lu)\n" "Last ISR time: %llu (%ptSp)\n"
"Last ACK time: %llu (%8llu.%09lu)\n" "Last ACK time: %llu (%ptSp)\n"
"Max ISR jiffies: %llu\n" "Max ISR jiffies: %llu\n"
"Max ISR time (ms) (0 denotes < 1 ms): %llu\n" "Max ISR time (ms) (0 denotes < 1 ms): %llu\n"
"Corr. work done: %llu\n" "Corr. work done: %llu\n"
@ -437,10 +432,8 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
"Number of rport not ready: %lld\n" "Number of rport not ready: %lld\n"
"Number of receive frame errors: %lld\n" "Number of receive frame errors: %lld\n"
"Port speed (in Mbps): %lld\n", "Port speed (in Mbps): %lld\n",
(u64)stats->misc_stats.last_isr_time, (u64)stats->misc_stats.last_isr_time, &val1,
(s64)val1.tv_sec, val1.tv_nsec, (u64)stats->misc_stats.last_ack_time, &val2,
(u64)stats->misc_stats.last_ack_time,
(s64)val2.tv_sec, val2.tv_nsec,
(u64)atomic64_read(&stats->misc_stats.max_isr_jiffies), (u64)atomic64_read(&stats->misc_stats.max_isr_jiffies),
(u64)atomic64_read(&stats->misc_stats.max_isr_time_ms), (u64)atomic64_read(&stats->misc_stats.max_isr_time_ms),
(u64)atomic64_read(&stats->misc_stats.corr_work_done), (u64)atomic64_read(&stats->misc_stats.corr_work_done),
@ -857,8 +850,8 @@ void copy_and_format_trace_data(struct fc_trace_hdr *tdata,
len = *orig_len; len = *orig_len;
len += scnprintf(fnic_dbgfs_prt->buffer + len, max_size - len, len += scnprintf(fnic_dbgfs_prt->buffer + len, max_size - len,
"%ptTs.%09lu ns%8x %c%8x\t", "%ptSs ns%8x %c%8x\t",
&tdata->time_stamp.tv_sec, tdata->time_stamp.tv_nsec, &tdata->time_stamp,
tdata->host_no, tdata->frame_type, tdata->frame_len); tdata->host_no, tdata->frame_type, tdata->frame_len);
fc_trace = (char *)FC_TRACE_ADDRESS(tdata); fc_trace = (char *)FC_TRACE_ADDRESS(tdata);

View File

@ -282,8 +282,8 @@ snic_stats_show(struct seq_file *sfp, void *data)
jiffies_to_timespec64(stats->misc.last_ack_time, &last_ack_tms); jiffies_to_timespec64(stats->misc.last_ack_time, &last_ack_tms);
seq_printf(sfp, seq_printf(sfp,
"Last ISR Time : %llu (%8llu.%09lu)\n" "Last ISR Time : %llu (%ptSp)\n"
"Last Ack Time : %llu (%8llu.%09lu)\n" "Last Ack Time : %llu (%ptSp)\n"
"Ack ISRs : %llu\n" "Ack ISRs : %llu\n"
"IO Cmpl ISRs : %llu\n" "IO Cmpl ISRs : %llu\n"
"Err Notify ISRs : %llu\n" "Err Notify ISRs : %llu\n"
@ -298,10 +298,8 @@ snic_stats_show(struct seq_file *sfp, void *data)
"Queue Ramp Down : %lld\n" "Queue Ramp Down : %lld\n"
"Queue Last Queue Depth : %lld\n" "Queue Last Queue Depth : %lld\n"
"Target Not Ready : %lld\n", "Target Not Ready : %lld\n",
(u64) stats->misc.last_isr_time, (u64) stats->misc.last_isr_time, &last_isr_tms,
last_isr_tms.tv_sec, last_isr_tms.tv_nsec, (u64) stats->misc.last_ack_time, &last_ack_tms,
(u64)stats->misc.last_ack_time,
last_ack_tms.tv_sec, last_ack_tms.tv_nsec,
(u64) atomic64_read(&stats->misc.ack_isr_cnt), (u64) atomic64_read(&stats->misc.ack_isr_cnt),
(u64) atomic64_read(&stats->misc.cmpl_isr_cnt), (u64) atomic64_read(&stats->misc.cmpl_isr_cnt),
(u64) atomic64_read(&stats->misc.errnotify_isr_cnt), (u64) atomic64_read(&stats->misc.errnotify_isr_cnt),

View File

@ -56,9 +56,8 @@ snic_fmt_trc_data(struct snic_trc_data *td, char *buf, int buf_sz)
jiffies_to_timespec64(td->ts, &tmspec); jiffies_to_timespec64(td->ts, &tmspec);
len += snprintf(buf, buf_sz, len += snprintf(buf, buf_sz,
"%llu.%09lu %-25s %3d %4x %16llx %16llx %16llx %16llx %16llx\n", "%ptSp %-25s %3d %4x %16llx %16llx %16llx %16llx %16llx\n",
tmspec.tv_sec, &tmspec,
tmspec.tv_nsec,
td->fn, td->fn,
td->hno, td->hno,
td->tag, td->tag,

View File

@ -321,7 +321,7 @@ static inline void print_time(char *s)
struct timespec64 ts; struct timespec64 ts;
ktime_get_real_ts64(&ts); ktime_get_real_ts64(&ts);
pr_info("%s(): %lld.%09ld\n", s, (s64)ts.tv_sec, ts.tv_nsec); pr_info("%s(): %ptSp\n", s, &ts);
#endif #endif
} }

View File

@ -2156,7 +2156,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
" rfiles: %20lld\n" " rfiles: %20lld\n"
" rsubdirs: %20lld\n" " rsubdirs: %20lld\n"
"rbytes: %20lld\n" "rbytes: %20lld\n"
"rctime: %10lld.%09ld\n", "rctime: %ptSp\n",
ci->i_files + ci->i_subdirs, ci->i_files + ci->i_subdirs,
ci->i_files, ci->i_files,
ci->i_subdirs, ci->i_subdirs,
@ -2164,8 +2164,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
ci->i_rfiles, ci->i_rfiles,
ci->i_rsubdirs, ci->i_rsubdirs,
ci->i_rbytes, ci->i_rbytes,
ci->i_rctime.tv_sec, &ci->i_rctime);
ci->i_rctime.tv_nsec);
} }
if (*ppos >= dfi->dir_info_len) if (*ppos >= dfi->dir_info_len)

View File

@ -879,7 +879,9 @@ void ceph_fill_file_time(struct inode *inode, int issued,
{ {
struct ceph_client *cl = ceph_inode_to_client(inode); struct ceph_client *cl = ceph_inode_to_client(inode);
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct timespec64 iatime = inode_get_atime(inode);
struct timespec64 ictime = inode_get_ctime(inode); struct timespec64 ictime = inode_get_ctime(inode);
struct timespec64 imtime = inode_get_mtime(inode);
int warn = 0; int warn = 0;
if (issued & (CEPH_CAP_FILE_EXCL| if (issued & (CEPH_CAP_FILE_EXCL|
@ -889,39 +891,26 @@ void ceph_fill_file_time(struct inode *inode, int issued,
CEPH_CAP_XATTR_EXCL)) { CEPH_CAP_XATTR_EXCL)) {
if (ci->i_version == 0 || if (ci->i_version == 0 ||
timespec64_compare(ctime, &ictime) > 0) { timespec64_compare(ctime, &ictime) > 0) {
doutc(cl, "ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n", doutc(cl, "ctime %ptSp -> %ptSp inc w/ cap\n", &ictime, ctime);
ictime.tv_sec, ictime.tv_nsec,
ctime->tv_sec, ctime->tv_nsec);
inode_set_ctime_to_ts(inode, *ctime); inode_set_ctime_to_ts(inode, *ctime);
} }
if (ci->i_version == 0 || if (ci->i_version == 0 ||
ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) { ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
/* the MDS did a utimes() */ /* the MDS did a utimes() */
doutc(cl, "mtime %lld.%09ld -> %lld.%09ld tw %d -> %d\n", doutc(cl, "mtime %ptSp -> %ptSp tw %d -> %d\n", &imtime, mtime,
inode_get_mtime_sec(inode), ci->i_time_warp_seq, (int)time_warp_seq);
inode_get_mtime_nsec(inode),
mtime->tv_sec, mtime->tv_nsec,
ci->i_time_warp_seq, (int)time_warp_seq);
inode_set_mtime_to_ts(inode, *mtime); inode_set_mtime_to_ts(inode, *mtime);
inode_set_atime_to_ts(inode, *atime); inode_set_atime_to_ts(inode, *atime);
ci->i_time_warp_seq = time_warp_seq; ci->i_time_warp_seq = time_warp_seq;
} else if (time_warp_seq == ci->i_time_warp_seq) { } else if (time_warp_seq == ci->i_time_warp_seq) {
struct timespec64 ts;
/* nobody did utimes(); take the max */ /* nobody did utimes(); take the max */
ts = inode_get_mtime(inode); if (timespec64_compare(mtime, &imtime) > 0) {
if (timespec64_compare(mtime, &ts) > 0) { doutc(cl, "mtime %ptSp -> %ptSp inc\n", &imtime, mtime);
doutc(cl, "mtime %lld.%09ld -> %lld.%09ld inc\n",
ts.tv_sec, ts.tv_nsec,
mtime->tv_sec, mtime->tv_nsec);
inode_set_mtime_to_ts(inode, *mtime); inode_set_mtime_to_ts(inode, *mtime);
} }
ts = inode_get_atime(inode); if (timespec64_compare(atime, &iatime) > 0) {
if (timespec64_compare(atime, &ts) > 0) { doutc(cl, "atime %ptSp -> %ptSp inc\n", &iatime, atime);
doutc(cl, "atime %lld.%09ld -> %lld.%09ld inc\n",
ts.tv_sec, ts.tv_nsec,
atime->tv_sec, atime->tv_nsec);
inode_set_atime_to_ts(inode, *atime); inode_set_atime_to_ts(inode, *atime);
} }
} else if (issued & CEPH_CAP_FILE_EXCL) { } else if (issued & CEPH_CAP_FILE_EXCL) {
@ -2692,10 +2681,8 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
if (ia_valid & ATTR_ATIME) { if (ia_valid & ATTR_ATIME) {
struct timespec64 atime = inode_get_atime(inode); struct timespec64 atime = inode_get_atime(inode);
doutc(cl, "%p %llx.%llx atime %lld.%09ld -> %lld.%09ld\n", doutc(cl, "%p %llx.%llx atime %ptSp -> %ptSp\n",
inode, ceph_vinop(inode), inode, ceph_vinop(inode), &atime, &attr->ia_atime);
atime.tv_sec, atime.tv_nsec,
attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec);
if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) { if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) {
ci->i_time_warp_seq++; ci->i_time_warp_seq++;
inode_set_atime_to_ts(inode, attr->ia_atime); inode_set_atime_to_ts(inode, attr->ia_atime);
@ -2769,10 +2756,8 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
if (ia_valid & ATTR_MTIME) { if (ia_valid & ATTR_MTIME) {
struct timespec64 mtime = inode_get_mtime(inode); struct timespec64 mtime = inode_get_mtime(inode);
doutc(cl, "%p %llx.%llx mtime %lld.%09ld -> %lld.%09ld\n", doutc(cl, "%p %llx.%llx mtime %ptSp -> %ptSp\n",
inode, ceph_vinop(inode), inode, ceph_vinop(inode), &mtime, &attr->ia_mtime);
mtime.tv_sec, mtime.tv_nsec,
attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec);
if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) { if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) {
ci->i_time_warp_seq++; ci->i_time_warp_seq++;
inode_set_mtime_to_ts(inode, attr->ia_mtime); inode_set_mtime_to_ts(inode, attr->ia_mtime);
@ -2793,13 +2778,11 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
/* these do nothing */ /* these do nothing */
if (ia_valid & ATTR_CTIME) { if (ia_valid & ATTR_CTIME) {
struct timespec64 ictime = inode_get_ctime(inode);
bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME| bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME|
ATTR_MODE|ATTR_UID|ATTR_GID)) == 0; ATTR_MODE|ATTR_UID|ATTR_GID)) == 0;
doutc(cl, "%p %llx.%llx ctime %lld.%09ld -> %lld.%09ld (%s)\n", doutc(cl, "%p %llx.%llx ctime %ptSp -> %ptSp (%s)\n",
inode, ceph_vinop(inode), inode, ceph_vinop(inode), &ictime, &attr->ia_ctime,
inode_get_ctime_sec(inode),
inode_get_ctime_nsec(inode),
attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
only ? "ctime only" : "ignored"); only ? "ctime only" : "ignored");
if (only) { if (only) {
/* /*

View File

@ -249,8 +249,7 @@ static ssize_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val,
static ssize_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, static ssize_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
size_t size) size_t size)
{ {
return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_rctime.tv_sec, return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_rctime);
ci->i_rctime.tv_nsec);
} }
/* dir pin */ /* dir pin */
@ -307,8 +306,7 @@ static bool ceph_vxattrcb_snap_btime_exists(struct ceph_inode_info *ci)
static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val, static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val,
size_t size) size_t size)
{ {
return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_snap_btime.tv_sec, return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_snap_btime);
ci->i_snap_btime.tv_nsec);
} }
static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci, static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,

View File

@ -1467,12 +1467,12 @@ trace_hwlat_print(struct trace_iterator *iter, int flags,
trace_assign_type(field, entry); trace_assign_type(field, entry);
trace_seq_printf(s, "#%-5u inner/outer(us): %4llu/%-5llu ts:%lld.%09ld count:%d", trace_seq_printf(s, "#%-5u inner/outer(us): %4llu/%-5llu ts:%ptSp count:%d",
field->seqnum, field->seqnum,
field->duration, field->duration,
field->outer_duration, field->outer_duration,
(long long)field->timestamp.tv_sec, &field->timestamp,
field->timestamp.tv_nsec, field->count); field->count);
if (field->nmi_count) { if (field->nmi_count) {
/* /*

View File

@ -504,6 +504,7 @@ time_and_date(struct kunit *kunittest)
}; };
/* 2019-01-04T15:32:23 */ /* 2019-01-04T15:32:23 */
time64_t t = 1546615943; time64_t t = 1546615943;
struct timespec64 ts = { .tv_sec = t, .tv_nsec = 11235813 };
test("(%pt?)", "%pt", &tm); test("(%pt?)", "%pt", &tm);
test("2018-11-26T05:35:43", "%ptR", &tm); test("2018-11-26T05:35:43", "%ptR", &tm);
@ -522,6 +523,9 @@ time_and_date(struct kunit *kunittest)
test("0119-00-04 15:32:23", "%ptTsr", &t); test("0119-00-04 15:32:23", "%ptTsr", &t);
test("15:32:23|2019-01-04", "%ptTts|%ptTds", &t, &t); test("15:32:23|2019-01-04", "%ptTts|%ptTds", &t, &t);
test("15:32:23|0119-00-04", "%ptTtrs|%ptTdrs", &t, &t); test("15:32:23|0119-00-04", "%ptTtrs|%ptTdrs", &t, &t);
test("2019-01-04T15:32:23.011235813", "%ptS", &ts);
test("1546615943.011235813", "%ptSp", &ts);
} }
static void static void

View File

@ -1983,6 +1983,28 @@ char *time64_str(char *buf, char *end, const time64_t time,
return rtc_str(buf, end, &rtc_time, spec, fmt); return rtc_str(buf, end, &rtc_time, spec, fmt);
} }
static noinline_for_stack
char *timespec64_str(char *buf, char *end, const struct timespec64 *ts,
struct printf_spec spec, const char *fmt)
{
static const struct printf_spec default_dec09_spec = {
.base = 10,
.field_width = 9,
.precision = -1,
.flags = ZEROPAD,
};
if (fmt[2] == 'p')
buf = number(buf, end, ts->tv_sec, default_dec_spec);
else
buf = time64_str(buf, end, ts->tv_sec, spec, fmt);
if (buf < end)
*buf = '.';
buf++;
return number(buf, end, ts->tv_nsec, default_dec09_spec);
}
static noinline_for_stack static noinline_for_stack
char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec, char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
const char *fmt) const char *fmt)
@ -1993,6 +2015,8 @@ char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
switch (fmt[1]) { switch (fmt[1]) {
case 'R': case 'R':
return rtc_str(buf, end, (const struct rtc_time *)ptr, spec, fmt); return rtc_str(buf, end, (const struct rtc_time *)ptr, spec, fmt);
case 'S':
return timespec64_str(buf, end, (const struct timespec64 *)ptr, spec, fmt);
case 'T': case 'T':
return time64_str(buf, end, *(const time64_t *)ptr, spec, fmt); return time64_str(buf, end, *(const time64_t *)ptr, spec, fmt);
default: default:
@ -2456,9 +2480,11 @@ early_param("no_hash_pointers", no_hash_pointers_enable);
* - 'd[234]' For a dentry name (optionally 2-4 last components) * - 'd[234]' For a dentry name (optionally 2-4 last components)
* - 'D[234]' Same as 'd' but for a struct file * - 'D[234]' Same as 'd' but for a struct file
* - 'g' For block_device name (gendisk + partition number) * - 'g' For block_device name (gendisk + partition number)
* - 't[RT][dt][r][s]' For time and date as represented by: * - 't[RST][dt][r][s]' For time and date as represented by:
* R struct rtc_time * R struct rtc_time
* S struct timespec64
* T time64_t * T time64_t
* - 'tSp' For time represented by struct timespec64 printed as <seconds>.<nanoseconds>
* - 'C' For a clock, it prints the name (Common Clock Framework) or address * - 'C' For a clock, it prints the name (Common Clock Framework) or address
* (legacy clock framework) of the clock * (legacy clock framework) of the clock
* - 'G' For flags to be printed as a collection of symbolic strings that would * - 'G' For flags to be printed as a collection of symbolic strings that would

View File

@ -1564,8 +1564,7 @@ static int prepare_keepalive2(struct ceph_connection *con)
struct timespec64 now; struct timespec64 now;
ktime_get_real_ts64(&now); ktime_get_real_ts64(&now);
dout("%s con %p timestamp %lld.%09ld\n", __func__, con, now.tv_sec, dout("%s con %p timestamp %ptSp\n", __func__, con, &now);
now.tv_nsec);
ceph_encode_timespec64(ts, &now); ceph_encode_timespec64(ts, &now);
@ -2759,8 +2758,7 @@ static int process_keepalive2_ack(struct ceph_connection *con,
ceph_decode_need(&p, end, sizeof(struct ceph_timespec), bad); ceph_decode_need(&p, end, sizeof(struct ceph_timespec), bad);
ceph_decode_timespec64(&con->last_keepalive_ack, p); ceph_decode_timespec64(&con->last_keepalive_ack, p);
dout("%s con %p timestamp %lld.%09ld\n", __func__, con, dout("%s con %p timestamp %ptSp\n", __func__, con, &con->last_keepalive_ack);
con->last_keepalive_ack.tv_sec, con->last_keepalive_ack.tv_nsec);
return 0; return 0;