* [PATCHv2 bpf-next 8/8] bpf, x86: Use single ftrace_ops for direct calls
From: Jiri Olsa @ 2025-11-13 12:37 UTC (permalink / raw)
To: Steven Rostedt, Florent Revest, Mark Rutland
Cc: bpf, linux-kernel, linux-trace-kernel, linux-arm-kernel,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Menglong Dong, Song Liu
In-Reply-To: <20251113123750.2507435-1-jolsa@kernel.org>
Using single ftrace_ops for direct calls update instead of allocating
ftrace_ops object for each trampoline.
With single ftrace_ops object we can use update_ftrace_direct_* api
that allows multiple ip sites updates on single ftrace_ops object.
Adding HAVE_SINGLE_FTRACE_DIRECT_OPS config option to be enabled on
each arch that supports this.
At the moment we can enable this only on x86 arch, because arm relies
on ftrace_ops object representing just single trampoline image (stored
in ftrace_ops::direct_call). Ach that do not support this will continue
to use *_ftrace_direct api.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
arch/x86/Kconfig | 1 +
kernel/bpf/trampoline.c | 166 ++++++++++++++++++++++++++++++++++++----
kernel/trace/Kconfig | 3 +
kernel/trace/ftrace.c | 7 +-
4 files changed, 160 insertions(+), 17 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fa3b616af03a..65a2fc279b46 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -332,6 +332,7 @@ config X86
select SCHED_SMT if SMP
select ARCH_SUPPORTS_SCHED_CLUSTER if SMP
select ARCH_SUPPORTS_SCHED_MC if SMP
+ select HAVE_SINGLE_FTRACE_DIRECT_OPS if X86_64 && DYNAMIC_FTRACE_WITH_DIRECT_CALLS
config INSTRUCTION_DECODER
def_bool y
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index 26887a0db955..436d393591a5 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -33,12 +33,40 @@ static DEFINE_MUTEX(trampoline_mutex);
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
static int bpf_trampoline_update(struct bpf_trampoline *tr, bool lock_direct_mutex);
+#ifdef CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS
+static struct bpf_trampoline *direct_ops_ip_lookup(struct ftrace_ops *ops, unsigned long ip)
+{
+ struct hlist_head *head_ip;
+ struct bpf_trampoline *tr;
+
+ mutex_lock(&trampoline_mutex);
+ head_ip = &trampoline_ip_table[hash_64(ip, TRAMPOLINE_HASH_BITS)];
+ hlist_for_each_entry(tr, head_ip, hlist_ip) {
+ if (tr->ip == ip)
+ goto out;
+ }
+ tr = NULL;
+out:
+ mutex_unlock(&trampoline_mutex);
+ return tr;
+}
+#else
+static struct bpf_trampoline *direct_ops_ip_lookup(struct ftrace_ops *ops, unsigned long ip)
+{
+ return ops->private;
+}
+#endif /* CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS */
+
static int bpf_tramp_ftrace_ops_func(struct ftrace_ops *ops, unsigned long ip,
enum ftrace_ops_cmd cmd)
{
- struct bpf_trampoline *tr = ops->private;
+ struct bpf_trampoline *tr;
int ret = 0;
+ tr = direct_ops_ip_lookup(ops, ip);
+ if (!tr)
+ return -EINVAL;
+
if (cmd == FTRACE_OPS_CMD_ENABLE_SHARE_IPMODIFY_SELF) {
/* This is called inside register_ftrace_direct_multi(), so
* tr->mutex is already locked.
@@ -137,6 +165,122 @@ void bpf_image_ksym_del(struct bpf_ksym *ksym)
PAGE_SIZE, true, ksym->name);
}
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
+#ifdef CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS
+/*
+ * We have only single direct_ops which contains all the direct call
+ * sites and is the only global ftrace_ops for all trampolines.
+ *
+ * We use 'update_ftrace_direct_*' api for attachment.
+ */
+struct ftrace_ops direct_ops = {
+ .ops_func = bpf_tramp_ftrace_ops_func,
+};
+
+static int direct_ops_alloc(struct bpf_trampoline *tr)
+{
+ tr->fops = &direct_ops;
+ return 0;
+}
+
+static void direct_ops_free(struct bpf_trampoline *tr) { }
+
+static struct ftrace_hash *hash_from(unsigned long ip, void *addr)
+{
+ struct ftrace_hash *hash;
+
+ ip = ftrace_location(ip);
+ if (!ip)
+ return NULL;
+ hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
+ if (!hash)
+ return NULL;
+ if (!add_hash_entry_direct(hash, ip, (unsigned long) addr)) {
+ free_ftrace_hash(hash);
+ return NULL;
+ }
+ return hash;
+}
+
+static int direct_ops_add(struct ftrace_ops *ops, unsigned long ip, void *addr)
+{
+ struct ftrace_hash *hash = hash_from(ip, addr);
+ int err = -ENOMEM;
+
+ if (hash)
+ err = update_ftrace_direct_add(ops, hash);
+ free_ftrace_hash(hash);
+ return err;
+}
+
+static int direct_ops_del(struct ftrace_ops *ops, unsigned long ip, void *addr)
+{
+ struct ftrace_hash *hash = hash_from(ip, addr);
+ int err = -ENOMEM;
+
+ if (hash)
+ err = update_ftrace_direct_del(ops, hash);
+ free_ftrace_hash(hash);
+ return err;
+}
+
+static int direct_ops_mod(struct ftrace_ops *ops, unsigned long ip, void *addr, bool lock_direct_mutex)
+{
+ struct ftrace_hash *hash = hash_from(ip, addr);
+ int err = -ENOMEM;
+
+ if (hash)
+ err = update_ftrace_direct_mod(ops, hash, lock_direct_mutex);
+ free_ftrace_hash(hash);
+ return err;
+}
+#else
+/*
+ * We allocate ftrace_ops object for each trampoline and it contains
+ * call site specific for that trampoline.
+ *
+ * We use *_ftrace_direct api for attachment.
+ */
+static int direct_ops_alloc(struct bpf_trampoline *tr)
+{
+ tr->fops = kzalloc(sizeof(struct ftrace_ops), GFP_KERNEL);
+ if (!tr->fops)
+ return -ENOMEM;
+ tr->fops->private = tr;
+ tr->fops->ops_func = bpf_tramp_ftrace_ops_func;
+ return 0;
+}
+
+static void direct_ops_free(struct bpf_trampoline *tr)
+{
+ if (tr->fops) {
+ ftrace_free_filter(tr->fops);
+ kfree(tr->fops);
+ }
+}
+
+static int direct_ops_add(struct ftrace_ops *ops, unsigned long ip, void *addr)
+{
+ ftrace_set_filter_ip(ops, (unsigned long)ip, 0, 1);
+ return register_ftrace_direct(ops, (long)addr);
+}
+
+static int direct_ops_del(struct ftrace_ops *ops, unsigned long ip, void *addr)
+{
+ return unregister_ftrace_direct(ops, (long)addr, false);
+}
+
+static int direct_ops_mod(struct ftrace_ops *ops, unsigned long ip, void *addr, bool lock_direct_mutex)
+{
+ if (lock_direct_mutex)
+ return modify_ftrace_direct(ops, (long)addr);
+ return modify_ftrace_direct_nolock(ops, (long)addr);
+}
+#endif /* CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS */
+#else
+static void direct_ops_free(struct bpf_trampoline *tr) { }
+#endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */
+
static struct bpf_trampoline *bpf_trampoline_lookup(u64 key, unsigned long ip)
{
struct bpf_trampoline *tr;
@@ -155,14 +299,11 @@ static struct bpf_trampoline *bpf_trampoline_lookup(u64 key, unsigned long ip)
if (!tr)
goto out;
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
- tr->fops = kzalloc(sizeof(struct ftrace_ops), GFP_KERNEL);
- if (!tr->fops) {
+ if (direct_ops_alloc(tr)) {
kfree(tr);
tr = NULL;
goto out;
}
- tr->fops->private = tr;
- tr->fops->ops_func = bpf_tramp_ftrace_ops_func;
#endif
tr->key = key;
@@ -187,7 +328,7 @@ static int unregister_fentry(struct bpf_trampoline *tr, void *old_addr)
int ret;
if (tr->func.ftrace_managed)
- ret = unregister_ftrace_direct(tr->fops, (long)old_addr, false);
+ ret = direct_ops_del(tr->fops, tr->ip, old_addr);
else
ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, old_addr, NULL);
@@ -201,10 +342,7 @@ static int modify_fentry(struct bpf_trampoline *tr, void *old_addr, void *new_ad
int ret;
if (tr->func.ftrace_managed) {
- if (lock_direct_mutex)
- ret = modify_ftrace_direct(tr->fops, (long)new_addr);
- else
- ret = modify_ftrace_direct_nolock(tr->fops, (long)new_addr);
+ ret = direct_ops_mod(tr->fops, tr->ip, new_addr, lock_direct_mutex);
} else {
ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, old_addr, new_addr);
}
@@ -226,8 +364,7 @@ static int register_fentry(struct bpf_trampoline *tr, void *new_addr)
}
if (tr->func.ftrace_managed) {
- ftrace_set_filter_ip(tr->fops, (unsigned long)ip, 0, 1);
- ret = register_ftrace_direct(tr->fops, (long)new_addr);
+ ret = direct_ops_add(tr->fops, tr->ip, new_addr);
} else {
ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, NULL, new_addr);
}
@@ -863,10 +1000,7 @@ void bpf_trampoline_put(struct bpf_trampoline *tr)
*/
hlist_del(&tr->hlist_key);
hlist_del(&tr->hlist_ip);
- if (tr->fops) {
- ftrace_free_filter(tr->fops);
- kfree(tr->fops);
- }
+ direct_ops_free(tr);
kfree(tr);
out:
mutex_unlock(&trampoline_mutex);
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index d2c79da81e4f..4bf5beb04a5b 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -50,6 +50,9 @@ config HAVE_DYNAMIC_FTRACE_WITH_REGS
config HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
bool
+config HAVE_SINGLE_FTRACE_DIRECT_OPS
+ bool
+
config HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS
bool
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 03948ec81434..e223fc196567 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2605,8 +2605,13 @@ unsigned long ftrace_find_rec_direct(unsigned long ip)
static void call_direct_funcs(unsigned long ip, unsigned long pip,
struct ftrace_ops *ops, struct ftrace_regs *fregs)
{
- unsigned long addr = READ_ONCE(ops->direct_call);
+ unsigned long addr;
+#ifdef CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS
+ addr = ftrace_find_rec_direct(ip);
+#else
+ addr = READ_ONCE(ops->direct_call);
+#endif
if (!addr)
return;
--
2.51.1
^ permalink raw reply related
* Re: [PATCH 0/5] rtla, osnoise: Fixes to address intermittent test issues
From: Wander Lairson Costa @ 2025-11-13 12:44 UTC (permalink / raw)
To: Crystal Wood
Cc: Steven Rostedt, linux-trace-kernel, John Kacur, Tomas Glozar,
Costa Shulyupin
In-Reply-To: <20251112152529.956778-1-crwood@redhat.com>
On Wed, Nov 12, 2025 at 09:25:24AM -0600, Crystal Wood wrote:
> With these fixes, I'm able to run the tests in a loop overnight with no
> failures.
>
> Crystal Wood (5):
> rtla/tests: Don't rely on matching ^1ALL
> tracing/osnoise: Dump stack on timerlat uret threshold event
> tracing/osnoise: Array printk init and cleanup
> rtla/timerlat: Exit top main loop on any non-zero wait_retval
> rtla: Set stop threshold after all instances are enabled
>
> kernel/trace/trace_osnoise.c | 46 +++++++++++++++++----------
> tools/tracing/rtla/src/common.c | 20 ++++++++++++
> tools/tracing/rtla/src/common.h | 4 +++
> tools/tracing/rtla/src/osnoise.c | 17 +++-------
> tools/tracing/rtla/src/osnoise.h | 5 ---
> tools/tracing/rtla/src/timerlat.c | 29 ++++++-----------
> tools/tracing/rtla/src/timerlat_top.c | 2 +-
> tools/tracing/rtla/tests/timerlat.t | 2 +-
> 8 files changed, 69 insertions(+), 56 deletions(-)
>
> --
> 2.48.1
>
On patch 3 the commit message says that osnoise_print() is implemented
as a macro, but it is actually implemented as a function. But that isn't
a blocker.
Reviewed-by: Wander Lairson Costa <wander@redhat.com>
^ permalink raw reply
* Re: [PATCHv2 bpf-next 5/8] ftrace: Add update_ftrace_direct_mod function
From: bot+bpf-ci @ 2025-11-13 13:02 UTC (permalink / raw)
To: jolsa, rostedt, revest, mark.rutland
Cc: bpf, linux-kernel, linux-trace-kernel, linux-arm-kernel, ast,
daniel, andrii, menglong8.dong, song, ast, andrii, daniel,
martin.lau, eddyz87, yonghong.song, clm, ihor.solodrai
In-Reply-To: <20251113123750.2507435-6-jolsa@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 3918 bytes --]
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index 433c36c3a..bacb6d9ab 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -544,6 +544,7 @@ int modify_ftrace_direct_nolock(struct ftrace_ops *ops, unsigned long addr);
>
> int update_ftrace_direct_add(struct ftrace_ops *ops, struct ftrace_hash *hash);
> int update_ftrace_direct_del(struct ftrace_ops *ops, struct ftrace_hash *hash);
> +int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, bool do_direct_lock);
>
> void ftrace_stub_direct_tramp(void);
>
> @@ -581,6 +582,11 @@ int update_ftrace_direct_del(struct ftrace_ops *ops, struct ftrace_hash *hash)
> return -ENODEV;
> }
>
> +int modify_ftrace_direct_hash(struct ftrace_ops *ops, struct ftrace_hash *hash, bool do_direct_lock)
^^^^^^^^^^^^^^^^^^^^^^^^^^
The stub function name doesn't match the declaration. Should this be
update_ftrace_direct_mod() instead of modify_ftrace_direct_hash()?
> +{
> + return -ENODEV;
> +}
> +
[ ... ]
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 345f3fdd2..627d05b57 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6445,6 +6445,74 @@ int update_ftrace_direct_del(struct ftrace_ops *ops, struct ftrace_hash *hash)
> return err;
> }
>
> +int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, bool do_direct_lock)
> +{
> + struct ftrace_hash *orig_hash = ops->func_hash->filter_hash;
> + struct ftrace_func_entry *entry, *tmp;
> + static struct ftrace_ops tmp_ops = {
> + .func = ftrace_stub,
> + .flags = FTRACE_OPS_FL_STUB,
> + };
> + unsigned long size, i;
> + int err;
> +
> + if (!hash_count(hash))
> + return 0;
> + if (check_direct_multi(ops))
> + return -EINVAL;
> + if (!(ops->flags & FTRACE_OPS_FL_ENABLED))
> + return -EINVAL;
> + if (direct_functions == EMPTY_HASH)
> + return -EINVAL;
> +
> + if (do_direct_lock)
> + mutex_lock(&direct_mutex);
> +
> + /* Enable the tmp_ops to have the same functions as the direct ops */
> + ftrace_ops_init(&tmp_ops);
> + tmp_ops.func_hash = ops->func_hash;
> +
> + err = register_ftrace_function_nolock(&tmp_ops);
> + if (err)
> + goto unlock;
> +
> + /*
> + * Call __ftrace_hash_update_ipmodify() here, so that we can call
> + * ops->ops_func for the ops. This is needed because the above
> + * register_ftrace_function_nolock() worked on tmp_ops.
> + */
> + err = __ftrace_hash_update_ipmodify(ops, orig_hash, orig_hash, true);
^^^^
Does __ftrace_hash_update_ipmodify() accept a fourth argument? The
function signature shows it only takes three parameters (ops, old_hash,
new_hash). This looks like a compilation error.
> + if (err)
> + goto out;
[ ... ]
> +
> +out:
> + /* Removing the tmp_ops will add the updated direct callers to the functions */
> + unregister_ftrace_function(&tmp_ops);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Can this deadlock when do_direct_lock is true? Looking at the code:
update_ftrace_direct_mod() with do_direct_lock=true
-> mutex_lock(&direct_mutex)
-> register_ftrace_function_nolock(&tmp_ops) succeeds
-> __ftrace_hash_update_ipmodify() fails
-> goto out (still holding direct_mutex)
-> unregister_ftrace_function(&tmp_ops)
-> cleanup_direct_functions_after_ipmodify()
-> mutex_lock(&direct_mutex) /* deadlock */
The unregister path tries to reacquire direct_mutex that we're already
holding.
> +
> +unlock:
> + if (do_direct_lock)
> + mutex_unlock(&direct_mutex);
> + return err;
> +}
> +
> #endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/19332026793
^ permalink raw reply
* Re: [PATCHv2 bpf-next 3/8] ftrace: Add update_ftrace_direct_add function
From: bot+bpf-ci @ 2025-11-13 13:02 UTC (permalink / raw)
To: jolsa, rostedt, revest, mark.rutland
Cc: bpf, linux-kernel, linux-trace-kernel, linux-arm-kernel, ast,
daniel, andrii, menglong8.dong, song, ast, andrii, daniel,
martin.lau, eddyz87, yonghong.song, clm, ihor.solodrai
In-Reply-To: <20251113123750.2507435-4-jolsa@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index e23e6a859..ded3a306a 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
[ ... ]
> @@ -568,6 +570,11 @@ static inline int modify_ftrace_direct_nolock(struct ftrace_ops *ops, unsigned l
> return -ENODEV;
> }
>
> +int update_ftrace_direct_add(struct ftrace_ops *ops, struct ftrace_hash *hash)
> +{
> + return -ENODEV;
> +}
> +
> /*
> * This must be implemented by the architecture.
> * It is the way the ftrace direct_ops helper, when called
Should this stub function have static inline qualifiers? All the other
stub functions in this section (ftrace_find_rec_direct,
register_ftrace_direct, unregister_ftrace_direct, modify_ftrace_direct,
and modify_ftrace_direct_nolock) use static inline. Without it, this
could cause multiple definition linker errors when the header is
included in multiple compilation units.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/19332026793
^ permalink raw reply
* Re: [PATCHv2 bpf-next 4/8] ftrace: Add update_ftrace_direct_del function
From: bot+bpf-ci @ 2025-11-13 13:02 UTC (permalink / raw)
To: jolsa, rostedt, revest, mark.rutland
Cc: bpf, linux-kernel, linux-trace-kernel, linux-arm-kernel, ast,
daniel, andrii, menglong8.dong, song, ast, andrii, daniel,
martin.lau, eddyz87, yonghong.song, clm, ihor.solodrai
In-Reply-To: <20251113123750.2507435-5-jolsa@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 3213 bytes --]
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index ded3a306a..433c36c3a 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -543,6 +543,7 @@ int modify_ftrace_direct(struct ftrace_ops *ops, unsigned long addr);
> int modify_ftrace_direct_nolock(struct ftrace_ops *ops, unsigned long addr);
>
> int update_ftrace_direct_add(struct ftrace_ops *ops, struct ftrace_hash *hash);
> +int update_ftrace_direct_del(struct ftrace_ops *ops, struct ftrace_hash *hash);
>
> void ftrace_stub_direct_tramp(void);
[ ... ]
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 311ce6406..345f3fdd2 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
[ ... ]
> +int update_ftrace_direct_del(struct ftrace_ops *ops, struct ftrace_hash *hash)
> +{
> + struct ftrace_hash *new_hash = NULL, *filter_hash = NULL, *free_hash = NULL;
> + struct ftrace_func_entry *del, *entry;
> + unsigned long size, i;
> + int err = -EINVAL;
> +
> + if (!hash_count(hash))
> + return 0;
> + if (check_direct_multi(ops))
> + return -EINVAL;
> + if (!(ops->flags & FTRACE_OPS_FL_ENABLED))
> + return -EINVAL;
> + if (direct_functions == EMPTY_HASH)
> + return -EINVAL;
> +
> + mutex_lock(&direct_mutex);
> +
> + /* Make sure requested entries are already registered. */
> + size = 1 << hash->size_bits;
> + for (i = 0; i < size; i++) {
> + hlist_for_each_entry(entry, &hash->buckets[i], hlist) {
> + del = __ftrace_lookup_ip(direct_functions, entry->ip);
> + if (!del || del->direct != entry->direct)
> + goto out_unlock;
> + }
> + }
> +
> + err = -ENOMEM;
> + filter_hash = hash_sub(ops->func_hash->filter_hash, hash);
> + if (!filter_hash)
> + goto out_unlock;
> +
> + new_hash = hash_sub(direct_functions, hash);
> + if (!new_hash)
> + goto out_unlock;
Can this leak new_hash? If hash_sub() succeeds for both filter_hash
and new_hash, but then either unregister_ftrace_function() or
ftrace_update_ops() fails below, we goto out_unlock without freeing
new_hash. The cleanup code only frees filter_hash:
> +
> + /* If there's nothing left, we need to unregister the ops. */
> + if (ftrace_hash_empty(filter_hash)) {
> + err = unregister_ftrace_function(ops);
> + /* cleanup for possible another register call */
> + ops->func = NULL;
> + ops->trampoline = 0;
> + ftrace_free_filter(ops);
> + ops->func_hash->filter_hash = NULL;
> + } else {
> + err = ftrace_update_ops(ops, filter_hash, EMPTY_HASH);
> + }
> +
> + if (!err) {
> + free_hash = direct_functions;
> + rcu_assign_pointer(direct_functions, new_hash);
> + }
> +
> + out_unlock:
> + mutex_unlock(&direct_mutex);
> +
> + if (free_hash && free_hash != EMPTY_HASH)
> + call_rcu_tasks(&free_hash->rcu, register_ftrace_direct_cb);
> + if (filter_hash)
> + free_ftrace_hash(filter_hash);
> +
> + return err;
> +}
If err != 0, new_hash remains allocated but is never freed. Should the
cleanup code add free_ftrace_hash(new_hash) when it's non-NULL?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/19332026793
^ permalink raw reply
* Re: [PATCH v3] trace/pid_list: optimize pid_list->lock contention
From: Sebastian Andrzej Siewior @ 2025-11-13 14:15 UTC (permalink / raw)
To: Yongliang Gao
Cc: rostedt, mhiramat, mathieu.desnoyers, linux-kernel,
linux-trace-kernel, frankjpliu, Yongliang Gao, Huang Cun
In-Reply-To: <CAJxhyqCyB3-CyDKgPtP-EoC=G9cWAYgLvse003+i2n6U4Pgv1w@mail.gmail.com>
On 2025-11-13 19:13:23 [+0800], Yongliang Gao wrote:
> Hi Sebastian,
Hi Yongliang,
> Thank you for your review and the thoughtful questions.
>
> 1. Performance Data
> We encountered this issue in a production environment with 288 cores
> where enabling set_ftrace_pid caused system CPU usage (sys%) to
> increase from 10% to over 90%. In our 92-core VM test environment:
>
> Before patch (spinlock):
> - Without filtering: cs=2395401/s, sys%=7%
> - With filtering: cs=1828261/s, sys%=40%
>
> After patch (seqlock):
> - Without filtering: cs=2397032/s, sys%=6%
> - With filtering: cs=2398922/s, sys%=6%
>
> The seqlock approach eliminates the pid_list->lock contention that was
> previously causing sys% to increase from 7% to 40%.
>
> 2. Reader Retry Behavior
> Yes, if the write side is continuously busy, the reader might spin and
> retry. However, in practice:
> - Writes are infrequent (only when setting ftrace_pid filter or during
> task fork/exit with function-fork enabled)
> - For readers, trace_pid_list_is_set() is called on every task switch,
> which can occur at a very high frequency.
See.
> 3. Result Accuracy
> You're correct that the result might change immediately after the
> read. For trace_ignore_this_task(), we don't require absolute
> accuracy. Slight race conditions (where a task might be traced or not
> in borderline cases) are acceptable.
I don't see why RCU work shouldn't work here.
If a pid is removed then it might result that a chunk cleared/ removed
then upper_chunk/ lower_chunk can become NULL. The buffer itself can be
reused and point to something else. It could lear to a false outcome in
test_bit(). This is handled by read_seqcount_retry().
You could assign upper1, upper2, to NULL/ buffer as now and the removal
(in put_lower_chunk(), put_upper_chunk()) delay to RCU so it happens
after the grace period. That would allow you to iterate over it in
trace_pid_list_is_set() lockless since the buffer will not disappear and
will not be reused for another task until after all reader left.
Additionally it would guarantee that the buffer is not released in
trace_pid_list_free(). I don't see how the seqcount ensures that the
buffer is not gone. I mean you could have a reader and the retry would
force you to do another loop but before that happens you dereference the
upper_chunk pointer which could be reused.
So I *think* the RCU approach should be doable and cover this.
> Best regards,
> Yongliang
Sebastian
^ permalink raw reply
* Re: [PATCH 1/2] mm/khugepaged: do synchronous writeback for MADV_COLLAPSE
From: kernel test robot @ 2025-11-13 14:21 UTC (permalink / raw)
To: Shivank Garg, Andrew Morton, David Hildenbrand, Lorenzo Stoakes
Cc: llvm, oe-kbuild-all, Linux Memory Management List, Zi Yan,
Baolin Wang, Liam R . Howlett, Nico Pache, Ryan Roberts, Dev Jain,
Barry Song, Lance Yang, Steven Rostedt, Masami Hiramatsu,
Mathieu Desnoyers, Zach O'Keefe, linux-kernel,
linux-trace-kernel, shivankg, Branden Moore
In-Reply-To: <20251110113254.77822-1-shivankg@amd.com>
Hi Shivank,
kernel test robot noticed the following build warnings:
[auto build test WARNING on e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c]
url: https://github.com/intel-lab-lkp/linux/commits/Shivank-Garg/mm-khugepaged-return-EAGAIN-for-transient-dirty-pages-in-MADV_COLLAPSE/20251110-193519
base: e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c
patch link: https://lore.kernel.org/r/20251110113254.77822-1-shivankg%40amd.com
patch subject: [PATCH 1/2] mm/khugepaged: do synchronous writeback for MADV_COLLAPSE
config: arm64-randconfig-002-20251113 (https://download.01.org/0day-ci/archive/20251113/202511132138.jhG6hoZ4-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 0bba1e76581bad04e7d7f09f5115ae5e2989e0d9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251113/202511132138.jhG6hoZ4-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511132138.jhG6hoZ4-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> mm/khugepaged.c:1867:7: warning: variable 'new_folio' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
1867 | if (filemap_write_and_wait_range(mapping, range_start, range_end)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/khugepaged.c:2284:40: note: uninitialized use occurs here
2284 | trace_mm_khugepaged_collapse_file(mm, new_folio, index, addr, is_shmem, file, HPAGE_PMD_NR, result);
| ^~~~~~~~~
mm/khugepaged.c:1867:3: note: remove the 'if' if its condition is always false
1867 | if (filemap_write_and_wait_range(mapping, range_start, range_end)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1868 | result = SCAN_FAIL;
| ~~~~~~~~~~~~~~~~~~~
1869 | goto out;
| ~~~~~~~~~
1870 | }
| ~
mm/khugepaged.c:1847:39: note: initialize the variable 'new_folio' to silence this warning
1847 | struct folio *folio, *tmp, *new_folio;
| ^
| = NULL
1 warning generated.
vim +1867 mm/khugepaged.c
1815
1816 /**
1817 * collapse_file - collapse filemap/tmpfs/shmem pages into huge one.
1818 *
1819 * @mm: process address space where collapse happens
1820 * @addr: virtual collapse start address
1821 * @file: file that collapse on
1822 * @start: collapse start address
1823 * @cc: collapse context and scratchpad
1824 *
1825 * Basic scheme is simple, details are more complex:
1826 * - allocate and lock a new huge page;
1827 * - scan page cache, locking old pages
1828 * + swap/gup in pages if necessary;
1829 * - copy data to new page
1830 * - handle shmem holes
1831 * + re-validate that holes weren't filled by someone else
1832 * + check for userfaultfd
1833 * - finalize updates to the page cache;
1834 * - if replacing succeeds:
1835 * + unlock huge page;
1836 * + free old pages;
1837 * - if replacing failed;
1838 * + unlock old pages
1839 * + unlock and free huge page;
1840 */
1841 static int collapse_file(struct mm_struct *mm, unsigned long addr,
1842 struct file *file, pgoff_t start,
1843 struct collapse_control *cc)
1844 {
1845 struct address_space *mapping = file->f_mapping;
1846 struct page *dst;
1847 struct folio *folio, *tmp, *new_folio;
1848 pgoff_t index = 0, end = start + HPAGE_PMD_NR;
1849 loff_t range_start, range_end;
1850 LIST_HEAD(pagelist);
1851 XA_STATE_ORDER(xas, &mapping->i_pages, start, HPAGE_PMD_ORDER);
1852 int nr_none = 0, result = SCAN_SUCCEED;
1853 bool is_shmem = shmem_file(file);
1854
1855 VM_BUG_ON(!IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS) && !is_shmem);
1856 VM_BUG_ON(start & (HPAGE_PMD_NR - 1));
1857
1858 /*
1859 * For MADV_COLLAPSE on regular files, do a synchronous writeback
1860 * to ensure dirty folios are flushed before we attempt collapse.
1861 * This is a best-effort approach to avoid failing on the first
1862 * attempt when freshly-written executable text is still dirty.
1863 */
1864 if (!is_shmem && cc && !cc->is_khugepaged && mapping_can_writeback(mapping)) {
1865 range_start = (loff_t)start << PAGE_SHIFT;
1866 range_end = ((loff_t)end << PAGE_SHIFT) - 1;
> 1867 if (filemap_write_and_wait_range(mapping, range_start, range_end)) {
1868 result = SCAN_FAIL;
1869 goto out;
1870 }
1871 }
1872
1873 result = alloc_charge_folio(&new_folio, mm, cc);
1874 if (result != SCAN_SUCCEED)
1875 goto out;
1876
1877 mapping_set_update(&xas, mapping);
1878
1879 __folio_set_locked(new_folio);
1880 if (is_shmem)
1881 __folio_set_swapbacked(new_folio);
1882 new_folio->index = start;
1883 new_folio->mapping = mapping;
1884
1885 /*
1886 * Ensure we have slots for all the pages in the range. This is
1887 * almost certainly a no-op because most of the pages must be present
1888 */
1889 do {
1890 xas_lock_irq(&xas);
1891 xas_create_range(&xas);
1892 if (!xas_error(&xas))
1893 break;
1894 xas_unlock_irq(&xas);
1895 if (!xas_nomem(&xas, GFP_KERNEL)) {
1896 result = SCAN_FAIL;
1897 goto rollback;
1898 }
1899 } while (1);
1900
1901 for (index = start; index < end;) {
1902 xas_set(&xas, index);
1903 folio = xas_load(&xas);
1904
1905 VM_BUG_ON(index != xas.xa_index);
1906 if (is_shmem) {
1907 if (!folio) {
1908 /*
1909 * Stop if extent has been truncated or
1910 * hole-punched, and is now completely
1911 * empty.
1912 */
1913 if (index == start) {
1914 if (!xas_next_entry(&xas, end - 1)) {
1915 result = SCAN_TRUNCATED;
1916 goto xa_locked;
1917 }
1918 }
1919 nr_none++;
1920 index++;
1921 continue;
1922 }
1923
1924 if (xa_is_value(folio) || !folio_test_uptodate(folio)) {
1925 xas_unlock_irq(&xas);
1926 /* swap in or instantiate fallocated page */
1927 if (shmem_get_folio(mapping->host, index, 0,
1928 &folio, SGP_NOALLOC)) {
1929 result = SCAN_FAIL;
1930 goto xa_unlocked;
1931 }
1932 /* drain lru cache to help folio_isolate_lru() */
1933 lru_add_drain();
1934 } else if (folio_trylock(folio)) {
1935 folio_get(folio);
1936 xas_unlock_irq(&xas);
1937 } else {
1938 result = SCAN_PAGE_LOCK;
1939 goto xa_locked;
1940 }
1941 } else { /* !is_shmem */
1942 if (!folio || xa_is_value(folio)) {
1943 xas_unlock_irq(&xas);
1944 page_cache_sync_readahead(mapping, &file->f_ra,
1945 file, index,
1946 end - index);
1947 /* drain lru cache to help folio_isolate_lru() */
1948 lru_add_drain();
1949 folio = filemap_lock_folio(mapping, index);
1950 if (IS_ERR(folio)) {
1951 result = SCAN_FAIL;
1952 goto xa_unlocked;
1953 }
1954 } else if (folio_test_dirty(folio)) {
1955 /*
1956 * khugepaged only works on read-only fd,
1957 * so this page is dirty because it hasn't
1958 * been flushed since first write. There
1959 * won't be new dirty pages.
1960 *
1961 * Trigger async flush here and hope the
1962 * writeback is done when khugepaged
1963 * revisits this page.
1964 *
1965 * This is a one-off situation. We are not
1966 * forcing writeback in loop.
1967 */
1968 xas_unlock_irq(&xas);
1969 filemap_flush(mapping);
1970 result = SCAN_FAIL;
1971 goto xa_unlocked;
1972 } else if (folio_test_writeback(folio)) {
1973 xas_unlock_irq(&xas);
1974 result = SCAN_FAIL;
1975 goto xa_unlocked;
1976 } else if (folio_trylock(folio)) {
1977 folio_get(folio);
1978 xas_unlock_irq(&xas);
1979 } else {
1980 result = SCAN_PAGE_LOCK;
1981 goto xa_locked;
1982 }
1983 }
1984
1985 /*
1986 * The folio must be locked, so we can drop the i_pages lock
1987 * without racing with truncate.
1988 */
1989 VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
1990
1991 /* make sure the folio is up to date */
1992 if (unlikely(!folio_test_uptodate(folio))) {
1993 result = SCAN_FAIL;
1994 goto out_unlock;
1995 }
1996
1997 /*
1998 * If file was truncated then extended, or hole-punched, before
1999 * we locked the first folio, then a THP might be there already.
2000 * This will be discovered on the first iteration.
2001 */
2002 if (folio_order(folio) == HPAGE_PMD_ORDER &&
2003 folio->index == start) {
2004 /* Maybe PMD-mapped */
2005 result = SCAN_PTE_MAPPED_HUGEPAGE;
2006 goto out_unlock;
2007 }
2008
2009 if (folio_mapping(folio) != mapping) {
2010 result = SCAN_TRUNCATED;
2011 goto out_unlock;
2012 }
2013
2014 if (!is_shmem && (folio_test_dirty(folio) ||
2015 folio_test_writeback(folio))) {
2016 /*
2017 * khugepaged only works on read-only fd, so this
2018 * folio is dirty because it hasn't been flushed
2019 * since first write.
2020 */
2021 result = SCAN_FAIL;
2022 goto out_unlock;
2023 }
2024
2025 if (!folio_isolate_lru(folio)) {
2026 result = SCAN_DEL_PAGE_LRU;
2027 goto out_unlock;
2028 }
2029
2030 if (!filemap_release_folio(folio, GFP_KERNEL)) {
2031 result = SCAN_PAGE_HAS_PRIVATE;
2032 folio_putback_lru(folio);
2033 goto out_unlock;
2034 }
2035
2036 if (folio_mapped(folio))
2037 try_to_unmap(folio,
2038 TTU_IGNORE_MLOCK | TTU_BATCH_FLUSH);
2039
2040 xas_lock_irq(&xas);
2041
2042 VM_BUG_ON_FOLIO(folio != xa_load(xas.xa, index), folio);
2043
2044 /*
2045 * We control 2 + nr_pages references to the folio:
2046 * - we hold a pin on it;
2047 * - nr_pages reference from page cache;
2048 * - one from lru_isolate_folio;
2049 * If those are the only references, then any new usage
2050 * of the folio will have to fetch it from the page
2051 * cache. That requires locking the folio to handle
2052 * truncate, so any new usage will be blocked until we
2053 * unlock folio after collapse/during rollback.
2054 */
2055 if (folio_ref_count(folio) != 2 + folio_nr_pages(folio)) {
2056 result = SCAN_PAGE_COUNT;
2057 xas_unlock_irq(&xas);
2058 folio_putback_lru(folio);
2059 goto out_unlock;
2060 }
2061
2062 /*
2063 * Accumulate the folios that are being collapsed.
2064 */
2065 list_add_tail(&folio->lru, &pagelist);
2066 index += folio_nr_pages(folio);
2067 continue;
2068 out_unlock:
2069 folio_unlock(folio);
2070 folio_put(folio);
2071 goto xa_unlocked;
2072 }
2073
2074 if (!is_shmem) {
2075 filemap_nr_thps_inc(mapping);
2076 /*
2077 * Paired with the fence in do_dentry_open() -> get_write_access()
2078 * to ensure i_writecount is up to date and the update to nr_thps
2079 * is visible. Ensures the page cache will be truncated if the
2080 * file is opened writable.
2081 */
2082 smp_mb();
2083 if (inode_is_open_for_write(mapping->host)) {
2084 result = SCAN_FAIL;
2085 filemap_nr_thps_dec(mapping);
2086 }
2087 }
2088
2089 xa_locked:
2090 xas_unlock_irq(&xas);
2091 xa_unlocked:
2092
2093 /*
2094 * If collapse is successful, flush must be done now before copying.
2095 * If collapse is unsuccessful, does flush actually need to be done?
2096 * Do it anyway, to clear the state.
2097 */
2098 try_to_unmap_flush();
2099
2100 if (result == SCAN_SUCCEED && nr_none &&
2101 !shmem_charge(mapping->host, nr_none))
2102 result = SCAN_FAIL;
2103 if (result != SCAN_SUCCEED) {
2104 nr_none = 0;
2105 goto rollback;
2106 }
2107
2108 /*
2109 * The old folios are locked, so they won't change anymore.
2110 */
2111 index = start;
2112 dst = folio_page(new_folio, 0);
2113 list_for_each_entry(folio, &pagelist, lru) {
2114 int i, nr_pages = folio_nr_pages(folio);
2115
2116 while (index < folio->index) {
2117 clear_highpage(dst);
2118 index++;
2119 dst++;
2120 }
2121
2122 for (i = 0; i < nr_pages; i++) {
2123 if (copy_mc_highpage(dst, folio_page(folio, i)) > 0) {
2124 result = SCAN_COPY_MC;
2125 goto rollback;
2126 }
2127 index++;
2128 dst++;
2129 }
2130 }
2131 while (index < end) {
2132 clear_highpage(dst);
2133 index++;
2134 dst++;
2135 }
2136
2137 if (nr_none) {
2138 struct vm_area_struct *vma;
2139 int nr_none_check = 0;
2140
2141 i_mmap_lock_read(mapping);
2142 xas_lock_irq(&xas);
2143
2144 xas_set(&xas, start);
2145 for (index = start; index < end; index++) {
2146 if (!xas_next(&xas)) {
2147 xas_store(&xas, XA_RETRY_ENTRY);
2148 if (xas_error(&xas)) {
2149 result = SCAN_STORE_FAILED;
2150 goto immap_locked;
2151 }
2152 nr_none_check++;
2153 }
2154 }
2155
2156 if (nr_none != nr_none_check) {
2157 result = SCAN_PAGE_FILLED;
2158 goto immap_locked;
2159 }
2160
2161 /*
2162 * If userspace observed a missing page in a VMA with
2163 * a MODE_MISSING userfaultfd, then it might expect a
2164 * UFFD_EVENT_PAGEFAULT for that page. If so, we need to
2165 * roll back to avoid suppressing such an event. Since
2166 * wp/minor userfaultfds don't give userspace any
2167 * guarantees that the kernel doesn't fill a missing
2168 * page with a zero page, so they don't matter here.
2169 *
2170 * Any userfaultfds registered after this point will
2171 * not be able to observe any missing pages due to the
2172 * previously inserted retry entries.
2173 */
2174 vma_interval_tree_foreach(vma, &mapping->i_mmap, start, end) {
2175 if (userfaultfd_missing(vma)) {
2176 result = SCAN_EXCEED_NONE_PTE;
2177 goto immap_locked;
2178 }
2179 }
2180
2181 immap_locked:
2182 i_mmap_unlock_read(mapping);
2183 if (result != SCAN_SUCCEED) {
2184 xas_set(&xas, start);
2185 for (index = start; index < end; index++) {
2186 if (xas_next(&xas) == XA_RETRY_ENTRY)
2187 xas_store(&xas, NULL);
2188 }
2189
2190 xas_unlock_irq(&xas);
2191 goto rollback;
2192 }
2193 } else {
2194 xas_lock_irq(&xas);
2195 }
2196
2197 if (is_shmem)
2198 __lruvec_stat_mod_folio(new_folio, NR_SHMEM_THPS, HPAGE_PMD_NR);
2199 else
2200 __lruvec_stat_mod_folio(new_folio, NR_FILE_THPS, HPAGE_PMD_NR);
2201
2202 if (nr_none) {
2203 __lruvec_stat_mod_folio(new_folio, NR_FILE_PAGES, nr_none);
2204 /* nr_none is always 0 for non-shmem. */
2205 __lruvec_stat_mod_folio(new_folio, NR_SHMEM, nr_none);
2206 }
2207
2208 /*
2209 * Mark new_folio as uptodate before inserting it into the
2210 * page cache so that it isn't mistaken for an fallocated but
2211 * unwritten page.
2212 */
2213 folio_mark_uptodate(new_folio);
2214 folio_ref_add(new_folio, HPAGE_PMD_NR - 1);
2215
2216 if (is_shmem)
2217 folio_mark_dirty(new_folio);
2218 folio_add_lru(new_folio);
2219
2220 /* Join all the small entries into a single multi-index entry. */
2221 xas_set_order(&xas, start, HPAGE_PMD_ORDER);
2222 xas_store(&xas, new_folio);
2223 WARN_ON_ONCE(xas_error(&xas));
2224 xas_unlock_irq(&xas);
2225
2226 /*
2227 * Remove pte page tables, so we can re-fault the page as huge.
2228 * If MADV_COLLAPSE, adjust result to call collapse_pte_mapped_thp().
2229 */
2230 retract_page_tables(mapping, start);
2231 if (cc && !cc->is_khugepaged)
2232 result = SCAN_PTE_MAPPED_HUGEPAGE;
2233 folio_unlock(new_folio);
2234
2235 /*
2236 * The collapse has succeeded, so free the old folios.
2237 */
2238 list_for_each_entry_safe(folio, tmp, &pagelist, lru) {
2239 list_del(&folio->lru);
2240 folio->mapping = NULL;
2241 folio_clear_active(folio);
2242 folio_clear_unevictable(folio);
2243 folio_unlock(folio);
2244 folio_put_refs(folio, 2 + folio_nr_pages(folio));
2245 }
2246
2247 goto out;
2248
2249 rollback:
2250 /* Something went wrong: roll back page cache changes */
2251 if (nr_none) {
2252 xas_lock_irq(&xas);
2253 mapping->nrpages -= nr_none;
2254 xas_unlock_irq(&xas);
2255 shmem_uncharge(mapping->host, nr_none);
2256 }
2257
2258 list_for_each_entry_safe(folio, tmp, &pagelist, lru) {
2259 list_del(&folio->lru);
2260 folio_unlock(folio);
2261 folio_putback_lru(folio);
2262 folio_put(folio);
2263 }
2264 /*
2265 * Undo the updates of filemap_nr_thps_inc for non-SHMEM
2266 * file only. This undo is not needed unless failure is
2267 * due to SCAN_COPY_MC.
2268 */
2269 if (!is_shmem && result == SCAN_COPY_MC) {
2270 filemap_nr_thps_dec(mapping);
2271 /*
2272 * Paired with the fence in do_dentry_open() -> get_write_access()
2273 * to ensure the update to nr_thps is visible.
2274 */
2275 smp_mb();
2276 }
2277
2278 new_folio->mapping = NULL;
2279
2280 folio_unlock(new_folio);
2281 folio_put(new_folio);
2282 out:
2283 VM_BUG_ON(!list_empty(&pagelist));
2284 trace_mm_khugepaged_collapse_file(mm, new_folio, index, addr, is_shmem, file, HPAGE_PMD_NR, result);
2285 return result;
2286 }
2287
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* [PATCH v3 01/21] lib/vsprintf: Add specifier for printing struct timespec64
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
A handful drivers want to print a content of the struct timespec64
in a format of %lld:%09ld. In order to make their lives easier, add
the respecting specifier directly to the printf() implementation.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
Documentation/core-api/printk-formats.rst | 11 +++++++--
lib/tests/printf_kunit.c | 4 ++++
lib/vsprintf.c | 28 ++++++++++++++++++++++-
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index 7f2f11b48286..c0b1b6089307 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -547,11 +547,13 @@ Time and date
%pt[RT]s YYYY-mm-dd HH:MM:SS
%pt[RT]d YYYY-mm-dd
%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::
- R struct rtc_time structure
+ R content of struct rtc_time
+ S content of struct timespec64
T time64_t type
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
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.
struct clk
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index bc54cca2d7a6..7617e5b8b02c 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -504,6 +504,7 @@ time_and_date(struct kunit *kunittest)
};
/* 2019-01-04T15:32:23 */
time64_t t = 1546615943;
+ struct timespec64 ts = { .tv_sec = t, .tv_nsec = 11235813 };
test("(%pt?)", "%pt", &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("15:32:23|2019-01-04", "%ptTts|%ptTds", &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
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 11dbf1023391..51a88b3f5b52 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1983,6 +1983,28 @@ char *time64_str(char *buf, char *end, const time64_t time,
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
char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
const char *fmt)
@@ -1993,6 +2015,8 @@ char *time_and_date(char *buf, char *end, void *ptr, struct printf_spec spec,
switch (fmt[1]) {
case 'R':
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':
return time64_str(buf, end, *(const time64_t *)ptr, spec, fmt);
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]' Same as 'd' but for a struct file
* - '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
+ * S struct timespec64
* 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
* (legacy clock framework) of the clock
* - 'G' For flags to be printed as a collection of symbolic strings that would
--
2.50.1
^ permalink raw reply related
* [PATCH v3 00/21] treewide: Introduce %ptS for struct timespec64 and convert users
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
Here is the third part of the unification time printing in the kernel.
This time for struct timespec64. The first patch brings a support
into printf() implementation (test cases and documentation update
included) followed by the treewide conversion of the current users.
Petr, we got like more than a half being Acked, I think if you are okay
with this, the patches that have been tagged can be applied.
Note, not everything was compile-tested. Kunit test has been passed, though.
Changelog v3:
- fixed a compilation issue with fnic (LKP), also satisfied checkpatch
- collected more tags
Petr, I have not renamed 'p' to 'n' due to much of rework and
noise introduction for the changes that has been reviewed.
However, I addressed the documentation issues.
v2: <20251111122735.880607-1-andriy.shevchenko@linux.intel.com>
Changelog v2:
- dropped wrong patches (Hans, Takashi)
- fixed most of the checkpatch warnings (fdo CI, media CI)
- collected tags
v1: <20251110184727.666591-1-andriy.shevchenko@linux.intel.com>
Andy Shevchenko (21):
lib/vsprintf: Add specifier for printing struct timespec64
ceph: Switch to use %ptSp
libceph: Switch to use %ptSp
dma-buf: Switch to use %ptSp
drm/amdgpu: Switch to use %ptSp
drm/msm: Switch to use %ptSp
drm/vblank: Switch to use %ptSp
drm/xe: Switch to use %ptSp
e1000e: Switch to use %ptSp
igb: Switch to use %ptSp
ipmi: Switch to use %ptSp
media: av7110: Switch to use %ptSp
mmc: mmc_test: Switch to use %ptSp
net: dsa: sja1105: Switch to use %ptSp
PCI: epf-test: Switch to use %ptSp
pps: Switch to use %ptSp
ptp: ocp: Switch to use %ptSp
s390/dasd: Switch to use %ptSp
scsi: fnic: Switch to use %ptSp
scsi: snic: Switch to use %ptSp
tracing: Switch to use %ptSp
Documentation/core-api/printk-formats.rst | 11 +++-
drivers/char/ipmi/ipmi_si_intf.c | 3 +-
drivers/char/ipmi/ipmi_ssif.c | 6 +--
drivers/dma-buf/sync_debug.c | 2 +-
.../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 3 +-
drivers/gpu/drm/drm_vblank.c | 6 +--
.../gpu/drm/msm/disp/msm_disp_snapshot_util.c | 3 +-
drivers/gpu/drm/msm/msm_gpu.c | 3 +-
drivers/gpu/drm/xe/xe_devcoredump.c | 4 +-
drivers/mmc/core/mmc_test.c | 20 +++----
drivers/net/dsa/sja1105/sja1105_tas.c | 8 ++-
drivers/net/ethernet/intel/e1000e/ptp.c | 7 +--
drivers/net/ethernet/intel/igb/igb_ptp.c | 7 +--
drivers/pci/endpoint/functions/pci-epf-test.c | 5 +-
drivers/pps/generators/pps_gen_parport.c | 3 +-
drivers/pps/kapi.c | 3 +-
drivers/ptp/ptp_ocp.c | 13 ++---
drivers/s390/block/dasd.c | 3 +-
drivers/scsi/fnic/fnic_trace.c | 52 ++++++++-----------
drivers/scsi/snic/snic_debugfs.c | 10 ++--
drivers/scsi/snic/snic_trc.c | 5 +-
drivers/staging/media/av7110/av7110.c | 2 +-
fs/ceph/dir.c | 5 +-
fs/ceph/inode.c | 49 ++++++-----------
fs/ceph/xattr.c | 6 +--
kernel/trace/trace_output.c | 6 +--
lib/tests/printf_kunit.c | 4 ++
lib/vsprintf.c | 28 +++++++++-
net/ceph/messenger_v2.c | 6 +--
29 files changed, 130 insertions(+), 153 deletions(-)
--
2.50.1
^ permalink raw reply
* [PATCH v3 04/21] dma-buf: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma-buf/sync_debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
index 67cd69551e42..9e5d662cd4e8 100644
--- a/drivers/dma-buf/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -59,7 +59,7 @@ static void sync_print_fence(struct seq_file *s,
struct timespec64 ts64 =
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);
--
2.50.1
^ permalink raw reply related
* [PATCH v3 02/21] ceph: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
fs/ceph/dir.c | 5 ++---
fs/ceph/inode.c | 49 ++++++++++++++++---------------------------------
fs/ceph/xattr.c | 6 ++----
3 files changed, 20 insertions(+), 40 deletions(-)
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index d18c0eaef9b7..bf50c6e7a029 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -2155,7 +2155,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
" rfiles: %20lld\n"
" rsubdirs: %20lld\n"
"rbytes: %20lld\n"
- "rctime: %10lld.%09ld\n",
+ "rctime: %ptSp\n",
ci->i_files + ci->i_subdirs,
ci->i_files,
ci->i_subdirs,
@@ -2163,8 +2163,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
ci->i_rfiles,
ci->i_rsubdirs,
ci->i_rbytes,
- ci->i_rctime.tv_sec,
- ci->i_rctime.tv_nsec);
+ &ci->i_rctime);
}
if (*ppos >= dfi->dir_info_len)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 37d3a2477c17..a596cb53f1ac 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -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_inode_info *ci = ceph_inode(inode);
+ struct timespec64 iatime = inode_get_atime(inode);
struct timespec64 ictime = inode_get_ctime(inode);
+ struct timespec64 imtime = inode_get_mtime(inode);
int warn = 0;
if (issued & (CEPH_CAP_FILE_EXCL|
@@ -889,39 +891,26 @@ void ceph_fill_file_time(struct inode *inode, int issued,
CEPH_CAP_XATTR_EXCL)) {
if (ci->i_version == 0 ||
timespec64_compare(ctime, &ictime) > 0) {
- doutc(cl, "ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n",
- ictime.tv_sec, ictime.tv_nsec,
- ctime->tv_sec, ctime->tv_nsec);
+ doutc(cl, "ctime %ptSp -> %ptSp inc w/ cap\n", &ictime, ctime);
inode_set_ctime_to_ts(inode, *ctime);
}
if (ci->i_version == 0 ||
ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
/* the MDS did a utimes() */
- doutc(cl, "mtime %lld.%09ld -> %lld.%09ld tw %d -> %d\n",
- inode_get_mtime_sec(inode),
- inode_get_mtime_nsec(inode),
- mtime->tv_sec, mtime->tv_nsec,
- ci->i_time_warp_seq, (int)time_warp_seq);
+ doutc(cl, "mtime %ptSp -> %ptSp tw %d -> %d\n", &imtime, mtime,
+ ci->i_time_warp_seq, (int)time_warp_seq);
inode_set_mtime_to_ts(inode, *mtime);
inode_set_atime_to_ts(inode, *atime);
ci->i_time_warp_seq = time_warp_seq;
} else if (time_warp_seq == ci->i_time_warp_seq) {
- struct timespec64 ts;
-
/* nobody did utimes(); take the max */
- ts = inode_get_mtime(inode);
- if (timespec64_compare(mtime, &ts) > 0) {
- doutc(cl, "mtime %lld.%09ld -> %lld.%09ld inc\n",
- ts.tv_sec, ts.tv_nsec,
- mtime->tv_sec, mtime->tv_nsec);
+ if (timespec64_compare(mtime, &imtime) > 0) {
+ doutc(cl, "mtime %ptSp -> %ptSp inc\n", &imtime, mtime);
inode_set_mtime_to_ts(inode, *mtime);
}
- ts = inode_get_atime(inode);
- if (timespec64_compare(atime, &ts) > 0) {
- doutc(cl, "atime %lld.%09ld -> %lld.%09ld inc\n",
- ts.tv_sec, ts.tv_nsec,
- atime->tv_sec, atime->tv_nsec);
+ if (timespec64_compare(atime, &iatime) > 0) {
+ doutc(cl, "atime %ptSp -> %ptSp inc\n", &iatime, atime);
inode_set_atime_to_ts(inode, *atime);
}
} else if (issued & CEPH_CAP_FILE_EXCL) {
@@ -2703,10 +2692,8 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
if (ia_valid & ATTR_ATIME) {
struct timespec64 atime = inode_get_atime(inode);
- doutc(cl, "%p %llx.%llx atime %lld.%09ld -> %lld.%09ld\n",
- inode, ceph_vinop(inode),
- atime.tv_sec, atime.tv_nsec,
- attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec);
+ doutc(cl, "%p %llx.%llx atime %ptSp -> %ptSp\n",
+ inode, ceph_vinop(inode), &atime, &attr->ia_atime);
if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) {
ci->i_time_warp_seq++;
inode_set_atime_to_ts(inode, attr->ia_atime);
@@ -2780,10 +2767,8 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
if (ia_valid & ATTR_MTIME) {
struct timespec64 mtime = inode_get_mtime(inode);
- doutc(cl, "%p %llx.%llx mtime %lld.%09ld -> %lld.%09ld\n",
- inode, ceph_vinop(inode),
- mtime.tv_sec, mtime.tv_nsec,
- attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec);
+ doutc(cl, "%p %llx.%llx mtime %ptSp -> %ptSp\n",
+ inode, ceph_vinop(inode), &mtime, &attr->ia_mtime);
if (!do_sync && (issued & CEPH_CAP_FILE_EXCL)) {
ci->i_time_warp_seq++;
inode_set_mtime_to_ts(inode, attr->ia_mtime);
@@ -2804,13 +2789,11 @@ int __ceph_setattr(struct mnt_idmap *idmap, struct inode *inode,
/* these do nothing */
if (ia_valid & ATTR_CTIME) {
+ struct timespec64 ictime = inode_get_ctime(inode);
bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME|
ATTR_MODE|ATTR_UID|ATTR_GID)) == 0;
- doutc(cl, "%p %llx.%llx ctime %lld.%09ld -> %lld.%09ld (%s)\n",
- inode, ceph_vinop(inode),
- inode_get_ctime_sec(inode),
- inode_get_ctime_nsec(inode),
- attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
+ doutc(cl, "%p %llx.%llx ctime %ptSp -> %ptSp (%s)\n",
+ inode, ceph_vinop(inode), &ictime, &attr->ia_ctime,
only ? "ctime only" : "ignored");
if (only) {
/*
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 537165db4519..ad1f30bea175 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -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,
size_t size)
{
- return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_rctime.tv_sec,
- ci->i_rctime.tv_nsec);
+ return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_rctime);
}
/* 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,
size_t size)
{
- return ceph_fmt_xattr(val, size, "%lld.%09ld", ci->i_snap_btime.tv_sec,
- ci->i_snap_btime.tv_nsec);
+ return ceph_fmt_xattr(val, size, "%ptSp", &ci->i_snap_btime);
}
static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,
--
2.50.1
^ permalink raw reply related
* [PATCH v3 06/21] drm/msm: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 3 +--
drivers/gpu/drm/msm/msm_gpu.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c
index 071bcdea80f7..19b470968f4d 100644
--- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c
+++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c
@@ -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, "module: " KBUILD_MODNAME "\n");
drm_printf(p, "dpu devcoredump\n");
- drm_printf(p, "time: %lld.%09ld\n",
- state->time.tv_sec, state->time.tv_nsec);
+ drm_printf(p, "time: %ptSp\n", &state->time);
list_for_each_entry_safe(block, tmp, &state->blocks, node) {
drm_printf(p, "====================%s================\n", block->name);
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 17759abc46d7..a4251afe4541 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -197,8 +197,7 @@ static ssize_t msm_gpu_devcoredump_read(char *buffer, loff_t offset,
drm_printf(&p, "---\n");
drm_printf(&p, "kernel: " UTS_RELEASE "\n");
drm_printf(&p, "module: " KBUILD_MODNAME "\n");
- drm_printf(&p, "time: %lld.%09ld\n",
- state->time.tv_sec, state->time.tv_nsec);
+ drm_printf(&p, "time: %ptSp\n", &state->time);
if (state->comm)
drm_printf(&p, "comm: %s\n", state->comm);
if (state->cmd)
--
2.50.1
^ permalink raw reply related
* [PATCH v3 03/21] libceph: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
net/ceph/messenger_v2.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ceph/messenger_v2.c b/net/ceph/messenger_v2.c
index 9e39378eda00..6e676e2d4ba0 100644
--- a/net/ceph/messenger_v2.c
+++ b/net/ceph/messenger_v2.c
@@ -1535,8 +1535,7 @@ static int prepare_keepalive2(struct ceph_connection *con)
struct timespec64 now;
ktime_get_real_ts64(&now);
- dout("%s con %p timestamp %lld.%09ld\n", __func__, con, now.tv_sec,
- now.tv_nsec);
+ dout("%s con %p timestamp %ptSp\n", __func__, con, &now);
ceph_encode_timespec64(ts, &now);
@@ -2729,8 +2728,7 @@ static int process_keepalive2_ack(struct ceph_connection *con,
ceph_decode_need(&p, end, sizeof(struct ceph_timespec), bad);
ceph_decode_timespec64(&con->last_keepalive_ack, p);
- dout("%s con %p timestamp %lld.%09ld\n", __func__, con,
- con->last_keepalive_ack.tv_sec, con->last_keepalive_ack.tv_nsec);
+ dout("%s con %p timestamp %ptSp\n", __func__, con, &con->last_keepalive_ack);
return 0;
--
2.50.1
^ permalink raw reply related
* [PATCH v3 05/21] drm/amdgpu: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
index 8a026bc9ea44..4e2fe6674db8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
@@ -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, "kernel: " UTS_RELEASE "\n");
drm_printf(&p, "module: " KBUILD_MODNAME "\n");
- drm_printf(&p, "time: %lld.%09ld\n", coredump->reset_time.tv_sec,
- coredump->reset_time.tv_nsec);
+ drm_printf(&p, "time: %ptSp\n", &coredump->reset_time);
if (coredump->reset_task_info.task.pid)
drm_printf(&p, "process_name: %s PID: %d\n",
--
2.50.1
^ permalink raw reply related
* [PATCH v3 10/21] igb: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/ethernet/intel/igb/igb_ptp.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index a7876882aeaf..bd85d02ecadd 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -840,14 +840,11 @@ static void igb_ptp_overflow_check(struct work_struct *work)
struct igb_adapter *igb =
container_of(work, struct igb_adapter, ptp_overflow_work.work);
struct timespec64 ts;
- u64 ns;
/* 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 %lld.%09lu\n",
- (long long) ts.tv_sec, ts.tv_nsec);
+ pr_debug("igb overflow check at %ptSp\n", &ts);
schedule_delayed_work(&igb->ptp_overflow_work,
IGB_SYSTIM_OVERFLOW_PERIOD);
--
2.50.1
^ permalink raw reply related
* [PATCH v3 11/21] ipmi: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton, Corey Minyard
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Acked-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/char/ipmi/ipmi_si_intf.c | 3 +--
drivers/char/ipmi/ipmi_ssif.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 70e55f5ff85e..5459ffdde8dc 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -275,8 +275,7 @@ void debug_timestamp(struct smi_info *smi_info, char *msg)
struct timespec64 t;
ktime_get_ts64(&t);
- dev_dbg(smi_info->io.dev, "**%s: %lld.%9.9ld\n",
- msg, t.tv_sec, t.tv_nsec);
+ dev_dbg(smi_info->io.dev, "**%s: %ptSp\n", msg, &t);
}
#else
#define debug_timestamp(smi_info, x)
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 1b63f7d2fcda..ef1582a029f4 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1083,10 +1083,8 @@ static int sender(void *send_info, struct ipmi_smi_msg *msg)
struct timespec64 t;
ktime_get_real_ts64(&t);
- dev_dbg(&ssif_info->client->dev,
- "**Enqueue %02x %02x: %lld.%6.6ld\n",
- msg->data[0], msg->data[1],
- (long long)t.tv_sec, (long)t.tv_nsec / NSEC_PER_USEC);
+ dev_dbg(&ssif_info->client->dev, "**Enqueue %02x %02x: %ptSp\n",
+ msg->data[0], msg->data[1], &t);
}
return IPMI_CC_NO_ERROR;
}
--
2.50.1
^ permalink raw reply related
* [PATCH v3 07/21] drm/vblank: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpu/drm/drm_vblank.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 32d013c5c8fc..5c14140cd0c2 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -806,10 +806,8 @@ drm_crtc_vblank_helper_get_vblank_timestamp_internal(
ts_vblank_time = ktime_to_timespec64(*vblank_time);
drm_dbg_vbl(dev,
- "crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n",
- pipe, hpos, vpos,
- (u64)ts_etime.tv_sec, ts_etime.tv_nsec / 1000,
- (u64)ts_vblank_time.tv_sec, ts_vblank_time.tv_nsec / 1000,
+ "crtc %u : v p(%d,%d)@ %ptSp -> %ptSp [e %d us, %d rep]\n",
+ pipe, hpos, vpos, &ts_etime, &ts_vblank_time,
duration_ns / 1000, i);
return true;
--
2.50.1
^ permalink raw reply related
* [PATCH v3 17/21] ptp: ocp: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
While at it, fix wrong use of %ptT against struct timespec64.
It's kinda lucky that it worked just because the first member
there 64-bit and it's of time64_t type. Now with %ptS it may
be used correctly.
Acked-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/ptp/ptp_ocp.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index eeebe4d149f7..21a8109fae34 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -4293,11 +4293,9 @@ ptp_ocp_summary_show(struct seq_file *s, void *data)
ns += (s64)bp->utc_tai_offset * NSEC_PER_SEC;
sys_ts = ns_to_timespec64(ns);
- seq_printf(s, "%7s: %lld.%ld == %ptT TAI\n", "PHC",
- ts.tv_sec, ts.tv_nsec, &ts);
- seq_printf(s, "%7s: %lld.%ld == %ptT UTC offset %d\n", "SYS",
- sys_ts.tv_sec, sys_ts.tv_nsec, &sys_ts,
- bp->utc_tai_offset);
+ seq_printf(s, "%7s: %ptSp == %ptS TAI\n", "PHC", &ts, &ts);
+ seq_printf(s, "%7s: %ptSp == %ptS UTC offset %d\n", "SYS",
+ &sys_ts, &sys_ts, bp->utc_tai_offset);
seq_printf(s, "%7s: PHC:SYS offset: %lld window: %lld\n", "",
timespec64_to_ns(&ts) - ns,
post_ns - pre_ns);
@@ -4505,9 +4503,8 @@ ptp_ocp_phc_info(struct ptp_ocp *bp)
ptp_clock_index(bp->ptp));
if (!ptp_ocp_gettimex(&bp->ptp_info, &ts, NULL))
- dev_info(&bp->pdev->dev, "Time: %lld.%ld, %s\n",
- ts.tv_sec, ts.tv_nsec,
- bp->sync ? "in-sync" : "UNSYNCED");
+ dev_info(&bp->pdev->dev, "Time: %ptSp, %s\n",
+ &ts, bp->sync ? "in-sync" : "UNSYNCED");
}
static void
--
2.50.1
^ permalink raw reply related
* [PATCH v3 08/21] drm/xe: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpu/drm/xe/xe_devcoredump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
index 203e3038cc81..d444eda65ca6 100644
--- a/drivers/gpu/drm/xe/xe_devcoredump.c
+++ b/drivers/gpu/drm/xe/xe_devcoredump.c
@@ -106,9 +106,9 @@ static ssize_t __xe_devcoredump_read(char *buffer, ssize_t count,
drm_puts(&p, "module: " KBUILD_MODNAME "\n");
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);
- 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);
xe_device_snapshot_print(xe, &p);
--
2.50.1
^ permalink raw reply related
* [PATCH v3 18/21] s390/dasd: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/s390/block/dasd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 7765e40f7cea..97dcc70f669e 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -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,
struct dasd_profile_info *data)
{
- seq_printf(m, "start_time %lld.%09ld\n",
- (s64)data->starttod.tv_sec, data->starttod.tv_nsec);
+ seq_printf(m, "start_time %ptSp\n", &data->starttod);
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_pav %u\n", data->dasd_io_alias);
--
2.50.1
^ permalink raw reply related
* [PATCH v3 09/21] e1000e: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/ethernet/intel/e1000e/ptp.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c
index ea3c3eb2ef20..ec39e35f3857 100644
--- a/drivers/net/ethernet/intel/e1000e/ptp.c
+++ b/drivers/net/ethernet/intel/e1000e/ptp.c
@@ -229,14 +229,11 @@ static void e1000e_systim_overflow_work(struct work_struct *work)
systim_overflow_work.work);
struct e1000_hw *hw = &adapter->hw;
struct timespec64 ts;
- u64 ns;
/* 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 %lld.%09lu\n",
- (long long) ts.tv_sec, ts.tv_nsec);
+ e_dbg("SYSTIM overflow check at %ptSp\n", &ts);
schedule_delayed_work(&adapter->systim_overflow_work,
E1000_SYSTIM_OVERFLOW_PERIOD);
--
2.50.1
^ permalink raw reply related
* [PATCH v3 12/21] media: av7110: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Acked-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/staging/media/av7110/av7110.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/av7110/av7110.c b/drivers/staging/media/av7110/av7110.c
index bc9a2a40afcb..602342d1174f 100644
--- a/drivers/staging/media/av7110/av7110.c
+++ b/drivers/staging/media/av7110/av7110.c
@@ -321,7 +321,7 @@ static inline void print_time(char *s)
struct timespec64 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
}
--
2.50.1
^ permalink raw reply related
* [PATCH v3 13/21] mmc: mmc_test: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mmc/core/mmc_test.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index a74089df4547..01d1e62c2ce7 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -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);
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 "
- "%llu.%09u seconds (%u kB/s, %u KiB/s, "
- "%u.%02u IOPS, sg_len %d)\n",
- mmc_hostname(test->card->host), count, sectors, count,
- sectors >> 1, (sectors & 1 ? ".5" : ""),
- (u64)ts.tv_sec, (u32)ts.tv_nsec,
- rate / 1000, rate / 1024, iops / 100, iops % 100,
- test->area.sg_len);
+ 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",
+ mmc_hostname(test->card->host), count, sectors, count,
+ sectors >> 1, (sectors & 1 ? ".5" : ""), &ts,
+ rate / 1000, rate / 1024, iops / 100, iops % 100,
+ test->area.sg_len);
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);
list_for_each_entry(tr, &gr->tr_lst, link) {
- seq_printf(sf, "%u %d %llu.%09u %u %u.%02u\n",
- tr->count, tr->sectors,
- (u64)tr->ts.tv_sec, (u32)tr->ts.tv_nsec,
- tr->rate, tr->iops / 100, tr->iops % 100);
+ seq_printf(sf, "%u %d %ptSp %u %u.%02u\n",
+ tr->count, tr->sectors, &tr->ts, tr->rate,
+ tr->iops / 100, tr->iops % 100);
}
}
--
2.50.1
^ permalink raw reply related
* [PATCH v3 16/21] pps: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pps/generators/pps_gen_parport.c | 3 +--
drivers/pps/kapi.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c
index f5eeb4dd01ad..05bbf8d30ef1 100644
--- a/drivers/pps/generators/pps_gen_parport.c
+++ b/drivers/pps/generators/pps_gen_parport.c
@@ -80,8 +80,7 @@ static enum hrtimer_restart hrtimer_event(struct hrtimer *timer)
/* check if we are late */
if (expire_time.tv_sec != ts1.tv_sec || ts1.tv_nsec > lim) {
local_irq_restore(flags);
- pr_err("we are late this time %lld.%09ld\n",
- (s64)ts1.tv_sec, ts1.tv_nsec);
+ pr_err("we are late this time %ptSp\n", &ts1);
goto done;
}
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index e9389876229e..6985c34de2ce 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -163,8 +163,7 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event,
/* check event type */
BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0);
- dev_dbg(&pps->dev, "PPS event at %lld.%09ld\n",
- (s64)ts->ts_real.tv_sec, ts->ts_real.tv_nsec);
+ dev_dbg(&pps->dev, "PPS event at %ptSp\n", &ts->ts_real);
timespec_to_pps_ktime(&ts_real, ts->ts_real);
--
2.50.1
^ permalink raw reply related
* [PATCH v3 14/21] net: dsa: sja1105: Switch to use %ptSp
From: Andy Shevchenko @ 2025-11-13 14:32 UTC (permalink / raw)
To: Corey Minyard, Christian König, Dr. David Alan Gilbert,
Alex Deucher, Thomas Zimmermann, Dmitry Baryshkov, Rob Clark,
Matthew Brost, Ulf Hansson, Andy Shevchenko, Aleksandr Loktionov,
Vitaly Lifshits, Manivannan Sadhasivam, Niklas Cassel,
Calvin Owens, Vadim Fedorenko, Sagi Maimon, Martin K. Petersen,
Karan Tilak Kumar, Hans Verkuil, Casey Schaufler, Steven Rostedt,
Petr Mladek, Viacheslav Dubeyko, Max Kellermann, linux-doc,
linux-kernel, openipmi-developer, linux-media, dri-devel,
linaro-mm-sig, amd-gfx, linux-arm-msm, freedreno, intel-xe,
linux-mmc, netdev, intel-wired-lan, linux-pci, linux-s390,
linux-scsi, linux-staging, ceph-devel, linux-trace-kernel
Cc: Rasmus Villemoes, Sergey Senozhatsky, Jonathan Corbet,
Sumit Semwal, Gustavo Padovan, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Dmitry Baryshkov, Abhinav Kumar,
Jessica Zhang, Sean Paul, Marijn Suijten, Konrad Dybcio,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Vladimir Oltean, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tony Nguyen, Przemek Kitszel,
Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
Rodolfo Giometti, Jonathan Lemon, Richard Cochran,
Stefan Haberland, Jan Hoeppner, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Satish Kharat, Sesidhar Baddela, James E.J. Bottomley,
Mauro Carvalho Chehab, Greg Kroah-Hartman, Xiubo Li, Ilya Dryomov,
Masami Hiramatsu, Mathieu Desnoyers, Andrew Morton
In-Reply-To: <20251113150217.3030010-1-andriy.shevchenko@linux.intel.com>
Use %ptSp instead of open coded variants to print content of
struct timespec64 in human readable format.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/dsa/sja1105/sja1105_tas.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/dsa/sja1105/sja1105_tas.c b/drivers/net/dsa/sja1105/sja1105_tas.c
index d7818710bc02..d5949d2c3e71 100644
--- a/drivers/net/dsa/sja1105/sja1105_tas.c
+++ b/drivers/net/dsa/sja1105/sja1105_tas.c
@@ -775,9 +775,8 @@ static void sja1105_tas_state_machine(struct work_struct *work)
base_time_ts = ns_to_timespec64(base_time);
now_ts = ns_to_timespec64(now);
- dev_dbg(ds->dev, "OPER base time %lld.%09ld (now %lld.%09ld)\n",
- base_time_ts.tv_sec, base_time_ts.tv_nsec,
- now_ts.tv_sec, now_ts.tv_nsec);
+ dev_dbg(ds->dev, "OPER base time %ptSp (now %ptSp)\n",
+ &base_time_ts, &now_ts);
break;
@@ -798,8 +797,7 @@ static void sja1105_tas_state_machine(struct work_struct *work)
if (now < tas_data->oper_base_time) {
/* TAS has not started yet */
diff = ns_to_timespec64(tas_data->oper_base_time - now);
- dev_dbg(ds->dev, "time to start: [%lld.%09ld]",
- diff.tv_sec, diff.tv_nsec);
+ dev_dbg(ds->dev, "time to start: [%ptSp]", &diff);
break;
}
--
2.50.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox