mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
timer_list: Annotate print_cpu() diagnostic reads
print_cpu() prints hrtimer_cpu_base and tick_sched state without synchronizing with concurrent updates. The output is diagnostic only, so use data_race(READ_ONCE()) for these scalar reads to document the intentional races and avoid KCSAN reports. Reported-by: syzbot+8f0e958900a14d08a51d@syzkaller.appspotmail.com Signed-off-by: Yu Peng <pengyu@kylinos.cn> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260707125813.2182532-1-pengyu@kylinos.cn Closes: https://syzkaller.appspot.com/bug?extid=8f0e958900a14d08a51d
This commit is contained in:
@@ -118,12 +118,15 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
|
|||||||
SEQ_printf(m, " clock %d:\n", i);
|
SEQ_printf(m, " clock %d:\n", i);
|
||||||
print_base(m, cpu_base->clock_base + i, now);
|
print_base(m, cpu_base->clock_base + i, now);
|
||||||
}
|
}
|
||||||
#define P(x) \
|
|
||||||
|
#define DIAG_READ(x) data_race(READ_ONCE(x))
|
||||||
|
|
||||||
|
#define P(x) \
|
||||||
SEQ_printf(m, " .%-15s: %Lu\n", #x, \
|
SEQ_printf(m, " .%-15s: %Lu\n", #x, \
|
||||||
(unsigned long long)(cpu_base->x))
|
(unsigned long long)DIAG_READ(cpu_base->x))
|
||||||
#define P_ns(x) \
|
#define P_ns(x) \
|
||||||
SEQ_printf(m, " .%-15s: %Lu nsecs\n", #x, \
|
SEQ_printf(m, " .%-15s: %Lu nsecs\n", #x, \
|
||||||
(unsigned long long)(ktime_to_ns(cpu_base->x)))
|
(unsigned long long)ktime_to_ns(DIAG_READ(cpu_base->x)))
|
||||||
|
|
||||||
#ifdef CONFIG_HIGH_RES_TIMERS
|
#ifdef CONFIG_HIGH_RES_TIMERS
|
||||||
P_ns(expires_next);
|
P_ns(expires_next);
|
||||||
@@ -139,12 +142,12 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
|
|||||||
#ifdef CONFIG_TICK_ONESHOT
|
#ifdef CONFIG_TICK_ONESHOT
|
||||||
# define P(x) \
|
# define P(x) \
|
||||||
SEQ_printf(m, " .%-15s: %Lu\n", #x, \
|
SEQ_printf(m, " .%-15s: %Lu\n", #x, \
|
||||||
(unsigned long long)(ts->x))
|
(unsigned long long)DIAG_READ(ts->x))
|
||||||
# define P_ns(x) \
|
# define P_ns(x) \
|
||||||
SEQ_printf(m, " .%-15s: %Lu nsecs\n", #x, \
|
SEQ_printf(m, " .%-15s: %Lu nsecs\n", #x, \
|
||||||
(unsigned long long)(ktime_to_ns(ts->x)))
|
(unsigned long long)ktime_to_ns(DIAG_READ(ts->x)))
|
||||||
# define P_flag(x, f) \
|
# define P_flag(x, f) \
|
||||||
SEQ_printf(m, " .%-15s: %d\n", #x, !!(ts->flags & (f)))
|
SEQ_printf(m, " .%-15s: %d\n", #x, !!(DIAG_READ(ts->flags) & (f)))
|
||||||
|
|
||||||
{
|
{
|
||||||
struct tick_sched *ts = tick_get_tick_sched(cpu);
|
struct tick_sched *ts = tick_get_tick_sched(cpu);
|
||||||
@@ -166,6 +169,8 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
|
|||||||
|
|
||||||
#undef P
|
#undef P
|
||||||
#undef P_ns
|
#undef P_ns
|
||||||
|
#undef P_flag
|
||||||
|
#undef DIAG_READ
|
||||||
SEQ_printf(m, "\n");
|
SEQ_printf(m, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user